Serial-Studio/app/qml/main.qml

107 lines
2.9 KiB
QML
Raw Normal View History

2020-10-18 06:50:26 -05:00
/*
2023-01-22 23:51:35 -06:00
* Copyright (c) 2020-2023 Alex Spataru <https://github.com/alex-spataru>
2020-10-18 06:50:26 -05:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
2022-05-02 04:31:32 -05:00
import QtQuick
import QtQuick.Window
import QtQuick.Controls
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 {
id: app
2021-09-25 21:48:06 -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-08-11 18:20:03 -05:00
// Main window + subdialogs
//
2024-08-11 18:20:03 -05:00
MainWindow.Root {
id: mainWindow
2024-09-18 21:48:57 -05:00
onClosing: (close) => {
close.accepted = false
if (Cpp_JSON_ProjectModel.askSave()) {
2024-09-18 21:48:57 -05:00
close.accepted = true
Qt.quit()
}
}
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
source: "qrc:/app/qml/Dialogs/MQTTConfiguration.qml"
2021-09-25 21:48:06 -05:00
}
2024-08-11 18:20:03 -05:00
DialogLoader {
id: aboutDialog
source: "qrc:/app/qml/Dialogs/About.qml"
}
DialogLoader {
id: acknowledgementsDialog
source: "qrc:/app/qml/Dialogs/Acknowledgements.qml"
}
}
//
// Project Editor
//
ProjectEditor.Root {
id: projectEditor
}
//
// External console
//
DialogLoader {
id: externalConsole
source: "qrc:/app/qml/Dialogs/ExternalConsole.qml"
}
//
2024-08-11 18:20:03 -05:00
// Dialog display functions
//
2024-08-11 18:20:03 -05:00
function showAboutDialog() { aboutDialog.active = true }
function showProjectEditor() { projectEditor.showNormal() }
function showExternalConsole() { externalConsole.active = true }
2024-08-11 18:20:03 -05:00
function showMqttConfiguration() { mqttConfiguration.active = true }
function showAcknowledgements() { acknowledgementsDialog.active = true }
2020-10-18 06:50:26 -05:00
}