mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-15 05:22:53 +08:00
Add menubar
This commit is contained in:
parent
da16abd7cf
commit
2557711523
@ -120,6 +120,9 @@ RESOURCES += \
|
||||
assets/assets.qrc
|
||||
|
||||
DISTFILES += \
|
||||
assets/qml/PlatformDependent/DecentMenuItem.qml \
|
||||
assets/qml/PlatformDependent/Menubar.qml \
|
||||
assets/qml/PlatformDependent/MenubarMacOS.qml \
|
||||
assets/qml/SetupPanes/Network.qml \
|
||||
assets/qml/SetupPanes/Serial.qml \
|
||||
assets/qml/SetupPanes/Settings.qml \
|
||||
|
@ -89,5 +89,8 @@
|
||||
<file>qml/SetupPanes/Serial.qml</file>
|
||||
<file>qml/SetupPanes/Settings.qml</file>
|
||||
<file>icons/search.svg</file>
|
||||
<file>qml/PlatformDependent/MenubarMacOS.qml</file>
|
||||
<file>qml/PlatformDependent/Menubar.qml</file>
|
||||
<file>qml/PlatformDependent/DecentMenuItem.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -24,11 +24,5 @@ MCU-Projekten, lesen Sie bitte das Wiki:
|
||||
|
||||
→ https://github.com/Serial-Studio/Serial-Studio/wiki
|
||||
|
||||
Tastatürkürzel:
|
||||
|
||||
Ctrl + S Konsolenpuffer speichern Ctrl + T Konsole anzeigen
|
||||
Ctrl + O CSV-Datei abspielen Ctrl + D Dashboard anzeigen
|
||||
Ctrl + , Setup-Bereich umschalten Ctrl + W Widgets anzeigen
|
||||
|
||||
Tipp: Doppelklicken Sie auf eine Gruppe, ein Diagramm oder ein Widget, um es in
|
||||
einem anderen Fenster anzuzeigen.
|
||||
|
@ -22,10 +22,4 @@ the wiki:
|
||||
|
||||
→ https://github.com/Serial-Studio/Serial-Studio/wiki
|
||||
|
||||
Keyboard shortcuts:
|
||||
|
||||
Ctrl + S Save console buffer Ctrl + T Show console tab
|
||||
Ctrl + O Open CSV file for playback Ctrl + D Show dashboard tab
|
||||
Ctrl + , Toggle setup pane Ctrl + W Show widgets tab
|
||||
|
||||
Tip: Double-click on any group, chart or widget to view it in another window.
|
||||
|
@ -22,11 +22,5 @@ actuales, por favor lea la wiki:
|
||||
|
||||
→ https://github.com/Serial-Studio/Serial-Studio/wiki
|
||||
|
||||
Atajos de teclado:
|
||||
|
||||
Ctrl + S Guardar salida de la consola Ctrl + T Mostrar la consola
|
||||
Ctrl + O Reproducir archivo CSV Ctrl + D Mostrar el dashboard
|
||||
Ctrl + , Mostar panel de configuración Ctrl + W Mostrar los widgets
|
||||
|
||||
Consejo: haga doble clic en cualquier grupo, gráfico o widget para verlo en
|
||||
otra ventana.
|
||||
|
@ -17,10 +17,4 @@ ____/ // __/ / _ / / /_/ /_ / ____/ // /_ / /_/ // /_/ / _ / / /_/ /
|
||||
|
||||
→ https://github.com/Serial-Studio/Serial-Studio/wiki
|
||||
|
||||
键盘快捷键:
|
||||
|
||||
Ctrl + S 保存控制台缓冲区 Ctrl + T 显示控制台标签
|
||||
Ctrl + O 打开CSV文件进行播放 Ctrl + D 显示仪表板选项卡
|
||||
Ctrl + , 切换设置窗格 Ctrl + W 显示小部件选项卡
|
||||
|
||||
提示:双击任何组,图表或小部件以在另一个窗口中查看它。
|
||||
|
64
assets/qml/PlatformDependent/DecentMenuItem.qml
Normal file
64
assets/qml/PlatformDependent/DecentMenuItem.qml
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Alex Spataru <https://github.com/alex-spataru>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
MenuItem {
|
||||
id: root
|
||||
|
||||
property alias sequence: _shortcut.sequence
|
||||
property bool indicatorVisible: root.icon.source.length > 0 || root.checkable
|
||||
|
||||
Shortcut {
|
||||
id: _shortcut
|
||||
enabled: root.enabled
|
||||
onActivated: root.triggered()
|
||||
}
|
||||
|
||||
contentItem: RowLayout {
|
||||
spacing: 0
|
||||
width: root.width
|
||||
opacity: root.enabled ? 1 : 0.5
|
||||
|
||||
Item {
|
||||
width: root.indicatorVisible ? root.indicator.width + 4 : 0
|
||||
}
|
||||
|
||||
Label {
|
||||
text: root.text
|
||||
Layout.fillWidth: true
|
||||
elide: Label.ElideRight
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
text: _shortcut.nativeText
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
358
assets/qml/PlatformDependent/Menubar.qml
Normal file
358
assets/qml/PlatformDependent/Menubar.qml
Normal file
@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Alex Spataru <https://github.com/alex-spataru>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
MenuBar {
|
||||
id: root
|
||||
|
||||
//
|
||||
// Set background color + border
|
||||
//
|
||||
background: Rectangle {
|
||||
border.width: 1
|
||||
border.color: palette.midlight
|
||||
color: Qt.lighter(app.windowBackgroundColor)
|
||||
}
|
||||
|
||||
//
|
||||
// Set this component as the application's default menubar upon creation
|
||||
//
|
||||
Component.onCompleted: app.menuBar = this
|
||||
|
||||
//
|
||||
// File menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("File")
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: "ctrl+j"
|
||||
text: qsTr("Select JSON file") + "..."
|
||||
onTriggered: Cpp_JSON_Generator.loadJsonMap()
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
Menu {
|
||||
title: qsTr("CSV export")
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Enable CSV export")
|
||||
checked: Cpp_CSV_Export.exportEnabled
|
||||
onTriggered: Cpp_CSV_Export.exportEnabled = checked
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: "ctrl+shift+o"
|
||||
enabled: Cpp_CSV_Export.isOpen
|
||||
text: qsTr("Show CSV in explorer")
|
||||
onTriggered: Cpp_CSV_Export.openCurrentCsv()
|
||||
}
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: "ctrl+o"
|
||||
text: qsTr("Replay CSV") + "..."
|
||||
onTriggered: Cpp_CSV_Player.openFile()
|
||||
enabled: Cpp_JSON_Generator.operationMode == 0
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: StandardKey.Print
|
||||
onClicked: Cpp_IO_Console.print()
|
||||
enabled: Cpp_IO_Console.saveAvailable
|
||||
text: qsTr("Print console output") + "..."
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: StandardKey.Save
|
||||
onClicked: Cpp_IO_Console.save()
|
||||
enabled: Cpp_IO_Console.saveAvailable
|
||||
text: qsTr("Export console output") + "..."
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
DecentMenuItem {
|
||||
text: qsTr("Quit")
|
||||
onTriggered: Qt.quit()
|
||||
sequence: StandardKey.Quit
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Edit menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("Edit")
|
||||
|
||||
DecentMenuItem {
|
||||
text: qsTr("Copy")
|
||||
sequence: StandardKey.Copy
|
||||
onTriggered: app.copyConsole()
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: StandardKey.SelectAll
|
||||
text: qsTr("Select all") + "..."
|
||||
onTriggered: app.selectAllConsole()
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: StandardKey.Delete
|
||||
onTriggered: app.clearConsole()
|
||||
text: qsTr("Clear console output")
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
Menu {
|
||||
title: qsTr("Communication mode")
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Device sends JSON")
|
||||
checked: Cpp_JSON_Generator.operationMode == 1
|
||||
onTriggered: Cpp_JSON_Generator.operationMode = checked ? 1 : 0
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Load JSON from computer")
|
||||
checked: Cpp_JSON_Generator.operationMode == 0
|
||||
onTriggered: Cpp_JSON_Generator.operationMode = checked ? 0 : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// View menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("View")
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
sequence: "ctrl+t"
|
||||
text: qsTr("Console")
|
||||
checked: app.consoleVisible
|
||||
onTriggered: app.showConsole()
|
||||
onCheckedChanged: {
|
||||
if (app.consoleVisible !== checked)
|
||||
checked = app.consoleVisible
|
||||
}
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
sequence: "ctrl+d"
|
||||
text: qsTr("Dashboard")
|
||||
checked: app.dashboardVisible
|
||||
enabled: app.dashboardAvailable
|
||||
onTriggered: app.showDashboard()
|
||||
onCheckedChanged: {
|
||||
if (app.dashboardVisible !== checked)
|
||||
checked = app.dashboardVisible
|
||||
}
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
sequence: "ctrl+w"
|
||||
text: qsTr("Widgets")
|
||||
checked: app.widgetsVisible
|
||||
enabled: app.widgetsAvailable
|
||||
onTriggered: app.showWidgets()
|
||||
onCheckedChanged: {
|
||||
if (app.widgetsVisible !== checked)
|
||||
checked = app.widgetsVisible
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
sequence: "ctrl+,"
|
||||
checked: app.setupVisible
|
||||
text: qsTr("Show setup pane")
|
||||
onTriggered: app.togglePreferences()
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: "alt+m"
|
||||
onTriggered: root.visible = !root.visible
|
||||
text: root.visible ? qsTr("Hide menubar") : qsTr("Show menubar")
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Console format
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("Console")
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Autoscroll")
|
||||
checked: Cpp_IO_Console.autoscroll
|
||||
onTriggered: Cpp_IO_Console.autoscroll = checked
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Show timestamp")
|
||||
checked: Cpp_IO_Console.showTimestamp
|
||||
onTriggered: Cpp_IO_Console.showTimestamp = checked
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
checked: app.vt100emulation
|
||||
text: qsTr("VT-100 emulation")
|
||||
onTriggered: app.vt100emulation = checked
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Echo user commands")
|
||||
checked: Cpp_IO_Console.echo
|
||||
onTriggered: Cpp_IO_Console.echo = checked
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
Menu {
|
||||
title: qsTr("Display mode")
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Normal (plain text)")
|
||||
checked: Cpp_IO_Console.displayMode == 0
|
||||
onTriggered: Cpp_IO_Console.displayMode = checked ? 0 : 1
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Binary (hexadecimal)")
|
||||
checked: Cpp_IO_Console.displayMode == 1
|
||||
onTriggered: Cpp_IO_Console.displayMode = checked ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: qsTr("Line ending character")
|
||||
|
||||
Repeater {
|
||||
model: Cpp_IO_Console.lineEndings()
|
||||
delegate: DecentMenuItem {
|
||||
id: menuItem
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[index]
|
||||
checked: Cpp_IO_Console.lineEnding === index
|
||||
onTriggered: Cpp_IO_Console.lineEnding = index
|
||||
onCheckedChanged: timer.start()
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 100
|
||||
onTriggered: {
|
||||
var shouldBeChecked = (Cpp_IO_Console.lineEnding === index)
|
||||
if (menuItem.checked !== shouldBeChecked)
|
||||
menuItem.checked = shouldBeChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Help menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("Help")
|
||||
|
||||
DecentMenuItem {
|
||||
onTriggered: app.showAbout()
|
||||
text: qsTr("About %1").arg(Cpp_AppName)
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
text: qsTr("About %1").arg("Qt")
|
||||
onTriggered: Cpp_Misc_Utilities.aboutQt()
|
||||
}
|
||||
|
||||
MenuSeparator {
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
checked: app.automaticUpdates
|
||||
onTriggered: app.automaticUpdates = checked
|
||||
text: qsTr("Auto-updater")
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
onTriggered: app.checkForUpdates()
|
||||
text: qsTr("Check for updates") + "..."
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
DecentMenuItem {
|
||||
text: qsTr("Project website") + "..."
|
||||
onTriggered: Qt.openUrlExternally("https://www.alex-spataru.com/serial-studio")
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
sequence: StandardKey.HelpContents
|
||||
text: qsTr("Documentation/wiki") + "..."
|
||||
onTriggered: Qt.openUrlExternally("https://github.com/Serial-Studio/Serial-Studio/wiki")
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
DecentMenuItem {
|
||||
text: qsTr("Show log file") + "..."
|
||||
onTriggered: Cpp_Misc_Utilities.openLogFile()
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
text: qsTr("Report bug") + "..."
|
||||
onTriggered: Qt.openUrlExternally("https://github.com/Serial-Studio/Serial-Studio/issues")
|
||||
}
|
||||
}
|
||||
}
|
340
assets/qml/PlatformDependent/MenubarMacOS.qml
Normal file
340
assets/qml/PlatformDependent/MenubarMacOS.qml
Normal file
@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Alex Spataru <https://github.com/alex-spataru>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.12
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
MenuBar {
|
||||
//
|
||||
// File menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("File")
|
||||
|
||||
MenuItem {
|
||||
shortcut: "ctrl+j"
|
||||
text: qsTr("Select JSON file") + "..."
|
||||
onTriggered: Cpp_JSON_Generator.loadJsonMap()
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
Menu {
|
||||
title: qsTr("CSV export")
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Enable CSV export")
|
||||
checked: Cpp_CSV_Export.exportEnabled
|
||||
onTriggered: Cpp_CSV_Export.exportEnabled = checked
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
shortcut: "ctrl+shift+o"
|
||||
enabled: Cpp_CSV_Export.isOpen
|
||||
text: qsTr("Show CSV in explorer")
|
||||
onTriggered: Cpp_CSV_Export.openCurrentCsv()
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
shortcut: "ctrl+o"
|
||||
text: qsTr("Replay CSV") + "..."
|
||||
onTriggered: Cpp_CSV_Player.openFile()
|
||||
enabled: Cpp_JSON_Generator.operationMode == 0
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.Print
|
||||
onTriggered: Cpp_IO_Console.print()
|
||||
enabled: Cpp_IO_Console.saveAvailable
|
||||
text: qsTr("Print console output") + "..."
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.Save
|
||||
onTriggered: Cpp_IO_Console.save()
|
||||
enabled: Cpp_IO_Console.saveAvailable
|
||||
text: qsTr("Export console output") + "..."
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Quit")
|
||||
onTriggered: Qt.quit()
|
||||
shortcut: StandardKey.Quit
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Edit menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("Edit")
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Copy")
|
||||
shortcut: StandardKey.Copy
|
||||
onTriggered: app.copyConsole()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.SelectAll
|
||||
text: qsTr("Select all") + "..."
|
||||
onTriggered: app.selectAllConsole()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.Delete
|
||||
onTriggered: app.clearConsole()
|
||||
text: qsTr("Clear console output")
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
Menu {
|
||||
title: qsTr("Communication mode")
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Device sends JSON")
|
||||
checked: Cpp_JSON_Generator.operationMode == 1
|
||||
onTriggered: Cpp_JSON_Generator.operationMode = checked ? 1 : 0
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Load JSON from computer")
|
||||
checked: Cpp_JSON_Generator.operationMode == 0
|
||||
onTriggered: Cpp_JSON_Generator.operationMode = checked ? 0 : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// View menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("View")
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
shortcut: "ctrl+t"
|
||||
text: qsTr("Console")
|
||||
checked: app.consoleVisible
|
||||
onTriggered: app.showConsole()
|
||||
onCheckedChanged: {
|
||||
if (app.consoleVisible !== checked)
|
||||
checked = app.consoleVisible
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
shortcut: "ctrl+d"
|
||||
text: qsTr("Dashboard")
|
||||
checked: app.dashboardVisible
|
||||
enabled: app.dashboardAvailable
|
||||
onTriggered: app.showDashboard()
|
||||
onCheckedChanged: {
|
||||
if (app.dashboardVisible !== checked)
|
||||
checked = app.dashboardVisible
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
shortcut: "ctrl+w"
|
||||
text: qsTr("Widgets")
|
||||
checked: app.widgetsVisible
|
||||
enabled: app.widgetsAvailable
|
||||
onTriggered: app.showWidgets()
|
||||
onCheckedChanged: {
|
||||
if (app.widgetsVisible !== checked)
|
||||
checked = app.widgetsVisible
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
shortcut: "ctrl+,"
|
||||
checked: app.setupVisible
|
||||
text: qsTr("Show setup pane")
|
||||
onTriggered: app.togglePreferences()
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Console format
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("Console")
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Autoscroll")
|
||||
checked: Cpp_IO_Console.autoscroll
|
||||
onTriggered: Cpp_IO_Console.autoscroll = checked
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Show timestamp")
|
||||
checked: Cpp_IO_Console.showTimestamp
|
||||
onTriggered: Cpp_IO_Console.showTimestamp = checked
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
checked: app.vt100emulation
|
||||
text: qsTr("VT-100 emulation")
|
||||
onTriggered: app.vt100emulation = checked
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Echo user commands")
|
||||
checked: Cpp_IO_Console.echo
|
||||
onTriggered: Cpp_IO_Console.echo = checked
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
Menu {
|
||||
title: qsTr("Display mode")
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Normal (plain text)")
|
||||
checked: Cpp_IO_Console.displayMode == 0
|
||||
onTriggered: Cpp_IO_Console.displayMode = checked ? 0 : 1
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: qsTr("Binary (hexadecimal)")
|
||||
checked: Cpp_IO_Console.displayMode == 1
|
||||
onTriggered: Cpp_IO_Console.displayMode = checked ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: qsTr("Line ending character")
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[0]
|
||||
checked: Cpp_IO_Console.lineEnding === 0
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 0
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[1]
|
||||
checked: Cpp_IO_Console.lineEnding == 1
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 1
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[2]
|
||||
checked: Cpp_IO_Console.lineEnding == 2
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 2
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[3]
|
||||
checked: Cpp_IO_Console.lineEnding == 3
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Help menu
|
||||
//
|
||||
Menu {
|
||||
title: qsTr("Help")
|
||||
|
||||
MenuItem {
|
||||
onTriggered: app.showAbout()
|
||||
text: qsTr("About %1").arg(Cpp_AppName)
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("About %1").arg("Qt")
|
||||
onTriggered: Cpp_Misc_Utilities.aboutQt()
|
||||
}
|
||||
|
||||
MenuSeparator {
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
checkable: true
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
checked: app.automaticUpdates
|
||||
onTriggered: app.automaticUpdates = checked
|
||||
text: qsTr("Auto-updater")
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
onTriggered: app.checkForUpdates()
|
||||
text: qsTr("Check for updates") + "..."
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Project website") + "..."
|
||||
onTriggered: Qt.openUrlExternally("https://www.alex-spataru.com/serial-studio")
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.HelpContents
|
||||
text: qsTr("Documentation/wiki") + "..."
|
||||
onTriggered: Qt.openUrlExternally("https://github.com/Serial-Studio/Serial-Studio/wiki")
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Show log file") + "..."
|
||||
onTriggered: Cpp_Misc_Utilities.openLogFile()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Report bug") + "..."
|
||||
onTriggered: Qt.openUrlExternally("https://github.com/Serial-Studio/Serial-Studio/issues")
|
||||
}
|
||||
}
|
||||
}
|
@ -115,6 +115,12 @@ Window {
|
||||
height: app.spacing
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Website")
|
||||
onClicked: Qt.openUrlExternally("https://www.alex-spataru.com/serial-studio")
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Contact author")
|
||||
@ -127,23 +133,6 @@ Window {
|
||||
onClicked: Qt.openUrlExternally("https://github.com/Serial-Studio/Serial-Studio/issues")
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
visible: Cpp_UpdaterEnabled
|
||||
enabled: Cpp_UpdaterEnabled
|
||||
text: qsTr("Check for updates")
|
||||
onClicked: {
|
||||
Cpp_Updater.setNotifyOnFinish(Cpp_AppUpdaterUrl, true)
|
||||
Cpp_Updater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
onClicked: Cpp_CSV_Export.openLogFile()
|
||||
text: qsTr("Open log file")
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Documentation")
|
||||
|
@ -32,6 +32,10 @@ import "../Widgets" as Widgets
|
||||
Control {
|
||||
id: root
|
||||
|
||||
//
|
||||
// Custom properties
|
||||
//
|
||||
property alias vt100emulation: textEdit.vt100emulation
|
||||
background: Rectangle {
|
||||
color: app.windowBackgroundColor
|
||||
}
|
||||
@ -52,6 +56,20 @@ Control {
|
||||
textEdit.clear()
|
||||
}
|
||||
|
||||
//
|
||||
// Copy function
|
||||
//
|
||||
function copy() {
|
||||
textEdit.copy()
|
||||
}
|
||||
|
||||
//
|
||||
// Select all text
|
||||
//
|
||||
function selectAll() {
|
||||
textEdit.selectAll()
|
||||
}
|
||||
|
||||
//
|
||||
// Load welcome guide
|
||||
//
|
||||
@ -64,39 +82,15 @@ Control {
|
||||
// Save settings
|
||||
//
|
||||
Settings {
|
||||
property alias echo: echoCheck.checked
|
||||
property alias hex: hexCheckbox.checked
|
||||
property alias vt100Enabled: vt100.checked
|
||||
property alias echo: echoCheckbox.checked
|
||||
property alias timestamp: timestampCheck.checked
|
||||
property alias autoscroll: autoscrollCheck.checked
|
||||
property alias vt100Enabled: textEdit.vt100emulation
|
||||
property alias lineEnding: lineEndingCombo.currentIndex
|
||||
property alias displayMode: displayModeCombo.currentIndex
|
||||
}
|
||||
|
||||
//
|
||||
// Save shortcut
|
||||
//
|
||||
Shortcut {
|
||||
sequence: StandardKey.Save
|
||||
onActivated: Cpp_IO_Console.save()
|
||||
}
|
||||
|
||||
//
|
||||
// Clear console data shortcut
|
||||
//
|
||||
Shortcut {
|
||||
sequence: StandardKey.Delete
|
||||
onActivated: root.clearConsole()
|
||||
}
|
||||
|
||||
//
|
||||
// Select all shortcut
|
||||
//
|
||||
Shortcut {
|
||||
sequence: StandardKey.SelectAll
|
||||
onActivated: textEdit.selectAll()
|
||||
}
|
||||
|
||||
//
|
||||
// Remove selection
|
||||
//
|
||||
@ -105,14 +99,6 @@ Control {
|
||||
onActivated: textEdit.clearSelection()
|
||||
}
|
||||
|
||||
//
|
||||
// Copy
|
||||
//
|
||||
Shortcut {
|
||||
sequence: StandardKey.Copy
|
||||
onActivated: textEdit.copy()
|
||||
}
|
||||
|
||||
//
|
||||
// Right-click context menu
|
||||
//
|
||||
@ -141,12 +127,28 @@ Control {
|
||||
enabled: Cpp_IO_Console.saveAvailable
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
opacity: enabled ? 1 : 0.5
|
||||
text: qsTr("Print")
|
||||
onTriggered: Cpp_IO_Console.print()
|
||||
enabled: Cpp_IO_Console.saveAvailable
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
opacity: enabled ? 1 : 0.5
|
||||
text: qsTr("Save as") + "..."
|
||||
onTriggered: Cpp_IO_Console.save()
|
||||
enabled: Cpp_IO_Console.saveAvailable
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
//onTriggered: app.menuBar.visible = !app.menuBar.visible
|
||||
//text: app.menuBar.visible ? qsTr("Hide menubar") : qsTr("Show menubar")
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@ -256,8 +258,8 @@ Control {
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "HEX"
|
||||
id: hexCheckbox
|
||||
text: "Hex"
|
||||
opacity: enabled ? 1 : 0.5
|
||||
enabled: Cpp_IO_Manager.readWrite
|
||||
checked: Cpp_IO_Console.dataMode === 1
|
||||
@ -270,9 +272,11 @@ Control {
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: echoCheck
|
||||
visible: false
|
||||
text: qsTr("Echo")
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
id: echoCheckbox
|
||||
opacity: enabled ? 1 : 0.5
|
||||
enabled: Cpp_IO_Manager.readWrite
|
||||
checked: Cpp_IO_Console.echo
|
||||
onCheckedChanged: {
|
||||
if (Cpp_IO_Console.echo != checked)
|
||||
@ -309,17 +313,6 @@ Control {
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: vt100
|
||||
text: qsTr("VT-100")
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
checked: textEdit.vt100emulation
|
||||
onCheckedChanged: {
|
||||
if (textEdit.vt100emulation != checked)
|
||||
textEdit.vt100emulation = checked
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
@ -149,11 +149,14 @@ Control {
|
||||
|
||||
Switch {
|
||||
id: csvLogging
|
||||
checked: true
|
||||
palette.highlight: "#2e895c"
|
||||
text: qsTr("Create CSV file")
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onCheckedChanged: Cpp_CSV_Export.exportEnabled = checked
|
||||
checked: Cpp_CSV_Export.exportEnabled
|
||||
onCheckedChanged: {
|
||||
if (Cpp_CSV_Export.exportEnabled !== checked)
|
||||
Cpp_CSV_Export.exportEnabled = checked
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -36,7 +36,6 @@ Control {
|
||||
// Custom signals
|
||||
//
|
||||
signal dataClicked()
|
||||
signal aboutClicked()
|
||||
signal setupClicked()
|
||||
signal consoleClicked()
|
||||
signal widgetsClicked()
|
||||
@ -45,7 +44,6 @@ Control {
|
||||
// Aliases to button check status
|
||||
//
|
||||
property alias dataChecked: dataBt.checked
|
||||
property alias aboutChecked: aboutBt.checked
|
||||
property alias setupChecked: setupBt.checked
|
||||
property alias consoleChecked: consoleBt.checked
|
||||
property alias widgetsChecked: widgetsBt.checked
|
||||
@ -114,7 +112,7 @@ Control {
|
||||
Layout.fillHeight: true
|
||||
icon.color: palette.text
|
||||
onClicked: root.dataClicked()
|
||||
enabled: Cpp_UI_Provider.groupCount > 0
|
||||
enabled: app.dashboardAvailable
|
||||
icon.source: "qrc:/icons/equalizer.svg"
|
||||
text: qsTr("Dashboard") + _btSpacer
|
||||
|
||||
@ -130,28 +128,15 @@ Control {
|
||||
icon.height: 24
|
||||
Layout.fillHeight: true
|
||||
icon.color: palette.text
|
||||
enabled: app.widgetsAvailable
|
||||
onClicked: root.widgetsClicked()
|
||||
icon.source: "qrc:/icons/chart.svg"
|
||||
enabled: Cpp_UI_WidgetProvider.totalWidgetCount > 0
|
||||
text: qsTr("Widgets") + _btSpacer
|
||||
|
||||
opacity: enabled ? 1 : 0.5
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: aboutBt
|
||||
|
||||
flat: true
|
||||
icon.width: 24
|
||||
icon.height: 24
|
||||
Layout.fillHeight: true
|
||||
icon.color: palette.text
|
||||
onClicked: root.aboutClicked()
|
||||
icon.source: "qrc:/icons/info.svg"
|
||||
text: qsTr("About")
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
@ -82,6 +82,81 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Application UI status variables (used for the menubar)
|
||||
//
|
||||
property alias vt100emulation: terminal.vt100emulation
|
||||
readonly property bool setupVisible: setup.visible
|
||||
readonly property bool dashboardVisible: data.visible
|
||||
readonly property bool widgetsVisible: widgets.visible
|
||||
readonly property bool consoleVisible: terminal.visible
|
||||
readonly property bool dashboardAvailable: Cpp_UI_Provider.groupCount > 0
|
||||
readonly property bool widgetsAvailable: Cpp_UI_WidgetProvider.totalWidgetCount > 0
|
||||
|
||||
//
|
||||
// Check for updates (non-silent mode)
|
||||
//
|
||||
function checkForUpdates() {
|
||||
Cpp_Updater.setNotifyOnFinish(Cpp_AppUpdaterUrl, true)
|
||||
Cpp_Updater.checkForUpdates(Cpp_AppUpdaterUrl)
|
||||
}
|
||||
|
||||
//
|
||||
// Display about dialog
|
||||
//
|
||||
function showAbout() {
|
||||
about.show()
|
||||
}
|
||||
|
||||
//
|
||||
// Display the console
|
||||
//
|
||||
function showConsole() {
|
||||
toolbar.consoleClicked()
|
||||
}
|
||||
|
||||
//
|
||||
// Display the dashboard
|
||||
//
|
||||
function showDashboard() {
|
||||
toolbar.dataClicked()
|
||||
}
|
||||
|
||||
//
|
||||
// Display the widgets
|
||||
//
|
||||
function showWidgets() {
|
||||
toolbar.widgetsClicked()
|
||||
}
|
||||
|
||||
//
|
||||
// Toggle preferences pane
|
||||
//
|
||||
function togglePreferences() {
|
||||
toolbar.setupClicked()
|
||||
}
|
||||
|
||||
//
|
||||
// Clears console output
|
||||
//
|
||||
function clearConsole() {
|
||||
terminal.clearConsole()
|
||||
}
|
||||
|
||||
//
|
||||
// Copy console selection
|
||||
//
|
||||
function copyConsole() {
|
||||
terminal.copy()
|
||||
}
|
||||
|
||||
//
|
||||
// Select all console text
|
||||
//
|
||||
function selectAllConsole() {
|
||||
terminal.selectAll()
|
||||
}
|
||||
|
||||
//
|
||||
// Window geometry
|
||||
//
|
||||
@ -124,59 +199,18 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
//
|
||||
// Shortcut to show/hide setup panel
|
||||
// Application menubar loader (we need to use a different version in macOS)
|
||||
//
|
||||
Shortcut {
|
||||
sequence: "Ctrl+,"
|
||||
onActivated: toolbar.setupClicked()
|
||||
}
|
||||
Loader {
|
||||
asynchronous: false
|
||||
source: {
|
||||
if (Qt.platform.os === "osx")
|
||||
return "qrc:/qml/PlatformDependent/MenubarMacOS.qml"
|
||||
|
||||
//
|
||||
// Shortcut to show/hide dashboard
|
||||
//
|
||||
Shortcut {
|
||||
sequence: "Ctrl+d"
|
||||
onActivated: {
|
||||
if (Cpp_UI_Provider.groupCount > 0)
|
||||
toolbar.dataClicked()
|
||||
return "qrc:/qml/PlatformDependent/Menubar.qml"
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Shortcut to show/hide widgets
|
||||
//
|
||||
Shortcut {
|
||||
sequence: "Ctrl+w"
|
||||
onActivated: {
|
||||
if (Cpp_UI_WidgetProvider.totalWidgetCount > 0)
|
||||
toolbar.widgetsClicked()
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Shortcut to show/hide terminal
|
||||
//
|
||||
Shortcut {
|
||||
sequence: "Ctrl+t"
|
||||
onActivated: toolbar.consoleClicked()
|
||||
}
|
||||
|
||||
//
|
||||
// Shortcut to show/hide terminal
|
||||
//
|
||||
Shortcut {
|
||||
sequence: "F1"
|
||||
onActivated: about.show()
|
||||
}
|
||||
|
||||
//
|
||||
// Shortcut to open CSV file
|
||||
//
|
||||
Shortcut {
|
||||
sequence: StandardKey.Open
|
||||
onActivated: Cpp_CSV_Player.openFile()
|
||||
}
|
||||
|
||||
//
|
||||
// Startup timer
|
||||
//
|
||||
@ -284,39 +318,47 @@ ApplicationWindow {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: 48
|
||||
Layout.maximumHeight: 48
|
||||
dataChecked: data.visible
|
||||
aboutChecked: about.visible
|
||||
setupChecked: setup.visible
|
||||
widgetsChecked: widgets.visible
|
||||
consoleChecked: terminal.visible
|
||||
onAboutClicked: about.visible ? about.hide() : about.show()
|
||||
setupChecked: app.setupVisible
|
||||
dataChecked: app.dashboardVisible
|
||||
widgetsChecked: app.widgetsVisible
|
||||
consoleChecked: app.consoleVisible
|
||||
onSetupClicked: setup.visible ? setup.hide() : setup.show()
|
||||
|
||||
onDataClicked: {
|
||||
data.opacity = 1
|
||||
terminal.opacity = 0
|
||||
widgets.opacity = 0
|
||||
dataChecked = true
|
||||
consoleChecked = false
|
||||
widgetsChecked = false
|
||||
if (app.dashboardAvailable) {
|
||||
data.opacity = 1
|
||||
terminal.opacity = 0
|
||||
widgets.opacity = 0
|
||||
dataChecked = true
|
||||
consoleChecked = false
|
||||
widgetsChecked = false
|
||||
}
|
||||
|
||||
else
|
||||
app.showConsole()
|
||||
}
|
||||
|
||||
onConsoleClicked: {
|
||||
data.opacity = 0
|
||||
data.opacity = 0
|
||||
terminal.opacity = 1
|
||||
widgets.opacity = 0
|
||||
consoleChecked = true
|
||||
dataChecked = false
|
||||
widgetsChecked = false
|
||||
widgets.opacity = 0
|
||||
consoleChecked = true
|
||||
dataChecked = false
|
||||
widgetsChecked = false
|
||||
}
|
||||
|
||||
onWidgetsClicked: {
|
||||
data.opacity = 0
|
||||
terminal.opacity = 0
|
||||
widgets.opacity = 1
|
||||
dataChecked = false
|
||||
widgetsChecked = true
|
||||
consoleChecked = false
|
||||
if (app.widgetsAvailable) {
|
||||
data.opacity = 0
|
||||
terminal.opacity = 0
|
||||
widgets.opacity = 1
|
||||
dataChecked = false
|
||||
widgetsChecked = true
|
||||
consoleChecked = false
|
||||
}
|
||||
|
||||
else
|
||||
app.showConsole()
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,7 +462,7 @@ ApplicationWindow {
|
||||
text: "<h3>" + qsTr("Check for updates automatically?") + "</h3>"
|
||||
informativeText: qsTr("Should %1 automatically check for updates? " +
|
||||
"You can always check for updates manually from " +
|
||||
"the \"About\" dialog").arg(Cpp_AppName);
|
||||
"the \"Help\" menu").arg(Cpp_AppName);
|
||||
|
||||
// Behavior when the user clicks on "Yes"
|
||||
onAccepted: {
|
||||
|
@ -92,14 +92,6 @@ bool Export::exportEnabled() const
|
||||
return m_exportEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the current application log file
|
||||
*/
|
||||
void Export::openLogFile()
|
||||
{
|
||||
Misc::Utilities::openLogFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the current CSV file in the Explorer/Finder window
|
||||
*/
|
||||
|
@ -61,7 +61,6 @@ private:
|
||||
|
||||
public slots:
|
||||
void closeFile();
|
||||
void openLogFile();
|
||||
void openCurrentCsv();
|
||||
void setExportEnabled(const bool enabled);
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <IO/DataSources/Serial.h>
|
||||
#include <IO/DataSources/Network.h>
|
||||
|
||||
#include <Misc/Utilities.h>
|
||||
#include <Misc/Translator.h>
|
||||
#include <Misc/TimerEvents.h>
|
||||
#include <Misc/ModuleManager.h>
|
||||
@ -145,6 +146,7 @@ void ModuleManager::initializeQmlInterface()
|
||||
auto ioSerial = IO::DataSources::Serial::getInstance();
|
||||
auto ioNetwork = IO::DataSources::Network::getInstance();
|
||||
auto jsonGenerator = JSON::Generator::getInstance();
|
||||
auto utilities = Misc::Utilities::getInstance();
|
||||
LOG_INFO() << "Finished initializing C++ modules";
|
||||
|
||||
// Retranslate the QML interface automagically
|
||||
@ -156,6 +158,7 @@ void ModuleManager::initializeQmlInterface()
|
||||
c->setContextProperty("Cpp_Updater", updater);
|
||||
c->setContextProperty("Cpp_UpdaterEnabled", autoUpdaterEnabled());
|
||||
c->setContextProperty("Cpp_Misc_Translator", translator);
|
||||
c->setContextProperty("Cpp_Misc_Utilities", utilities);
|
||||
c->setContextProperty("Cpp_CSV_Export", csvExport);
|
||||
c->setContextProperty("Cpp_CSV_Player", csvPlayer);
|
||||
c->setContextProperty("Cpp_UI_Provider", uiDataProvider);
|
||||
|
@ -121,11 +121,6 @@ QString Translator::welcomeConsoleText() const
|
||||
if (file.open(QFile::ReadOnly))
|
||||
{
|
||||
text = QString::fromUtf8(file.readAll());
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
text = text.replace("Ctrl", "⌘");
|
||||
#endif
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,18 @@
|
||||
|
||||
using namespace Misc;
|
||||
|
||||
/**
|
||||
* Returns the onlt instance of the class, this is to be used by the QML interface
|
||||
*/
|
||||
static Utilities *INSTANCE = nullptr;
|
||||
Utilities *Utilities::getInstance()
|
||||
{
|
||||
if (!INSTANCE)
|
||||
INSTANCE = new Utilities;
|
||||
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a macOS-like message box with the given properties
|
||||
*/
|
||||
@ -59,6 +71,14 @@ int Utilities::showMessageBox(QString text, QString informativeText, QString win
|
||||
return box.exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the about Qt dialog
|
||||
*/
|
||||
void Utilities::aboutQt()
|
||||
{
|
||||
qApp->aboutQt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the location of the current log file in the Finder window
|
||||
*/
|
||||
|
@ -31,16 +31,22 @@ namespace Misc
|
||||
{
|
||||
class Utilities : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// clang-format off
|
||||
Q_INVOKABLE static void openLogFile();
|
||||
Q_INVOKABLE static void configureDarkUi();
|
||||
Q_INVOKABLE static void revealFile(const QString& pathToReveal);
|
||||
Q_INVOKABLE static int showMessageBox(QString text,
|
||||
QString informativeText,
|
||||
QString windowTitle = qAppName(),
|
||||
QMessageBox::StandardButtons bt = QMessageBox::Ok);
|
||||
static Utilities* getInstance();
|
||||
static int showMessageBox(QString text,
|
||||
QString informativeText,
|
||||
QString windowTitle = qAppName(),
|
||||
QMessageBox::StandardButtons bt = QMessageBox::Ok);
|
||||
//clang-format on
|
||||
|
||||
public slots:
|
||||
static void aboutQt();
|
||||
static void openLogFile();
|
||||
static void configureDarkUi();
|
||||
static void revealFile(const QString& pathToReveal);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user