Adds q2 repos to migrate
This commit is contained in:
1 parent
ad1f62c4ee
commit
17f1c61c9e
991 files changed
+178451
No files matched your search
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# CMake Script für nglsettings
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
SET(nglsettings_SRCS
|
||||
nglsettings_connections.cpp
|
||||
nglsettings_settings.cpp
|
||||
)
|
||||
|
||||
SET(nglsettings_HDRS
|
||||
nglsettings_connections.h
|
||||
nglsettings_export.h
|
||||
nglsettings_settings.h
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(ALL nglsettings SHARED ${nglsettings_SRCS} ${nglsettings_HDRS})
|
||||
NGL_TARGET_LINK_LIBRARIES(nglsettings
|
||||
PRIVATE
|
||||
ngltools
|
||||
Qt5::Network
|
||||
PUBLIC
|
||||
Qt5::Core
|
||||
)
|
||||
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(nglsettings
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
NGL_INSTALL_TARGET(nglsettings)
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
|
||||
|
||||
#include "nglsettings_connections.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QMap>
|
||||
#include <QPair>
|
||||
#include <QSettings>
|
||||
#include <QtNetwork/QHostAddress>
|
||||
#include <QtNetwork/QHostInfo>
|
||||
#include <QtNetwork/QNetworkInterface>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
namespace Connections
|
||||
{
|
||||
enum class eHostConfig
|
||||
{
|
||||
public_local,
|
||||
localhost,
|
||||
server,
|
||||
server_avs
|
||||
};
|
||||
struct configStruct
|
||||
{
|
||||
eHostConfig host;
|
||||
unsigned short port;
|
||||
QString name;
|
||||
};
|
||||
|
||||
static QMap<eConnection, configStruct> *s_config = nullptr;
|
||||
static QSettings *s_settings = nullptr;
|
||||
static unsigned short s_portOffset = 9000;
|
||||
static QString *s_serverHostname = nullptr;
|
||||
|
||||
static void cleanupSettings()
|
||||
{
|
||||
delete s_settings;
|
||||
s_settings = nullptr;
|
||||
delete s_serverHostname;
|
||||
s_serverHostname = nullptr;
|
||||
delete s_config;
|
||||
s_config = nullptr;
|
||||
}
|
||||
|
||||
static void insertConfig(eConnection conn, eHostConfig host, unsigned short port, const char *name)
|
||||
{
|
||||
if (!s_config)
|
||||
s_config = new QMap<eConnection, configStruct>();
|
||||
configStruct s;
|
||||
s.host = host;
|
||||
s.port = port;
|
||||
s.name = QString::fromLatin1(name);
|
||||
s_config->insert(conn, s);
|
||||
}
|
||||
|
||||
static void initConfig()
|
||||
{
|
||||
if (s_config && !s_config->isEmpty())
|
||||
return;
|
||||
|
||||
insertConfig(eConnection::AVS_WORKSTATION, eHostConfig::localhost, 6370, "AVS_WORKSTATION");
|
||||
insertConfig(eConnection::AVS_WORKSTATION_VD, eHostConfig::localhost, 6380, "AVS_WORKSTATION_VD");
|
||||
insertConfig(eConnection::AVS_ROOT, eHostConfig::server_avs, 6350, "AVS_ROOT");
|
||||
insertConfig(eConnection::AVS_FM, eHostConfig::server_avs, 6360, "AVS_FM");
|
||||
insertConfig(eConnection::AVS_MOTION_RECORDER, eHostConfig::server_avs, 6390, "AVS_MOTION_RECORDER");
|
||||
insertConfig(eConnection::AVS_AVA, eHostConfig::server_avs, 6391, "AVS_AVA");
|
||||
|
||||
insertConfig(eConnection::PWS_WEBSOCKET, eHostConfig::server, 5701, "PWS_WEBSOCKET");
|
||||
insertConfig(eConnection::SCM_WEBSOCKET, eHostConfig::server, 7300, "SCM_WEBSOCKET");
|
||||
insertConfig(eConnection::ISM_WEBSOCKET, eHostConfig::server, 2080, "ISM_WEBSOCKET");
|
||||
insertConfig(eConnection::FLM_THP_SERVER, eHostConfig::server, 2090, "FLM_THP_SERVER");
|
||||
insertConfig(eConnection::FLM_PDF_SERVER, eHostConfig::server, 3000, "FLM_PDF_SERVER");
|
||||
|
||||
insertConfig(eConnection::LVS, eHostConfig::server, 94, "LVS");
|
||||
insertConfig(eConnection::ZWLVSV, eHostConfig::server, 95, "ZWLVSV");
|
||||
insertConfig(eConnection::ZWLVWCS, eHostConfig::server, 97, "ZWLVWCS");
|
||||
insertConfig(eConnection::ZWLVWMS, eHostConfig::server, 98, "ZWLVWMS");
|
||||
insertConfig(eConnection::ZSLV, eHostConfig::server, 99, "ZSLV");
|
||||
}
|
||||
|
||||
void setIniFile(const QString &iniFileName)
|
||||
{
|
||||
if (!s_settings)
|
||||
qAddPostRoutine(cleanupSettings);
|
||||
delete s_settings;
|
||||
s_settings = new QSettings(iniFileName, QSettings::IniFormat);
|
||||
}
|
||||
|
||||
QString iniFile()
|
||||
{
|
||||
return s_settings ? s_settings->fileName() : QString();
|
||||
}
|
||||
|
||||
unsigned short portOffset()
|
||||
{
|
||||
return s_portOffset;
|
||||
}
|
||||
|
||||
void setPortOffset(unsigned short portOffset)
|
||||
{
|
||||
s_portOffset = portOffset;
|
||||
}
|
||||
|
||||
unsigned short port(eConnection connection)
|
||||
{
|
||||
initConfig();
|
||||
unsigned short port = s_config->value(connection).port;
|
||||
|
||||
if (s_settings)
|
||||
{
|
||||
bool bOk;
|
||||
QString key = s_config->value(connection).name + QLatin1String("/port");
|
||||
unsigned short port2 = s_settings->value(key, port).toString().toUShort(&bOk);
|
||||
if (bOk)
|
||||
port = port2;
|
||||
}
|
||||
if (port < 100)
|
||||
return portOffset() + port;
|
||||
return port;
|
||||
}
|
||||
|
||||
QString hostName(eConnection connection)
|
||||
{
|
||||
initConfig();
|
||||
|
||||
QString host;
|
||||
switch (s_config->value(connection).host)
|
||||
{
|
||||
case eHostConfig::public_local:
|
||||
host = QString::fromLocal8Bit(qgetenv("HOST"));
|
||||
break;
|
||||
case eHostConfig::localhost:
|
||||
host = QLatin1String("127.0.0.1");
|
||||
break;
|
||||
case eHostConfig::server:
|
||||
if (s_serverHostname)
|
||||
host = *s_serverHostname;
|
||||
if (host.isEmpty())
|
||||
host = QLatin1String("EXCTDS01");
|
||||
break;
|
||||
case eHostConfig::server_avs:
|
||||
host = QStringLiteral("EXCAVS01");
|
||||
break;
|
||||
}
|
||||
if (s_settings)
|
||||
{
|
||||
QString key = s_config->value(connection).name + QLatin1String("/host");
|
||||
QString host2 = s_settings->value(key, host).toString();
|
||||
if (!host2.isEmpty())
|
||||
host = host2;
|
||||
}
|
||||
return host;
|
||||
}
|
||||
|
||||
void setServerHostname(const QString &serverHostName)
|
||||
{
|
||||
if (!s_serverHostname)
|
||||
s_serverHostname = new QString(serverHostName);
|
||||
else
|
||||
*s_serverHostname = serverHostName;
|
||||
}
|
||||
|
||||
QString connectionName(eConnection connection)
|
||||
{
|
||||
if (s_config)
|
||||
{
|
||||
auto it = s_config->constFind(connection);
|
||||
if (it != s_config->constEnd())
|
||||
return it.value().name;
|
||||
}
|
||||
return QString::number((int)connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include "nglsettings_export.h"
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
|
||||
|
||||
namespace Connections
|
||||
{
|
||||
|
||||
|
||||
enum class eConnection
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
AVS_WORKSTATION,
|
||||
AVS_WORKSTATION_VD,
|
||||
AVS_ROOT,
|
||||
AVS_FM,
|
||||
AVS_MOTION_RECORDER,
|
||||
AVS_AVA,
|
||||
ZWLVSV,
|
||||
ZSLV,
|
||||
ZWLVWCS,
|
||||
ZWLVWMS,
|
||||
PWS_WEBSOCKET,
|
||||
SCM_WEBSOCKET,
|
||||
ISM_WEBSOCKET,
|
||||
FLM_THP_SERVER,
|
||||
FLM_PDF_SERVER,
|
||||
LVS ,
|
||||
};
|
||||
|
||||
|
||||
|
||||
NGLSETTINGS_EXPORT void setIniFile(const QString &iniFileName);
|
||||
|
||||
|
||||
NGLSETTINGS_EXPORT QString iniFile();
|
||||
|
||||
|
||||
|
||||
NGLSETTINGS_EXPORT unsigned short portOffset();
|
||||
void setPortOffset(unsigned short portOffset);
|
||||
|
||||
|
||||
NGLSETTINGS_EXPORT unsigned short port(eConnection connection);
|
||||
|
||||
|
||||
NGLSETTINGS_EXPORT QString hostName(eConnection connection);
|
||||
void setServerHostname(const QString &serverHostName);
|
||||
|
||||
|
||||
NGLSETTINGS_EXPORT QString connectionName(eConnection connection);
|
||||
}
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef NGLSETTINGS_EXPORT
|
||||
# ifdef BUILD_STATIC_LIBRARIES
|
||||
# define NGLSETTINGS_EXPORT
|
||||
# else
|
||||
# ifdef MAKE_NGLSETTINGS_LIB
|
||||
# define NGLSETTINGS_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define NGLSETTINGS_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
Executable
+320
@@ -0,0 +1,320 @@
|
||||
|
||||
|
||||
#include "nglsettings_settings.h"
|
||||
#include "nglsettings_connections.h"
|
||||
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QSize>
|
||||
#include <QStandardPaths>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
QSettings *Settings::s_globalSettings = nullptr;
|
||||
|
||||
Settings::Settings(const QString &iniFile_)
|
||||
: m_settings(nullptr)
|
||||
{
|
||||
QString iniFile = iniFile_;
|
||||
if(iniFile == QLatin1String("gfs_ws.ini")) {
|
||||
const QByteArray defUser = qgetenv("USER");
|
||||
if( defUser == "ctc_aar" || defUser == "ctc_rbf" ) {
|
||||
QByteArray home = qgetenv("HOME");
|
||||
if(!home.isEmpty()) {
|
||||
QString fn = QString::fromLocal8Bit(home) +
|
||||
QLatin1String("/gfs_") +
|
||||
QString::fromLocal8Bit(defUser.mid(4)) +
|
||||
QLatin1String(".ini");
|
||||
QFileInfo fi(fn);
|
||||
if(fi.exists() && fi.isFile() && fi.isReadable()) {
|
||||
iniFile = fn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initializeGlobalSettings();
|
||||
|
||||
initPre();
|
||||
if(!iniFile.isEmpty()) {
|
||||
if(QFileInfo(iniFile).isAbsolute())
|
||||
m_settings = new QSettings(iniFile, QSettings::IniFormat);
|
||||
else
|
||||
m_settings = new QSettings(basePath() + iniFile, QSettings::IniFormat);
|
||||
initPost();
|
||||
}
|
||||
|
||||
if (!m_settings)
|
||||
m_settings = new QSettings(QLatin1String("RDE"));
|
||||
}
|
||||
|
||||
Settings::Settings(const QString &organization, const QString &application)
|
||||
: m_settings(new QSettings(organization, application))
|
||||
{
|
||||
initPre();
|
||||
initPost();
|
||||
}
|
||||
|
||||
Settings::~Settings()
|
||||
{
|
||||
delete m_settings;
|
||||
}
|
||||
|
||||
void Settings::initializeGlobalSettings()
|
||||
{
|
||||
if (s_globalSettings)
|
||||
return;
|
||||
|
||||
if (!s_globalSettings)
|
||||
{
|
||||
QString globalSettingsFile = NGL::findProjectConfigFile();
|
||||
|
||||
|
||||
if (!globalSettingsFile.isEmpty())
|
||||
s_globalSettings = new QSettings(globalSettingsFile, QSettings::IniFormat);
|
||||
}
|
||||
if (!s_globalSettings)
|
||||
s_globalSettings = new QSettings(QLatin1String("RDE"), QLatin1String("LTS-CC"));
|
||||
Connections::setPortOffset(portOffset());
|
||||
Connections::setServerHostname(serverHostname());
|
||||
}
|
||||
|
||||
QString Settings::globalSectionName()
|
||||
{
|
||||
QString secName = QLatin1String("Global");
|
||||
static const char envGlobSecName[] = "LTS_CONF_GLOBAL_SECTION_NAME";
|
||||
if (qEnvironmentVariableIsSet(envGlobSecName))
|
||||
secName = QString::fromLocal8Bit(qgetenv(envGlobSecName));
|
||||
|
||||
return secName;
|
||||
}
|
||||
|
||||
QString Settings::basePath() const
|
||||
{
|
||||
return m_paths["GFS_PATH"];
|
||||
}
|
||||
|
||||
QString Settings::tempPath() const
|
||||
{
|
||||
return m_paths["TMP_PATH"];
|
||||
}
|
||||
|
||||
QString Settings::printPath()
|
||||
{
|
||||
return getDirectory("PDF", tempPath());
|
||||
}
|
||||
|
||||
QString Settings::logoProject()
|
||||
{
|
||||
return QLatin1String(":project/logo.png");
|
||||
}
|
||||
|
||||
QString Settings::bitmapPath()
|
||||
{
|
||||
return getDirectory("BITMAPS", basePath() + QLatin1String("DATA"));
|
||||
}
|
||||
|
||||
QString Settings::zsks_rxPath()
|
||||
{
|
||||
return getDirectory("ZSKS_RX", tempPath());
|
||||
}
|
||||
|
||||
QString Settings::zsks_txPath()
|
||||
{
|
||||
return getDirectory("ZSKS_TX", tempPath());
|
||||
}
|
||||
|
||||
QString Settings::aarServerPath(int exerciseId)
|
||||
{
|
||||
return getDirectory(QByteArray::number(exerciseId), QString::fromLocal8Bit("/data/aar/"));
|
||||
}
|
||||
|
||||
bool Settings::isDatabaseConnectionLocal()
|
||||
{
|
||||
return (databaseHostname() == QStringLiteral("localhost"));
|
||||
}
|
||||
|
||||
QString Settings::databaseName()
|
||||
{
|
||||
initializeGlobalSettings();
|
||||
|
||||
return s_globalSettings->value(globalSectionName()+ QLatin1String("/DatabaseName"), QLatin1String("lts_ets_pro")).toString();
|
||||
}
|
||||
|
||||
QString Settings::databaseHostname()
|
||||
{
|
||||
initializeGlobalSettings();
|
||||
return s_globalSettings->value(QLatin1String("Global/DatabaseHostname"), QLatin1String("EXCDBS01")).toString();
|
||||
}
|
||||
|
||||
QString Settings::databaseUser()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QByteArray defUser = qgetenv("USERNAME");
|
||||
#else
|
||||
QByteArray defUser = qgetenv("USER");
|
||||
#endif
|
||||
QString ret = m_settings->value(QLatin1String("db/user"), QString::fromLocal8Bit(defUser)).toString();
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString Settings::databasePassword(const QString &databaseUser)
|
||||
{
|
||||
QString defaultPw = QStringLiteral("ctc11de");
|
||||
if (!databaseUser.isEmpty())
|
||||
{
|
||||
const QVector<QStringRef> &sl = databaseUser.splitRef(QLatin1Char('_'));
|
||||
if (sl.size() > 1)
|
||||
defaultPw = sl.at(0).toString() + QStringLiteral("11de");
|
||||
}
|
||||
return m_settings->value(QLatin1String("db/passwd"), defaultPw).toString();
|
||||
}
|
||||
|
||||
QString Settings::databaseDriver()
|
||||
{
|
||||
return m_settings->value(QLatin1String("db/driver"), QLatin1String("QPSQL")).toString();
|
||||
}
|
||||
|
||||
int Settings::avsKeepAliveTimeout()
|
||||
{
|
||||
return m_settings->value(QLatin1String("avs/keepalivetimeout"), 20000).toInt();
|
||||
}
|
||||
|
||||
QString Settings::avsServerHost()
|
||||
{
|
||||
return m_settings->value(QLatin1String("avs/serverhost"), QLatin1String("EXCAVS01")).toString();
|
||||
}
|
||||
|
||||
quint16 Settings::avsServerPortAVE()
|
||||
{
|
||||
static const quint16 defaultPort = 6350;
|
||||
bool bOk;
|
||||
quint16 ret = m_settings->value(QLatin1String("avs/serverport_ave"), defaultPort).toUInt(&bOk);
|
||||
return bOk ? ret : defaultPort;
|
||||
}
|
||||
|
||||
QSettings *Settings::settings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
const QSettings *Settings::settings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
QString Settings::fixupPath(const QString &_path) const
|
||||
{
|
||||
QString path = QDir::fromNativeSeparators(_path);
|
||||
if(!QDir::isAbsolutePath(path))
|
||||
path = basePath() + path;
|
||||
path = QDir::cleanPath(path);
|
||||
if(!path.endsWith(QLatin1Char('/')))
|
||||
path += QLatin1Char('/');
|
||||
return path;
|
||||
}
|
||||
|
||||
QString Settings::getDirectory(const QByteArray &_dir, const QString &defPrefix, bool bPathLowercase)
|
||||
{
|
||||
if(m_paths[_dir].isEmpty()) {
|
||||
const QString lowerDir = QString::fromLatin1(_dir.toLower());
|
||||
const QString dir = bPathLowercase ? lowerDir : QString::fromLatin1(_dir);
|
||||
QString def = defPrefix + QLatin1Char('/') + dir + QLatin1Char('/');
|
||||
m_paths[_dir] = fixupPath(m_settings->value(QLatin1String("paths/") + lowerDir, def).toString());
|
||||
QDir d(m_paths[_dir]);
|
||||
if(!d.exists())
|
||||
d.mkpath(d.absolutePath());
|
||||
}
|
||||
return m_paths[_dir];
|
||||
}
|
||||
|
||||
void Settings::initPre()
|
||||
{
|
||||
#ifdef WIN32
|
||||
QString path = QString::fromLocal8Bit(qgetenv("GFS_PATH"));
|
||||
if(path.isEmpty())
|
||||
path = QCoreApplication::applicationDirPath();
|
||||
m_paths["GFS_PATH"] = fixupPath(path);
|
||||
#else
|
||||
QByteArray path = qgetenv("GFS_PATH");
|
||||
if(path.isEmpty())
|
||||
path = qgetenv("HOME");
|
||||
m_paths["GFS_PATH"] = fixupPath(QString::fromLocal8Bit(path));
|
||||
#endif
|
||||
|
||||
QByteArray tmppath = qgetenv("TMP_PATH");
|
||||
if(tmppath.isEmpty())
|
||||
tmppath = qgetenv("TMP");
|
||||
if (tmppath.isEmpty())
|
||||
tmppath = QDir::tempPath().toLocal8Bit();
|
||||
m_paths["TMP_PATH"] = fixupPath(QString::fromLocal8Bit(tmppath));
|
||||
}
|
||||
|
||||
void Settings::initPost()
|
||||
{
|
||||
NGL::Connections::setIniFile(m_settings->fileName());
|
||||
}
|
||||
|
||||
int Settings::getInteger(const QString &key, int defVal) const
|
||||
{
|
||||
bool bOk;
|
||||
int ret = m_settings->value(key, defVal).toInt(&bOk);
|
||||
return bOk ? ret : defVal;
|
||||
}
|
||||
|
||||
float Settings::getFloat(const QString &key, float defVal) const
|
||||
{
|
||||
bool bOk;
|
||||
float ret = m_settings->value(key, defVal).toFloat(&bOk);
|
||||
return bOk ? ret : defVal;
|
||||
}
|
||||
|
||||
double Settings::getDouble(const QString &key, double defVal) const
|
||||
{
|
||||
bool bOk;
|
||||
double ret = m_settings->value(key, defVal).toDouble(&bOk);
|
||||
return bOk ? ret : defVal;
|
||||
}
|
||||
|
||||
bool Settings::getBoolean(const QString &key, bool defVal) const
|
||||
{
|
||||
return m_settings->value(key, defVal).toBool();
|
||||
}
|
||||
|
||||
QString Settings::getString(const QString &key, const QString &defVal) const
|
||||
{
|
||||
return m_settings->value(key, defVal).toString();
|
||||
}
|
||||
|
||||
unsigned short Settings::domainId()
|
||||
{
|
||||
initializeGlobalSettings();
|
||||
return s_globalSettings->value(QLatin1String("Global/DomainId"), 0).toUInt();
|
||||
}
|
||||
|
||||
unsigned short Settings::portOffset()
|
||||
{
|
||||
initializeGlobalSettings();
|
||||
return s_globalSettings->value(QLatin1String("Global/PortOffset"), 9000).toUInt();
|
||||
}
|
||||
|
||||
QString Settings::serverHostname()
|
||||
{
|
||||
initializeGlobalSettings();
|
||||
return s_globalSettings->value(QLatin1String("Global/ServerHostname"), QLatin1String("EXCTDS01")).toString();
|
||||
}
|
||||
|
||||
QString Settings::logPath()
|
||||
{
|
||||
initializeGlobalSettings();
|
||||
#ifdef WIN32
|
||||
return s_globalSettings->value(QLatin1String("Global/LogPath"), QStandardPaths::writableLocation(QStandardPaths::TempLocation)).toString();
|
||||
#else
|
||||
return s_globalSettings->value(QLatin1String("Global/LogPath"), QLatin1String("/shd/CTC/LOG")).toString();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+142
@@ -0,0 +1,142 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QHash>
|
||||
#include "nglsettings_export.h"
|
||||
|
||||
class QSettings;
|
||||
|
||||
namespace NGL {
|
||||
|
||||
|
||||
class NGLSETTINGS_EXPORT Settings {
|
||||
public:
|
||||
|
||||
|
||||
explicit Settings(const QString &iniFile);
|
||||
|
||||
|
||||
|
||||
explicit Settings(const QString &organization, const QString &application);
|
||||
|
||||
Settings(const Settings&) = delete;
|
||||
Settings &operator=(const Settings&) = delete;
|
||||
|
||||
|
||||
|
||||
virtual ~Settings();
|
||||
|
||||
|
||||
static void initializeGlobalSettings();
|
||||
|
||||
|
||||
QString basePath() const;
|
||||
|
||||
QString tempPath() const;
|
||||
|
||||
QString printPath();
|
||||
|
||||
QString logoProject();
|
||||
|
||||
QString bitmapPath();
|
||||
|
||||
|
||||
|
||||
QString zsks_rxPath();
|
||||
|
||||
QString zsks_txPath();
|
||||
|
||||
|
||||
|
||||
static QString databaseName();
|
||||
|
||||
static QString databaseHostname();
|
||||
|
||||
QString databaseUser();
|
||||
|
||||
QString databasePassword(const QString &databaseUser = QString());
|
||||
|
||||
QString databaseDriver();
|
||||
|
||||
|
||||
|
||||
QString aarServerPath(int exerciseId);
|
||||
bool isDatabaseConnectionLocal();
|
||||
|
||||
|
||||
int avsKeepAliveTimeout();
|
||||
QString avsServerHost();
|
||||
quint16 avsServerPortAVE();
|
||||
|
||||
|
||||
QSettings *settings();
|
||||
|
||||
const QSettings *settings() const;
|
||||
|
||||
|
||||
int getInteger(const QString &key, int defVal) const;
|
||||
|
||||
|
||||
int getInteger(const QString &group, const QString &key, int defVal) const
|
||||
{
|
||||
return getInteger(group + QLatin1Char('/') + key, defVal);
|
||||
}
|
||||
|
||||
|
||||
float getFloat(const QString &key, float defVal) const;
|
||||
|
||||
|
||||
float getFloat(const QString &group, const QString &key, float defVal) const
|
||||
{
|
||||
return getFloat(group + QLatin1Char('/') + key, defVal);
|
||||
}
|
||||
|
||||
|
||||
double getDouble(const QString &key, double defVal) const;
|
||||
|
||||
|
||||
double getDouble(const QString &group, const QString &key, double defVal) const
|
||||
{
|
||||
return getDouble(group + QLatin1Char('/') + key, defVal);
|
||||
}
|
||||
|
||||
|
||||
bool getBoolean(const QString &key, bool defVal) const;
|
||||
|
||||
|
||||
bool getBoolean(const QString &group, const QString &key, bool defVal) const
|
||||
{
|
||||
return getBoolean(group + QLatin1Char('/') + key, defVal);
|
||||
}
|
||||
|
||||
|
||||
QString getString(const QString &key, const QString &defVal) const;
|
||||
|
||||
|
||||
QString getString(const QString &group, const QString &key, const QString &defVal) const
|
||||
{
|
||||
return getString(group + QLatin1Char('/') + key, defVal);
|
||||
}
|
||||
|
||||
static unsigned short portOffset();
|
||||
static unsigned short domainId();
|
||||
static QString serverHostname();
|
||||
static QString logPath();
|
||||
static QString globalSectionName();
|
||||
|
||||
private:
|
||||
|
||||
QString fixupPath(const QString &path) const;
|
||||
|
||||
|
||||
QString getDirectory(const QByteArray &dir, const QString &defPrefix, bool bPathLowercase = false);
|
||||
private:
|
||||
void initPre();
|
||||
void initPost();
|
||||
QSettings *m_settings;
|
||||
static QSettings *s_globalSettings;
|
||||
QHash<QByteArray, QString> m_paths;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user