mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Add option to disable QSU (#6)
This commit is contained in:
parent
3bd194f3a4
commit
69a3d443a7
@ -20,9 +20,9 @@
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
# Make options
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
UI_DIR = uic
|
||||
MOC_DIR = moc
|
||||
@ -35,16 +35,16 @@ isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
# Qt configuration
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = serial-studio
|
||||
TEMPLATE = app # Project template
|
||||
TARGET = serial-studio # Set default target name
|
||||
CONFIG += resources_big # Avoid isses with large *.qrc
|
||||
CONFIG += qtquickcompiler # Pre-compile QML interface
|
||||
|
||||
CONFIG += qtc_runnable
|
||||
CONFIG += resources_big
|
||||
CONFIG += qtquickcompiler
|
||||
QTPLUGIN += qsvg # Fixes issues with windeployqt
|
||||
|
||||
QT += xml
|
||||
QT += sql
|
||||
@ -56,11 +56,9 @@ QT += widgets
|
||||
QT += serialport
|
||||
QT += quickcontrols2
|
||||
|
||||
QTPLUGIN += qsvg
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
# Compiler options
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
*g++*: {
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O
|
||||
@ -72,49 +70,49 @@ QTPLUGIN += qsvg
|
||||
QMAKE_CXXFLAGS_RELEASE *= /O2
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
# Libraries
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
include(libs/Libraries.pri)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
# Deploy options
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
win32* {
|
||||
TARGET = SerialStudio
|
||||
RC_FILE = deploy/windows/resources/info.rc
|
||||
TARGET = SerialStudio # Change target name
|
||||
RC_FILE = deploy/windows/resources/info.rc # Set applicaiton icon
|
||||
}
|
||||
|
||||
macx* {
|
||||
TARGET = SerialStudio
|
||||
ICON = deploy/macOS/icon.icns
|
||||
RC_FILE = deploy/macOS/icon.icns
|
||||
QMAKE_INFO_PLIST = deploy/macOS/info.plist
|
||||
CONFIG += sdk_no_version_check # To avoid warnings with Big Sur
|
||||
TARGET = SerialStudio # Change target name
|
||||
ICON = deploy/macOS/icon.icns # icon file
|
||||
RC_FILE = deploy/macOS/icon.icns # icon file
|
||||
QMAKE_INFO_PLIST = deploy/macOS/info.plist # Add info.plist file
|
||||
CONFIG += sdk_no_version_check # Avoid warnings with Big Sur
|
||||
}
|
||||
|
||||
target.path = $$PREFIX/bin
|
||||
|
||||
linux:!android {
|
||||
icon.path = $$PREFIX/share/pixmaps
|
||||
desktop.path = $$PREFIX/share/applications
|
||||
icon.files += deploy/linux/serial-studio.png
|
||||
desktop.files += deploy/linux/serial-studio.desktop
|
||||
|
||||
INSTALLS += target desktop icon
|
||||
icon.path = $$PREFIX/share/pixmaps # icon instalation path
|
||||
desktop.path = $$PREFIX/share/applications # *.desktop instalation path
|
||||
icon.files += deploy/linux/serial-studio.png # Add application icon
|
||||
desktop.files += deploy/linux/serial-studio.desktop # Add *.desktop file
|
||||
INSTALLS += target desktop icon # make install targets
|
||||
}
|
||||
|
||||
mingw {
|
||||
license.path = $$PREFIX/share/licenses/$$TARGET
|
||||
license.files += LICENSE.md
|
||||
INSTALLS += target license
|
||||
license.path = $$PREFIX/share/licenses/$$TARGET # Set license install path
|
||||
license.files += LICENSE.md # Add LICENSE.md file
|
||||
INSTALLS += target license # Install target+licence (MSYS2)
|
||||
DEFINES += DISABLE_QSU # Disable QSimpleUpdater (MSYS2)
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
# Import source code
|
||||
#-------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
INCLUDEPATH += src
|
||||
|
||||
|
@ -129,10 +129,12 @@ Window {
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
text: qsTr("Check for updates") + Cpp_Misc_Translator.dummy
|
||||
onClicked: {
|
||||
CppUpdater.setNotifyOnFinish(Cpp_AppUpdaterUrl, true)
|
||||
CppUpdater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
Cpp_Updater.setNotifyOnFinish(Cpp_AppUpdaterUrl, true)
|
||||
Cpp_Updater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,11 +170,11 @@ ApplicationWindow {
|
||||
|
||||
// Second launch ask user if he/she wants to enable automatic updates
|
||||
if (appLaunchStatus == 2)
|
||||
automaticUpdatesMessageDialog.visible = true
|
||||
automaticUpdatesMessageDialog.visible = Cpp_UpdaterEnabled
|
||||
|
||||
// Check for updates (if we are allowed)
|
||||
if (automaticUpdates)
|
||||
CppUpdater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
if (automaticUpdates && Cpp_UpdaterEnabled)
|
||||
Cpp_Updater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,7 +376,7 @@ ApplicationWindow {
|
||||
// Behavior when the user clicks on "Yes"
|
||||
onAccepted: {
|
||||
app.automaticUpdates = true
|
||||
CppUpdater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
Cpp_Updater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
}
|
||||
|
||||
// Behavior when the user clicks on "No"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <QString>
|
||||
|
||||
// clang-format off
|
||||
#define APP_VERSION "1.0.14"
|
||||
#define APP_VERSION "1.0.12"
|
||||
#define APP_DEVELOPER "Alex Spataru"
|
||||
#define APP_NAME "Serial Studio"
|
||||
#define APP_ICON ":/images/icon.png"
|
||||
|
@ -55,7 +55,7 @@
|
||||
*/
|
||||
ModuleManager::ModuleManager()
|
||||
{
|
||||
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(stopOperations()));
|
||||
connect(engine(), SIGNAL(quit()), this, SLOT(stopOperations()));
|
||||
LOG_INFO() << "Initialized module manager class";
|
||||
}
|
||||
|
||||
@ -82,6 +82,9 @@ void ModuleManager::configureLogger()
|
||||
*/
|
||||
void ModuleManager::configureUpdater()
|
||||
{
|
||||
if (!autoUpdaterEnabled())
|
||||
return;
|
||||
|
||||
LOG_INFO() << "Configuring QSimpleUpdater...";
|
||||
QSimpleUpdater::getInstance()->setNotifyOnUpdate(APP_UPDATER_URL, true);
|
||||
QSimpleUpdater::getInstance()->setNotifyOnFinish(APP_UPDATER_URL, false);
|
||||
@ -102,6 +105,22 @@ void ModuleManager::registerQmlTypes()
|
||||
qmlRegisterType<JSON::Dataset>("SerialStudio", 1, 0, "Dataset");
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the auto-updater system (QSimpleUpdater).
|
||||
*
|
||||
* To disable QSimpleUpdater, you need to add DEFINES += DISABLE_QSU in the qmake project
|
||||
* file. This option is provided for package managers, users are expected to update the
|
||||
* application using the same package manager they used for installing it.
|
||||
*/
|
||||
bool ModuleManager::autoUpdaterEnabled()
|
||||
{
|
||||
#ifdef DISABLE_QSU
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all the application modules, registers them with the QML engine and loads
|
||||
* the "main.qml" file as the root QML file.
|
||||
@ -123,9 +142,14 @@ void ModuleManager::initializeQmlInterface()
|
||||
auto jsonGenerator = JSON::Generator::getInstance();
|
||||
LOG_INFO() << "Finished initializing C++ modules";
|
||||
|
||||
// Retranslate the QML interface automagically
|
||||
connect(translator, &Misc::Translator::languageChanged,
|
||||
engine(), &QQmlEngine::retranslate);
|
||||
|
||||
// Register C++ modules with QML
|
||||
auto c = engine()->rootContext();
|
||||
c->setContextProperty("CppUpdater", updater);
|
||||
c->setContextProperty("Cpp_Updater", updater);
|
||||
c->setContextProperty("Cpp_UpdaterEnabled", autoUpdaterEnabled());
|
||||
c->setContextProperty("Cpp_Misc_Translator", translator);
|
||||
c->setContextProperty("Cpp_CSV_Export", csvExport);
|
||||
c->setContextProperty("Cpp_CSV_Player", csvPlayer);
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
void configureLogger();
|
||||
void configureUpdater();
|
||||
void registerQmlTypes();
|
||||
bool autoUpdaterEnabled();
|
||||
void initializeQmlInterface();
|
||||
|
||||
QQmlApplicationEngine *engine();
|
||||
|
Loading…
x
Reference in New Issue
Block a user