Skip to content

Commit

Permalink
Added tooltip with tool name to buttons, removed classic icons
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilInTheGaps committed Nov 8, 2023
1 parent c3862fc commit 0076e64
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 70 deletions.
10 changes: 0 additions & 10 deletions app/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,7 @@ qt_add_resources(gm-companion-ui "ui-resources"
PREFIX "/"
FILES
resources/splash.jpg
resources/icons/audio.png
resources/icons/characters.png
resources/icons/combat.png
resources/icons/converter.png
resources/icons/dice.png
resources/icons/generators.png
resources/icons/icon.png
resources/icons/item-shop.png
resources/icons/maps.png
resources/icons/notes.png
resources/icons/settings.png
resources/icons/dice/d4.png
resources/icons/dice/d6.png
resources/icons/dice/d8.png
Expand Down
11 changes: 0 additions & 11 deletions app/ui/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,47 +23,38 @@ ApplicationWindow {
readonly property var tools: [{
"name": qsTr("Audio"),
"source": "tools/Audio.qml",
"classicIcon": "qrc:/resources/icons/audio.png",
"faIcon": FontAwesome.music
}, {
"name": qsTr("Maps"),
"source": "tools/Maps.qml",
"classicIcon": "qrc:/resources/icons/maps.png",
"faIcon": FontAwesome.mapLocationDot
}, {
"name": qsTr("Dice"),
"source": "tools/Dice.qml",
"classicIcon": "qrc:/resources/icons/dice.png",
"faIcon": FontAwesome.diceD20
}, {
"name": qsTr("Combat Tracker"),
"source": "tools/CombatTracker.qml",
"classicIcon": "qrc:/resources/icons/combat.png",
"faIcon": FontAwesome.bookSkull
}, {
"name": qsTr("Item Shop"),
"source": "tools/ItemShop.qml",
"classicIcon": "qrc:/resources/icons/item-shop.png",
"faIcon": FontAwesome.cartShopping
}, {
"name": qsTr("Characters"),
"source": "tools/Characters.qml",
"classicIcon": "qrc:/resources/icons/characters.png",
"faIcon": FontAwesome.addressCard
}, {
"name": qsTr("Generators"),
"source": "tools/Generators.qml",
"classicIcon": "qrc:/resources/icons/generators.png",
"faIcon": FontAwesome.industry
}, {
"name": qsTr("Notes"),
"source": "tools/Notes.qml",
"classicIcon": "qrc:/resources/icons/notes.png",
"faIcon": FontAwesome.book
}, {
"name": qsTr("Converter"),
"source": "tools/Converter.qml",
"classicIcon": "qrc:/resources/icons/converter.png",
"faIcon": FontAwesome.scaleBalanced
}]

Expand Down Expand Up @@ -141,7 +132,6 @@ ApplicationWindow {
required property int index

toolName: modelData.name
iconSource: modelData.classicIcon
faIcon: modelData.faIcon

Shortcut {
Expand Down Expand Up @@ -186,7 +176,6 @@ ApplicationWindow {
anchors.bottom: parent.bottom

toolName: qsTr("Settings")
iconSource: "qrc:/resources/icons/settings.png"
faIcon: FontAwesome.gear

onClicked: {
Expand Down
51 changes: 10 additions & 41 deletions app/ui/main/SideMenuButton.qml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Effects
import IconFonts
import common
import ".."

Button {
id: button
id: root

property string toolName
property string iconSource
property string faIcon
property string altColor
property bool currentTool: false
Expand All @@ -24,61 +22,32 @@ Button {

font.bold: false

ToolTip.delay: 1000
ToolTip.visible: root.hovered && !SettingsManager.showToolNames
ToolTip.text: root.toolName

Row {
anchors.fill: parent
padding: 5
spacing: 5

property int iconWidth: height - padding * 2

// Classic Icons
Image {
id: button_icon
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
sourceSize.width: parent.iconWidth
sourceSize.height: parent.iconWidth
height: sourceSize.height
width: height
source: button.iconSource
visible: SettingsManager.classicIcons && button.iconSource !== ""
asynchronous: true

MultiEffect {
source: button_icon
anchors.fill: button_icon

visible: button.pressed || button.hovered
colorization: 1
colorizationColor: {
if (button.pressed) {
Qt.rgba(0, 0, 0, 0.4)
} else if (button.hovered) {
Qt.rgba(0, 0, 0, 0.2)
} else {
"white"
}
}
}
}
readonly property int iconWidth: height - padding * 2

// New Icons
Label {
visible: !button_icon.visible
width: parent.iconWidth
height: width
text: button.faIcon
text: root.faIcon
font.family: FontAwesome.fontSolid.family
font.styleName: FontAwesome.fontSolid.styleName
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: button.down ? "grey" : button.hovered ? "darkgrey" : button.useAltColor ? button.altColor : palette.text
color: root.down ? "grey" : root.hovered ? "darkgrey" : root.useAltColor ? root.altColor : palette.text
font.pixelSize: height - 10
anchors.verticalCenter: parent.verticalCenter
}

Text {
text: button.toolName
text: root.toolName
font.pixelSize: 16
visible: SettingsManager.showToolNames

Expand All @@ -87,7 +56,7 @@ Button {
elide: Text.ElideRight

opacity: enabled ? 1.0 : 0.3
color: button.down ? "grey" : button.hovered ? "darkgrey" : palette.text
color: root.down ? "grey" : root.hovered ? "darkgrey" : palette.text

verticalAlignment: Text.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
Expand Down
Binary file removed app/ui/resources/icons/audio.png
Binary file not shown.
Binary file removed app/ui/resources/icons/characters.png
Binary file not shown.
Binary file removed app/ui/resources/icons/combat.png
Binary file not shown.
Binary file removed app/ui/resources/icons/converter.png
Binary file not shown.
Binary file removed app/ui/resources/icons/dice.png
Binary file not shown.
Binary file removed app/ui/resources/icons/generators.png
Binary file not shown.
Binary file removed app/ui/resources/icons/item-shop.png
Binary file not shown.
Binary file removed app/ui/resources/icons/maps.png
Binary file not shown.
Binary file removed app/ui/resources/icons/notes.png
Binary file not shown.
Binary file removed app/ui/resources/icons/settings.png
Binary file not shown.
7 changes: 0 additions & 7 deletions app/ui/tools/settings/GeneralPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ Column {
checked: SettingsManager.showToolNames
onClicked: SettingsManager.showToolNames = checked
}

// Classic Icons
CheckBox {
text: qsTr("Classic menu icons")
checked: SettingsManager.classicIcons
onClicked: SettingsManager.classicIcons = checked
}
}

// Telemetry
Expand Down
1 change: 0 additions & 1 deletion src/common/settings/quicksettingsmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class QuickSettingsManager : public QObject

// General Settings
SETTINGS_PROPERTY(bool, showToolNames, false)
SETTINGS_PROPERTY(bool, classicIcons, false)
SETTINGS_PROPERTY(QString, cloudMode, QStringLiteral("local"))
READ_PROPERTY2(QString, languageBcp47, SettingsManager::instance()->getLanguageBcp47())

Expand Down

0 comments on commit 0076e64

Please sign in to comment.