FSBrowserWidget::FSBrowserWidget (QWidget *parent) : QWidget (parent) , Player_ (0) , FSModel_ (new FSModel (this)) , ColumnsBeenResized_ (false) { Ui_.setupUi (this); FSModel_->setReadOnly (true); FSModel_->setRootPath (QDir::rootPath ()); Ui_.FSTree_->setModel (FSModel_); auto addToPlaylist = new QAction (tr ("Add to playlist"), this); addToPlaylist->setProperty ("ActionIcon", "list-add"); connect (addToPlaylist, SIGNAL (triggered ()), this, SLOT (loadFromFSBrowser ())); Ui_.FSTree_->addAction (addToPlaylist); DirCollection_ = new QAction (QString (), this); DirCollection_->setProperty ("WatchActionIconChange", true); Ui_.FSTree_->addAction (DirCollection_); Ui_.FSTree_->addAction (Util::CreateSeparator (this)); ViewProps_ = new QAction (tr ("Show track properties"), this); ViewProps_->setProperty ("ActionIcon", "document-properties"); connect (ViewProps_, SIGNAL (triggered ()), this, SLOT (viewProps ())); Ui_.FSTree_->addAction (ViewProps_); connect (Ui_.FSTree_->selectionModel (), SIGNAL (currentRowChanged (QModelIndex, QModelIndex)), this, SLOT (handleItemSelected (QModelIndex))); connect (Core::Instance ().GetLocalCollection (), SIGNAL (rootPathsChanged (QStringList)), this, SLOT (handleCollectionChanged ())); }
/* * Description : slot function for active network event * Parameters : aEvent, see the definition of IRQNetworkEvent */ void IRCategoryView::networkRequestNotified(IRQNetworkEvent aEvent) { Q_ASSERT(iViewParameter != EIRViewPara_InvalidId); if (getViewManager()->currentView() != this) { return; } switch (aEvent) { case EIRQNetworkConnectionEstablished: if (EIR_UseNetwork_StartingView == getUseNetworkReason()) { IRQIsdsClient::IRQIsdsClientInterfaceIDs request = IRQIsdsClient::EGenre; switch (iViewParameter) { case EIRViewPara_Genre: request = IRQIsdsClient::EGenre; break; case EIRViewPara_Language: request = IRQIsdsClient::ELanguages; break; case EIRViewPara_Country: request = IRQIsdsClient::ECountries; break; default: break; } connectToIsdsClient(); bool cache = false; iIsdsClient->isdsCategoryRequest(request, cache); iApplication->startLoadingAnimation(this, SLOT(cancelRequest())); } //for there may be some cache, and when we click, we need to handle here else if ( EIR_UseNetwork_SelectItem == getUseNetworkReason()) { handleItemSelected(); } break; case EIRQConnectingCancelled: case EIRQDisplayNetworkMessageNoConnectivity: if (iListView->model()->rowCount() == 0) { getViewManager()->activateView(EIRView_MainView); } else { setCheckedAction(); } break; default: setCheckedAction(); break; } setUseNetworkReason(EIR_UseNetwork_NoReason); }
void FSBrowserWidget::handleCollectionChanged () { handleItemSelected (Ui_.FSTree_->currentIndex ()); }