Exemple #1
0
MpdLibraryDb::MpdLibraryDb(QObject *p)
    : LibraryDb(p, "MPD")
    , loading(false)
    , coverQuery(nullptr)
    , albumIdOnlyCoverQuery(nullptr)
    , artistImageQuery(nullptr)
{
    connect(MPDConnection::self(), SIGNAL(updatingLibrary(time_t)), this, SLOT(updateStarted(time_t)));
    connect(MPDConnection::self(), SIGNAL(librarySongs(QList<Song>*)), this, SLOT(insertSongs(QList<Song>*)));
    connect(MPDConnection::self(), SIGNAL(updatedLibrary()), this, SLOT(updateFinished()));
    connect(MPDConnection::self(), SIGNAL(statsUpdated(MPDStatsValues)), this, SLOT(statsUpdated(MPDStatsValues)));
    connect(this, SIGNAL(loadLibrary()), MPDConnection::self(), SLOT(loadLibrary()));
    connect(MPDConnection::self(), SIGNAL(connectionChanged(MPDConnectionDetails)), this, SLOT(connectionChanged(MPDConnectionDetails)));
    DBUG;
}
Exemple #2
0
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());
}
FriendsLibraryDialog::FriendsLibraryDialog(QWidget *parent)
    : QWidget(parent) {
    /* Invoke the Qt Designer generated object setup routine */
    ui.setupUi(this);

    connect(ui.updateLibraryButton, SIGNAL(clicked()), this, SLOT(updateLibrary()));
    connect(librarymixerconnect, SIGNAL(downloadedFriendsLibrary()), this, SLOT(updatedLibrary()), Qt::QueuedConnection);

    /* Setup LibraryFriendModel */
    LibraryFriendModel* libraryFriendModel = new LibraryFriendModel(ui.libraryList, this);
    LibrarySearchModel* librarySearchModel = new LibrarySearchModel(ui.searchBar, this);
    librarySearchModel->setSourceModel(libraryFriendModel);
    ui.libraryList->setModel(librarySearchModel);

    /* Setup OffLMFriendModel */
    OffLMFriendModel* friendModel = new OffLMFriendModel(ui.offLMList, this);
    OffLMSearchModel* searchableFriendModel = new OffLMSearchModel(ui.searchBar, this);
    searchableFriendModel->setSourceModel(friendModel);
    friendModel->setContainingSearchModel(searchableFriendModel);
    ui.offLMList->setModel(searchableFriendModel);
}
void FriendsLibraryDialog::updateLibrary() {
    ui.updateLibraryButton->setEnabled(false);
    if (librarymixerconnect->downloadFriendsLibrary() < 0) updatedLibrary();
}