add message box on save

This commit is contained in:
2022-04-15 12:13:27 +02:00
parent 09b23fc296
commit a6aad07f05
3 changed files with 15 additions and 3 deletions

View File

@ -168,7 +168,7 @@ bool MainObject::storeJsonObjectToDisk(const QJsonObject& json, QString filePath
file.write(document.toJson()); file.write(document.toJson());
file.close(); file.close();
QFile::remove(filePath); QFile::remove(filePath);
file.rename(filePath); file.rename(filePath);
return true; return true;
} }
} }

View File

@ -4,6 +4,7 @@
#include "itemsettingsdialog.h" #include "itemsettingsdialog.h"
#include "itemcreationdialog.h" #include "itemcreationdialog.h"
#include "../mainobject.h" #include "../mainobject.h"
#include <QMessageBox>
MainWindow::MainWindow(MainObject * const mainObject, QWidget *parent) : MainWindow::MainWindow(MainObject * const mainObject, QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
@ -15,9 +16,14 @@ MainWindow::MainWindow(MainObject * const mainObject, QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
if(!mainObject->master) if(!mainObject->master)
{
connect(ui->pushButton_broadcast, &QPushButton::clicked, this, &MainWindow::sigBrodcast); connect(ui->pushButton_broadcast, &QPushButton::clicked, this, &MainWindow::sigBrodcast);
}
else else
{
connect(ui->pushButton_broadcast, &QPushButton::clicked, this, &MainWindow::sigSave); connect(ui->pushButton_broadcast, &QPushButton::clicked, this, &MainWindow::sigSave);
connect(ui->pushButton_broadcast, &QPushButton::clicked, this, &MainWindow::saved);
}
connect(ui->pushButton_power, SIGNAL(clicked()), this, SLOT(showPowerItemDialog())); connect(ui->pushButton_power, SIGNAL(clicked()), this, SLOT(showPowerItemDialog()));
@ -42,7 +48,7 @@ MainWindow::MainWindow(MainObject * const mainObject, QWidget *parent) :
connect(&globalSensors, &SensorStore::stateChenged, ui->sensorListView, &SensorListWidget::sensorsChanged); connect(&globalSensors, &SensorStore::stateChenged, ui->sensorListView, &SensorListWidget::sensorsChanged);
//RGB Leds //RGB Leds
connect(&colorChooser, SIGNAL(colorSelected(const QColor)), this, SLOT(slotChangedRgb(const QColor))); connect(&colorChooser, SIGNAL(colorSelected(QColor)), this, SLOT(slotChangedRgb(QColor)));
connect(ui->button_quit, SIGNAL(clicked()), this, SLOT(close())); connect(ui->button_quit, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->button_color, SIGNAL(clicked()), &colorChooser, SLOT(show())); connect(ui->button_color, SIGNAL(clicked()), &colorChooser, SLOT(show()));
@ -62,6 +68,11 @@ void MainWindow::showPowerItemDialog()
diag.exec(); diag.exec();
} }
void MainWindow::saved()
{
QMessageBox::information(this, "Saved", "Settings where saved");
}
void MainWindow::slotChangedRgb(const QColor color) void MainWindow::slotChangedRgb(const QColor color)
{ {
_micro->changeRgbColor(color); _micro->changeRgbColor(color);

View File

@ -50,10 +50,11 @@ private slots:
void slotChangedRgb(const QColor color); void slotChangedRgb(const QColor color);
void showPowerItemDialog(); void showPowerItemDialog();
void showItemCreationDialog(); void showItemCreationDialog();
void saved();
public slots: public slots:
void changeHeaderLableText(QString string); void changeHeaderLableText(QString string);
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H