mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Change Settings/AppRoot to Settings/AppData to reduce confusion between execuable path and data folder path
This commit is contained in:
parent
691ff40d48
commit
9c3091b1c0
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -39,7 +39,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
||||
// +tr("Graphics Engine: %1").arg(getGraphicsEngine());
|
||||
// }
|
||||
|
||||
QString path = GetAppRoot();
|
||||
QString path = GetAppData();
|
||||
QString text = /* gitrev + */ "<br/><br/><a href=\"file:///"+path+"\">"+tr("Show data folder")+"</a>";
|
||||
ui->infoLabel->setText(text);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user