From 728f2e9c7e02350ff8673948e8539a4fe3dbb142 Mon Sep 17 00:00:00 2001 From: Viktor Verebelyi Date: Wed, 15 Feb 2017 11:09:24 +0000 Subject: [PATCH 1/2] change RadioInterface exposed methods Changed the called functions of RadioInterface from slots to public Q_INVOKABLE and call them directly from QML. --- gui/QML/SettingsPage.qml | 10 +-- gui/QML/main.qml | 12 +-- gui/gui.cpp | 13 +-- gui/gui.h | 182 +++++++++++++++++++-------------------- 4 files changed, 100 insertions(+), 117 deletions(-) diff --git a/gui/QML/SettingsPage.qml b/gui/QML/SettingsPage.qml index cc602ac9..50b05f79 100644 --- a/gui/QML/SettingsPage.qml +++ b/gui/QML/SettingsPage.qml @@ -66,7 +66,7 @@ Item { onClicked: { startChannelScanButton.enabled = false stopChannelScanButton.enabled = true - mainWindow.startChannelScanClicked() + cppGUI.startChannelScanClick() } } @@ -79,7 +79,7 @@ Item { onClicked: { startChannelScanButton.enabled = true stopChannelScanButton.enabled = false - mainWindow.stopChannelScanClicked() + cppGUI.stopChannelScanClick() } } } @@ -126,14 +126,14 @@ Item { name: "Enable AGC" objectName: "enableAGC" checked: true - onChanged: mainWindow.inputEnableAGCChanged(valueChecked) + onChanged: cppGUI.inputEnableAGCChanged(valueChecked) } TouchSlider { id: gain enabled: !enableAGC.checked name: "Manual gain" - onValueChanged: mainWindow.inputGainChanged(valueGain) + onValueChanged: cppGUI.inputGainChanged(valueGain) } } } @@ -175,7 +175,7 @@ Item { TouchButton { id: exitAppButton text: "Exit welle.io" - onClicked: mainWindow.exitApplicationClicked() + onClicked: cppGUI.terminateProcess() Layout.preferredWidth: parent.width Layout.alignment: Qt.AlignBottom } diff --git a/gui/QML/main.qml b/gui/QML/main.qml index eb238225..95420bbb 100644 --- a/gui/QML/main.qml +++ b/gui/QML/main.qml @@ -47,14 +47,6 @@ import QtQuick.Layouts 1.1 import "style" ApplicationWindow { - signal stationClicked(string statio, string channel) - signal startChannelScanClicked - signal stopChannelScanClicked - signal exitApplicationClicked - signal exitSettingsClicked - signal inputEnableAGCChanged(bool valueChecked) - signal inputGainChanged(double valueGain) - id: mainWindow visible: true width: Units.dp(700) @@ -116,7 +108,7 @@ ApplicationWindow { onClicked: { if(stackView.depth > 1) { stackView.pop(); - exitSettingsClicked(); + cppGUI.saveSettings(); } else { @@ -202,7 +194,7 @@ ApplicationWindow { delegate: StationDelegate { stationNameText: stationName channelNameText: channelName - onClicked: mainWindow.stationClicked(stationName, channelName) + onClicked: cppGUI.channelClick(stationName, channelName) } } } diff --git a/gui/gui.cpp b/gui/gui.cpp index c9f6cd85..ae7138c1 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -151,15 +151,6 @@ RadioInterface::RadioInterface(QSettings *Si, showLicenseTextObject -> setProperty("text", FileContent); } - // Connect signals - connect(rootObject, SIGNAL(stationClicked(QString, QString)), this, SLOT(channelClick(QString, QString))); - connect(rootObject, SIGNAL(startChannelScanClicked(void)), this, SLOT(startChannelScanClick(void))); - connect(rootObject, SIGNAL(stopChannelScanClicked(void)), this, SLOT(stopChannelScanClick(void))); - connect(rootObject, SIGNAL(exitApplicationClicked(void)), this, SLOT(TerminateProcess(void))); - connect(rootObject, SIGNAL(exitSettingsClicked(void)), this, SLOT(saveSettings(void))); - connect(rootObject, SIGNAL(inputEnableAGCChanged(bool)), this, SLOT(inputEnableAGCChange(bool))); - connect(rootObject, SIGNAL(inputGainChanged(double)), this, SLOT(inputGainChange(double))); - // the name of the device is passed on from the main program if(!setDevice(input_device)) emit showErrorMessage("Error while opening input device \"" + device + "\""); @@ -863,11 +854,11 @@ void RadioInterface::setStart(void) } /** - * \brief TerminateProcess + * \brief terminateProcess * Pretty critical, since there are many threads involved * A clean termination is what is needed, regardless of the GUI */ -void RadioInterface::TerminateProcess(void) +void RadioInterface::terminateProcess(void) { running = false; inputDevice -> stopReader(); // might be concurrent diff --git a/gui/gui.h b/gui/gui.h index cf6d4062..6e305c85 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -6,7 +6,7 @@ * * This file is part of the SDR-J. * Many of the ideas as implemented in SDR-J are derived from - * other work, made available through the GNU general Public License. + * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * SDR-J is free software; you can redistribute it and/or modify @@ -60,12 +60,12 @@ class ficHandler; class common_fft; typedef enum { - ScanStart, - ScanTunetoChannel, - ScanCheckSignal, - ScanWaitForFIC, - ScanWaitForChannelNames, - ScanDone + ScanStart, + ScanTunetoChannel, + ScanCheckSignal, + ScanWaitForFIC, + ScanWaitForChannelNames, + ScanDone } tScanChannelState; /* @@ -76,54 +76,61 @@ class RadioInterface: public QObject{ Q_OBJECT public: - RadioInterface (QSettings *, - QString, - uint8_t, - QString, - QObject *parent = NULL); - ~RadioInterface (); + RadioInterface (QSettings *, + QString, + uint8_t, + QString, + QObject *parent = NULL); + ~RadioInterface (); + Q_INVOKABLE void channelClick (QString, QString); + Q_INVOKABLE void startChannelScanClick (void); + Q_INVOKABLE void stopChannelScanClick (void); + Q_INVOKABLE void saveSettings (void); + Q_INVOKABLE void inputEnableAGCChange (bool checked); + Q_INVOKABLE void inputGainChange (double gain); + Q_INVOKABLE void terminateProcess (void); private: - QSettings *dabSettings; - QQmlApplicationEngine *engine; - bool autoStart; - int16_t threshold; - void setModeParameters (uint8_t); - DabParams dabModeParameters; - uint8_t isSynced; - uint8_t dabBand; - bool running; - virtualInput *inputDevice; - ofdmProcessor *my_ofdmProcessor; - ficHandler *my_ficHandler; - mscHandler *my_mscHandler; - audioBase *soundOut; - RingBuffer *audioBuffer; + QSettings *dabSettings; + QQmlApplicationEngine *engine; + bool autoStart; + int16_t threshold; + void setModeParameters (uint8_t); + DabParams dabModeParameters; + uint8_t isSynced; + uint8_t dabBand; + bool running; + virtualInput *inputDevice; + ofdmProcessor *my_ofdmProcessor; + ficHandler *my_ficHandler; + mscHandler *my_mscHandler; + audioBase *soundOut; + RingBuffer *audioBuffer; common_fft *spectrum_fft_handler; - bool autoCorrector; + bool autoCorrector; const char *get_programm_type_string (uint8_t); const char *get_programm_language_string (uint8_t); - void dumpControlState (QSettings *); + void dumpControlState (QSettings *); - QTimer CheckFICTimer; - QTimer ScanChannelTimer; + QTimer CheckFICTimer; + QTimer ScanChannelTimer; QTimer StationTimer; - QString currentChannel; - QString CurrentStation; - QString CurrentDevice; - - bool isFICCRC; - bool isSignalPresent; - bool scanMode; - int BandIIIChannelIt; - int LBandChannelIt; - tScanChannelState ScanChannelState; - StationList stationList; - QVector spectrum_data; - int coarseCorrector; - int fineCorrector; - bool setDevice (QString); - QString nextChannel (QString currentChannel); + QString currentChannel; + QString CurrentStation; + QString CurrentDevice; + + bool isFICCRC; + bool isSignalPresent; + bool scanMode; + int BandIIIChannelIt; + int LBandChannelIt; + tScanChannelState ScanChannelState; + StationList stationList; + QVector spectrum_data; + int coarseCorrector; + int fineCorrector; + bool setDevice (QString); + QString nextChannel (QString currentChannel); QString input_device; MOTImageProvider *MOTImage; int32_t tunedFrequency; @@ -131,70 +138,63 @@ const char *get_programm_language_string (uint8_t); int CurrentFrameErrors; public slots: - void end_of_waiting_for_stations (void); - void set_fineCorrectorDisplay (int); - void set_coarseCorrectorDisplay (int); - void clearEnsemble (void); - void addtoEnsemble (const QString &); - void nameofEnsemble (int, const QString &); + void end_of_waiting_for_stations (void); + void set_fineCorrectorDisplay (int); + void set_coarseCorrectorDisplay (int); + void clearEnsemble (void); + void addtoEnsemble (const QString &); + void nameofEnsemble (int, const QString &); void show_frameErrors (int); void show_rsErrors (int); void show_aacErrors (int); void show_ficSuccess (bool); - void show_snr (int); - void setSynced (char); - void showLabel (QString); - void showMOT (QByteArray, int, QString); - void sendDatagram (char *, int); - void changeinConfiguration (void); - void newAudio (int); + void show_snr (int); + void setSynced (char); + void showLabel (QString); + void showMOT (QByteArray, int, QString); + void sendDatagram (char *, int); + void changeinConfiguration (void); + void newAudio (int); // - void show_mscErrors (int); - void show_ipErrors (int); - void setStereo (bool isStereo); + void show_mscErrors (int); + void show_ipErrors (int); + void setStereo (bool isStereo); void setSignalPresent (bool isSignal); - void displayDateTime (int *DateTime); - void updateSpectrum (QAbstractSeries *series); + void displayDateTime (int *DateTime); + void updateSpectrum (QAbstractSeries *series); void setErrorMessage (QString ErrorMessage); private slots: // // Somehow, these must be connected to the GUI // We assume that any GUI will need these three: - void setStart (void); - void TerminateProcess (void); - void set_channelSelect (QString); - void updateTimeDisplay (void); - void autoCorrector_on (void); + void setStart (void); + void set_channelSelect (QString); + void updateTimeDisplay (void); + void autoCorrector_on (void); - void CheckFICTimerTimeout (void); + void CheckFICTimerTimeout (void); void StationTimerTimeout (void); - void channelClick (QString, QString); - void startChannelScanClick (void); - void stopChannelScanClick (void); - void saveSettings (void); - void inputEnableAGCChange (bool checked); - void inputGainChange (double gain); signals: - void currentStation (QString text); - void stationText (QString text); + void currentStation (QString text); + void stationText (QString text); void syncFlag (bool active); void ficFlag (bool active); - void dabType (QString text); - void audioType (QString text); - void bitrate (int bitrate); - void stationType (QString text); - void languageType (QString text); - void signalPower (int power); + void dabType (QString text); + void audioType (QString text); + void bitrate (int bitrate); + void stationType (QString text); + void languageType (QString text); + void signalPower (int power); void motChanged (void); - void channelScanStopped (void); - void channelScanProgress (int progress); - void foundChannelCount (int channelCount); + void channelScanStopped (void); + void channelScanProgress (int progress); + void foundChannelCount (int channelCount); void newDateTime (int Year, int Month, int Day, int Hour, int Minute); void setYAxisMax (qreal max); void setXAxisMinMax (qreal min, qreal max); - void displayFreqCorr (int Freq); - void displayMSCErrors (int Errors); + void displayFreqCorr (int Freq); + void displayMSCErrors (int Errors); void displayCurrentChannel (QString Channel, int Frequency); void displayFrameErrors (int Errors); void displayRSErrors (int Errors); From c5b37b8e603ee9204c320e78638a07f9eb195286 Mon Sep 17 00:00:00 2001 From: Viktor Verebelyi Date: Wed, 15 Feb 2017 12:44:11 +0000 Subject: [PATCH 2/2] Load and launch QQmlApplicationEngine from main() rather than RadioInterface Appropriate changes have been made to the RadioInterface and QML files --- gui/QML/InfoPage.qml | 6 +- gui/QML/SettingsPage.qml | 7 +- gui/QML/main.qml | 13 ++-- gui/gui.cpp | 141 +++++++++++---------------------------- gui/gui.h | 14 +++- main.cpp | 12 +++- 6 files changed, 78 insertions(+), 115 deletions(-) diff --git a/gui/QML/InfoPage.qml b/gui/QML/InfoPage.qml index dda5ea42..bb2fb584 100644 --- a/gui/QML/InfoPage.qml +++ b/gui/QML/InfoPage.qml @@ -27,7 +27,7 @@ Item { TextStandart { id: showVersionText - text: "welle.io version" + text: cppGUI.licenses.version Layout.alignment: Qt.AlignLeft objectName: "showVersionText" } @@ -40,7 +40,7 @@ Item { TextStandart { id: showGraphLicense - text: "showGraphLicense" + text: cppGUI.licenses.graphLicense Layout.alignment: Qt.AlignLeft objectName: "showGraphLicense" wrapMode: Text.Wrap @@ -50,7 +50,7 @@ Item { TextStandart { id: showLicenseText - text: "showLicenseText" + text: cppGUI.licenses.license Layout.alignment: Qt.AlignLeft objectName: "showLicenseText" wrapMode: Text.WrapAnywhere diff --git a/gui/QML/SettingsPage.qml b/gui/QML/SettingsPage.qml index 50b05f79..d3041e71 100644 --- a/gui/QML/SettingsPage.qml +++ b/gui/QML/SettingsPage.qml @@ -1,17 +1,22 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 +import Qt.labs.settings 1.0 // Import custom styles import "style" Item { id: settingsPage - property alias showChannelState : enableExpertMode.checked property alias enableFullScreenState : enableFullScreen.checked property alias enableExpertModeState : enableExpertMode.checked + Settings { + property alias enableFullScreenState : settingsPage.enableFullScreenState + property alias enableExpertModeState : settingsPage.enableExpertModeState + } + Connections{ target: cppGUI onChannelScanStopped:{ diff --git a/gui/QML/main.qml b/gui/QML/main.qml index 95420bbb..4110f442 100644 --- a/gui/QML/main.qml +++ b/gui/QML/main.qml @@ -42,6 +42,7 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.1 +import Qt.labs.settings 1.0 // Import custom styles import "style" @@ -53,6 +54,10 @@ ApplicationWindow { height: Units.dp(500) visibility: settingsPageLoader.settingsPage.enableFullScreenState ? "FullScreen" : "Windowed" + Settings { + property alias width : mainWindow.width + property alias height : mainWindow.height + } Loader { id: settingsPageLoader anchors.topMargin: Units.dp(10) @@ -189,12 +194,12 @@ ApplicationWindow { anchors.bottomMargin: 0 anchors.leftMargin: 0 anchors.topMargin: 0 - model: stationModel + model: cppGUI.stationModel anchors.fill: parent delegate: StationDelegate { - stationNameText: stationName - channelNameText: channelName - onClicked: cppGUI.channelClick(stationName, channelName) + stationNameText: modelData.stationName + channelNameText: modelData.channelName + onClicked: cppGUI.channelClick(modelData.stationName, modelData.channelName) } } } diff --git a/gui/gui.cpp b/gui/gui.cpp index ae7138c1..537d0b59 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -72,10 +72,6 @@ RadioInterface::RadioInterface(QSettings *Si, int16_t latency = dabSettings -> value("latency", 1). toInt(); // latency is used to allow different settings for different situations wrt the output buffering threshold = dabSettings -> value("threshold", 3). toInt(); // threshold is used in the phaseReference class as threshold for checking the validity of the correlation result autoStart = dabSettings -> value("autoStart", 0). toInt() != 0; - int WindowHeight = dabSettings -> value("WindowHeight", 0). toInt(); - int WindowWidth = dabSettings -> value("WindowWidth", 0). toInt(); - bool isFullscreen = dabSettings -> value("StartInFullScreen", false). toBool(); - bool isExpertMode = dabSettings-> value("EnableExpertMode", false). toBool(); // Read channels from the settings dabSettings -> beginGroup("channels"); @@ -88,68 +84,11 @@ RadioInterface::RadioInterface(QSettings *Si, dabSettings -> endGroup(); stationList. sort(); - // Create new QML application, set some requried options and load the QML file - engine = new QQmlApplicationEngine; - QQmlContext *rootContext = engine -> rootContext(); - rootContext -> setContextProperty("cppGUI", this); - rootContext -> setContextProperty("stationModel", QVariant::fromValue(stationList.getList())); - engine->load(QUrl("qrc:/QML/main.qml")); - QObject *rootObject = engine -> rootObjects().first(); - - // Set some properties - if(WindowHeight != 0) rootObject -> setProperty ("height", WindowHeight); - if(WindowWidth != 0)rootObject -> setProperty ("width", WindowWidth); + p_stationModel = QVariant::fromValue(stationList.getList()); + emit stationModelChanged(); // Add image provider for the MOT slide show MOTImage = new MOTImageProvider; - engine->addImageProvider(QLatin1String("motslideshow"), MOTImage); - - - // Restore the full screen property - QObject *enableFullScreenObject = rootObject -> findChild ("enableFullScreen"); - if(enableFullScreenObject != NULL) - enableFullScreenObject -> setProperty("checked", isFullscreen); - - // Restore expert mode - QObject *expertModeObject = rootObject -> findChild ("enableExpertMode"); - if(expertModeObject != NULL) - expertModeObject -> setProperty("checked", isExpertMode); - - // Set application version - QObject *showVersionTextObject = rootObject -> findChild ("showVersionText"); - if(showVersionTextObject != NULL) - { - QString InfoText; - InfoText += "welle.io version: " + QString(CURRENT_VERSION) + "\n"; - InfoText += "Build on: " + QString(__TIMESTAMP__); - showVersionTextObject -> setProperty("text", InfoText); - } - - // Set graph license - QObject *showGraphLicenseObject = rootObject -> findChild ("showGraphLicense"); - if(showGraphLicenseObject != NULL) - { - // Read license - QFile File(":/QML/images/NOTICE.txt"); - File.open(QFile::ReadOnly); - QByteArray FileContent = File.readAll(); - - // Set license content - showGraphLicenseObject -> setProperty("text", FileContent); - } - - // Set license - QObject *showLicenseTextObject = rootObject -> findChild ("showLicenseText"); - if(showLicenseTextObject != NULL) - { - // Read license - QFile File(":/license"); - File.open(QFile::ReadOnly); - QByteArray FileContent = File.readAll(); - - // Set license content - showLicenseTextObject -> setProperty("text", FileContent); - } // the name of the device is passed on from the main program if(!setDevice(input_device)) @@ -205,6 +144,34 @@ RadioInterface::~RadioInterface() { fprintf(stderr, "deleting radioInterface\n"); } +/** + * \brief returns the licenses for all the relative libraries plus application version information + */ +const QVariantMap RadioInterface::licenses(){ + QVariantMap ret; + // Set application version + QString InfoText; + InfoText += "welle.io version: " + QString(CURRENT_VERSION) + "\n"; + InfoText += "Build on: " + QString(__TIMESTAMP__); + ret.insert("version", InfoText); + + // Read graph license + QFile File(":/QML/images/NOTICE.txt"); + File.open(QFile::ReadOnly); + QByteArray FileContent = File.readAll(); + + // Set graph license content + ret.insert("graphLicense", FileContent); + + // Read license + QFile File2(":/license"); + File2.open(QFile::ReadOnly); + QByteArray FileContent2 = File2.readAll(); + + // Set license content + ret.insert("license", FileContent2); + return ret; +} /** * \brief At the end, we might save some GUI values @@ -231,37 +198,6 @@ void RadioInterface::dumpControlState(QSettings *s) s -> setValue("channel/" + QString::number(i), stationList. getStationAt(i - 1)); dabSettings -> endGroup(); - - // Read settings from GUI - // Take the root object - QObject *rootObject = engine -> rootObjects(). first(); - - // Save the windows properties - int WindowWidth = rootObject -> property("width"). toInt(); - s -> setValue("WindowWidth", WindowWidth); - int WindowHeight = rootObject -> property("height"). toInt(); - s -> setValue("WindowHeight", WindowHeight); - // Access the full screen mode switch - QObject *enableFullScreenObject = - rootObject -> findChild("enableFullScreen"); - if(enableFullScreenObject != NULL) - { - bool isFullScreen = - enableFullScreenObject -> property("checked").toBool(); - // Save the setting - s -> setValue("StartInFullScreen", isFullScreen); - } - - // Access to the enable expert mode switch - QObject *expertModeObject = - rootObject -> findChild ("enableExpertMode"); - if(expertModeObject != NULL) - { - bool isExpertMode = - expertModeObject->property("checked"). toBool(); - // Save the setting - s -> setValue("EnableExpertMode", isExpertMode); - } } // /// the values for the different Modes: @@ -719,11 +655,11 @@ void RadioInterface::stopChannelScanClick(void) scanMode = false; emit currentStation("No Station"); + // Sort stations stationList. sort(); - QQmlContext *rootContext = engine -> rootContext(); - rootContext -> setContextProperty("stationModel", - QVariant::fromValue(stationList. getList())); + p_stationModel = QVariant::fromValue(stationList.getList()); + emit stationModelChanged(); } QString RadioInterface::nextChannel(QString currentChannel) @@ -763,9 +699,9 @@ void RadioInterface::setSignalPresent(bool isSignal) emit currentStation("No Station"); // Sort stations stationList. sort(); - QQmlContext *rootContext = engine -> rootContext(); - rootContext -> setContextProperty("stationModel", - QVariant::fromValue(stationList. getList())); + + p_stationModel = QVariant::fromValue(stationList.getList()); + emit stationModelChanged(); return; } set_channelSelect(currentChannel); @@ -793,9 +729,8 @@ void RadioInterface::end_of_waiting_for_stations(void) emit currentStation("No Station"); // Sort stations stationList. sort(); - QQmlContext *rootContext = engine -> rootContext(); - rootContext -> setContextProperty("stationModel", - QVariant::fromValue(stationList. getList())); + p_stationModel = QVariant::fromValue(stationList.getList()); + emit stationModelChanged(); return; } set_channelSelect(currentChannel); diff --git a/gui/gui.h b/gui/gui.h index 6e305c85..23aba643 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -42,6 +42,7 @@ #include #include +#include using namespace QtCharts; #include "stationlist.h" @@ -73,7 +74,9 @@ typedef enum { * QDialog and the generated form */ class RadioInterface: public QObject{ -Q_OBJECT + Q_OBJECT + Q_PROPERTY(QVariant stationModel READ stationModel NOTIFY stationModelChanged) + Q_PROPERTY(QVariant licenses READ licenses CONSTANT) public: RadioInterface (QSettings *, @@ -89,10 +92,13 @@ Q_OBJECT Q_INVOKABLE void inputEnableAGCChange (bool checked); Q_INVOKABLE void inputGainChange (double gain); Q_INVOKABLE void terminateProcess (void); + QVariant stationModel() const { + return p_stationModel; + } + MOTImageProvider *MOTImage; private: QSettings *dabSettings; - QQmlApplicationEngine *engine; bool autoStart; int16_t threshold; void setModeParameters (uint8_t); @@ -108,6 +114,7 @@ Q_OBJECT RingBuffer *audioBuffer; common_fft *spectrum_fft_handler; bool autoCorrector; + const QVariantMap licenses(); const char *get_programm_type_string (uint8_t); const char *get_programm_language_string (uint8_t); void dumpControlState (QSettings *); @@ -132,10 +139,10 @@ const char *get_programm_language_string (uint8_t); bool setDevice (QString); QString nextChannel (QString currentChannel); QString input_device; - MOTImageProvider *MOTImage; int32_t tunedFrequency; int LastCurrentManualGain; int CurrentFrameErrors; + QVariant p_stationModel; public slots: void end_of_waiting_for_stations (void); @@ -200,6 +207,7 @@ private slots: void displayRSErrors (int Errors); void displayAACErrors (int Errors); void showErrorMessage (QString Text); + void stationModelChanged (); }; #endif diff --git a/main.cpp b/main.cpp index 4d6f68c9..c6e5d576 100644 --- a/main.cpp +++ b/main.cpp @@ -301,7 +301,17 @@ uint16_t ipPort = 1234; #if QT_VERSION >= 0x050600 QGuiApplication::setAttribute (Qt::AA_EnableHighDpiScaling); -#endif +#endif + + QQmlApplicationEngine *engine; + + // Create new QML application, set some requried options and load the QML file + engine = new QQmlApplicationEngine; + QQmlContext *rootContext = engine -> rootContext(); + rootContext -> setContextProperty("cppGUI", MyRadioInterface); + engine->load(QUrl("qrc:/QML/main.qml")); + engine->addImageProvider(QLatin1String("motslideshow"), MyRadioInterface->MOTImage); + a. exec (); /* * done: