Commit 6e6e4139 authored by Leander Schulten's avatar Leander Schulten
Browse files

Added possibility to save with control + S

parent 76261c62
......@@ -188,7 +188,7 @@ int main(int argc, char *argv[])
});
engine.rootContext()->setContextProperty("ModelManager",new ModelManager());
engine.rootContext()->setContextProperty("ModelManager",new ModelManager(settings));
engine.rootContext()->setContextProperty("easingModel",dataList);
engine.rootContext()->setContextProperty("ErrorNotifier",ErrorNotifier::get());
engine.setObjectOwnership(ErrorNotifier::get(),QQmlEngine::CppOwnership);
......
......@@ -16,6 +16,16 @@ ApplicationWindow {
Item{
anchors.fill: parent
id: root
Shortcut{
sequence: StandardKey.Save
autoRepeat: false
onActivated: {
ModelManager.save()
root.ToolTip.show("Data Saved",1500)
}
}
VerticalTabBar{
id: tabBar
......
#ifndef MODELMANAGER_H
#define MODELMANAGER_H
#include <QObject>
#include "applicationdata.h"
#include "device.h"
#include "programmprototype.h"
#include "programm.h"
#include "programmprototype.h"
#include "programms/modulemanager.h"
#include "settings.h"
#include <QObject>
class ModelManager : public QObject{
Q_OBJECT
Settings & settings;
public:
explicit ModelManager(Settings & settings):settings(settings){}
Q_INVOKABLE void remove(QObject * item){
if(item)
delete item;
......@@ -72,6 +77,16 @@ public:
vec.erase(index);
}
}
/**
* @brief saves the application data
*/
Q_INVOKABLE void save(){
QFile savePath(settings.getJsonSettingsFilePath());
if(savePath.exists()){
savePath.copy(savePath.fileName()+"_"+QDateTime::currentDateTime().toString(QStringLiteral("dd.MM.yyyy HH.mm.ss")));
}
ApplicationData::saveData(savePath);
}
};
......
Supports Markdown
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