Ejemplo n.º 1
0
void AnalysisFeature::setTitleProgress(int trackNum, int totalNum) {
    m_Title = QString("%1 (%2 / %3)")
            .arg(m_analysisTitleName)
            .arg(QString::number(trackNum))
            .arg(QString::number(totalNum));
    emit(featureIsLoading(this, false));
}
Ejemplo n.º 2
0
void TraktorFeature::activate() {
    qDebug() << "TraktorFeature::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
        // Let a worker thread do the XML parsing
        m_future = QtConcurrent::run(this, &TraktorFeature::importLibrary,
                                     getTraktorMusicDatabase());
        m_future_watcher.setFuture(m_future);
        m_title = tr("(loading) Traktor");
        //calls a slot in the sidebar model such that 'iTunes (isLoading)' is displayed.
        emit (featureIsLoading(this));
    }

    emit(showTrackModel(m_pTraktorTableModel));
}
Ejemplo n.º 3
0
void ITunesFeature::activate(bool forceReload) {
    //qDebug("ITunesFeature::activate()");
    if (!m_isActivated || forceReload) {
        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()) {
                emit(showTrackModel(m_pITunesTrackModel));
                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));
    }

    emit(showTrackModel(m_pITunesTrackModel));
    emit(enableCoverArtDisplay(false));
}
Ejemplo n.º 4
0
// Sets the title of this feature to the default name followed by (x / y)
// where x is the current track being analyzed and y is the total number of tracks in the job
void AnalysisFeature::setTitleProgress(int trackNum, int totalNum) {
	QString title = m_analysisTitleName;
	title.append(" (");
	title.append(QString::number(trackNum));
	title.append(" / ");
	title.append(QString::number(totalNum));
	title.append(")");
	m_Title = title;
	emit(featureIsLoading(this, false));	// Signals a change in title
}
Ejemplo n.º 5
0
void ITunesFeature::activate(bool forceReload) {
    //qDebug("ITunesFeature::activate()");
    if (!m_isActivated || forceReload) {
        SettingsDAO settings(m_pTrackCollection->getDatabase());
        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();
        }
        // 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
        if (!QFile::exists(m_dbfile)) {
            m_dbfile = QFileDialog::getOpenFileName(
                NULL, tr("Select your iTunes library"), QDir::homePath(), "*.xml");
            if (m_dbfile.isEmpty() || !QFile::exists(m_dbfile)) {
                emit(showTrackModel(m_pITunesTrackModel));
                return;
            }
            settings.setValue(ITDB_PATH_KEY, m_dbfile);
        }
        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
        // 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));
    }

    emit(showTrackModel(m_pITunesTrackModel));
}
Ejemplo n.º 6
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));
    }

    emit(showTrackModel(m_pRhythmboxTrackModel));
}
Ejemplo n.º 7
0
void AnalysisFeature::setTitleDefault() {
    m_Title = m_analysisTitleName;
    emit(featureIsLoading(this, false));
}