2020-10-18 06:50:26 -05:00
|
|
|
/*
|
2025-01-01 15:06:49 -05:00
|
|
|
* Serial Studio - https://serial-studio.github.io/
|
2020-10-18 06:50:26 -05:00
|
|
|
*
|
2025-01-01 15:06:49 -05:00
|
|
|
* Copyright (C) 2020-2025 Alex Spataru <https://aspatru.com>
|
2020-10-18 06:50:26 -05:00
|
|
|
*
|
2025-01-01 15:06:49 -05:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2020-10-18 06:50:26 -05:00
|
|
|
*
|
2025-01-01 15:06:49 -05:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later OR Commercial
|
2020-10-18 06:50:26 -05:00
|
|
|
*/
|
|
|
|
|
2022-05-02 04:31:32 -05:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Window
|
|
|
|
import QtQuick.Controls
|
2021-11-09 14:30:59 -06:00
|
|
|
|
2024-10-27 05:38:58 -05:00
|
|
|
import "Widgets" as Widgets
|
2024-08-11 18:20:03 -05:00
|
|
|
import "Dialogs" as Dialogs
|
2024-08-10 12:58:21 -05:00
|
|
|
import "MainWindow" as MainWindow
|
|
|
|
import "ProjectEditor" as ProjectEditor
|
2021-09-25 21:48:06 -05:00
|
|
|
|
2021-09-05 02:41:48 -05:00
|
|
|
Item {
|
2024-05-05 00:20:10 -05:00
|
|
|
id: app
|
2021-09-25 21:48:06 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
//
|
|
|
|
// Check for updates (non-silent mode)
|
|
|
|
//
|
|
|
|
function checkForUpdates() {
|
|
|
|
Cpp_Updater.setNotifyOnFinish(Cpp_AppUpdaterUrl, true)
|
|
|
|
Cpp_Updater.checkForUpdates(Cpp_AppUpdaterUrl)
|
|
|
|
}
|
2021-09-25 21:48:06 -05:00
|
|
|
|
2024-10-27 05:38:58 -05:00
|
|
|
//
|
|
|
|
// Ask the user to save the project file before closing the app
|
|
|
|
//
|
|
|
|
function handleClose(close) {
|
|
|
|
close.accepted = false
|
|
|
|
if (Cpp_JSON_ProjectModel.askSave()) {
|
|
|
|
close.accepted = true
|
|
|
|
Qt.quit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
//
|
2024-08-11 18:20:03 -05:00
|
|
|
// Main window + subdialogs
|
2024-05-05 00:20:10 -05:00
|
|
|
//
|
2024-08-11 18:20:03 -05:00
|
|
|
MainWindow.Root {
|
|
|
|
id: mainWindow
|
2024-10-27 05:38:58 -05:00
|
|
|
onClosing: (close) => app.handleClose(close)
|
2024-08-11 18:20:03 -05:00
|
|
|
|
2024-09-25 18:09:13 -05:00
|
|
|
Dialogs.IconPicker {
|
|
|
|
id: actionIconPicker
|
|
|
|
}
|
|
|
|
|
2024-08-11 18:20:03 -05:00
|
|
|
Dialogs.CsvPlayer {
|
|
|
|
id: csvPlayer
|
2021-09-25 21:48:06 -05:00
|
|
|
}
|
|
|
|
|
2024-08-11 18:20:03 -05:00
|
|
|
Dialogs.Donate {
|
|
|
|
id: donateDialog
|
2021-09-25 21:48:06 -05:00
|
|
|
}
|
|
|
|
|
2024-08-11 18:20:03 -05:00
|
|
|
DialogLoader {
|
|
|
|
id: mqttConfiguration
|
2024-11-11 10:08:26 -05:00
|
|
|
source: "qrc:/qml/Dialogs/MQTTConfiguration.qml"
|
2021-09-25 21:48:06 -05:00
|
|
|
}
|
|
|
|
|
2024-08-11 18:20:03 -05:00
|
|
|
DialogLoader {
|
|
|
|
id: aboutDialog
|
2024-11-11 10:08:26 -05:00
|
|
|
source: "qrc:/qml/Dialogs/About.qml"
|
2024-08-11 18:20:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
DialogLoader {
|
|
|
|
id: acknowledgementsDialog
|
2024-11-11 10:08:26 -05:00
|
|
|
source: "qrc:/qml/Dialogs/Acknowledgements.qml"
|
2021-01-20 10:31:27 -05:00
|
|
|
}
|
2024-11-17 22:24:01 -05:00
|
|
|
|
|
|
|
DialogLoader {
|
|
|
|
id: fileTransmissionDialog
|
|
|
|
source: "qrc:/qml/Dialogs/FileTransmission.qml"
|
|
|
|
}
|
2024-05-05 00:20:10 -05:00
|
|
|
}
|
2021-11-07 01:57:30 -06:00
|
|
|
|
2024-08-29 13:51:17 -05:00
|
|
|
//
|
|
|
|
// Project Editor
|
|
|
|
//
|
|
|
|
ProjectEditor.Root {
|
|
|
|
id: projectEditor
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// External console
|
|
|
|
//
|
|
|
|
DialogLoader {
|
|
|
|
id: externalConsole
|
2024-11-11 10:08:26 -05:00
|
|
|
source: "qrc:/qml/Dialogs/ExternalConsole.qml"
|
2024-08-29 13:51:17 -05:00
|
|
|
}
|
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
//
|
2024-08-11 18:20:03 -05:00
|
|
|
// Dialog display functions
|
2024-05-05 00:20:10 -05:00
|
|
|
//
|
2024-08-11 18:20:03 -05:00
|
|
|
function showAboutDialog() { aboutDialog.active = true }
|
2024-11-07 22:54:25 -05:00
|
|
|
function showProjectEditor() { projectEditor.displayWindow() }
|
2024-08-29 13:51:17 -05:00
|
|
|
function showExternalConsole() { externalConsole.active = true }
|
2024-08-11 18:20:03 -05:00
|
|
|
function showMqttConfiguration() { mqttConfiguration.active = true }
|
|
|
|
function showAcknowledgements() { acknowledgementsDialog.active = true }
|
2024-11-17 22:24:01 -05:00
|
|
|
function showFileTransmission() { fileTransmissionDialog.active = true }
|
2020-10-18 06:50:26 -05:00
|
|
|
}
|