mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-06 06:53:37 +00:00
More intuitive handling of calibration measurements
- Allow saving of calibration only if a calibration is active (no more calibration files that "don't do anything" when they are opened) - Delete old measurements when loading a new calibration file - Update calibration when a measurement is updated (no need to disable and enable again) - Disable calibration when a required measurement is deleted
This commit is contained in:
parent
3f66bdda48
commit
0d6e844def
12 changed files with 149 additions and 88 deletions
43
Software/PC_Application/CustomWidgets/informationbox.cpp
Normal file
43
Software/PC_Application/CustomWidgets/informationbox.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include "informationbox.h"
|
||||
#include <QCheckBox>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
|
||||
void InformationBox::ShowMessage(QString title, QString message, QWidget *parent)
|
||||
{
|
||||
// check if the user still wants to see this message
|
||||
auto hash = qHash(message);
|
||||
|
||||
QSettings s;
|
||||
if(!s.contains(hashToSettingsKey(hash))) {
|
||||
auto box = new InformationBox(title, message, hash, parent);
|
||||
box->exec();
|
||||
}
|
||||
}
|
||||
|
||||
InformationBox::InformationBox(QString title, QString message, unsigned int hash, QWidget *parent)
|
||||
: QMessageBox(parent),
|
||||
hash(hash)
|
||||
{
|
||||
setWindowTitle(title);
|
||||
setText(message);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setIcon(QMessageBox::Information);
|
||||
|
||||
auto cb = new QCheckBox("Do not show this message again");
|
||||
setCheckBox(cb);
|
||||
}
|
||||
|
||||
InformationBox::~InformationBox()
|
||||
{
|
||||
auto cb = checkBox();
|
||||
if(cb->isChecked()) {
|
||||
QSettings s;
|
||||
s.setValue(hashToSettingsKey(hash), true);
|
||||
}
|
||||
}
|
||||
|
||||
QString InformationBox::hashToSettingsKey(unsigned int hash)
|
||||
{
|
||||
return QString("DoNotShowDialog/") + QString::number(hash);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue