Merge branch 'librevna-rename'

This commit is contained in:
Jan Käberich 2021-04-10 12:52:57 +02:00
commit f88c891ccf
14 changed files with 636 additions and 11 deletions

View File

@ -22,15 +22,15 @@ jobs:
- name: Build application
run: |
cd Software/PC_Application
qmake
qmake LibreVNA-GUI.pro
make -j9
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Application_Ubuntu
path: Software/PC_Application/Application
name: GUI_Ubuntu
path: Software/PC_Application/LibreVNA-GUI
PC_Application_Windows:
runs-on: windows-latest
@ -54,7 +54,7 @@ jobs:
- name: Build application
run: |
cd Software/PC_Application
qmake
qmake LibreVNA-GUI.pro
make -j9
shell: cmd
@ -72,8 +72,36 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v2
with:
name: Application_Windows
name: GUI_Windows
path: Software/PC_Application/release
PC_Application_OSX:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: |
brew install qt@5 libusb
- name: Set Environment
run: |
echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH
- name: Build application
run: |
cd Software/PC_Application
qmake LibreVNA-GUI.pro
make -j9
macdeployqt LibreVNA-GUI.app
zip -ry LibreVNA-GUI.zip LibreVNA-GUI.app
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: GUI_OSX
path: Software/PC_Application/LibreVNA-GUI.zip
Embedded_Firmware:
runs-on: ubuntu-18.04

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

View File

@ -112,7 +112,7 @@
\usepackage{makecell}
\usepackage{hyperref}
\newcommand{\vna}{VNA}
\newcommand{\vna}{LibreVNA}
\newcommand{\screenshot}[2]{\begin{center}
\includegraphics[width=#1\textwidth]{Screenshots/#2}

View File

@ -225,6 +225,8 @@ SOURCES += \
LIBS += -lusb-1.0
unix:LIBS += -L/usr/lib/
win32:LIBS += -L"$$_PRO_FILE_PWD_" # Github actions placed libusb here
osx:INCPATH += /usr/local/include
osx:LIBS += $(shell pkg-config --libs libusb-1.0)
QT += widgets
@ -274,9 +276,10 @@ DISTFILES +=
RESOURCES += \
icons.qrc
CONFIG += c++14
CONFIG += c++17
REVISION = $$system(git rev-parse HEAD)
DEFINES += GITHASH=\\"\"$$REVISION\\"\"
DEFINES += FW_MAJOR=0 FW_MINOR=1 FW_PATCH=0 FW_SUFFIX=\\"\"-alpha.2\\"\"
DEFINES -= _UNICODE UNICODE
TARGET=VNA2

View File

@ -0,0 +1,183 @@
#include "jsonpickerdialog.h"
#include "ui_jsonpickerdialog.h"
JSONPickerDialog::JSONPickerDialog(const nlohmann::json &json, QWidget *parent) :
QDialog(parent),
ui(new Ui::JSONPickerDialog),
model(new JSONModel(json))
{
ui->setupUi(this);
ui->treeView->setModel(model);
}
JSONPickerDialog::~JSONPickerDialog()
{
delete ui;
delete model;
}
JSONModel::JSONModel(const nlohmann::json &json, QObject *parent) :
json(json)
{
setupJsonInfo(json);
}
JSONModel::~JSONModel()
{
}
QModelIndex JSONModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
nlohmann::json const *parentItem;
if (!parent.isValid())
parentItem = &json;
else
parentItem = static_cast<nlohmann::json*>(parent.internalPointer());
auto it = parentItem->begin();
int rb = row;
while(rb) {
it++;
rb--;
}
nlohmann::json *childItem = const_cast<nlohmann::json*>(&*it);
if (childItem)
return createIndex(row, column, childItem);
return QModelIndex();
}
QModelIndex JSONModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
nlohmann::json *childItem = static_cast<nlohmann::json*>(index.internalPointer());
if (childItem == &json) {
return QModelIndex();
}
// find the parent of this entry and its position in the list
nlohmann::json *parentItem = const_cast<nlohmann::json*>(jsonInfo.at(childItem).parent);
auto it = parentItem->begin();
int row = 0;
while(&*it != childItem) {
it++;
row++;
}
return createIndex(row, 0, parentItem);
}
int JSONModel::rowCount(const QModelIndex &parent) const
{
const nlohmann::json *parentItem;
if (parent.column() > 0) {
return 0;
}
if (!parent.isValid()) {
parentItem = &json;
} else {
parentItem = static_cast<nlohmann::json*>(parent.internalPointer());
}
if (parentItem->is_object() || parentItem->is_array()) {
return parentItem->size();
} else {
return 0;
}
}
int JSONModel::columnCount(const QModelIndex &parent) const
{
return 2;
}
QVariant JSONModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
nlohmann::json *item = static_cast<nlohmann::json*>(index.internalPointer());
auto info = jsonInfo.at(item);
switch(role) {
case Qt::DisplayRole:
switch(index.column()) {
case 0:
return info.name;
case 1:
if(item->is_object() || item->is_array()) {
return QVariant();
} else {
return info.data;
}
}
case Qt::CheckStateRole: {
if(index.column() == 0) {
return info.enabled ? Qt::Checked : Qt::Unchecked;
} else {
return QVariant();
}
}
default:
return QVariant();
}
}
QVariant JSONModel::headerData(int section, Qt::Orientation orientation, int role) const
{
return QVariant();
}
bool JSONModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
nlohmann::json *item = static_cast<nlohmann::json*>(index.internalPointer());
auto info = jsonInfo.at(item);
if(role == Qt::CheckStateRole)
{
info.enabled = !info.enabled;
jsonInfo[item] = info;
emit dataChanged(index, index);
return true;
}
if (role != Qt::EditRole)
return false;
return true;
}
Qt::ItemFlags JSONModel::flags(const QModelIndex &index) const
{
if (!index.isValid()) {
return Qt::NoItemFlags;
}
return Qt::ItemIsEditable | QAbstractItemModel::flags(index)|Qt::ItemIsUserCheckable;
}
void JSONModel::setupJsonInfo(const nlohmann::json &j)
{
for(auto it = j.begin();it != j.end(); it++) {
JSONInfo i;
i.parent = &j;
i.enabled = true;
if(j.is_object()) {
i.name = it.key().c_str();
} else if(j.is_array()) {
i.name = QString::number(it - j.begin() + 1);
}
if(it->is_object() || it->is_array()) {
setupJsonInfo(*it);
} else {
i.data = QString::fromStdString(it->dump());
}
jsonInfo[&*it] = i;
}
}

View File

@ -0,0 +1,55 @@
#ifndef JSONPICKERDIALOG_H
#define JSONPICKERDIALOG_H
#include <QDialog>
#include <QAbstractItemModel>
#include "json.hpp"
namespace Ui {
class JSONPickerDialog;
}
class JSONModel : public QAbstractItemModel
{
Q_OBJECT
public:
JSONModel(const nlohmann::json &json, QObject *parent = 0);
~JSONModel();
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
private:
void setupJsonInfo(const nlohmann::json &j);
const nlohmann::json &json;
class JSONInfo {
public:
const nlohmann::json *parent;
QString name;
QString data;
bool enabled;
};
std::map<const nlohmann::json*, JSONInfo> jsonInfo;
};
class JSONPickerDialog : public QDialog
{
Q_OBJECT
public:
explicit JSONPickerDialog(const nlohmann::json &json, QWidget *parent = nullptr);
~JSONPickerDialog();
private:
Ui::JSONPickerDialog *ui;
JSONModel *model;
};
#endif // JSONPICKERDIALOG_H

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>JSONPickerDialog</class>
<widget class="QDialog" name="JSONPickerDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTreeView" name="treeView"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>JSONPickerDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>JSONPickerDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Binary file not shown.

View File

@ -0,0 +1,286 @@
HEADERS += \
../VNA_embedded/Application/Communication/Protocol.hpp \
Calibration/amplitudecaldialog.h \
Calibration/calibration.h \
Calibration/calibrationtracedialog.h \
Calibration/calkit.h \
Calibration/calkitdialog.h \
Calibration/manualcalibrationdialog.h \
Calibration/measurementmodel.h \
Calibration/receivercaldialog.h \
Calibration/sourcecaldialog.h \
CustomWidgets/colorpickerbutton.h \
CustomWidgets/informationbox.h \
CustomWidgets/jsonpickerdialog.h \
CustomWidgets/siunitedit.h \
CustomWidgets/tilewidget.h \
CustomWidgets/toggleswitch.h \
CustomWidgets/touchstoneimport.h \
Device/device.h \
Device/devicelog.h \
Device/firmwareupdatedialog.h \
Device/manualcontroldialog.h \
Generator/generator.h \
Generator/signalgenwidget.h \
SpectrumAnalyzer/spectrumanalyzer.h \
SpectrumAnalyzer/tracewidgetsa.h \
Tools/eseries.h \
Tools/impedancematchdialog.h \
Tools/parameters.h \
Traces/Math/dft.h \
Traces/Math/expression.h \
Traces/Math/medianfilter.h \
Traces/Math/parser/mpCompat.h \
Traces/Math/parser/mpDefines.h \
Traces/Math/parser/mpError.h \
Traces/Math/parser/mpFuncCmplx.h \
Traces/Math/parser/mpFuncCommon.h \
Traces/Math/parser/mpFuncMatrix.h \
Traces/Math/parser/mpFuncNonCmplx.h \
Traces/Math/parser/mpFuncStr.h \
Traces/Math/parser/mpFwdDecl.h \
Traces/Math/parser/mpICallback.h \
Traces/Math/parser/mpIOprt.h \
Traces/Math/parser/mpIPackage.h \
Traces/Math/parser/mpIPrecedence.h \
Traces/Math/parser/mpIToken.h \
Traces/Math/parser/mpIValReader.h \
Traces/Math/parser/mpIValue.h \
Traces/Math/parser/mpIfThenElse.h \
Traces/Math/parser/mpMatrix.h \
Traces/Math/parser/mpMatrixError.h \
Traces/Math/parser/mpOprtBinAssign.h \
Traces/Math/parser/mpOprtBinCommon.h \
Traces/Math/parser/mpOprtCmplx.h \
Traces/Math/parser/mpOprtIndex.h \
Traces/Math/parser/mpOprtMatrix.h \
Traces/Math/parser/mpOprtNonCmplx.h \
Traces/Math/parser/mpOprtPostfixCommon.h \
Traces/Math/parser/mpPackageCmplx.h \
Traces/Math/parser/mpPackageCommon.h \
Traces/Math/parser/mpPackageMatrix.h \
Traces/Math/parser/mpPackageNonCmplx.h \
Traces/Math/parser/mpPackageStr.h \
Traces/Math/parser/mpPackageUnit.h \
Traces/Math/parser/mpParser.h \
Traces/Math/parser/mpParserBase.h \
Traces/Math/parser/mpParserMessageProvider.h \
Traces/Math/parser/mpRPN.h \
Traces/Math/parser/mpScriptTokens.h \
Traces/Math/parser/mpStack.h \
Traces/Math/parser/mpTest.h \
Traces/Math/parser/mpTokenReader.h \
Traces/Math/parser/mpTypes.h \
Traces/Math/parser/mpValReader.h \
Traces/Math/parser/mpValue.h \
Traces/Math/parser/mpValueCache.h \
Traces/Math/parser/mpVariable.h \
Traces/Math/parser/suSortPred.h \
Traces/Math/parser/suStringTokens.h \
Traces/Math/parser/utGeneric.h \
Traces/Math/tdr.h \
Traces/Math/tracemath.h \
Traces/Math/windowfunction.h \
Traces/fftcomplex.h \
Traces/markerwidget.h \
Traces/sparamtraceselector.h \
Traces/trace.h \
Traces/tracecsvexport.h \
Traces/traceeditdialog.h \
Traces/traceimportdialog.h \
Traces/tracemarker.h \
Traces/tracemarkermodel.h \
Traces/tracemodel.h \
Traces/traceplot.h \
Traces/tracesmithchart.h \
Traces/tracetouchstoneexport.h \
Traces/tracewidget.h \
Traces/tracexyplot.h \
Traces/xyplotaxisdialog.h \
Util/qpointervariant.h \
Util/util.h \
VNA/Deembedding/deembedding.h \
VNA/Deembedding/deembeddingdialog.h \
VNA/Deembedding/deembeddingoption.h \
VNA/Deembedding/manualdeembeddingdialog.h \
VNA/Deembedding/matchingnetwork.h \
VNA/Deembedding/portextension.h \
VNA/Deembedding/twothru.h \
VNA/tracewidgetvna.h \
VNA/vna.h \
appwindow.h \
averaging.h \
csv.h \
json.hpp \
mode.h \
preferences.h \
savable.h \
touchstone.h \
unit.h
SOURCES += \
../VNA_embedded/Application/Communication/Protocol.cpp \
Calibration/amplitudecaldialog.cpp \
Calibration/calibration.cpp \
Calibration/calibrationtracedialog.cpp \
Calibration/calkit.cpp \
Calibration/calkitdialog.cpp \
Calibration/manualcalibrationdialog.cpp \
Calibration/measurementmodel.cpp \
Calibration/receivercaldialog.cpp \
Calibration/sourcecaldialog.cpp \
CustomWidgets/colorpickerbutton.cpp \
CustomWidgets/informationbox.cpp \
CustomWidgets/jsonpickerdialog.cpp \
CustomWidgets/siunitedit.cpp \
CustomWidgets/tilewidget.cpp \
CustomWidgets/toggleswitch.cpp \
CustomWidgets/touchstoneimport.cpp \
Device/device.cpp \
Device/devicelog.cpp \
Device/firmwareupdatedialog.cpp \
Device/manualcontroldialog.cpp \
Generator/generator.cpp \
Generator/signalgenwidget.cpp \
SpectrumAnalyzer/spectrumanalyzer.cpp \
SpectrumAnalyzer/tracewidgetsa.cpp \
Tools/eseries.cpp \
Tools/impedancematchdialog.cpp \
Tools/parameters.cpp \
Traces/Math/dft.cpp \
Traces/Math/expression.cpp \
Traces/Math/medianfilter.cpp \
Traces/Math/parser/mpError.cpp \
Traces/Math/parser/mpFuncCmplx.cpp \
Traces/Math/parser/mpFuncCommon.cpp \
Traces/Math/parser/mpFuncMatrix.cpp \
Traces/Math/parser/mpFuncNonCmplx.cpp \
Traces/Math/parser/mpFuncStr.cpp \
Traces/Math/parser/mpICallback.cpp \
Traces/Math/parser/mpIOprt.cpp \
Traces/Math/parser/mpIPackage.cpp \
Traces/Math/parser/mpIToken.cpp \
Traces/Math/parser/mpIValReader.cpp \
Traces/Math/parser/mpIValue.cpp \
Traces/Math/parser/mpIfThenElse.cpp \
Traces/Math/parser/mpOprtBinAssign.cpp \
Traces/Math/parser/mpOprtBinCommon.cpp \
Traces/Math/parser/mpOprtCmplx.cpp \
Traces/Math/parser/mpOprtIndex.cpp \
Traces/Math/parser/mpOprtMatrix.cpp \
Traces/Math/parser/mpOprtNonCmplx.cpp \
Traces/Math/parser/mpOprtPostfixCommon.cpp \
Traces/Math/parser/mpPackageCmplx.cpp \
Traces/Math/parser/mpPackageCommon.cpp \
Traces/Math/parser/mpPackageMatrix.cpp \
Traces/Math/parser/mpPackageNonCmplx.cpp \
Traces/Math/parser/mpPackageStr.cpp \
Traces/Math/parser/mpPackageUnit.cpp \
Traces/Math/parser/mpParser.cpp \
Traces/Math/parser/mpParserBase.cpp \
Traces/Math/parser/mpParserMessageProvider.cpp \
Traces/Math/parser/mpRPN.cpp \
Traces/Math/parser/mpScriptTokens.cpp \
Traces/Math/parser/mpTest.cpp \
Traces/Math/parser/mpTokenReader.cpp \
Traces/Math/parser/mpValReader.cpp \
Traces/Math/parser/mpValue.cpp \
Traces/Math/parser/mpValueCache.cpp \
Traces/Math/parser/mpVariable.cpp \
Traces/Math/tdr.cpp \
Traces/Math/tracemath.cpp \
Traces/Math/windowfunction.cpp \
Traces/fftcomplex.cpp \
Traces/markerwidget.cpp \
Traces/sparamtraceselector.cpp \
Traces/trace.cpp \
Traces/tracecsvexport.cpp \
Traces/traceeditdialog.cpp \
Traces/traceimportdialog.cpp \
Traces/tracemarker.cpp \
Traces/tracemarkermodel.cpp \
Traces/tracemodel.cpp \
Traces/traceplot.cpp \
Traces/tracesmithchart.cpp \
Traces/tracetouchstoneexport.cpp \
Traces/tracewidget.cpp \
Traces/tracexyplot.cpp \
Traces/xyplotaxisdialog.cpp \
VNA/Deembedding/deembedding.cpp \
VNA/Deembedding/deembeddingdialog.cpp \
VNA/Deembedding/deembeddingoption.cpp \
VNA/Deembedding/manualdeembeddingdialog.cpp \
VNA/Deembedding/matchingnetwork.cpp \
VNA/Deembedding/portextension.cpp \
VNA/Deembedding/twothru.cpp \
VNA/tracewidgetvna.cpp \
VNA/vna.cpp \
appwindow.cpp \
averaging.cpp \
csv.cpp \
main.cpp \
mode.cpp \
preferences.cpp \
touchstone.cpp \
unit.cpp
LIBS += -lusb-1.0
unix:LIBS += -L/usr/lib/
win32:LIBS += -L"$$_PRO_FILE_PWD_" # Github actions placed libusb here
osx:INCPATH += /usr/local/include
osx:LIBS += $(shell pkg-config --libs libusb-1.0)
QT += widgets
FORMS += \
Calibration/addamplitudepointsdialog.ui \
Calibration/amplitudecaldialog.ui \
Calibration/automaticamplitudedialog.ui \
Calibration/calibrationtracedialog.ui \
Calibration/calkitdialog.ui \
Calibration/manualcalibrationdialog.ui \
CustomWidgets/jsonpickerdialog.ui \
CustomWidgets/tilewidget.ui \
CustomWidgets/touchstoneimport.ui \
Device/devicelog.ui \
Device/firmwareupdatedialog.ui \
Device/manualcontroldialog.ui \
Generator/signalgenwidget.ui \
Tools/impedancematchdialog.ui \
Traces/Math/dftdialog.ui \
Traces/Math/dftexplanationwidget.ui \
Traces/Math/expressiondialog.ui \
Traces/Math/expressionexplanationwidget.ui \
Traces/Math/medianexplanationwidget.ui \
Traces/Math/medianfilterdialog.ui \
Traces/Math/newtracemathdialog.ui \
Traces/Math/tdrdialog.ui \
Traces/Math/tdrexplanationwidget.ui \
Traces/markerwidget.ui \
Traces/smithchartdialog.ui \
Traces/tracecsvexport.ui \
Traces/traceeditdialog.ui \
Traces/traceimportdialog.ui \
Traces/tracetouchstoneexport.ui \
Traces/tracewidget.ui \
Traces/xyplotaxisdialog.ui \
VNA/Deembedding/deembeddingdialog.ui \
VNA/Deembedding/manualdeembeddingdialog.ui \
VNA/Deembedding/matchingnetworkdialog.ui \
VNA/Deembedding/measurementdialog.ui \
VNA/Deembedding/portextensioneditdialog.ui \
VNA/Deembedding/twothrudialog.ui \
VNA/s2pImportOptions.ui \
main.ui \
preferencesdialog.ui
DISTFILES +=
RESOURCES += \
icons.qrc
CONFIG += c++17
REVISION = $$system(git rev-parse HEAD)
DEFINES += GITHASH=\\"\"$$REVISION\\"\"
DEFINES += FW_MAJOR=0 FW_MINOR=1 FW_PATCH=0 FW_SUFFIX=\\"\"-alpha.2\\"\"
DEFINES -= _UNICODE UNICODE

View File

@ -47,7 +47,7 @@
#include "Calibration/sourcecaldialog.h"
#include "Calibration/receivercaldialog.h"
#include <QDebug>
#include "CustomWidgets/jsonpickerdialog.h"
using namespace std;
AppWindow::AppWindow(QWidget *parent)
@ -55,8 +55,8 @@ AppWindow::AppWindow(QWidget *parent)
, deviceActionGroup(new QActionGroup(this))
, ui(new Ui::MainWindow)
{
QCoreApplication::setOrganizationName("VNA");
QCoreApplication::setApplicationName("Application");
QCoreApplication::setOrganizationName("LibreVNA");
QCoreApplication::setApplicationName("LibreVNA-GUI");
qSetMessagePattern("%{time process}: [%{type}] %{message}");
@ -165,7 +165,7 @@ AppWindow::AppWindow(QWidget *parent)
+ "." + QString::number(FW_PATCH) + FW_SUFFIX + " ("+ commit+")");
});
setWindowTitle("VNA");
setWindowTitle("LibreVNA-GUI");
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
@ -429,6 +429,8 @@ nlohmann::json AppWindow::SaveSetup()
void AppWindow::LoadSetup(nlohmann::json j)
{
// auto d = new JSONPickerDialog(j);
// d->exec();
vna->fromJSON(j["VNA"]);
generator->fromJSON(j["Generator"]);
spectrumAnalyzer->fromJSON(j["SpectrumAnalyzer"]);

View File

@ -3,6 +3,7 @@
#include "Device/device.h"
#include <array>
#include <deque>
#include <complex>