diff --git a/source/PA_Calculator.pro b/source/PA_Calculator.pro index a138990..e971b4e 100644 --- a/source/PA_Calculator.pro +++ b/source/PA_Calculator.pro @@ -1,4 +1,4 @@ -QT += core gui multimedia +QT += core gui multimedia network concurrent greaterThan(QT_MAJOR_VERSION, 4): QT += widgets diff --git a/source/mainwindow.cpp b/source/mainwindow.cpp index fab8d4a..76727bf 100644 --- a/source/mainwindow.cpp +++ b/source/mainwindow.cpp @@ -10,12 +10,25 @@ #include #include "about.h" #include "analyzer.h" +#include +#include +#include +#include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); + + manager = new QNetworkAccessManager(); + + + checkUpdates(); + + m_ampCount=0; m_pCAmp=Q_NULLPTR; @@ -381,3 +394,37 @@ void MainWindow::on_checkBox_optimizeGain_stateChanged(int arg1) } } +void MainWindow::checkUpdates() +{ + QObject::connect(manager, &QNetworkAccessManager::finished, + this,&MainWindow::checkUpdatesFinished); + request.setUrl(QUrl("https://git.aldiserver.de/api/v1/repos/DKM-Tech/pa-calculator/releases?draft=false&pre-release=false&per_page=1&limit=1")); + manager->get(request); +} + +void MainWindow::checkUpdatesFinished(QNetworkReply *reply) +{ + if (reply->error()) { + //qDebug() << reply->errorString(); + return; + } + + QString ReplyText = reply->readAll(); + QJsonDocument doc = QJsonDocument::fromJson(ReplyText.toUtf8()); + QJsonArray array = doc.array(); + QJsonObject obj=array.at(0).toObject(); + QString current_version=obj.value("tag_name").toString().remove(0,1); + QString current_version_url=obj.value("html_url").toString(); + QString installed_version = APP_VERSION; + installed_version=installed_version.mid(0,installed_version.lastIndexOf('.')); + //qDebug() << "Neueste Version: " <Installierte Version: "+installed_version+"
Verfügbare Version: "+current_version+"
Du kannst das Update hier herunterladen."); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + } +} + diff --git a/source/mainwindow.h b/source/mainwindow.h index 4642821..e3e6869 100644 --- a/source/mainwindow.h +++ b/source/mainwindow.h @@ -6,6 +6,14 @@ #include "cspeaker.h" #include +#include +#include +#include +#include + +#include +#include + QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE @@ -18,6 +26,7 @@ public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); + private slots: void on_ComboBox_selectSensUnit_currentIndexChanged(int index); @@ -44,6 +53,9 @@ private slots: void on_checkBox_optimizeGain_stateChanged(int arg1); + + void checkUpdatesFinished(QNetworkReply *reply); + private: Ui::MainWindow *ui; cAmp* m_pCAmp; @@ -62,8 +74,12 @@ private: void refreshLibraryDacs(); + void checkUpdates(); void loadLibrary(); void saveLibrary(); + QNetworkAccessManager *manager; + QNetworkRequest request; + QFuture requestFuture; }; #endif // MAINWINDOW_H diff --git a/source/mainwindow.ui b/source/mainwindow.ui index 264eaac..8de65cc 100644 --- a/source/mainwindow.ui +++ b/source/mainwindow.ui @@ -324,29 +324,13 @@ - - + + - Load Speaker from library + Number of speaker in parallel - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -357,26 +341,16 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + - Number of speaker in parallel + Load Speaker from library + + + @@ -395,6 +369,19 @@ + + + + Qt::Vertical + + + + 20 + 10 + + + + @@ -466,12 +453,12 @@ Qt::Vertical - QSizePolicy::Maximum + QSizePolicy::Expanding 20 - 40 + 20 @@ -619,6 +606,7 @@ 15 + 75 true @@ -647,6 +635,9 @@ 0 ms + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + @@ -666,6 +657,9 @@ 0 ms + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + @@ -742,6 +736,7 @@ 15 + 75 true @@ -770,6 +765,9 @@ 0 ms + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + @@ -789,6 +787,9 @@ 0 ms + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + @@ -857,7 +858,7 @@ 0 0 1242 - 17 + 24