Commit 1e2d5b06 authored by marco's avatar marco
Browse files

Fix translate setting + Mod oracle to portable build

parent c8d59eec
...@@ -17,8 +17,8 @@ QString SettingsCache::getSettingsPath() ...@@ -17,8 +17,8 @@ QString SettingsCache::getSettingsPath()
#else #else
file = QDesktopServices::storageLocation(QDesktopServices::DataLocation); file = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif #endif
file.append("/settings/");
#endif #endif
file.append("/settings/");
return file; return file;
} }
...@@ -98,7 +98,7 @@ void SettingsCache::translateLegacySettings() ...@@ -98,7 +98,7 @@ void SettingsCache::translateLegacySettings()
QStringList allFilters = legacySetting.allKeys(); QStringList allFilters = legacySetting.allKeys();
for (int i = 0; i < allFilters.size(); ++i) { for (int i = 0; i < allFilters.size(); ++i) {
if(allFilters.at(i).startsWith("game_type")){ if(allFilters.at(i).startsWith("game_type")){
gameFilters().setGameTypeEnabled(allFilters.at(i), legacySetting.value(allFilters.at(i)).toBool()); gameFilters().setGameHashedTypeEnabled(allFilters.at(i), legacySetting.value(allFilters.at(i)).toBool());
} }
} }
QStringList allKeysfilter_games = legacySetting.allKeys(); QStringList allKeysfilter_games = legacySetting.allKeys();
......
...@@ -48,13 +48,19 @@ OracleWizard::OracleWizard(QWidget *parent) ...@@ -48,13 +48,19 @@ OracleWizard::OracleWizard(QWidget *parent)
settings = new QSettings(this); settings = new QSettings(this);
connect(settingsCache, SIGNAL(langChanged()), this, SLOT(updateLanguage())); connect(settingsCache, SIGNAL(langChanged()), this, SLOT(updateLanguage()));
importer = new OracleImporter( QString dataDir;
#if QT_VERSION < 0x050000
QDesktopServices::storageLocation(QDesktopServices::DataLocation) #ifndef PORTABLE_BUILD
#if QT_VERSION < 0x050000
QDesktopServices::storageLocation(QDesktopServices::DataLocation)
#else
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
#else #else
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first() dataDir.append("data/");
#endif #endif
, this);
importer = new OracleImporter(dataDir, this);
addPage(new IntroPage); addPage(new IntroPage);
addPage(new LoadSetsPage); addPage(new LoadSetsPage);
...@@ -485,6 +491,9 @@ void SaveSetsPage::retranslateUi() ...@@ -485,6 +491,9 @@ void SaveSetsPage::retranslateUi()
"Press \"Save\" to save the imported cards to the Cockatrice database.")); "Press \"Save\" to save the imported cards to the Cockatrice database."));
defaultPathCheckBox->setText(tr("Save to the default path (recommended)")); defaultPathCheckBox->setText(tr("Save to the default path (recommended)"));
#ifdef PORTABLE_BUILD
defaultPathCheckBox->setEnabled(false);
#endif
} }
void SaveSetsPage::updateTotalProgress(int cardsImported, int /* setIndex */, const QString &setName) void SaveSetsPage::updateTotalProgress(int cardsImported, int /* setIndex */, const QString &setName)
...@@ -500,12 +509,17 @@ void SaveSetsPage::updateTotalProgress(int cardsImported, int /* setIndex */, co ...@@ -500,12 +509,17 @@ void SaveSetsPage::updateTotalProgress(int cardsImported, int /* setIndex */, co
bool SaveSetsPage::validatePage() bool SaveSetsPage::validatePage()
{ {
bool ok = false; bool ok = false;
const QString dataDir = QString dataDir;
#ifndef PORTABLE_BUILD
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
QDesktopServices::storageLocation(QDesktopServices::DataLocation); dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#else
dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
#else #else
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first(); dataDir = "data/";
#endif #endif
QSettings* settings = new QSettings(this); QSettings* settings = new QSettings(this);
QString defaultPath = settings->value("paths/carddatabase").toString(); QString defaultPath = settings->value("paths/carddatabase").toString();
QString windowName = tr("Save card database"); QString windowName = tr("Save card database");
...@@ -695,16 +709,23 @@ void SaveTokensPage::retranslateUi() ...@@ -695,16 +709,23 @@ void SaveTokensPage::retranslateUi()
"Press \"Save\" to save the imported tokens to the Cockatrice tokens database.")); "Press \"Save\" to save the imported tokens to the Cockatrice tokens database."));
defaultPathCheckBox->setText(tr("Save to the default path (recommended)")); defaultPathCheckBox->setText(tr("Save to the default path (recommended)"));
#ifdef PORTABLE_BUILD
defaultPathCheckBox->setEnabled(false);
#endif
} }
bool SaveTokensPage::validatePage() bool SaveTokensPage::validatePage()
{ {
bool ok = false; bool ok = false;
const QString dataDir = QString dataDir;
#ifndef PORTABLE_BUILD
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
QDesktopServices::storageLocation(QDesktopServices::DataLocation); dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#else
dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
#else #else
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first(); dataDir = "data/";
#endif #endif
QSettings* settings = new QSettings(this); QSettings* settings = new QSettings(this);
QString defaultPath = settings->value("paths/tokendatabase").toString(); QString defaultPath = settings->value("paths/tokendatabase").toString();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment