Skip to content

Commit

Permalink
Add debug ShowPaletteDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
timangus committed Oct 9, 2023
1 parent 1c44416 commit 0efe35e
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/app/ui/app_qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
<file>qml/Visualisation/Visualisation.qml</file>
<file>qml/Visualisation/Visualisations.qml</file>
<file>qml/Visualisation/VisualisationUtils.js</file>
<file>qml/ShowPaletteDialog.qml</file>
</qresource>
</RCC>
114 changes: 114 additions & 0 deletions source/app/ui/qml/ShowPaletteDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/* Copyright © 2013-2023 Graphia Technologies Ltd.
*
* This file is part of Graphia.
*
* Graphia 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.
*
* Graphia 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 Graphia. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts

import app.graphia
import app.graphia.Controls
import app.graphia.Shared

Window
{
id: root

flags: Qt.Window|Qt.Dialog
color: palette.window
title: qsTr("Palette")

minimumWidth: 600
minimumHeight: 600

ColumnLayout
{
anchors.fill: parent
anchors.margins: Constants.margin

FramedScrollView
{
id: textArea

Layout.fillWidth: true
Layout.fillHeight: true

Column
{
padding: Constants.padding
spacing: 4

Repeater
{
model: ["alternateBase", "base", "brightText", "button", "buttonText",
"dark", "highlight", "highlightedText", "light", "link", "mid",
"midlight", "placeholderText", "shadow", "text", "toolTipBase",
"toolTipText", "window", "windowText"]

RowLayout
{
property string colorName: modelData

Repeater
{
model: ["active", "disabled", "inactive"]

Rectangle
{
id: colorRectangle
width: 128
height: 28
color: palette[modelData][colorName]
border.color: QmlUtils.contrastingColor(color)
border.width: 1

Label
{
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 4
text: colorRectangle.color
color: QmlUtils.contrastingColor(colorRectangle.color)
}
}
}

Label
{
text: modelData
color: palette.windowText
}
}
}
}
}

RowLayout
{
Layout.fillWidth: true

Item { Layout.fillWidth: true }

Button
{
text: qsTr("Close")
onClicked: function(mouse) { root.close(); }
}
}
}
}
10 changes: 10 additions & 0 deletions source/app/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ ApplicationWindow
text: mainWindow.environment
}

ShowPaletteDialog { id: showPaletteDialog }

TextDialog
{
id: provenanceLogDialog
Expand Down Expand Up @@ -1870,6 +1872,13 @@ ApplicationWindow
onTriggered: function(source) { environmentDialog.show(); }
}

Action
{
id: showPaletteAction
text: qsTr("Show Palette")
onTriggered: function(source) { showPaletteDialog.show(); }
}

Action
{
id: testCommandAction
Expand Down Expand Up @@ -2435,6 +2444,7 @@ ApplicationWindow
PlatformMenuItem { action: reportScopeTimersAction }
PlatformMenuItem { action: showCommandLineArgumentsAction }
PlatformMenuItem { action: showEnvironmentAction }
PlatformMenuItem { action: showPaletteAction }
PlatformMenuItem { action: testCommandAction }
PlatformMenuItem { action: testInfiniteParseAction }
PlatformMenuItem { action: restartAction }
Expand Down

0 comments on commit 0efe35e

Please sign in to comment.