Serial-Studio/app/qml/main.qml

118 lines
2.8 KiB
QML
Raw Normal View History

2020-10-18 06:50:26 -05:00
/*
* Serial Studio - https://serial-studio.github.io/
2020-10-18 06:50:26 -05:00
*
* Copyright (C) 2020-2025 Alex Spataru <https://aspatru.com>
2020-10-18 06:50:26 -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
*
* 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
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 {
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
//
// 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-08-11 18:20:03 -05:00
// Main window + subdialogs
//
2024-08-11 18:20:03 -05:00
MainWindow.Root {
id: mainWindow
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
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
source: "qrc:/qml/Dialogs/About.qml"
2024-08-11 18:20:03 -05:00
}
DialogLoader {
id: acknowledgementsDialog
source: "qrc:/qml/Dialogs/Acknowledgements.qml"
}
2024-11-17 22:24:01 -05:00
DialogLoader {
id: fileTransmissionDialog
source: "qrc:/qml/Dialogs/FileTransmission.qml"
}
}
//
// Project Editor
//
ProjectEditor.Root {
id: projectEditor
}
//
// External console
//
DialogLoader {
id: externalConsole
source: "qrc:/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 }
2024-11-07 22:54:25 -05:00
function showProjectEditor() { projectEditor.displayWindow() }
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
}