Example #1
0
void ListItems::connectionLost()
{
   unSubscribe();
   Watch::unsubscribe( eventsOnOff);
   deleteAllItems();
}
Example #2
0
void ListItems::hideEvent( QHideEvent * event)
{
   unSubscribe();
}
Example #3
0
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);
}