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.close();
QFile::remove(filePath);
file.rename(filePath);
file.rename(filePath);
return true;
}
}

View File

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

View File

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