Show setup/calibration info in statusbar
This commit is contained in:
parent
fa481e2062
commit
392b06f0eb
@ -127,6 +127,7 @@ VNA::VNA(AppWindow *window)
|
|||||||
connect(saveCal, &QAction::triggered, [=](){
|
connect(saveCal, &QAction::triggered, [=](){
|
||||||
if(cal.saveToFile()) {
|
if(cal.saveToFile()) {
|
||||||
calEdited = false;
|
calEdited = false;
|
||||||
|
UpdateStatusbar();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -431,6 +432,8 @@ VNA::VNA(AppWindow *window)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Calibration connections
|
// Calibration connections
|
||||||
|
connect(this, &VNA::CalibrationApplied, this, &VNA::UpdateStatusbar);
|
||||||
|
connect(this, &VNA::CalibrationDisabled, this, &VNA::UpdateStatusbar);
|
||||||
connect(cbEnableCal, &QCheckBox::stateChanged, calToolbarLambda);
|
connect(cbEnableCal, &QCheckBox::stateChanged, calToolbarLambda);
|
||||||
connect(cbType, qOverload<int>(&QComboBox::currentIndexChanged), calToolbarLambda);
|
connect(cbType, qOverload<int>(&QComboBox::currentIndexChanged), calToolbarLambda);
|
||||||
connect(this, &VNA::CalibrationDisabled, [=](){
|
connect(this, &VNA::CalibrationDisabled, [=](){
|
||||||
@ -1525,3 +1528,17 @@ VNA::SweepType VNA::SweepTypeFromString(QString s)
|
|||||||
return SweepType::Last;
|
return SweepType::Last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VNA::UpdateStatusbar()
|
||||||
|
{
|
||||||
|
if(calValid) {
|
||||||
|
QFileInfo fi(cal.getCurrentCalibrationFile());
|
||||||
|
auto filename = fi.fileName();
|
||||||
|
if(filename.isEmpty()) {
|
||||||
|
filename = "Unsaved";
|
||||||
|
}
|
||||||
|
setStatusbarMessage("Calibration: "+filename);
|
||||||
|
} else {
|
||||||
|
setStatusbarMessage("Calibration: -");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -107,6 +107,7 @@ private:
|
|||||||
void UpdateCalWidget();
|
void UpdateCalWidget();
|
||||||
private slots:
|
private slots:
|
||||||
void EnableDeembedding(bool enable);
|
void EnableDeembedding(bool enable);
|
||||||
|
void UpdateStatusbar();
|
||||||
private:
|
private:
|
||||||
Settings settings;
|
Settings settings;
|
||||||
unsigned int averages;
|
unsigned int averages;
|
||||||
|
@ -151,6 +151,8 @@ AppWindow::AppWindow(QWidget *parent)
|
|||||||
file.open(filename.toStdString());
|
file.open(filename.toStdString());
|
||||||
file << setw(4) << SaveSetup() << endl;
|
file << setw(4) << SaveSetup() << endl;
|
||||||
file.close();
|
file.close();
|
||||||
|
QFileInfo fi(filename);
|
||||||
|
lSetupName.setText("Setup: "+fi.fileName());
|
||||||
});
|
});
|
||||||
connect(ui->actionLoad_setup, &QAction::triggered, [=](){
|
connect(ui->actionLoad_setup, &QAction::triggered, [=](){
|
||||||
auto filename = QFileDialog::getOpenFileName(nullptr, "Load setup data", "", "Setup files (*.setup)", nullptr, QFileDialog::DontUseNativeDialog);
|
auto filename = QFileDialog::getOpenFileName(nullptr, "Load setup data", "", "Setup files (*.setup)", nullptr, QFileDialog::DontUseNativeDialog);
|
||||||
@ -173,11 +175,20 @@ AppWindow::AppWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
LoadSetup(j);
|
LoadSetup(j);
|
||||||
|
QFileInfo fi(filename);
|
||||||
|
lSetupName.setText("Setup: "+fi.fileName());
|
||||||
});
|
});
|
||||||
connect(ui->actionSave_image, &QAction::triggered, [=](){
|
connect(ui->actionSave_image, &QAction::triggered, [=](){
|
||||||
Mode::getActiveMode()->saveSreenshot();
|
Mode::getActiveMode()->saveSreenshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
auto setModeStatusbar = [=](QString msg) {
|
||||||
|
lModeInfo.setText(msg);
|
||||||
|
};
|
||||||
|
connect(vna, &Mode::statusbarMessage, setModeStatusbar);
|
||||||
|
connect(generator, &Mode::statusbarMessage, setModeStatusbar);
|
||||||
|
connect(spectrumAnalyzer, &Mode::statusbarMessage, setModeStatusbar);
|
||||||
|
|
||||||
connect(ui->actionManual_Control, &QAction::triggered, this, &AppWindow::StartManualControl);
|
connect(ui->actionManual_Control, &QAction::triggered, this, &AppWindow::StartManualControl);
|
||||||
connect(ui->actionFirmware_Update, &QAction::triggered, this, &AppWindow::StartFirmwareUpdateDialog);
|
connect(ui->actionFirmware_Update, &QAction::triggered, this, &AppWindow::StartFirmwareUpdateDialog);
|
||||||
connect(ui->actionSource_Calibration, &QAction::triggered, this, &AppWindow::SourceCalibrationDialog);
|
connect(ui->actionSource_Calibration, &QAction::triggered, this, &AppWindow::SourceCalibrationDialog);
|
||||||
@ -988,6 +999,16 @@ void AppWindow::SetupStatusBar()
|
|||||||
ui->statusbar->addWidget(&lDeviceInfo);
|
ui->statusbar->addWidget(&lDeviceInfo);
|
||||||
ui->statusbar->addWidget(new QLabel, 1);
|
ui->statusbar->addWidget(new QLabel, 1);
|
||||||
|
|
||||||
|
ui->statusbar->addWidget(&lSetupName);
|
||||||
|
lSetupName.setText("Setup: -");
|
||||||
|
auto div2 = new QFrame;
|
||||||
|
div2->setFrameShape(QFrame::VLine);
|
||||||
|
ui->statusbar->addWidget(div2);
|
||||||
|
ui->statusbar->addWidget(&lModeInfo);
|
||||||
|
auto div3 = new QFrame;
|
||||||
|
div3->setFrameShape(QFrame::VLine);
|
||||||
|
ui->statusbar->addWidget(div3);
|
||||||
|
|
||||||
lADCOverload.setStyleSheet("color : red");
|
lADCOverload.setStyleSheet("color : red");
|
||||||
lADCOverload.setText("ADC overload");
|
lADCOverload.setText("ADC overload");
|
||||||
lADCOverload.setVisible(false);
|
lADCOverload.setVisible(false);
|
||||||
@ -1028,4 +1049,5 @@ void AppWindow::UpdateStatusBar(DeviceStatusBar status)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,9 @@ private:
|
|||||||
// Status bar widgets
|
// Status bar widgets
|
||||||
QLabel lConnectionStatus;
|
QLabel lConnectionStatus;
|
||||||
QLabel lDeviceInfo;
|
QLabel lDeviceInfo;
|
||||||
|
|
||||||
|
QLabel lModeInfo;
|
||||||
|
QLabel lSetupName;
|
||||||
// Error flag labels
|
// Error flag labels
|
||||||
QLabel lADCOverload;
|
QLabel lADCOverload;
|
||||||
QLabel lUnlevel;
|
QLabel lUnlevel;
|
||||||
|
@ -101,6 +101,8 @@ void Mode::activate()
|
|||||||
if(window->getDevice()) {
|
if(window->getDevice()) {
|
||||||
initializeDevice();
|
initializeDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit statusbarMessage(statusbarMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mode::deactivate()
|
void Mode::deactivate()
|
||||||
@ -174,6 +176,14 @@ void Mode::finalize(QWidget *centralWidget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mode::setStatusbarMessage(QString msg)
|
||||||
|
{
|
||||||
|
statusbarMsg = msg;
|
||||||
|
if(this == activeMode) {
|
||||||
|
emit statusbarMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString Mode::getName() const
|
QString Mode::getName() const
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
class Mode : public QObject, public Savable
|
class Mode : public QObject, public Savable
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Mode(AppWindow *window, QString name);
|
Mode(AppWindow *window, QString name);
|
||||||
|
|
||||||
@ -26,8 +27,10 @@ public:
|
|||||||
virtual void deviceDisconnected(){};
|
virtual void deviceDisconnected(){};
|
||||||
|
|
||||||
virtual void saveSreenshot();
|
virtual void saveSreenshot();
|
||||||
|
signals:
|
||||||
|
void statusbarMessage(QString msg);
|
||||||
protected:
|
protected:
|
||||||
|
void setStatusbarMessage(QString msg);
|
||||||
// call once the derived class is fully initialized
|
// call once the derived class is fully initialized
|
||||||
void finalize(QWidget *centralWidget);
|
void finalize(QWidget *centralWidget);
|
||||||
AppWindow *window;
|
AppWindow *window;
|
||||||
@ -40,6 +43,7 @@ private:
|
|||||||
static QWidget *cornerWidget;
|
static QWidget *cornerWidget;
|
||||||
static QButtonGroup *modeButtonGroup;
|
static QButtonGroup *modeButtonGroup;
|
||||||
const QString name;
|
const QString name;
|
||||||
|
QString statusbarMsg;
|
||||||
QWidget *central;
|
QWidget *central;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user