diff --git a/oscar/SleepLib/common.cpp b/oscar/SleepLib/common.cpp
index 927fa3ac..14983a28 100644
--- a/oscar/SleepLib/common.cpp
+++ b/oscar/SleepLib/common.cpp
@@ -51,19 +51,25 @@ const QString getDeveloperName()
const QString getAppName()
{
QString name = STR_AppName;
- if ((GIT_BRANCH != "master") || (!((ReleaseStatus.compare("r", Qt::CaseInsensitive)==0) || (ReleaseStatus.compare("rc", Qt::CaseInsensitive)==0) || (ReleaseStatus.compare("beta", Qt::CaseInsensitive)==0)))) {
+ if ((GIT_BRANCH != "master") ||
+ (!((ReleaseStatus.compare("r", Qt::CaseInsensitive)==0) ||
+ (ReleaseStatus.compare("rc", Qt::CaseInsensitive)==0) ||
+ (ReleaseStatus.compare("beta", Qt::CaseInsensitive)==0)))) {
name += "-"+GIT_BRANCH;
}
return name;
}
-const QString getDefaultAppRoot()
+const QString getModifiedAppData()
{
- QString approot = STR_AppRoot;
- if ((GIT_BRANCH != "master") || (!((ReleaseStatus.compare("r", Qt::CaseInsensitive)==0) || (ReleaseStatus.compare("rc", Qt::CaseInsensitive)==0) || (ReleaseStatus.compare("beta", Qt::CaseInsensitive)==0)))) {
- approot += "-"+GIT_BRANCH;
+ QString appdata = STR_AppData;
+ if ((GIT_BRANCH != "master") ||
+ (!((ReleaseStatus.compare("r", Qt::CaseInsensitive)==0) ||
+ (ReleaseStatus.compare("rc", Qt::CaseInsensitive)==0) ||
+ (ReleaseStatus.compare("beta", Qt::CaseInsensitive)==0)))) {
+ appdata += "-"+GIT_BRANCH;
}
- return approot;
+ return appdata;
}
bool gfxEgnineIsSupported(GFXEngine e)
diff --git a/oscar/SleepLib/common.h b/oscar/SleepLib/common.h
index 737ff223..cc74183a 100644
--- a/oscar/SleepLib/common.h
+++ b/oscar/SleepLib/common.h
@@ -134,7 +134,7 @@ const QString STR_TestBuild = "";
const QString getAppName();
const QString getDeveloperName();
-const QString getDefaultAppRoot();
+const QString getModifiedAppData();
void initializeStrings();
@@ -166,7 +166,7 @@ const QString STR_PREF_Language = "Language";
const QString STR_AppName = "OSCAR";
const QString STR_DeveloperName = "NightOwl";
-const QString STR_AppRoot = "OSCAR_Data";
+const QString STR_AppData = "OSCAR_Data";
///////////////////////////////////////////////////////////////////////////////////////////////
// Commonly used translatable text strings
diff --git a/oscar/SleepLib/preferences.cpp b/oscar/SleepLib/preferences.cpp
index 9fc15648..d1c3bd91 100644
--- a/oscar/SleepLib/preferences.cpp
+++ b/oscar/SleepLib/preferences.cpp
@@ -59,24 +59,24 @@ const QString &getUserName()
}
-QString GetAppRoot()
+QString GetAppData()
{
QSettings settings;
- QString HomeAppRoot = settings.value("Settings/AppRoot").toString();
+ QString HomeAppData = settings.value("Settings/AppData").toString();
- if (HomeAppRoot.isEmpty()) {
- HomeAppRoot = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)+"/"+getDefaultAppRoot();
+ if (HomeAppData.isEmpty()) {
+ HomeAppData = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)+"/"+getModifiedAppData();
}
- return HomeAppRoot;
+ return HomeAppData;
}
Preferences::Preferences()
{
p_name = "Preferences";
- p_path = GetAppRoot();
+ p_path = GetAppData();
}
Preferences::Preferences(QString name, QString filename)
@@ -88,10 +88,10 @@ Preferences::Preferences(QString name, QString filename)
}
if (filename.isEmpty()) {
- p_filename = GetAppRoot() + "/" + p_name + STR_ext_XML;
+ p_filename = GetAppData() + "/" + p_name + STR_ext_XML;
} else {
if (!filename.contains("/")) {
- p_filename = GetAppRoot() + "/";
+ p_filename = GetAppData() + "/";
} else { p_filename = ""; }
p_filename += filename;
@@ -147,7 +147,7 @@ const QString Preferences::Get(QString name)
ref = a.section(cbr, 0, 0);
if (ref.toLower() == "home") {
- temp += GetAppRoot();
+ temp += GetAppData();
} else if (ref.toLower() == "user") {
temp += getUserName();
} else if (ref.toLower() == "sep") { // redundant in QT
@@ -174,10 +174,10 @@ bool Preferences::Open(QString filename)
QDomDocument doc(p_name);
QFile file(p_filename);
- qDebug() << "Reading " << p_filename.toLocal8Bit().data();
+ qDebug() << "Opening " << p_filename.toLocal8Bit().data();
if (!file.open(QIODevice::ReadOnly)) {
- qWarning() << "Could not open" << p_filename.toLocal8Bit().data();
+ qWarning() << "Could not open" << p_filename.toLocal8Bit().data() << " Error: " << file.error();
return false;
}
diff --git a/oscar/SleepLib/preferences.h b/oscar/SleepLib/preferences.h
index 2dbb6ca5..65c8688f 100644
--- a/oscar/SleepLib/preferences.h
+++ b/oscar/SleepLib/preferences.h
@@ -18,7 +18,7 @@
const QString STR_ext_XML = ".xml";
-extern QString GetAppRoot(); //returns app root path plus trailing path separator.
+extern QString GetAppData(); //returns app data path plus trailing path separator.
inline QString PrefMacro(QString s)
{
@@ -130,7 +130,7 @@ class Preferences
};
//! \brief Main Preferences Object used throughout the application
-extern Preferences PREF;
+// extern Preferences PREF;
// Parent class for subclasses that manipulate the profile.
class PrefSettings
diff --git a/oscar/aboutdialog.cpp b/oscar/aboutdialog.cpp
index df881c4b..1943dec5 100644
--- a/oscar/aboutdialog.cpp
+++ b/oscar/aboutdialog.cpp
@@ -39,7 +39,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
// +tr("Graphics Engine: %1").arg(getGraphicsEngine());
// }
- QString path = GetAppRoot();
+ QString path = GetAppData();
QString text = /* gitrev + */ "
"+tr("Show data folder")+"";
ui->infoLabel->setText(text);
diff --git a/oscar/daily.cpp b/oscar/daily.cpp
index 8963a919..b27ba07e 100644
--- a/oscar/daily.cpp
+++ b/oscar/daily.cpp
@@ -1569,7 +1569,7 @@ void Daily::Load(QDate date)
//sessbar->update();
#ifdef DEBUG_DAILY_HTML
- QString name = GetAppRoot()+"/test.html";
+ QString name = GetAppData()+"/test.html";
QFile file(name);
if (file.open(QFile::WriteOnly)) {
const QByteArray & b = html.toLocal8Bit();
diff --git a/oscar/profileselect.cpp b/oscar/profileselect.cpp
index c095791e..ae7cd0c4 100644
--- a/oscar/profileselect.cpp
+++ b/oscar/profileselect.cpp
@@ -99,8 +99,8 @@ ProfileSelect::ProfileSelect(QWidget *parent) :
// if (GIT_BRANCH!="master")
// ui->labelBuild->setText(GIT_BRANCH);
// else ui->labelBuild->setText(QString());
- ui->labelFolder->setText(GetAppRoot());
- ui->labelFolder->setToolTip("Current OSCAR data folder\n" + GetAppRoot());
+ ui->labelFolder->setText(GetAppData());
+ ui->labelFolder->setToolTip("Current OSCAR data folder\n" + GetAppData());
ui->listView->verticalScrollBar()->setStyleSheet("QScrollBar:vertical {border: 0px solid grey; background: transparent; }"
"QScrollBar::handle:vertical {"
@@ -208,7 +208,7 @@ void ProfileSelect::deleteProfile()
// if (!profile->Load()) {
// QMessageBox::warning(this, STR_MessageBox_Error,
// QString(tr("Could not open profile.. You will need to delete this profile directory manually")+
-// "\n\n"+tr("You will find it under the following location:")+"\n\n%1").arg(QDir::toNativeSeparators(GetAppRoot() + "/Profiles/" + profile->user->userName())), QMessageBox::Ok);
+// "\n\n"+tr("You will find it under the following location:")+"\n\n%1").arg(QDir::toNativeSeparators(GetAppData() + "/Profiles/" + profile->user->userName())), QMessageBox::Ok);
// return;
// }
bool reallydelete = false;