Adjust Sidebar

pull/19/head
reionwong 4 years ago
parent 43207ac378
commit cb5fa6fe1e

@ -6,12 +6,11 @@
#include <unicode/locid.h> #include <unicode/locid.h>
#include <unicode/unistr.h> #include <unicode/unistr.h>
static const QStringList supportList = {"en_US", "en_AU", "en_CA", "en_NZ", "en_GB", static const QStringList supportList = {"en_US", "en_GB", "de_DE", "cs_CZ", "es_ES",
"de_DE", "cs_CZ", "es_ES", "es_MX", "fa_IR", "es_MX", "fa_IR", "fi_FI", "fr_FR", "id_ID",
"fi_FI", "fr_FR", "id_ID", "it_IT", "ja_JP", "it_IT", "ja_JP", "nb_NO", "ne_NP", "pl_PL",
"nb_NO", "ne_NP", "pl_PL", "pt_BR", "pt_PT", "pt_BR", "pt_PT", "ru_RU", "id_ID", "sv_SE",
"ru_RU", "sv_SE", "tr_TR", "be_BY", "tr_TR", "zh_CN", "zh_HK", "zh_TW"
"zh_CN", "zh_HK", "zh_TW"
}; };
static const QMap<QString, QString> s_displayName = { {"zh_CN", "简体中文"}, static const QMap<QString, QString> s_displayName = { {"zh_CN", "简体中文"},

@ -52,6 +52,7 @@ Item {
name: "network" name: "network"
page: "qrc:/qml/WLAN/Main.qml" page: "qrc:/qml/WLAN/Main.qml"
iconSource: "wlan.svg" iconSource: "wlan.svg"
iconColor: "#0067FF"
category: qsTr("Network and connection") category: qsTr("Network and connection")
} }
@ -60,6 +61,7 @@ Item {
name: "wired" name: "wired"
page: "qrc:/qml/Wired/Main.qml" page: "qrc:/qml/Wired/Main.qml"
iconSource: "network.svg" iconSource: "network.svg"
iconColor: "#0067FF"
category: qsTr("Network and connection") category: qsTr("Network and connection")
} }
@ -75,6 +77,7 @@ Item {
name: "display" name: "display"
page: "qrc:/qml/Display/Main.qml" page: "qrc:/qml/Display/Main.qml"
iconSource: "display.svg" iconSource: "display.svg"
iconColor: "#0087ED"
category: qsTr("Display and appearance") category: qsTr("Display and appearance")
} }
@ -83,6 +86,7 @@ Item {
name: "appearance" name: "appearance"
page: "qrc:/qml/Appearance/Main.qml" page: "qrc:/qml/Appearance/Main.qml"
iconSource: "appearance.svg" iconSource: "appearance.svg"
iconColor: "#03B4CB"
category: qsTr("Display and appearance") category: qsTr("Display and appearance")
} }
@ -91,6 +95,7 @@ Item {
name: "background" name: "background"
page: "qrc:/qml/Wallpaper/Main.qml" page: "qrc:/qml/Wallpaper/Main.qml"
iconSource: "wallpaper.svg" iconSource: "wallpaper.svg"
iconColor: "#34B4A7"
category: qsTr("Display and appearance") category: qsTr("Display and appearance")
} }
@ -99,6 +104,7 @@ Item {
name: "dock" name: "dock"
page: "qrc:/qml/Dock/Main.qml" page: "qrc:/qml/Dock/Main.qml"
iconSource: "dock.svg" iconSource: "dock.svg"
iconColor: "#8458FF"
category: qsTr("Display and appearance") category: qsTr("Display and appearance")
} }
@ -107,6 +113,7 @@ Item {
name: "accounts" name: "accounts"
page: "qrc:/qml/User/Main.qml" page: "qrc:/qml/User/Main.qml"
iconSource: "accounts.svg" iconSource: "accounts.svg"
iconColor: "#DA7C43"
category: qsTr("System") category: qsTr("System")
} }
@ -115,6 +122,7 @@ Item {
name: "language" name: "language"
page: "qrc:/qml/LanguagePage.qml" page: "qrc:/qml/LanguagePage.qml"
iconSource: "language.svg" iconSource: "language.svg"
iconColor: "#20A7FF"
category: qsTr("System") category: qsTr("System")
} }
@ -123,6 +131,7 @@ Item {
name: "battery" name: "battery"
page: "qrc:/qml/Battery/Main.qml" page: "qrc:/qml/Battery/Main.qml"
iconSource: "battery.svg" iconSource: "battery.svg"
iconColor: "#2EC347"
category: qsTr("System") category: qsTr("System")
} }
@ -138,6 +147,7 @@ Item {
name: "about" name: "about"
page: "qrc:/qml/About/Main.qml" page: "qrc:/qml/About/Main.qml"
iconSource: "about.svg" iconSource: "about.svg"
iconColor: "#24A7FD"
category: qsTr("System") category: qsTr("System")
} }
} }
@ -170,7 +180,9 @@ Item {
highlightResizeDuration : 0 highlightResizeDuration : 0
highlight: Rectangle { highlight: Rectangle {
radius: FishUI.Theme.mediumRadius radius: FishUI.Theme.mediumRadius
color: FishUI.Theme.highlightColor color: Qt.rgba(FishUI.Theme.textColor.r,
FishUI.Theme.textColor.g,
FishUI.Theme.textColor.b, 0.1)
smooth: true smooth: true
} }
@ -186,6 +198,7 @@ Item {
anchors.topMargin: FishUI.Units.largeSpacing anchors.topMargin: FishUI.Units.largeSpacing
anchors.bottomMargin: FishUI.Units.smallSpacing anchors.bottomMargin: FishUI.Units.smallSpacing
color: FishUI.Theme.disabledTextColor color: FishUI.Theme.disabledTextColor
font.pointSize: 8
text: section text: section
} }
} }
@ -193,7 +206,7 @@ Item {
delegate: Item { delegate: Item {
id: item id: item
width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
height: FishUI.Units.fontMetrics.height + FishUI.Units.largeSpacing * 1.5 height: 35
property bool isCurrent: listView.currentIndex === index property bool isCurrent: listView.currentIndex === index
@ -212,30 +225,41 @@ Item {
color: mouseArea.containsMouse && !isCurrent ? Qt.rgba(FishUI.Theme.textColor.r, color: mouseArea.containsMouse && !isCurrent ? Qt.rgba(FishUI.Theme.textColor.r,
FishUI.Theme.textColor.g, FishUI.Theme.textColor.g,
FishUI.Theme.textColor.b, FishUI.Theme.textColor.b,
0.1) : "transparent" 0.05) : "transparent"
smooth: true smooth: true
} }
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: FishUI.Units.largeSpacing anchors.leftMargin: FishUI.Units.smallSpacing
spacing: FishUI.Units.smallSpacing * 1.5 spacing: FishUI.Units.smallSpacing
Image { Rectangle {
id: icon id: iconRect
width: 16 width: 24
height: width height: 24
source: FishUI.Theme.darkMode || isCurrent ? "qrc:/images/sidebar/dark/" + model.iconSource
: "qrc:/images/sidebar/light/" + model.iconSource
sourceSize: Qt.size(width, height)
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
radius: 6
color: model.iconColor
Image {
id: icon
anchors.centerIn: parent
width: 16
height: width
source: "qrc:/images/sidebar/dark/" + model.iconSource
sourceSize: Qt.size(width, height)
Layout.alignment: Qt.AlignVCenter
}
} }
Label { Label {
id: itemTitle id: itemTitle
text: model.title text: model.title
color: isCurrent ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor color: FishUI.Theme.disabledTextColor
font.pointSize: 8
} }
Item { Item {

Loading…
Cancel
Save