[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [amarok] src: Cleanups & corrections; remove unused code
From: Matěj_Laitl <matej () laitl ! cz>
Date: 2014-05-12 21:05:55
Message-ID: E1WjxQ3-0007aK-NS () scm ! kde ! org
[Download RAW message or body]
Git commit 91a3d82b97dd42ff092b64df7c5b1d33d32cabbe by Matěj Laitl.
Committed on 11/05/2014 at 17:40.
Pushed by laitl into branch 'master'.
Cleanups & corrections; remove unused code
Does not change any behaviour.
M +11 -7 src/browsers/CollectionTreeItemModelBase.cpp
M +9 -9 src/browsers/CollectionTreeItemModelBase.h
M +22 -19 src/browsers/CollectionTreeView.cpp
M +0 -8 src/toolbar/MainToolbar.cpp
M +0 -1 src/toolbar/MainToolbar.h
M +1 -2 src/widgets/SearchWidget.cpp
http://commits.kde.org/amarok/91a3d82b97dd42ff092b64df7c5b1d33d32cabbe
diff --git a/src/browsers/CollectionTreeItemModelBase.cpp \
b/src/browsers/CollectionTreeItemModelBase.cpp index a202266..e45efd3 100644
--- a/src/browsers/CollectionTreeItemModelBase.cpp
+++ b/src/browsers/CollectionTreeItemModelBase.cpp
@@ -1071,6 +1071,12 @@ void CollectionTreeItemModelBase::loadingAnimationTick()
}
}
+QString
+CollectionTreeItemModelBase::currentFilter() const
+{
+ return m_currentFilter;
+}
+
void
CollectionTreeItemModelBase::setCurrentFilter( const QString &filter )
{
@@ -1082,14 +1088,12 @@ void
CollectionTreeItemModelBase::slotFilter()
{
filterChildren();
- if ( !m_expandedCollections.isEmpty() )
+
+ foreach( Collections::Collection *expanded, m_expandedCollections )
{
- foreach( Collections::Collection *expanded, m_expandedCollections )
- {
- CollectionTreeItem *expandedItem = m_collections.value( \
expanded->collectionId() ).second;
- if( expandedItem )
- emit expandIndex( createIndex( expandedItem->row(), 0, expandedItem \
) );
- }
+ CollectionTreeItem *expandedItem = m_collections.value( \
expanded->collectionId() ).second; + if( expandedItem )
+ emit expandIndex( createIndex( expandedItem->row(), 0, expandedItem ) );
}
}
diff --git a/src/browsers/CollectionTreeItemModelBase.h \
b/src/browsers/CollectionTreeItemModelBase.h index aa6ab8c..d326908 100644
--- a/src/browsers/CollectionTreeItemModelBase.h
+++ b/src/browsers/CollectionTreeItemModelBase.h
@@ -49,7 +49,7 @@ class AMAROK_EXPORT CollectionTreeItemModelBase : public \
QAbstractItemModel Q_OBJECT
public:
- CollectionTreeItemModelBase( );
+ CollectionTreeItemModelBase();
virtual ~CollectionTreeItemModelBase();
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
@@ -75,13 +75,7 @@ class AMAROK_EXPORT CollectionTreeItemModelBase : public \
QAbstractItemModel
virtual QList<CategoryId::CatMenuId> levels() const { return m_levelType; }
virtual CategoryId::CatMenuId levelCategory( const int level ) const;
- QString currentFilter() const
- { return m_currentFilter; }
-
- /** Adds the query maker to the running queries and connects the slots */
- void addQueryMaker( CollectionTreeItem* item,
- Collections::QueryMaker *qm ) const;
-
+ QString currentFilter() const;
void setCurrentFilter( const QString &filter );
void itemAboutToBeDeleted( CollectionTreeItem *item );
@@ -117,7 +111,9 @@ class AMAROK_EXPORT CollectionTreeItemModelBase : public \
QAbstractItemModel void newResultReady( Meta::LabelList );
virtual void newResultReady( Meta::DataList data );
- /** Apply the current filter */
+ /**
+ * Apply the current filter.
+ */
void slotFilter();
void slotCollapsed( const QModelIndex &index );
@@ -130,6 +126,10 @@ class AMAROK_EXPORT CollectionTreeItemModelBase : public \
QAbstractItemModel
Collections::QueryMaker::QueryType mapCategoryToQueryType( int levelType ) \
const;
protected:
+ /** Adds the query maker to the running queries and connects the slots */
+ void addQueryMaker( CollectionTreeItem* item,
+ Collections::QueryMaker *qm ) const;
+
virtual void populateChildren(const Meta::DataList &dataList, \
CollectionTreeItem *parent, const QModelIndex &parentIndex ); virtual void \
updateHeaderText();
diff --git a/src/browsers/CollectionTreeView.cpp \
b/src/browsers/CollectionTreeView.cpp index 60df144..7649647 100644
--- a/src/browsers/CollectionTreeView.cpp
+++ b/src/browsers/CollectionTreeView.cpp
@@ -88,6 +88,9 @@ CollectionTreeView::CollectionTreeView( QWidget *parent)
void
CollectionTreeView::setModel( QAbstractItemModel *model )
{
+ if( m_treeModel )
+ disconnect( m_treeModel, 0, this, 0);
+
m_treeModel = qobject_cast<CollectionTreeItemModelBase *>( model );
if( !m_treeModel )
return;
@@ -651,27 +654,27 @@ CollectionTreeView::slotExpandIndex( const QModelIndex &index )
void
CollectionTreeView::slotCheckAutoExpand()
{
- if( m_filterModel )
- {
- // Cases where root is not collections but
- // for example magnatunes's plethora of genres, don't expand by default
- if( m_filterModel->rowCount() > 6 )
- return;
+ if( !m_filterModel )
+ return;
- QModelIndexList indicesToCheck;
- for( int i = 0; i < m_filterModel->rowCount(); i++ ) //need something to \
start for'ing with
- indicesToCheck += m_filterModel->index( i, 0 ); //lowest level is fine \
for that + // Cases where root is not collections but
+ // for example magnatunes's plethora of genres, don't expand by default
+ if( m_filterModel->rowCount() > 6 )
+ return;
- QModelIndex current;
- for( int j = 0; j < indicesToCheck.size(); j++)
- {
- current = indicesToCheck.at( j );
- if( m_filterModel->rowCount( current ) < 4 )
- { //don't expand if many results
- expand( current );
- for( int i = 0; i < m_filterModel->rowCount( current ); i++ )
- indicesToCheck += m_filterModel->index( i, 0, current );
- }
+ QModelIndexList indicesToCheck;
+ for( int i = 0; i < m_filterModel->rowCount(); i++ ) //need something to start \
for'ing with + indicesToCheck += m_filterModel->index( i, 0 ); //lowest level \
is fine for that +
+ QModelIndex current;
+ for( int j = 0; j < indicesToCheck.size(); j++)
+ {
+ current = indicesToCheck.at( j );
+ if( m_filterModel->rowCount( current ) < 4 )
+ { //don't expand if many results
+ expand( current );
+ for( int i = 0; i < m_filterModel->rowCount( current ); i++ )
+ indicesToCheck += m_filterModel->index( i, 0, current );
}
}
}
diff --git a/src/toolbar/MainToolbar.cpp b/src/toolbar/MainToolbar.cpp
index 97d2f1e..e3318f0 100644
--- a/src/toolbar/MainToolbar.cpp
+++ b/src/toolbar/MainToolbar.cpp
@@ -30,7 +30,6 @@
#include "amarokconfig.h"
#include "amarokurls/AmarokUrl.h"
#include "amarokurls/AmarokUrlHandler.h"
-#include "browsers/collectionbrowser/CollectionWidget.h"
#include "core/capabilities/ActionsCapability.h"
#include "core/capabilities/BookmarkThisCapability.h"
#include "core/meta/Meta.h"
@@ -281,13 +280,6 @@ MainToolbar::muteStateChanged( bool mute )
}
void
-MainToolbar::filter( const QString &string )
-{
- if( CollectionWidget::instance() )
- CollectionWidget::instance()->setFilter( string );
-}
-
-void
MainToolbar::layoutProgressBar()
{
const int limit = constant_progress_ratio_minimum_width;
diff --git a/src/toolbar/MainToolbar.h b/src/toolbar/MainToolbar.h
index f47d33d..77f21e8 100644
--- a/src/toolbar/MainToolbar.h
+++ b/src/toolbar/MainToolbar.h
@@ -61,7 +61,6 @@ private slots:
void muteStateChanged( bool mute );
void volumeChanged( int percent );
void addBookmark( const QString &name, int milliSeconds );
- void filter( const QString &string );
void layoutProgressBar();
void layoutTrackBar();
void setLabelTime( int ms );
diff --git a/src/widgets/SearchWidget.cpp b/src/widgets/SearchWidget.cpp
index 7bee331..19fd19e 100644
--- a/src/widgets/SearchWidget.cpp
+++ b/src/widgets/SearchWidget.cpp
@@ -50,10 +50,9 @@ SearchWidget::SearchWidget( QWidget *parent, bool advanced )
m_sw->completionObject()->setIgnoreCase( true );
m_sw->setToolTip( i18n( "Enter space-separated terms to search." ) );
m_sw->addItem( KStandardGuiItem::find().icon(), QString() );
- connect( m_sw, SIGNAL(returnPressed(QString)), SLOT(addCompletion(QString)) );
connect( m_sw, SIGNAL(activated(int)), SLOT(onComboItemActivated(int)) );
connect( m_sw, SIGNAL(editTextChanged(QString)), SLOT(resetFilterTimeout()) );
- connect( m_sw, SIGNAL(returnPressed()), SLOT(filterNow()) );
+ connect( m_sw, SIGNAL(returnPressed()), SLOT(filterNow()) ); // filterNow() \
calls addCompletion() connect( m_sw, SIGNAL(returnPressed()), \
SIGNAL(returnPressed()) ); connect( m_sw, SIGNAL(downPressed()), \
SLOT(advanceFocus()) );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic