Load DC-config from '/etc/'

This commit is contained in:
Siegfried Siegert 2024-06-05 14:36:25 +02:00
parent ec7da3cc45
commit 81d1e2984a
Signed by untrusted user: SiegfriedSiegert
GPG Key ID: 68371E015E8F0B03
3 changed files with 27 additions and 14 deletions

12
datei.h
View File

@ -28,13 +28,13 @@
// all generated files located in sudirectory "dynamic machine data - dmd" // all generated files located in sudirectory "dynamic machine data - dmd"
#define FILENAME_COMPORT "../comport.csv" #define FILENAME_COMPORT "../comport.csv"
#define FILENAME_CONFIG "/own/work2023/PSA1256ptu5/smd/DC2C_conf.json" #define FILENAME_APSERVCONF "../APserviceConfig.csv"
#define FILENAME_DEVICE "/own/work2023/PSA1256ptu5/smd/DC2C_device.json"
#define FILENAME_CASH "/own/work2023/PSA1256ptu5/smd/DC2C_cash.json"
#define FILENAME_PRINT "/own/work2023/PSA1256ptu5/smd/DC2C_print32.json"
#define FILENAME_APSERVCONF "../APserviceConfig.csv"
const QString config_path = QStringLiteral("/etc/psa_config/");
const QString filename_config = QStringLiteral("DC2C_conf.json");
const QString filename_device = QStringLiteral("DC2C_device.json");
const QString filename_cash = QStringLiteral("DC2C_cash.json");
const QString filename_print = QStringLiteral("DC2C_print32.json");
// ------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ create csv file ------------------------------- // ------------------------------------------------------ create csv file -------------------------------

View File

@ -109,6 +109,13 @@ T_win13::T_win13(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
myTO->setSingleShot(true); myTO->setSingleShot(true);
myTO->start(2000); myTO->start(2000);
this->config_filename = QString(config_path) + QString(filename_config);
this->device_filename = QString(config_path) + QString(filename_device);
this->cash_filename = QString(config_path) + QString(filename_cash);
this->print_filename = QString(config_path) + QString(filename_print);
} }
T_win13::~T_win13() T_win13::~T_win13()
@ -132,9 +139,9 @@ void T_win13::Nav_next(void)
void T_win13::slot_pb1(void) void T_win13::slot_pb1(void)
{ {
showFile->clear(); showFile->clear();
if (QFileInfo::exists(FILENAME_CONFIG)) if (QFileInfo::exists(this->config_filename))
{ {
loadedFile=datei_readFromFile(FILENAME_CONFIG); loadedFile=datei_readFromFile(this->config_filename);
showFile->append(loadedFile); showFile->append(loadedFile);
} else } else
{ {
@ -145,9 +152,9 @@ void T_win13::slot_pb1(void)
void T_win13::slot_pb2(void) void T_win13::slot_pb2(void)
{ {
showFile->clear(); showFile->clear();
if (QFileInfo::exists(FILENAME_DEVICE)) if (QFileInfo::exists(this->device_filename))
{ {
loadedFile=datei_readFromFile(FILENAME_DEVICE); loadedFile=datei_readFromFile(this->device_filename);
showFile->append(loadedFile); showFile->append(loadedFile);
} else } else
{ {
@ -158,9 +165,9 @@ void T_win13::slot_pb2(void)
void T_win13::slot_pb3(void) void T_win13::slot_pb3(void)
{ {
showFile->clear(); showFile->clear();
if (QFileInfo::exists(FILENAME_CASH)) if (QFileInfo::exists(this->cash_filename))
{ {
loadedFile=datei_readFromFile(FILENAME_CASH); loadedFile=datei_readFromFile(this->cash_filename);
showFile->append(loadedFile); showFile->append(loadedFile);
} else } else
{ {
@ -171,9 +178,9 @@ void T_win13::slot_pb3(void)
void T_win13::slot_pb4(void) void T_win13::slot_pb4(void)
{ {
showFile->clear(); showFile->clear();
if (QFileInfo::exists(FILENAME_PRINT)) if (QFileInfo::exists(this->print_filename))
{ {
loadedFile=datei_readFromFile(FILENAME_PRINT); loadedFile=datei_readFromFile(this->print_filename);
showFile->append(loadedFile); showFile->append(loadedFile);
} else } else
{ {

View File

@ -71,6 +71,12 @@ public slots:
void slot_pb7(void); void slot_pb7(void);
void slot_pb8(void); void slot_pb8(void);
private:
QString config_filename;
QString device_filename;
QString cash_filename;
QString print_filename;
}; };
#endif #endif