Пример #1
0
QString SkinLoader::getConfiguredSkinPath() {

    QString qSkinPath = m_pConfig->getResourcePath();
    qSkinPath.append("skins/");

    QString configSkin = m_pConfig->getValueString(ConfigKey("[Config]","Skin"));
    QString qThisSkin = qSkinPath + configSkin;
    QDir thisSkin(qThisSkin);

    if (configSkin.length() > 0 && thisSkin.exists()) {
        qSkinPath = qThisSkin;
    } else {
        // Fall back to default skin
        QString defaultSkin;
        QRect screenGeo = QApplication::desktop()->screenGeometry();
        if (screenGeo.width() >= 1280 && screenGeo.height() >= 800) {
            defaultSkin = "Deere1280x800-WXGA";
        }
        else if (screenGeo.width() >= 1024 && screenGeo.height() >= 600) {
            defaultSkin = "ShadeDark1024x600-Netbook";
        }
        else {
            defaultSkin = "Outline800x480-WVGA"; // Mixxx's smallest Skin
        }
        qSkinPath.append(defaultSkin);
    }

    QDir skinPath(qSkinPath);
    if (!skinPath.exists()) {
        reportCriticalErrorAndQuit("Skin directory does not exist: " + qSkinPath);
    }

    return qSkinPath;
}
Пример #2
0
QList<QDir> SkinLoader::getSkinSearchPaths() {
    QList<QDir> searchPaths;
    // If we can't find the skins folder then we can't load a skin at all. This
    // is a critical error in the user's Mixxx installation.
    QDir skinsPath(m_pConfig->getResourcePath());
    if (!skinsPath.cd("skins")) {
        reportCriticalErrorAndQuit("Skin directory does not exist: " +
                                   skinsPath.absoluteFilePath("skins"));
    }
    searchPaths.append(skinsPath);

    QDir developerSkinsPath(m_pConfig->getResourcePath());
    if (developerSkinsPath.cd("developer_skins")) {
        searchPaths.append(developerSkinsPath);
    }

    return searchPaths;
}
Пример #3
0
void TrackCollection::createAndPopulateDbConnection() {
    // initialize database connection in TrackCollection
    const QStringList avaiableDrivers = QSqlDatabase::drivers();
    const QString sqliteDriverName("QSQLITE");

    if (!avaiableDrivers.contains(sqliteDriverName)) {
        QString errorMsg = QString("No QSQLITE driver! Available QtSQL drivers: %1")
                .arg(avaiableDrivers.join(","));
        qDebug() << errorMsg;
        MainExecuter::callSync([this, errorMsg](void) {
            reportCriticalErrorAndQuit(errorMsg);
        });
    }

    m_database = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE"));
    m_database->setHostName("localhost");
    m_database->setDatabaseName(m_pConfig->getSettingsPath().append("/mixxxdb.sqlite"));
    m_database->setUserName("mixxx");
    m_database->setPassword("mixxx");
    bool ok = m_database->open();
    qDebug() << "DB status:" << m_database->databaseName() << "=" << ok;
    if (m_database->lastError().isValid()) {
        qDebug() << "Error loading database:" << m_database->lastError();
    }
    // Check for tables and create them if missing
    if (!checkForTables()) {
        // TODO(XXX) something a little more elegant
        exit(-1);
    }

    m_playlistDao = new PlaylistDAO(*m_database);
    m_crateDao = new CrateDAO(*m_database);
    m_cueDao = new CueDAO(*m_database);
    m_analysisDao = new AnalysisDao(*m_database, m_pConfig);
    m_trackDao = new TrackDAO(*m_database, *m_cueDao, *m_playlistDao, *m_crateDao, *m_analysisDao, m_pConfig);
}