Commit 8de914ab authored by Leander Schulten's avatar Leander Schulten
Browse files

Update Settings

set dmx data to 0 when starting
make security copy of settings
parent 0fddc984
......@@ -48,6 +48,17 @@ Pane{
}
}
}
Label{
text: "Update pause for dmx in ms:"
}
TextInputField{
validator: IntValidator{
bottom: 10
top: 10000
}
text: Settings.updatePauseInMs;
onAccepted: Settings.updatePauseInMs = text;
}
}
FileDialog{
property var callback;
......
......@@ -5,6 +5,7 @@
#include "programm.h"
#include "dmxchannelfilter.h"
#include <QDir>
#include <cstring>
HardwareInterface * driver = nullptr;
......@@ -35,6 +36,7 @@ namespace Driver {
ErrorNotifier::get()->newError(s);
});
inter->setSetValuesCallback([](unsigned char* values, int size, double time){
std::memset(values,0,size);
DMXChannelFilter::initValues(values,size);
Programm::fill(values,size,time);
DMXChannelFilter::filterValues(values,size);
......
......@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
Settings settings;
settings.setJsonSettingsFilePath("QTJSONFile.json");
QFile file(settings.getJsonSettingsFilePath());
file.copy(settings.getJsonSettingsFilePath()+"_"+QDateTime::currentDateTime().toString("dd.MM.YYYY HH:mm:ss"));
#warning Dont use IDBase<xxxxx>::getAllIDBases() in this file. It will crash the aplication when its closing
......@@ -108,6 +108,11 @@ int main(int argc, char *argv[])
settings.connect(&settings,&Settings::driverFilePathChanged,[&](){
Driver::loadAndStartDriver(settings.getDriverFilePath());
});
settings.connect(&settings,&Settings::updatePauseInMsChanged,[&](){
if(Driver::getCurrentDriver()){
Driver::getCurrentDriver()->setWaitTime(std::chrono::milliseconds(settings.getUpdatePauseInMs()));
}
});
engine.rootContext()->setContextProperty("ModelManager",new ModelManager());
......@@ -129,7 +134,7 @@ int main(int argc, char *argv[])
// Treiber laden
#define USE_DUMMY_DRIVER
//#define USE_DUMMY_DRIVER
#ifndef USE_DUMMY_DRIVER
if(!Driver::loadAndStartDriver(settings.getDriverFilePath())){
ErrorNotifier::showError("Cant start driver.");
......
......@@ -11,15 +11,19 @@ class Settings : public QObject
QSettings settings;
Q_PROPERTY(QString jsonSettingsFilePath READ getJsonSettingsFilePath WRITE setJsonSettingsFilePath NOTIFY jsonSettingsFilePathChanged)
Q_PROPERTY(QString driverFilePath READ getDriverFilePath WRITE setDriverFilePath NOTIFY driverFilePathChanged)
Q_PROPERTY(unsigned int updatePauseInMs READ getUpdatePauseInMs WRITE setUpdatePauseInMs NOTIFY updatePauseInMsChanged)
public:
explicit Settings(QObject *parent = nullptr);
void setJsonSettingsFilePath(QString file){if(!QFile::exists(file))return;settings.setValue("jsonSettingsFilePath",file);emit jsonSettingsFilePathChanged();}
QString getJsonSettingsFilePath()const{return settings.value("jsonSettingsFilePath").toString();}
void setDriverFilePath(QString file){if(!QFile::exists(file))return;settings.setValue("driverFilePath",file);emit driverFilePathChanged();}
QString getDriverFilePath()const{return settings.value("driverFilePath").toString();}
void setUpdatePauseInMs(unsigned int pause){settings.setValue("driverFilePath",pause);emit updatePauseInMsChanged();}
unsigned int getUpdatePauseInMs()const{return settings.value("driverFilePath").toUInt();}
signals:
void jsonSettingsFilePathChanged();
void driverFilePathChanged();
void updatePauseInMsChanged();
public slots:
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment