gui: implement about dialog and unify app version/hash
This commit is contained in:
parent
f5991fef0e
commit
99d0066f1e
@ -102,6 +102,7 @@ HEADERS += \
|
|||||||
Traces/xyplotaxisdialog.h \
|
Traces/xyplotaxisdialog.h \
|
||||||
Util/qpointervariant.h \
|
Util/qpointervariant.h \
|
||||||
Util/util.h \
|
Util/util.h \
|
||||||
|
Util/app_common.h \
|
||||||
VNA/Deembedding/deembedding.h \
|
VNA/Deembedding/deembedding.h \
|
||||||
VNA/Deembedding/deembeddingdialog.h \
|
VNA/Deembedding/deembeddingdialog.h \
|
||||||
VNA/Deembedding/deembeddingoption.h \
|
VNA/Deembedding/deembeddingoption.h \
|
||||||
@ -111,6 +112,7 @@ HEADERS += \
|
|||||||
VNA/Deembedding/twothru.h \
|
VNA/Deembedding/twothru.h \
|
||||||
VNA/tracewidgetvna.h \
|
VNA/tracewidgetvna.h \
|
||||||
VNA/vna.h \
|
VNA/vna.h \
|
||||||
|
about.h \
|
||||||
appwindow.h \
|
appwindow.h \
|
||||||
averaging.h \
|
averaging.h \
|
||||||
csv.h \
|
csv.h \
|
||||||
@ -223,6 +225,7 @@ SOURCES += \
|
|||||||
VNA/Deembedding/twothru.cpp \
|
VNA/Deembedding/twothru.cpp \
|
||||||
VNA/tracewidgetvna.cpp \
|
VNA/tracewidgetvna.cpp \
|
||||||
VNA/vna.cpp \
|
VNA/vna.cpp \
|
||||||
|
about.cpp \
|
||||||
appwindow.cpp \
|
appwindow.cpp \
|
||||||
averaging.cpp \
|
averaging.cpp \
|
||||||
csv.cpp \
|
csv.cpp \
|
||||||
@ -285,6 +288,7 @@ FORMS += \
|
|||||||
VNA/Deembedding/portextensioneditdialog.ui \
|
VNA/Deembedding/portextensioneditdialog.ui \
|
||||||
VNA/Deembedding/twothrudialog.ui \
|
VNA/Deembedding/twothrudialog.ui \
|
||||||
VNA/s2pImportOptions.ui \
|
VNA/s2pImportOptions.ui \
|
||||||
|
aboutdialog.ui \
|
||||||
main.ui \
|
main.ui \
|
||||||
preferencesdialog.ui
|
preferencesdialog.ui
|
||||||
|
|
||||||
|
8
Software/PC_Application/Util/app_common.h
Normal file
8
Software/PC_Application/Util/app_common.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef APP_COMMON_H
|
||||||
|
#define APP_COMMON_H
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
#define qlibrevnaApp (QCoreApplication::instance())
|
||||||
|
|
||||||
|
#endif // APP_COMMON_H
|
33
Software/PC_Application/about.cpp
Normal file
33
Software/PC_Application/about.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include "Util/app_common.h"
|
||||||
|
#include "about.h"
|
||||||
|
#include "ui_aboutdialog.h"
|
||||||
|
|
||||||
|
About About::instance;
|
||||||
|
|
||||||
|
AboutDialog::AboutDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::AboutDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowTitle("About " + qlibrevnaApp->applicationName());
|
||||||
|
ui->appName->setText(qlibrevnaApp->applicationName());
|
||||||
|
ui->appVersion->setText(QString("Version: %1")
|
||||||
|
.arg(qlibrevnaApp->applicationVersion()));
|
||||||
|
ui->sourceCodeDescription->setText(QString("<a href='%1'>%1</a>")
|
||||||
|
.arg("https://github.com/jankae/LibreVNA"));
|
||||||
|
ui->sourceCodeDescription->setOpenExternalLinks(true);
|
||||||
|
ui->contributeDescription->setOpenExternalLinks(true);
|
||||||
|
ui->headerDescription->setOpenExternalLinks(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AboutDialog::~AboutDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void About::about()
|
||||||
|
{
|
||||||
|
auto dialog = new AboutDialog();
|
||||||
|
dialog->exec();
|
||||||
|
}
|
34
Software/PC_Application/about.h
Normal file
34
Software/PC_Application/about.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef ABOUT_H
|
||||||
|
#define ABOUT_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class About
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static About& getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
void about();
|
||||||
|
private:
|
||||||
|
About() {};
|
||||||
|
static About instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class AboutDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AboutDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit AboutDialog(QWidget *parent = nullptr);
|
||||||
|
~AboutDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::AboutDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ABOUT_H
|
179
Software/PC_Application/aboutdialog.ui
Normal file
179
Software/PC_Application/aboutdialog.ui
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AboutDialog</class>
|
||||||
|
<widget class="QDialog" name="AboutDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>344</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="appName">
|
||||||
|
<property name="text">
|
||||||
|
<string>PLACEHOLDER_APP_NAME</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::AutoText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="appVersion">
|
||||||
|
<property name="text">
|
||||||
|
<string>PLACEHOLDER_MAIN</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tabInformation">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Information</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="informationDescription">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>LibreVNA it's a Vector Network Analyzer instrument that comes with a set of tools aside of hardware as LibreVNA-GUI application and the firmware that runs over theboard itself. </string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="headerCommunity">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><span style=" font-weight:600;">LibreVNA Community</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::AutoText</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="headerDescription">
|
||||||
|
<property name="text">
|
||||||
|
<string>For general questions or discussions, the <a href="https://groups.io/g/LibreVNA">LibreVNA group</a> is probably the best place.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="headerSourceCode">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><span style=" font-weight:600;">LibreVNA Source Code</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="sourceCodeDescription">
|
||||||
|
<property name="text">
|
||||||
|
<string>PLACEHOLDER_SOURCE_CODE_DESC</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabContribute">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Contribute</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="contributeDescription">
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p>Pull request are always welcome and this project is always in on-going development. If you have any proposal or feature just go to: <a href="https://github.com/jankae/LibreVNA/issues"><span style=" text-decoration: underline;">LibreVNA issues</span></a></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -50,28 +50,31 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "CustomWidgets/jsonpickerdialog.h"
|
#include "CustomWidgets/jsonpickerdialog.h"
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
#include "Util/app_common.h"
|
||||||
|
#include "about.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
static const QString APP_VERSION = QString::number(FW_MAJOR) + "." +
|
||||||
|
QString::number(FW_MINOR) + "." +
|
||||||
|
QString::number(FW_PATCH);
|
||||||
|
static const QString APP_GIT_HASH = QString(GITHASH);
|
||||||
|
|
||||||
AppWindow::AppWindow(QWidget *parent)
|
AppWindow::AppWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, deviceActionGroup(new QActionGroup(this))
|
, deviceActionGroup(new QActionGroup(this))
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
, server(nullptr)
|
, server(nullptr)
|
||||||
|
, appVersion(APP_VERSION)
|
||||||
|
, appGitHash(APP_GIT_HASH)
|
||||||
{
|
{
|
||||||
QCoreApplication::setOrganizationName("LibreVNA");
|
|
||||||
QCoreApplication::setApplicationName("LibreVNA-GUI");
|
|
||||||
auto commit = QString(GITHASH);
|
|
||||||
commit.truncate(7);
|
|
||||||
QCoreApplication::setApplicationVersion(QString::number(FW_MAJOR) + "." + QString::number(FW_MINOR)
|
|
||||||
+ "." + QString::number(FW_PATCH) + FW_SUFFIX + " ("+ commit+")");
|
|
||||||
|
|
||||||
qSetMessagePattern("%{time process}: [%{type}] %{message}");
|
qSetMessagePattern("%{time process}: [%{type}] %{message}");
|
||||||
|
|
||||||
// qDebug().setVerbosity(0);
|
// qDebug().setVerbosity(0);
|
||||||
qDebug() << "Application start";
|
qDebug() << "Application start";
|
||||||
|
|
||||||
parser.setApplicationDescription("LibreVNA-GUI");
|
parser.setApplicationDescription(qlibrevnaApp->applicationName());
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
parser.addOption(QCommandLineOption({"p","port"}, "Specify port to listen for SCPI commands", "port"));
|
parser.addOption(QCommandLineOption({"p","port"}, "Specify port to listen for SCPI commands", "port"));
|
||||||
@ -202,12 +205,13 @@ AppWindow::AppWindow(QWidget *parent)
|
|||||||
// settings might have changed, update necessary stuff
|
// settings might have changed, update necessary stuff
|
||||||
// TraceXYPlot::updateGraphColors();
|
// TraceXYPlot::updateGraphColors();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->actionAbout, &QAction::triggered, [=](){
|
connect(ui->actionAbout, &QAction::triggered, [=](){
|
||||||
QMessageBox::about(this, "About", "More information: github.com/jankae/LibreVNA\n"
|
auto &a = About::getInstance();
|
||||||
"\nVersion: " + QCoreApplication::applicationVersion());
|
a.about();
|
||||||
});
|
});
|
||||||
|
|
||||||
setWindowTitle("LibreVNA-GUI");
|
setWindowTitle(qlibrevnaApp->applicationName() + " v" + getAppVersion());
|
||||||
|
|
||||||
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
|
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
|
||||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||||
@ -696,3 +700,13 @@ Ui::MainWindow *AppWindow::getUi() const
|
|||||||
{
|
{
|
||||||
return ui;
|
return ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString& AppWindow::getAppVersion() const
|
||||||
|
{
|
||||||
|
return appVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& AppWindow::getAppGitHash() const
|
||||||
|
{
|
||||||
|
return appGitHash;
|
||||||
|
}
|
||||||
|
@ -41,6 +41,9 @@ public:
|
|||||||
QStackedWidget *getCentral() const;
|
QStackedWidget *getCentral() const;
|
||||||
Device *getDevice() const;
|
Device *getDevice() const;
|
||||||
|
|
||||||
|
const QString& getAppVersion() const;
|
||||||
|
const QString& getAppGitHash() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
private slots:
|
private slots:
|
||||||
@ -95,6 +98,9 @@ private:
|
|||||||
|
|
||||||
SCPI scpi;
|
SCPI scpi;
|
||||||
TCPServer *server;
|
TCPServer *server;
|
||||||
|
|
||||||
|
QString appVersion;
|
||||||
|
QString appGitHash;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNA_H
|
#endif // VNA_H
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
|
||||||
|
static void setApplicationData();
|
||||||
|
|
||||||
static QApplication *app;
|
static QApplication *app;
|
||||||
static AppWindow *window;
|
static AppWindow *window;
|
||||||
|
|
||||||
@ -35,7 +37,16 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
app = new QApplication(argc, argv_ext);
|
app = new QApplication(argc, argv_ext);
|
||||||
window = new AppWindow;
|
window = new AppWindow;
|
||||||
|
setApplicationData();
|
||||||
signal(SIGINT, sig_handler);
|
signal(SIGINT, sig_handler);
|
||||||
app->exec();
|
app->exec();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setApplicationData()
|
||||||
|
{
|
||||||
|
QCoreApplication::setOrganizationName("LibreVNA");
|
||||||
|
QCoreApplication::setApplicationName("LibreVNA-GUI");
|
||||||
|
QCoreApplication::setApplicationVersion(window->getAppVersion() + "-" +
|
||||||
|
window->getAppGitHash().left(9));
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user