Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+112
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* Settings for ExerciseManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
|
||||
#include "LtsUtilsCore/lts_portrange.h"
|
||||
|
||||
namespace ExerciseManagement
|
||||
{
|
||||
class NGLSettingsClass : public NGL::Settings
|
||||
{
|
||||
public:
|
||||
NGLSettingsClass()
|
||||
: NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile)
|
||||
{}
|
||||
static void setIniFile(const QString &fn)
|
||||
{
|
||||
s_iniFile = fn;
|
||||
}
|
||||
static QString s_iniFile;
|
||||
};
|
||||
QString NGLSettingsClass::s_iniFile;
|
||||
Q_GLOBAL_STATIC(NGLSettingsClass, s)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
NGL::Settings *Settings::settings()
|
||||
{
|
||||
return s();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Settings::setIniFile(const QString &ini)
|
||||
{
|
||||
NGLSettingsClass::setIniFile(ini);
|
||||
}
|
||||
|
||||
int Settings::maxStartedExercises()
|
||||
{
|
||||
int ret = s()->settings()->value(QStringLiteral("ExerciseManagement/maxStartedExercises"), -1).toInt();
|
||||
if (ret < 1)
|
||||
ret = 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Settings::maxPreparedExercises()
|
||||
{
|
||||
int ret = s()->settings()->value(QStringLiteral("ExerciseManagement/maxPreparedExercises"), -1).toInt();
|
||||
if (ret < 1)
|
||||
ret = 4;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Settings::maxStoppedExercises()
|
||||
{
|
||||
int ret = s()->settings()->value(QStringLiteral("ExerciseManagement/maxStoppedExercises"), -1).toInt();
|
||||
if (ret < 1)
|
||||
ret = 5;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Settings::maxHlaExercises()
|
||||
{
|
||||
int ret = s()->settings()->value(QStringLiteral("ExerciseManagement/maxHlaExercises"), -1).toInt();
|
||||
if (ret < 1)
|
||||
ret = 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Settings::enableExerciseTerminatedToStopped()
|
||||
{
|
||||
bool ret = s()->settings()->value(QStringLiteral("ExerciseManagement/enableExerciseTerminatedToStopped"), 0).toBool();
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString Settings::serverDatabaseHost()
|
||||
{
|
||||
return s()->databaseHostname();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString Settings::serverDatabaseName()
|
||||
{
|
||||
return s()->databaseName();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString Settings::evaluationDatabaseHost()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("EvaluationDb/DatabaseHostname"), QStringLiteral("EXCADB01")).toString();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString Settings::evaluationDatabaseName()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("EvaluationDb/DatabaseName"), QStringLiteral("dbAdmin")).toString();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QPair<quint16, quint16> Settings::getWebSocketServerPortRange(int type)
|
||||
{
|
||||
return LtsUtils::fromQPoint(settings()->settings()->value(QString(QStringLiteral("ExerciseManagement/webSocketServerPortRange/%1")).arg(type), QPoint()).toPoint());
|
||||
}
|
||||
|
||||
} // namespace ExerciseManagement
|
||||
Reference in new issue
Block a user