mirror of https://github.com/mgba-emu/mgba.git
Qt: Make ConfigController::configDir static
This commit is contained in:
parent
22a36e0af9
commit
c11551a1f7
|
@ -88,14 +88,13 @@ void ConfigOption::setValue(const QVariant& value) {
|
|||
}
|
||||
}
|
||||
|
||||
QString ConfigController::s_configDir;
|
||||
|
||||
ConfigController::ConfigController(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_opts()
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
mCoreConfigDirectory(path, sizeof(path));
|
||||
m_configDir = QString::fromUtf8(path);
|
||||
QString fileName = (m_configDir);
|
||||
QString fileName = configDir();
|
||||
fileName.append(QDir::separator());
|
||||
fileName.append("qt.ini");
|
||||
m_settings = new QSettings(fileName, QSettings::IniFormat, this);
|
||||
|
@ -270,7 +269,7 @@ void ConfigController::write() {
|
|||
void ConfigController::makePortable() {
|
||||
mCoreConfigMakePortable(&m_config);
|
||||
|
||||
QString fileName(m_configDir);
|
||||
QString fileName(configDir());
|
||||
fileName.append(QDir::separator());
|
||||
fileName.append("qt.ini");
|
||||
QSettings* settings2 = new QSettings(fileName, QSettings::IniFormat, this);
|
||||
|
@ -280,3 +279,12 @@ void ConfigController::makePortable() {
|
|||
delete m_settings;
|
||||
m_settings = settings2;
|
||||
}
|
||||
|
||||
const QString& ConfigController::configDir() {
|
||||
if (s_configDir.isNull()) {
|
||||
char path[PATH_MAX];
|
||||
mCoreConfigDirectory(path, sizeof(path));
|
||||
s_configDir = QString::fromUtf8(path);
|
||||
}
|
||||
return s_configDir;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
const mCoreConfig* config() { return &m_config; }
|
||||
|
||||
const QString& configDir() { return m_configDir; }
|
||||
static const QString& configDir();
|
||||
|
||||
public slots:
|
||||
void setOption(const char* key, bool value);
|
||||
|
@ -105,7 +105,7 @@ private:
|
|||
|
||||
QMap<QString, ConfigOption*> m_optionSet;
|
||||
QSettings* m_settings;
|
||||
QString m_configDir;
|
||||
static QString s_configDir;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ QString GBAApp::dataDir() {
|
|||
#ifdef USE_SQLITE3
|
||||
bool GBAApp::reloadGameDB() {
|
||||
NoIntroDB* db = nullptr;
|
||||
db = NoIntroDBLoad((m_configController.configDir() + "/nointro.sqlite3").toLocal8Bit().constData());
|
||||
db = NoIntroDBLoad((ConfigController::configDir() + "/nointro.sqlite3").toUtf8().constData());
|
||||
if (db && m_db) {
|
||||
NoIntroDBDestroy(m_db);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue