Changeset View
Changeset View
Standalone View
Standalone View
src/browsers/BrowserCategoryList.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 43 | { | |||
---|---|---|---|---|---|
48 | QVBoxLayout* vLayout = new QVBoxLayout( mainWidget ); | 48 | QVBoxLayout* vLayout = new QVBoxLayout( mainWidget ); | ||
49 | mainWidget->setLayout( vLayout ); | 49 | mainWidget->setLayout( vLayout ); | ||
50 | 50 | | |||
51 | // -- the search widget | 51 | // -- the search widget | ||
52 | m_searchWidget = new SearchWidget( this, false ); | 52 | m_searchWidget = new SearchWidget( this, false ); | ||
53 | m_searchWidget->setClickMessage( i18n( "Filter Music Sources" ) ); | 53 | m_searchWidget->setClickMessage( i18n( "Filter Music Sources" ) ); | ||
54 | vLayout->addWidget( m_searchWidget ); | 54 | vLayout->addWidget( m_searchWidget ); | ||
55 | 55 | | |||
56 | connect( m_searchWidget, SIGNAL(filterChanged(QString)), SLOT(setFilter(QString)) ); | 56 | connect( m_searchWidget, &SearchWidget::filterChanged, this, &BrowserCategoryList::setFilter ); | ||
57 | 57 | | |||
58 | // -- the main list view | 58 | // -- the main list view | ||
59 | m_categoryListView = new Amarok::PrettyTreeView(); | 59 | m_categoryListView = new Amarok::PrettyTreeView(); | ||
60 | m_categoryListView->setFrameShape( QFrame::NoFrame ); | 60 | m_categoryListView->setFrameShape( QFrame::NoFrame ); | ||
61 | 61 | | |||
62 | m_proxyModel = new BrowserCategoryListSortFilterProxyModel( this ); | 62 | m_proxyModel = new BrowserCategoryListSortFilterProxyModel( this ); | ||
63 | m_proxyModel->setSourceModel( m_categoryListModel ); | 63 | m_proxyModel->setSourceModel( m_categoryListModel ); | ||
64 | 64 | | |||
65 | m_categoryListView->setItemDelegate( new PrettyTreeDelegate( m_categoryListView ) ); | 65 | m_categoryListView->setItemDelegate( new PrettyTreeDelegate( m_categoryListView ) ); | ||
66 | m_categoryListView->setHeaderHidden( true ); | 66 | m_categoryListView->setHeaderHidden( true ); | ||
67 | m_categoryListView->setRootIsDecorated( false ); | 67 | m_categoryListView->setRootIsDecorated( false ); | ||
68 | m_categoryListView->setModel( m_proxyModel ); | 68 | m_categoryListView->setModel( m_proxyModel ); | ||
69 | m_categoryListView->setMouseTracking ( true ); | 69 | m_categoryListView->setMouseTracking ( true ); | ||
70 | 70 | | |||
71 | if( sort ) | 71 | if( sort ) | ||
72 | { | 72 | { | ||
73 | m_proxyModel->setSortRole( Qt::DisplayRole ); | 73 | m_proxyModel->setSortRole( Qt::DisplayRole ); | ||
74 | m_categoryListView->setSortingEnabled( true ); | 74 | m_categoryListView->setSortingEnabled( true ); | ||
75 | m_categoryListView->sortByColumn( 0 ); | 75 | m_categoryListView->sortByColumn( 0 ); | ||
76 | } | 76 | } | ||
77 | 77 | | |||
78 | connect( m_categoryListView, SIGNAL(activated(QModelIndex)), | 78 | connect( m_categoryListView, &Amarok::PrettyTreeView::activated, | ||
79 | SLOT(categoryActivated(QModelIndex)) ); | 79 | this, &BrowserCategoryList::categoryActivated ); | ||
80 | 80 | | |||
81 | connect( m_categoryListView, SIGNAL(entered(QModelIndex)), | 81 | connect( m_categoryListView, &Amarok::PrettyTreeView::entered, | ||
82 | SLOT(categoryEntered(QModelIndex)) ); | 82 | this, &BrowserCategoryList::categoryEntered ); | ||
83 | 83 | | |||
84 | vLayout->addWidget( m_categoryListView ); | 84 | vLayout->addWidget( m_categoryListView ); | ||
85 | m_widgetStack->addWidget( mainWidget ); | 85 | m_widgetStack->addWidget( mainWidget ); | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | BrowserCategoryList::~BrowserCategoryList() | 88 | BrowserCategoryList::~BrowserCategoryList() | ||
89 | { } | 89 | { } | ||
90 | 90 | | |||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 136 | { | |||
144 | m_categoryListModel->addCategory( category ); | 144 | m_categoryListModel->addCategory( category ); | ||
145 | m_widgetStack->addWidget( category ); | 145 | m_widgetStack->addWidget( category ); | ||
146 | 146 | | |||
147 | //if this is also a category list, watch it for changes as we need to report | 147 | //if this is also a category list, watch it for changes as we need to report | ||
148 | //these down the tree | 148 | //these down the tree | ||
149 | 149 | | |||
150 | BrowserCategoryList *childList = qobject_cast<BrowserCategoryList*>( category ); | 150 | BrowserCategoryList *childList = qobject_cast<BrowserCategoryList*>( category ); | ||
151 | if ( childList ) | 151 | if ( childList ) | ||
152 | connect( childList, SIGNAL(viewChanged()), this, SLOT(childViewChanged()) ); | 152 | connect( childList, &BrowserCategoryList::viewChanged, this, &BrowserCategoryList::childViewChanged ); | ||
153 | 153 | | |||
154 | category->polish(); // service categories do an additional construction in polish | 154 | category->polish(); // service categories do an additional construction in polish | ||
155 | 155 | | |||
156 | if( m_sorting ) | 156 | if( m_sorting ) | ||
157 | { | 157 | { | ||
158 | m_proxyModel->sort( 0 ); | 158 | m_proxyModel->sort( 0 ); | ||
159 | } | 159 | } | ||
160 | emit( viewChanged() ); | 160 | emit( viewChanged() ); | ||
▲ Show 20 Lines • Show All 261 Lines • Show Last 20 Lines |