LibraryPage::LibraryPage(QWidget *p) : QWidget(p) { setupUi(this); addToPlayQueue->setDefaultAction(StdActions::self()->addToPlayQueueAction); replacePlayQueue->setDefaultAction(StdActions::self()->replacePlayQueueAction); view->addAction(StdActions::self()->addToPlayQueueAction); view->addAction(StdActions::self()->replacePlayQueueAction); view->addAction(StdActions::self()->addWithPriorityAction); view->addAction(StdActions::self()->addToStoredPlaylistAction); #ifdef TAGLIB_FOUND #ifdef ENABLE_DEVICES_SUPPORT view->addAction(StdActions::self()->copyToDeviceAction); #endif view->addAction(StdActions::self()->organiseFilesAction); view->addAction(StdActions::self()->editTagsAction); #ifdef ENABLE_REPLAYGAIN_SUPPORT view->addAction(StdActions::self()->replaygainAction); #endif view->addAction(StdActions::self()->setCoverAction); #ifdef ENABLE_DEVICES_SUPPORT view->addSeparator(); view->addAction(StdActions::self()->deleteSongsAction); #endif #endif // TAGLIB_FOUND connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8))); connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &))); connect(genreCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(searchItems())); connect(MPDConnection::self(), SIGNAL(updatingLibrary()), view, SLOT(updating())); connect(MPDConnection::self(), SIGNAL(updatedLibrary()), view, SLOT(updated())); connect(MPDConnection::self(), SIGNAL(updatingDatabase()), view, SLOT(updating())); connect(MPDConnection::self(), SIGNAL(updatedDatabase()), view, SLOT(updated())); connect(MusicLibraryModel::self(), SIGNAL(updateGenres(const QSet<QString> &)), genreCombo, SLOT(update(const QSet<QString> &))); connect(this, SIGNAL(loadLibrary()), MPDConnection::self(), SLOT(loadLibrary())); connect(view, SIGNAL(itemsSelected(bool)), this, SLOT(controlActions())); connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &))); connect(view, SIGNAL(searchItems()), this, SLOT(searchItems())); connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(updateGenres(QModelIndex))); proxy.setSourceModel(MusicLibraryModel::self()); view->setModel(&proxy); view->load(metaObject()->className()); }
DevicesPage::DevicesPage(QWidget *p) : QWidget(p) { setupUi(this); copyAction = ActionCollection::get()->createAction("copytolibrary", i18n("Copy To Library"), Icons::self()->importIcon); copyToLibraryButton->setDefaultAction(copyAction); syncAction = ActionCollection::get()->createAction("syncdevice", i18n("Sync"), "folder-sync"); searchButton->setDefaultAction(StdActions::self()->searchAction); connect(syncAction, SIGNAL(triggered()), this, SLOT(sync())); #ifdef ENABLE_REMOTE_DEVICES forgetDeviceAction=ActionCollection::get()->createAction("forgetdevice", i18n("Forget Device"), "list-remove"); connect(forgetDeviceAction, SIGNAL(triggered()), this, SLOT(forgetRemoteDevice())); #endif connect(DevicesModel::self()->connectAct(), SIGNAL(triggered()), this, SLOT(toggleDevice())); connect(DevicesModel::self()->disconnectAct(), SIGNAL(triggered()), this, SLOT(toggleDevice())); copyToLibraryButton->setEnabled(false); syncAction->setEnabled(false); view->addAction(copyAction); view->addAction(syncAction); view->addAction(StdActions::self()->organiseFilesAction); view->addAction(StdActions::self()->editTagsAction); #ifdef ENABLE_REPLAYGAIN_SUPPORT view->addAction(StdActions::self()->replaygainAction); #endif #ifdef ENABLE_REMOTE_DEVICES QAction *sepA=new QAction(this); sepA->setSeparator(true); view->addAction(sepA); view->addAction(forgetDeviceAction); #endif QAction *sep=new QAction(this); sep->setSeparator(true); view->addAction(sep); view->addAction(StdActions::self()->deleteSongsAction); connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8))); connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &))); connect(genreCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(searchItems())); connect(DevicesModel::self(), SIGNAL(updateGenres(const QSet<QString> &)), genreCombo, SLOT(update(const QSet<QString> &))); connect(DevicesModel::self(), SIGNAL(updated(QModelIndex)), this, SLOT(updated(QModelIndex))); connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &))); connect(view, SIGNAL(searchItems()), this, SLOT(searchItems())); connect(view, SIGNAL(itemsSelected(bool)), SLOT(controlActions())); connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(updateGenres(QModelIndex))); connect(copyAction, SIGNAL(triggered()), this, SLOT(copyToLibrary())); connect(DevicesModel::self()->configureAct(), SIGNAL(triggered()), this, SLOT(configureDevice())); connect(DevicesModel::self()->refreshAct(), SIGNAL(triggered()), this, SLOT(refreshDevice())); #if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND connect(DevicesModel::self()->editAct(), SIGNAL(triggered()), this, SLOT(editDetails())); connect(DevicesModel::self(), SIGNAL(matches(const QString &, const QList<CdAlbum> &)), SLOT(cdMatches(const QString &, const QList<CdAlbum> &))); #endif QMenu *menu=new QMenu(this); #ifdef ENABLE_REMOTE_DEVICES Action *addRemote=ActionCollection::get()->createAction("adddevice", i18n("Add Device"), "network-server"); connect(addRemote, SIGNAL(triggered()), this, SLOT(addRemoteDevice())); menu->addAction(addRemote); menu->addAction(forgetDeviceAction); menu->addSeparator(); #endif menu->addAction(DevicesModel::self()->configureAct()); menu->addAction(DevicesModel::self()->refreshAct()); menu->addSeparator(); menu->addAction(StdActions::self()->organiseFilesAction); menu->addAction(StdActions::self()->editTagsAction); #ifdef ENABLE_REPLAYGAIN_SUPPORT menu->addAction(StdActions::self()->replaygainAction); #endif menuButton->setMenu(menu); proxy.setSourceModel(DevicesModel::self()); view->setModel(&proxy); view->setRootIsDecorated(false); }
OnlineServicesPage::OnlineServicesPage(QWidget *p) : QWidget(p) , onlineSearchRequest(false) , searchable(true) , expanded(false) { setupUi(this); addToPlayQueue->setDefaultAction(StdActions::self()->addToPlayQueueAction); replacePlayQueue->setDefaultAction(StdActions::self()->replacePlayQueueAction); view->addAction(StdActions::self()->addToPlayQueueAction); view->addAction(StdActions::self()->replacePlayQueueAction); view->addAction(StdActions::self()->addWithPriorityAction); view->addAction(StdActions::self()->addToStoredPlaylistAction); downloadAction = new Action(Icon("go-down"), i18n("Download To Library"), this); downloadPodcastAction = new Action(Icon("go-down"), i18n("Download Episodes"), this); deleteDownloadedPodcastAction = new Action(Icon("edit-delete"), i18n("Delete Downloaded Episodes"), this); cancelPodcastDownloadAction = new Action(Icons::self()->cancelIcon, i18n("Cancel Podcast Download"), this); markPodcastAsNewAction = new Action(Icon("document-new"), i18n("Mark Episodes As New"), this); markPodcastAsListenedAction = new Action(i18n("Mark Episodes As Listened"), this); connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8))); connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &))); connect(genreCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(searchItems())); connect(OnlineServicesModel::self(), SIGNAL(updateGenres(const QSet<QString> &)), genreCombo, SLOT(update(const QSet<QString> &))); connect(OnlineServicesModel::self(), SIGNAL(updated(QModelIndex)), this, SLOT(updated(QModelIndex))); // connect(OnlineServicesModel::self(), SIGNAL(needToSort()), this, SLOT(sortList())); connect(OnlineServicesModel::self(), SIGNAL(busy(bool)), view, SLOT(showSpinner(bool))); connect(OnlineServicesModel::self(), SIGNAL(providersChanged()), this, SLOT(providersChanged())); connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &))); connect(view, SIGNAL(searchItems()), this, SLOT(searchItems())); connect(view, SIGNAL(searchIsActive(bool)), this, SLOT(controlSearch(bool))); connect(view, SIGNAL(itemsSelected(bool)), SLOT(controlActions())); connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(updateGenres(QModelIndex))); connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(setSearchable(QModelIndex))); connect(OnlineServicesModel::self()->configureAct(), SIGNAL(triggered()), this, SLOT(configureService())); connect(OnlineServicesModel::self()->refreshAct(), SIGNAL(triggered()), this, SLOT(refreshService())); connect(OnlineServicesModel::self()->subscribeAct(), SIGNAL(triggered()), this, SLOT(subscribe())); connect(OnlineServicesModel::self()->unSubscribeAct(), SIGNAL(triggered()), this, SLOT(unSubscribe())); connect(OnlineServicesModel::self()->refreshSubscriptionAct(), SIGNAL(triggered()), this, SLOT(refreshSubscription())); connect(downloadAction, SIGNAL(triggered()), this, SLOT(download())); connect(downloadPodcastAction, SIGNAL(triggered()), this, SLOT(downloadPodcast())); connect(deleteDownloadedPodcastAction, SIGNAL(triggered()), this, SLOT(deleteDownloadedPodcast())); connect(cancelPodcastDownloadAction, SIGNAL(triggered()), this, SLOT(cancelPodcastDownload())); connect(markPodcastAsNewAction, SIGNAL(triggered()), this, SLOT(markPodcastAsNew())); connect(markPodcastAsListenedAction, SIGNAL(triggered()), this, SLOT(markPodcastAsListened())); QMenu *menu=new QMenu(this); menu->addAction(OnlineServicesModel::self()->configureAct()); menu->addAction(OnlineServicesModel::self()->refreshAct()); menu->addSeparator(); menu->addAction(OnlineServicesModel::self()->subscribeAct()); menu->addAction(OnlineServicesModel::self()->unSubscribeAct()); menu->addAction(OnlineServicesModel::self()->refreshSubscriptionAct()); menu->addAction(downloadPodcastAction); menu->addAction(cancelPodcastDownloadAction); menu->addAction(deleteDownloadedPodcastAction); menu->addSeparator(); menu->addAction(markPodcastAsNewAction); menu->addAction(markPodcastAsListenedAction); menu->addSeparator(); QAction *configAction=new QAction(Icons::self()->configureIcon, i18n("Configure..."), this); menu->addAction(configAction); connect(configAction, SIGNAL(triggered()), this, SLOT(showPreferencesPage())); view->addAction(downloadAction); view->addSeparator(); view->addAction(OnlineServicesModel::self()->subscribeAct()); view->addAction(OnlineServicesModel::self()->unSubscribeAct()); view->addAction(OnlineServicesModel::self()->refreshSubscriptionAct()); view->addAction(downloadPodcastAction); view->addAction(deleteDownloadedPodcastAction); view->addAction(cancelPodcastDownloadAction); view->addAction(deleteDownloadedPodcastAction); view->addSeparator(); view->addAction(markPodcastAsNewAction); view->addAction(markPodcastAsListenedAction); menuButton->setMenu(menu); proxy.setSourceModel(OnlineServicesModel::self()); // proxy.setDynamicSortFilter(false); view->setModel(&proxy); view->setRootIsDecorated(true); view->setSearchResetLevel(1); }