Remove widgets section (dashboard will show everything)
@ -34,6 +34,6 @@ RESOURCES += \
|
||||
$$PWD/images/rcc_images.qrc \
|
||||
$$PWD/themes/rcc_themes.qrc \
|
||||
$$PWD/messages/rcc_messages.qrc \
|
||||
$$PWD/mac-icons/rcc_mac-icons.qrc \
|
||||
$$PWD/touchbar/rcc_touchbar.qrc \
|
||||
$$PWD/translations/rcc_translations.qrc
|
||||
|
||||
|
Before Width: | Height: | Size: 5.6 KiB |
@ -88,12 +88,10 @@ 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
|
||||
property alias vt100emulation: terminal.vt100emulation
|
||||
readonly property bool consoleVisible: terminal.visible
|
||||
readonly property bool widgetsAvailable: Cpp_UI_QmlDataProvider.widgetCount > 0
|
||||
readonly property bool dashboardVisible: dashboard.visible
|
||||
readonly property bool dashboardAvailable: Cpp_UI_QmlDataProvider.groupCount > 0
|
||||
|
||||
//
|
||||
@ -132,14 +130,7 @@ ApplicationWindow {
|
||||
// Display the dashboard
|
||||
//
|
||||
function showDashboard() {
|
||||
toolbar.dataClicked()
|
||||
}
|
||||
|
||||
//
|
||||
// Display the widgets
|
||||
//
|
||||
function showWidgets() {
|
||||
toolbar.widgetsClicked()
|
||||
toolbar.dashboardClicked()
|
||||
}
|
||||
|
||||
//
|
||||
@ -237,8 +228,7 @@ ApplicationWindow {
|
||||
csvPlayer.hide()
|
||||
|
||||
// Hide everything except the terminal
|
||||
data.opacity = 0
|
||||
widgets.opacity = 0
|
||||
dashboard.opacity = 0
|
||||
terminal.opacity = 1
|
||||
|
||||
// Load welcome guide
|
||||
@ -331,13 +321,16 @@ ApplicationWindow {
|
||||
enabled: !app.firstValidFrame
|
||||
|
||||
function onUpdated() {
|
||||
if ((Cpp_IO_Manager.connected || Cpp_CSV_Player.isOpen) && Cpp_UI_QmlDataProvider.frameValid()) {
|
||||
app.firstValidFrame = true
|
||||
if ((Cpp_IO_Manager.connected || Cpp_CSV_Player.isOpen) &&
|
||||
Cpp_UI_QmlDataProvider.frameValid()) {
|
||||
setup.hide()
|
||||
app.showDashboard()
|
||||
} else {
|
||||
toolbar.consoleClicked()
|
||||
app.firstValidFrame = true
|
||||
}
|
||||
|
||||
else {
|
||||
setup.show()
|
||||
app.showConsole()
|
||||
app.firstValidFrame = false
|
||||
}
|
||||
}
|
||||
@ -377,6 +370,9 @@ ApplicationWindow {
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
|
||||
//
|
||||
// Application toolbar
|
||||
//
|
||||
Toolbar {
|
||||
z: 1
|
||||
id: toolbar
|
||||
@ -384,20 +380,16 @@ ApplicationWindow {
|
||||
Layout.minimumHeight: 48
|
||||
Layout.maximumHeight: 48
|
||||
setupChecked: app.setupVisible
|
||||
dataChecked: app.dashboardVisible
|
||||
widgetsChecked: app.widgetsVisible
|
||||
consoleChecked: app.consoleVisible
|
||||
dashboardChecked: app.dashboardVisible
|
||||
onJsonEditorClicked: jsonEditor.show()
|
||||
onSetupClicked: setup.visible ? setup.hide() : setup.show()
|
||||
|
||||
onDataClicked: {
|
||||
onDashboardClicked: {
|
||||
if (app.dashboardAvailable) {
|
||||
data.opacity = 1
|
||||
terminal.opacity = 0
|
||||
widgets.opacity = 0
|
||||
dataChecked = true
|
||||
consoleChecked = false
|
||||
widgetsChecked = false
|
||||
consoleChecked = 0
|
||||
dashboardChecked = 1
|
||||
swipe.currentIndex = 1
|
||||
}
|
||||
|
||||
else
|
||||
@ -405,98 +397,62 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
onConsoleClicked: {
|
||||
data.opacity = 0
|
||||
terminal.opacity = 1
|
||||
widgets.opacity = 0
|
||||
consoleChecked = true
|
||||
dataChecked = false
|
||||
widgetsChecked = false
|
||||
}
|
||||
|
||||
onWidgetsClicked: {
|
||||
if (app.widgetsAvailable) {
|
||||
data.opacity = 0
|
||||
terminal.opacity = 0
|
||||
widgets.opacity = 1
|
||||
dataChecked = false
|
||||
widgetsChecked = true
|
||||
consoleChecked = false
|
||||
}
|
||||
|
||||
else
|
||||
app.showConsole()
|
||||
consoleChecked = 1
|
||||
dashboardChecked = 0
|
||||
swipe.currentIndex = 0
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Console, dashboard & setup panel
|
||||
//
|
||||
RowLayout {
|
||||
spacing: 0
|
||||
clip: true
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Item {
|
||||
SwipeView {
|
||||
id: swipe
|
||||
interactive: false
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
if (currentIndex == 0) {
|
||||
terminal.opacity = 1
|
||||
dashboard.opacity = 0
|
||||
}
|
||||
|
||||
else {
|
||||
terminal.opacity = 0
|
||||
dashboard.opacity = 1
|
||||
}
|
||||
}
|
||||
|
||||
Console {
|
||||
id: terminal
|
||||
anchors.fill: parent
|
||||
|
||||
// Animate on show
|
||||
enabled: opacity > 0
|
||||
visible: opacity > 0
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
|
||||
// Show translated welcome text on lang. change
|
||||
Connections {
|
||||
target: Cpp_Misc_Translator
|
||||
function onLanguageChanged() {
|
||||
terminal.showWelcomeGuide()
|
||||
}
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
DataGrid {
|
||||
id: data
|
||||
anchors.fill: parent
|
||||
|
||||
// Animate on show
|
||||
visible: opacity > 0
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
}
|
||||
|
||||
Widgets {
|
||||
id: widgets
|
||||
anchors.fill: parent
|
||||
|
||||
// Animate on show
|
||||
Dashboard {
|
||||
id: dashboard
|
||||
enabled: opacity > 0
|
||||
visible: opacity > 0
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
Setup {
|
||||
id: setup
|
||||
property int displayedWidth: 340 + app.spacing * 1.5
|
||||
|
||||
function show() {
|
||||
opacity = 1
|
||||
displayedWidth = 340 + app.spacing * 1.5
|
||||
}
|
||||
|
||||
function hide() {
|
||||
opacity = 0
|
||||
displayedWidth = 0
|
||||
}
|
||||
|
||||
visible: opacity > 0
|
||||
Layout.fillHeight: true
|
||||
Layout.rightMargin: setupMargin
|
||||
Layout.minimumWidth: displayedWidth
|
||||
Layout.maximumWidth: displayedWidth
|
||||
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
Behavior on displayedWidth {NumberAnimation{}}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,117 +486,10 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
//
|
||||
// Intuitive UI stuff for drag and drop
|
||||
// JSON project drop area
|
||||
//
|
||||
Rectangle {
|
||||
id: dropRectangle
|
||||
|
||||
function hide() {
|
||||
rectTimer.start()
|
||||
}
|
||||
|
||||
opacity: 0
|
||||
border.width: 1
|
||||
color: palette.highlight
|
||||
anchors.centerIn: parent
|
||||
border.color: Cpp_ThemeManager.text
|
||||
width: dropLayout.implicitWidth + 6 * app.spacing
|
||||
height: dropLayout.implicitHeight + 6 * app.spacing
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
id: dropLayout
|
||||
spacing: app.spacing * 2
|
||||
anchors.centerIn: parent
|
||||
|
||||
ToolButton {
|
||||
flat: true
|
||||
enabled: false
|
||||
icon.width: 128
|
||||
icon.height: 128
|
||||
icon.color: Cpp_ThemeManager.text
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
icon.source: "qrc:/icons/drag-drop.svg"
|
||||
}
|
||||
|
||||
Label {
|
||||
font.bold: true
|
||||
font.pixelSize: 24
|
||||
color: Cpp_ThemeManager.text
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: qsTr("Drop JSON and CSV files here")
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: rectTimer
|
||||
interval: 200
|
||||
onTriggered: dropRectangle.opacity = 0
|
||||
}
|
||||
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
}
|
||||
|
||||
//
|
||||
// File drop area
|
||||
//
|
||||
DropArea {
|
||||
id: dropArea
|
||||
JSONDropArea {
|
||||
anchors.fill: parent
|
||||
enabled: terminal.visible
|
||||
|
||||
//
|
||||
// Show rectangle and set color based on file extension on drag enter
|
||||
//
|
||||
onEntered: {
|
||||
// Get file name & set color of rectangle accordingly
|
||||
var path = drag.urls[0].toString()
|
||||
if (path.endsWith(".json") || path.endsWith(".csv")) {
|
||||
drag.accept(Qt.LinkAction)
|
||||
dropRectangle.color = Qt.darker(palette.highlight, 1.4)
|
||||
}
|
||||
|
||||
// Invalid file name, show red rectangle
|
||||
else
|
||||
dropRectangle.color = Cpp_ThemeManager.alternativeHighlight
|
||||
|
||||
// Show drag&drop rectangle
|
||||
dropRectangle.opacity = 0.8
|
||||
}
|
||||
|
||||
//
|
||||
// Open *.json & *.csv files on drag drop
|
||||
//
|
||||
onDropped: {
|
||||
// Hide rectangle
|
||||
dropRectangle.hide()
|
||||
|
||||
// Get dropped file URL and remove prefixed "file://"
|
||||
var path = drop.urls[0].toString()
|
||||
if (Qt.platform.os != "windows")
|
||||
path = path.replace(/^(file:\/{2})/,"");
|
||||
else
|
||||
path = path.replace(/^(file:\/{3})/,"");
|
||||
|
||||
// Unescape html codes like '%23' for '#'
|
||||
var cleanPath = decodeURIComponent(path);
|
||||
|
||||
// Process JSON files
|
||||
if (cleanPath.endsWith(".json")) {
|
||||
Cpp_JSON_Generator.setOperationMode(0)
|
||||
Cpp_JSON_Generator.loadJsonMap(cleanPath)
|
||||
}
|
||||
|
||||
// Process CSV files
|
||||
else if (cleanPath.endsWith(".csv"))
|
||||
Cpp_CSV_Player.openFile(cleanPath)
|
||||
}
|
||||
|
||||
//
|
||||
// Hide drag & drop rectangle on drag exit
|
||||
//
|
||||
onExited: {
|
||||
dropRectangle.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
132
assets/qml/JSONDropArea.qml
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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.0
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
DropArea {
|
||||
//
|
||||
// Show rectangle and set color based on file extension on drag enter
|
||||
//
|
||||
onEntered: {
|
||||
// Get file name & set color of rectangle accordingly
|
||||
var path = drag.urls[0].toString()
|
||||
if (path.endsWith(".json") || path.endsWith(".csv")) {
|
||||
drag.accept(Qt.LinkAction)
|
||||
dropRectangle.color = Qt.darker(palette.highlight, 1.4)
|
||||
}
|
||||
|
||||
// Invalid file name, show red rectangle
|
||||
else
|
||||
dropRectangle.color = Cpp_ThemeManager.alternativeHighlight
|
||||
|
||||
// Show drag&drop rectangle
|
||||
dropRectangle.opacity = 0.8
|
||||
}
|
||||
|
||||
//
|
||||
// Open *.json & *.csv files on drag drop
|
||||
//
|
||||
onDropped: {
|
||||
// Hide rectangle
|
||||
dropRectangle.hide()
|
||||
|
||||
// Get dropped file URL and remove prefixed "file://"
|
||||
var path = drop.urls[0].toString()
|
||||
if (Qt.platform.os != "windows")
|
||||
path = path.replace(/^(file:\/{2})/,"");
|
||||
else
|
||||
path = path.replace(/^(file:\/{3})/,"");
|
||||
|
||||
// Unescape html codes like '%23' for '#'
|
||||
var cleanPath = decodeURIComponent(path);
|
||||
|
||||
// Process JSON files
|
||||
if (cleanPath.endsWith(".json")) {
|
||||
Cpp_JSON_Generator.setOperationMode(0)
|
||||
Cpp_JSON_Generator.loadJsonMap(cleanPath)
|
||||
}
|
||||
|
||||
// Process CSV files
|
||||
else if (cleanPath.endsWith(".csv"))
|
||||
Cpp_CSV_Player.openFile(cleanPath)
|
||||
}
|
||||
|
||||
//
|
||||
// Hide drag & drop rectangle on drag exit
|
||||
//
|
||||
onExited: {
|
||||
dropRectangle.hide()
|
||||
}
|
||||
|
||||
//
|
||||
// Drop rectangle + icon + text
|
||||
//
|
||||
Rectangle {
|
||||
id: dropRectangle
|
||||
|
||||
function hide() {
|
||||
rectTimer.start()
|
||||
}
|
||||
|
||||
opacity: 0
|
||||
border.width: 1
|
||||
color: palette.highlight
|
||||
anchors.centerIn: parent
|
||||
border.color: Cpp_ThemeManager.text
|
||||
width: dropLayout.implicitWidth + 6 * app.spacing
|
||||
height: dropLayout.implicitHeight + 6 * app.spacing
|
||||
|
||||
ColumnLayout {
|
||||
id: dropLayout
|
||||
spacing: app.spacing * 2
|
||||
anchors.centerIn: parent
|
||||
|
||||
ToolButton {
|
||||
flat: true
|
||||
enabled: false
|
||||
icon.width: 128
|
||||
icon.height: 128
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
icon.source: "qrc:/icons/drag-drop.svg"
|
||||
icon.color: Cpp_ThemeManager.highlightedText
|
||||
}
|
||||
|
||||
Label {
|
||||
font.bold: true
|
||||
font.pixelSize: 24
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: Cpp_ThemeManager.highlightedText
|
||||
text: qsTr("Drop JSON and CSV files here")
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: rectTimer
|
||||
interval: 200
|
||||
onTriggered: dropRectangle.opacity = 0
|
||||
}
|
||||
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
}
|
||||
}
|
@ -189,19 +189,6 @@ MenuBar {
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
@ -217,7 +204,8 @@ MenuBar {
|
||||
DecentMenuItem {
|
||||
sequence: "alt+m"
|
||||
onTriggered: app.toggleMenubar()
|
||||
text: root.visible ? qsTr("Hide menubar") : qsTr("Show menubar")
|
||||
text: root.visible ? qsTr("Hide menubar") :
|
||||
qsTr("Show menubar")
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
@ -225,7 +213,8 @@ MenuBar {
|
||||
DecentMenuItem {
|
||||
sequence: StandardKey.FullScreen
|
||||
onTriggered: app.toggleFullscreen()
|
||||
text: app.fullScreen ? qsTr("Exit full screen") : qsTr("Enter full screen")
|
||||
text: app.fullScreen ? qsTr("Exit full screen") :
|
||||
qsTr("Enter full screen")
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,26 +275,32 @@ MenuBar {
|
||||
Menu {
|
||||
title: qsTr("Line ending character")
|
||||
|
||||
Repeater {
|
||||
model: Cpp_IO_Console.lineEndings()
|
||||
delegate: DecentMenuItem {
|
||||
id: menuItem
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[index]
|
||||
checked: Cpp_IO_Console.lineEnding === index
|
||||
onTriggered: Cpp_IO_Console.lineEnding = index
|
||||
onCheckedChanged: timer.start()
|
||||
text: Cpp_IO_Console.lineEndings()[0]
|
||||
checked: Cpp_IO_Console.lineEnding === 0
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 0
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 100
|
||||
onTriggered: {
|
||||
var shouldBeChecked = (Cpp_IO_Console.lineEnding === index)
|
||||
if (menuItem.checked !== shouldBeChecked)
|
||||
menuItem.checked = shouldBeChecked
|
||||
}
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[1]
|
||||
checked: Cpp_IO_Console.lineEnding == 1
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 1
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[2]
|
||||
checked: Cpp_IO_Console.lineEnding == 2
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 2
|
||||
}
|
||||
|
||||
DecentMenuItem {
|
||||
checkable: true
|
||||
text: Cpp_IO_Console.lineEndings()[3]
|
||||
checked: Cpp_IO_Console.lineEnding == 3
|
||||
onTriggered: Cpp_IO_Console.lineEnding = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,19 +164,6 @@ MenuBar {
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
@ -192,7 +179,8 @@ MenuBar {
|
||||
DecentMenuItem {
|
||||
sequence: StandardKey.FullScreen
|
||||
onTriggered: app.toggleFullscreen()
|
||||
text: app.fullScreen ? qsTr("Exit full screen") : qsTr("Enter full screen")
|
||||
text: app.fullScreen ? qsTr("Exit full screen") :
|
||||
qsTr("Enter full screen")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,11 @@ Item {
|
||||
//
|
||||
property alias vt100emulation: textEdit.vt100emulation
|
||||
|
||||
//
|
||||
// Animations
|
||||
//
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
|
||||
//
|
||||
// Function to send through serial port data
|
||||
//
|
||||
@ -75,6 +80,16 @@ Item {
|
||||
Cpp_IO_Console.append(Cpp_Misc_Translator.welcomeConsoleText() + "\n")
|
||||
}
|
||||
|
||||
//
|
||||
// Re-load welcome text when the language is changed
|
||||
//
|
||||
Connections {
|
||||
target: Cpp_Misc_Translator
|
||||
function onLanguageChanged() {
|
||||
root.showWelcomeGuide()
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Save settings
|
||||
//
|
||||
|
@ -28,4 +28,9 @@ import "../Widgets" as Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
//
|
||||
// Animations
|
||||
//
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
}
|
@ -32,8 +32,37 @@ import "../SetupPanes" as SetupPanes
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
//
|
||||
// Custom properties
|
||||
//
|
||||
property int setupMargin: 0
|
||||
property int displayedWidth: 340 + app.spacing * 1.5
|
||||
readonly property int maxItemWidth: column.width - 2 * spacing
|
||||
|
||||
//
|
||||
// Displays the setup panel
|
||||
//
|
||||
function show() {
|
||||
opacity = 1
|
||||
setupMargin = 0
|
||||
}
|
||||
|
||||
//
|
||||
// Hides the setup panel
|
||||
//
|
||||
function hide() {
|
||||
opacity = 0
|
||||
setupMargin = -1 * displayedWidth
|
||||
}
|
||||
|
||||
//
|
||||
// Animations
|
||||
//
|
||||
visible: opacity > 0
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
Behavior on setupMargin {NumberAnimation{}}
|
||||
|
||||
//
|
||||
// Save settings
|
||||
//
|
||||
|
@ -37,19 +37,17 @@ Control {
|
||||
//
|
||||
// Custom signals
|
||||
//
|
||||
signal dataClicked()
|
||||
signal setupClicked()
|
||||
signal consoleClicked()
|
||||
signal widgetsClicked()
|
||||
signal dashboardClicked()
|
||||
signal jsonEditorClicked()
|
||||
|
||||
//
|
||||
// Aliases to button check status
|
||||
//
|
||||
property alias dataChecked: dashboardBt.checked
|
||||
property alias setupChecked: setupBt.checked
|
||||
property alias consoleChecked: consoleBt.checked
|
||||
property alias widgetsChecked: widgetsBt.checked
|
||||
property alias dashboardChecked: dashboardBt.checked
|
||||
|
||||
//
|
||||
// Connections with mac touchbar
|
||||
@ -67,11 +65,6 @@ Control {
|
||||
Cpp_Misc_MacExtras.setConsoleChecked(consoleBt.checked)
|
||||
}
|
||||
|
||||
function onWidgetsClicked() {
|
||||
widgetsBt.clicked()
|
||||
Cpp_Misc_MacExtras.setWidgetsChecked(widgetsBt.checked)
|
||||
}
|
||||
|
||||
function onDashboardClicked() {
|
||||
dashboardBt.clicked()
|
||||
Cpp_Misc_MacExtras.setDashboardChecked(dashboardBt.checked)
|
||||
@ -149,10 +142,10 @@ Control {
|
||||
icon.width: 24
|
||||
icon.height: 24
|
||||
Layout.fillHeight: true
|
||||
enabled: dashboardBt.enabled
|
||||
onClicked: root.consoleClicked()
|
||||
icon.source: "qrc:/icons/code.svg"
|
||||
text: qsTr("Console") + _btSpacer
|
||||
enabled: dashboardBt.enabled || widgetsBt.enabled
|
||||
icon.color: Cpp_ThemeManager.brightText
|
||||
palette.buttonText: Cpp_ThemeManager.brightText
|
||||
palette.button: Cpp_ThemeManager.toolbarGradient1
|
||||
@ -167,7 +160,7 @@ Control {
|
||||
icon.width: 24
|
||||
icon.height: 24
|
||||
Layout.fillHeight: true
|
||||
onClicked: root.dataClicked()
|
||||
onClicked: root.dashboardClicked()
|
||||
enabled: app.dashboardAvailable
|
||||
text: qsTr("Dashboard") + _btSpacer
|
||||
icon.source: "qrc:/icons/equalizer.svg"
|
||||
@ -182,28 +175,6 @@ Control {
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: widgetsBt
|
||||
|
||||
flat: true
|
||||
icon.width: 24
|
||||
icon.height: 24
|
||||
Layout.fillHeight: true
|
||||
enabled: app.widgetsAvailable
|
||||
onClicked: root.widgetsClicked()
|
||||
text: qsTr("Widgets") + _btSpacer
|
||||
icon.source: "qrc:/icons/widget.svg"
|
||||
icon.color: Cpp_ThemeManager.brightText
|
||||
palette.buttonText: Cpp_ThemeManager.brightText
|
||||
palette.button: Cpp_ThemeManager.toolbarGradient1
|
||||
palette.window: Cpp_ThemeManager.toolbarGradient1
|
||||
onCheckedChanged: Cpp_Misc_MacExtras.setWidgetsChecked(checked)
|
||||
onEnabledChanged: Cpp_Misc_MacExtras.setWidgetsEnabled(enabled)
|
||||
|
||||
opacity: enabled ? 1 : 0.5
|
||||
Behavior on opacity {NumberAnimation{}}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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.Window 2.12 as QtWindow
|
||||
|
||||
import "../Widgets" as Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
}
|
@ -17,14 +17,14 @@
|
||||
<file>Windows/Acknowledgements.qml</file>
|
||||
<file>Windows/Console.qml</file>
|
||||
<file>Windows/CsvPlayer.qml</file>
|
||||
<file>Windows/DataGrid.qml</file>
|
||||
<file>Windows/Dashboard.qml</file>
|
||||
<file>Windows/Donate.qml</file>
|
||||
<file>Windows/Setup.qml</file>
|
||||
<file>Windows/Toolbar.qml</file>
|
||||
<file>Windows/Widgets.qml</file>
|
||||
<file>JsonEditor/JsonDatasetDelegate.qml</file>
|
||||
<file>JsonEditor/JsonEditor.qml</file>
|
||||
<file>JsonEditor/JsonGroupDelegate.qml</file>
|
||||
<file>Widgets/Shadow.qml</file>
|
||||
<file>JSONDropArea.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
@ -1,8 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/mac-icons">
|
||||
<qresource prefix="/touchbar">
|
||||
<file>console.png</file>
|
||||
<file>dashboard.png</file>
|
||||
<file>setup.png</file>
|
||||
<file>widgets.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
@ -38,27 +38,23 @@ MacExtras::MacExtras()
|
||||
updateButtonText();
|
||||
|
||||
// Configure action icons
|
||||
m_setupAction.setIcon(QIcon("://mac-icons/setup.png"));
|
||||
m_consoleAction.setIcon(QIcon("://mac-icons/console.png"));
|
||||
m_widgetsAction.setIcon(QIcon("://mac-icons/widgets.png"));
|
||||
m_dashboardAction.setIcon(QIcon("://mac-icons/dashboard.png"));
|
||||
m_setupAction.setIcon(QIcon("://touchbar/setup.png"));
|
||||
m_consoleAction.setIcon(QIcon("://touchbar/console.png"));
|
||||
m_dashboardAction.setIcon(QIcon("://touchbar/dashboard.png"));
|
||||
|
||||
// Setup checkable items
|
||||
m_setupAction.setCheckable(true);
|
||||
m_consoleAction.setCheckable(true);
|
||||
m_widgetsAction.setCheckable(true);
|
||||
m_dashboardAction.setCheckable(true);
|
||||
|
||||
// Set initial button status(es)
|
||||
m_setupAction.setChecked(true);
|
||||
m_consoleAction.setChecked(true);
|
||||
m_widgetsAction.setEnabled(false);
|
||||
m_dashboardAction.setEnabled(false);
|
||||
|
||||
// Configure signals
|
||||
connect(&m_setupAction, SIGNAL(triggered()), this, SIGNAL(setupClicked()));
|
||||
connect(&m_consoleAction, SIGNAL(triggered()), this, SIGNAL(consoleClicked()));
|
||||
connect(&m_widgetsAction, SIGNAL(triggered()), this, SIGNAL(widgetsClicked()));
|
||||
connect(&m_dashboardAction, SIGNAL(triggered()), this, SIGNAL(dashboardClicked()));
|
||||
|
||||
// Create touchbar
|
||||
@ -66,7 +62,6 @@ MacExtras::MacExtras()
|
||||
bar->addAction(&m_setupAction);
|
||||
bar->addAction(&m_consoleAction);
|
||||
bar->addAction(&m_dashboardAction);
|
||||
bar->addAction(&m_widgetsAction);
|
||||
|
||||
// Re-translate buttons when language is changed
|
||||
connect(Translator::getInstance(), SIGNAL(languageChanged()), this,
|
||||
@ -92,16 +87,6 @@ void MacExtras::setConsoleChecked(const bool checked)
|
||||
m_consoleAction.setChecked(checked);
|
||||
}
|
||||
|
||||
void MacExtras::setWidgetsChecked(const bool checked)
|
||||
{
|
||||
m_widgetsAction.setChecked(checked);
|
||||
}
|
||||
|
||||
void MacExtras::setWidgetsEnabled(const bool enabled)
|
||||
{
|
||||
m_widgetsAction.setEnabled(enabled);
|
||||
}
|
||||
|
||||
void MacExtras::setDashboardChecked(const bool checked)
|
||||
{
|
||||
m_dashboardAction.setChecked(checked);
|
||||
@ -116,6 +101,5 @@ void MacExtras::updateButtonText()
|
||||
{
|
||||
m_setupAction.setText(tr("Setup"));
|
||||
m_consoleAction.setText(tr("Console"));
|
||||
m_widgetsAction.setText(tr("Widgets"));
|
||||
m_dashboardAction.setText(tr("Dashboard"));
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ class MacExtras : public QObject
|
||||
|
||||
signals:
|
||||
void setupClicked();
|
||||
void widgetsClicked();
|
||||
void connectClicked();
|
||||
void consoleClicked();
|
||||
void dashboardClicked();
|
||||
@ -45,8 +44,6 @@ public:
|
||||
public slots:
|
||||
void setSetupChecked(const bool checked);
|
||||
void setConsoleChecked(const bool checked);
|
||||
void setWidgetsChecked(const bool checked);
|
||||
void setWidgetsEnabled(const bool enabled);
|
||||
void setDashboardChecked(const bool checked);
|
||||
void setDashboardEnabled(const bool enabled);
|
||||
|
||||
@ -59,7 +56,6 @@ private:
|
||||
private:
|
||||
QAction m_setupAction;
|
||||
QAction m_consoleAction;
|
||||
QAction m_widgetsAction;
|
||||
QAction m_dashboardAction;
|
||||
};
|
||||
}
|
||||
|