Пример #1
0
void RhythmboxFeature::activateChild(const QModelIndex& index) {
    //qDebug() << "RhythmboxFeature::activateChild()" << index;
    QString playlist = index.data().toString();
    qDebug() << "Activating " << playlist;
    m_pRhythmboxPlaylistModel->setPlaylist(playlist);
    emit(showTrackModel(m_pRhythmboxPlaylistModel));
    emit(enableCoverArtDisplay(false));
}
Пример #2
0
void BasePlaylistFeature::activateChild(const QModelIndex& index) {
    //qDebug() << "BasePlaylistFeature::activateChild()" << index;
    int playlistId = playlistIdFromIndex(index);
    if (playlistId != -1 && m_pPlaylistTableModel) {
        m_pPlaylistTableModel->setTableModel(playlistId);
        emit(showTrackModel(m_pPlaylistTableModel));
        emit(enableCoverArtDisplay(true));
    }
}
Пример #3
0
void BansheeFeature::activateChild(const QModelIndex& index) {
    TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
    int playlistID = item->getData().toInt();
    if (playlistID > 0) {
        qDebug() << "Activating " << item->getLabel();
        m_pBansheePlaylistModel->setTableModel(playlistID);
        emit(showTrackModel(m_pBansheePlaylistModel));
        emit(enableCoverArtDisplay(false));
    }
}
Пример #4
0
void CrateFeature::activateChild(const QModelIndex& index) {
    if (!index.isValid())
        return;
    int crateId = crateIdFromIndex(index);
    if (crateId == -1) {
        return;
    }
    m_crateTableModel.setTableModel(crateId);
    emit(showTrackModel(&m_crateTableModel));
    emit(enableCoverArtDisplay(true));
}
Пример #5
0
void BansheeFeature::activate() {
    //qDebug("BansheeFeature::activate()");

    if (!m_isActivated) {
        if (!QFile::exists(m_databaseFile)) {
            // Fall back to default
            m_databaseFile = BansheeDbConnection::getDatabaseFile();
        }

        if (!QFile::exists(m_databaseFile)) {
            QMessageBox::warning(
                    NULL,
                    tr("Error loading Banshee database"),
                    tr("Banshee database file not found at\n") +
                    m_databaseFile);
            qDebug() << m_databaseFile << "does not exist";
        }

        if (!m_connection.open(m_databaseFile)) {
            QMessageBox::warning(
                    NULL,
                    tr("Error loading Banshee database"),
                    tr("There was an error loading your Banshee database at\n") +
                    m_databaseFile);
            return;
        }

        qDebug() << "Using Banshee Database Schema V" << m_connection.getSchemaVersion();

        m_isActivated =  true;

        auto pRootItem = std::make_unique<TreeItem>(this);
        QList<BansheeDbConnection::Playlist> playlists = m_connection.getPlaylists();
        for (const BansheeDbConnection::Playlist& playlist: playlists) {
            qDebug() << playlist.name;
            // append the playlist to the child model
            pRootItem->appendChild(playlist.name, playlist.playlistId);
        }
        m_childModel.setRootItem(std::move(pRootItem));

        if (m_isActivated) {
            activate();
        }
        qDebug() << "Banshee library loaded: success";

        //calls a slot in the sidebarmodel such that 'isLoading' is removed from the feature title.
        m_title = tr("Banshee");
        emit(featureLoadingFinished(this));
    }

    m_pBansheePlaylistModel->setTableModel(0); // Gets the master playlist
    emit(showTrackModel(m_pBansheePlaylistModel));
    emit(enableCoverArtDisplay(false));
}
Пример #6
0
void CrateFeature::activateCrate(int crateId) {
    //qDebug() << "CrateFeature::activateCrate()" << crateId;
    QModelIndex index = indexFromCrateId(crateId);
    if (crateId != -1 && index.isValid()) {
        m_crateTableModel.setTableModel(crateId);
        emit(showTrackModel(&m_crateTableModel));
        emit(enableCoverArtDisplay(true));
        // Update selection
        emit(featureSelect(this, m_lastRightClickedIndex));
        activateChild(m_lastRightClickedIndex);
    }
}
Пример #7
0
void TraktorFeature::activateChild(const QModelIndex& index) {

    if (!index.isValid()) return;

    //access underlying TreeItem object
    TreeItem *item = static_cast<TreeItem*>(index.internalPointer());

    if (item->isPlaylist()) {
        qDebug() << "Activate Traktor Playlist: " << item->dataPath().toString();
        m_pTraktorPlaylistModel->setPlaylist(item->dataPath().toString());
        emit(showTrackModel(m_pTraktorPlaylistModel));
        emit(enableCoverArtDisplay(false));
    }
}
Пример #8
0
void RhythmboxFeature::activate() {
    qDebug() << "RhythmboxFeature::activate()";

    if (!m_isActivated) {
        m_isActivated =  true;
        // Ususally the maximum number of threads
        // is > 2 depending on the CPU cores
        // Unfortunately, within VirtualBox
        // the maximum number of allowed threads
        // is 1 at all times We'll need to increase
        // the number to > 1, otherwise importing the music collection
        // takes place when the GUI threads terminates, i.e., on
        // Mixxx shutdown.
        QThreadPool::globalInstance()->setMaxThreadCount(4); //Tobias decided to use 4
        m_track_future = QtConcurrent::run(this, &RhythmboxFeature::importMusicCollection);
        m_track_watcher.setFuture(m_track_future);
        m_title = "(loading) Rhythmbox";
        //calls a slot in the sidebar model such that 'Rhythmbox (isLoading)' is displayed.
        emit (featureIsLoading(this, true));
    }

    emit(showTrackModel(m_pRhythmboxTrackModel));
    emit(enableCoverArtDisplay(false));
}
Пример #9
0
void AutoDJFeature::activate() {
    //qDebug() << "AutoDJFeature::activate()";
    emit(switchToView(m_sAutoDJViewName));
    emit(restoreSearch(QString())); //Null String disables search box
    emit(enableCoverArtDisplay(true));
}
Пример #10
0
void CrateFeature::activate() {
    emit(switchToView("CRATEHOME"));
    emit(restoreSearch(QString())); //disable search on crate home
    emit(enableCoverArtDisplay(true));
}
Пример #11
0
        if (playlist_root) {
            m_childModel.setRootItem(playlist_root);
            if (m_isActivated) {
                activate();
            }
            qDebug() << "Banshee library loaded: success";
        }

        //calls a slot in the sidebarmodel such that 'isLoading' is removed from the feature title.
        m_title = tr("Banshee");
        emit(featureLoadingFinished(this));
    }

    m_pBansheePlaylistModel->setTableModel(0); // Gets the master playlist
    emit(showTrackModel(m_pBansheePlaylistModel));
    emit(enableCoverArtDisplay(false));
}

void BansheeFeature::activateChild(const QModelIndex& index) {
    TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
    //qDebug() << "BansheeFeature::activateChild " << item->data() << " " << item->dataPath();
    QString playlist = item->dataPath().toString();
    int playlistID = playlist.toInt();
    if (playlistID > 0) {
        qDebug() << "Activating " << item->data().toString();
        m_pBansheePlaylistModel->setTableModel(playlistID);
        emit(showTrackModel(m_pBansheePlaylistModel));
        emit(enableCoverArtDisplay(false));
    }
}
Пример #12
0
void MixxxLibraryFeature::activateChild(const QModelIndex& index) {
    QString itemName = index.data().toString();
    emit(switchToView(itemName));
    emit(enableCoverArtDisplay(true));
}
Пример #13
0
void MixxxLibraryFeature::activate() {
    qDebug() << "MixxxLibraryFeature::activate()";
    emit(showTrackModel(m_pLibraryTableModel));
    emit(enableCoverArtDisplay(true));
}
Пример #14
0
void ITunesFeature::activate() {
    activate(false);
    emit(enableCoverArtDisplay(false));
}
Пример #15
0
void BasePlaylistFeature::activate() {
    emit(switchToView(m_rootViewName));
    emit(restoreSearch(QString())); // Null String disables search box
    emit(enableCoverArtDisplay(true));
}
Пример #16
0
void ITunesFeature::activate(bool forceReload) {
    //qDebug("ITunesFeature::activate()");
    if (!m_isActivated || forceReload) {

        //Delete all table entries of iTunes feature
        ScopedTransaction transaction(m_database);
        clearTable("itunes_playlist_tracks");
        clearTable("itunes_library");
        clearTable("itunes_playlists");
        transaction.commit();

        emit(showTrackModel(m_pITunesTrackModel));

        SettingsDAO settings(m_pTrackCollection->database());
        QString dbSetting(settings.getValue(ITDB_PATH_KEY));
        // if a path exists in the database, use it
        if (!dbSetting.isEmpty() && QFile::exists(dbSetting)) {
            m_dbfile = dbSetting;
        } else {
            // No Path in settings, try the default
            m_dbfile = getiTunesMusicPath();
        }

        QFileInfo dbFile(m_dbfile);
        if (!m_dbfile.isEmpty() && dbFile.exists()) {
            // Users of Mixxx <1.12.0 didn't support sandboxing. If we are sandboxed
            // and using a custom iTunes path then we have to ask for access to this
            // file.
            Sandbox::askForAccess(m_dbfile);
        } else {
            // if the path we got between the default and the database doesn't
            // exist, ask for a new one and use/save it if it exists
            m_dbfile = QFileDialog::getOpenFileName(
                NULL, tr("Select your iTunes library"), QDir::homePath(), "*.xml");
            QFileInfo dbFile(m_dbfile);
            if (m_dbfile.isEmpty() || !dbFile.exists()) {
                return;
            }

            // The user has picked a new directory via a file dialog. This means the
            // system sandboxer (if we are sandboxed) has granted us permission to
            // this folder. Create a security bookmark while we have permission so
            // that we can access the folder on future runs. We need to canonicalize
            // the path so we first wrap the directory string with a QDir.
            Sandbox::createSecurityToken(dbFile);
            settings.setValue(ITDB_PATH_KEY, m_dbfile);
        }
        m_isActivated =  true;
        // Usually the maximum number of threads
        // is > 2 depending on the CPU cores
        // Unfortunately, within VirtualBox
        // the maximum number of allowed threads
        // is 1 at all times We'll need to increase
        // the number to > 1, otherwise importing the music collection
        // takes place when the GUI threads terminates, i.e., on
        // Mixxx shutdown.
        QThreadPool::globalInstance()->setMaxThreadCount(4); //Tobias decided to use 4
        // Let a worker thread do the XML parsing
        m_future = QtConcurrent::run(this, &ITunesFeature::importLibrary);
        m_future_watcher.setFuture(m_future);
        m_title = tr("(loading) iTunes");
        // calls a slot in the sidebar model such that 'iTunes (isLoading)' is displayed.
        emit(featureIsLoading(this, true));
    } else {
        emit(showTrackModel(m_pITunesTrackModel));
    }
    emit(enableCoverArtDisplay(false));
}