mirror of https://github.com/cutefishos/settings
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
6.8 KiB
QML
217 lines
6.8 KiB
QML
/*
|
|
* Copyright (C) 2021 CutefishOS Team.
|
|
*
|
|
* Author: Reion Wong <reionwong@gmail.com>
|
|
*
|
|
* This program 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
|
|
* any later version.
|
|
*
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import QtQuick 2.4
|
|
import QtQuick.Controls 2.4
|
|
import QtQuick.Layouts 1.3
|
|
import Qt5Compat.GraphicalEffects
|
|
|
|
import Cutefish.Settings 1.0
|
|
import Cutefish.Appearance 1.0 as FrameworkAppearance
|
|
import FishUI 1.0 as FishUI
|
|
import "../"
|
|
|
|
ItemPage {
|
|
id: control
|
|
headerTitle: qsTr("Fonts")
|
|
|
|
FrameworkAppearance.Appearance {
|
|
id: appearance
|
|
}
|
|
|
|
FontsModel {
|
|
id: fontsModel
|
|
}
|
|
|
|
Fonts {
|
|
id: fonts
|
|
}
|
|
|
|
Connections {
|
|
target: fontsModel
|
|
|
|
function onLoadFinished() {
|
|
for (var i in fontsModel.generalFonts) {
|
|
if (fontsModel.systemGeneralFont === fontsModel.generalFonts[i]) {
|
|
generalFontComboBox.currentIndex = i
|
|
break;
|
|
}
|
|
}
|
|
|
|
for (i in fontsModel.fixedFonts) {
|
|
if (fontsModel.systemFixedFont === fontsModel.fixedFonts[i]) {
|
|
fixedFontComboBox.currentIndex = i
|
|
break;
|
|
}
|
|
}
|
|
|
|
console.log("fonts load finished")
|
|
}
|
|
}
|
|
|
|
Scrollable {
|
|
anchors.fill: parent
|
|
contentHeight: layout.implicitHeight
|
|
|
|
ColumnLayout {
|
|
id: layout
|
|
anchors.fill: parent
|
|
spacing: FishUI.Units.largeSpacing * 2
|
|
|
|
// Font
|
|
RoundedItem {
|
|
// Label {
|
|
// text: qsTr("Font")
|
|
// color: FishUI.Theme.disabledTextColor
|
|
// bottomPadding: FishUI.Units.smallSpacing
|
|
// }
|
|
|
|
GridLayout {
|
|
rows: 3
|
|
columns: 2
|
|
|
|
columnSpacing: FishUI.Units.largeSpacing * 1.5
|
|
rowSpacing: FishUI.Units.largeSpacing * 1.5
|
|
|
|
Label {
|
|
text: qsTr("General Font")
|
|
bottomPadding: FishUI.Units.smallSpacing
|
|
}
|
|
|
|
ComboBox {
|
|
id: generalFontComboBox
|
|
model: fontsModel.generalFonts
|
|
enabled: true
|
|
Layout.fillWidth: true
|
|
topInset: 0
|
|
bottomInset: 0
|
|
leftPadding: FishUI.Units.largeSpacing
|
|
rightPadding: FishUI.Units.largeSpacing
|
|
onActivated: appearance.setFontFamily(currentText)
|
|
}
|
|
|
|
Label {
|
|
text: qsTr("Fixed Font")
|
|
bottomPadding: FishUI.Units.smallSpacing
|
|
}
|
|
|
|
ComboBox {
|
|
id: fixedFontComboBox
|
|
model: fontsModel.fixedFonts
|
|
enabled: true
|
|
Layout.fillWidth: true
|
|
topInset: 0
|
|
bottomInset: 0
|
|
leftPadding: FishUI.Units.largeSpacing
|
|
rightPadding: FishUI.Units.largeSpacing
|
|
onActivated: appearance.setFixedFontFamily(currentText)
|
|
}
|
|
|
|
Label {
|
|
text: qsTr("Font Size")
|
|
bottomPadding: FishUI.Units.smallSpacing
|
|
}
|
|
|
|
TabBar {
|
|
Layout.fillWidth: true
|
|
|
|
TabButton {
|
|
text: qsTr("Small")
|
|
}
|
|
|
|
TabButton {
|
|
text: qsTr("Medium")
|
|
}
|
|
|
|
TabButton {
|
|
text: qsTr("Large")
|
|
}
|
|
|
|
TabButton {
|
|
text: qsTr("Huge")
|
|
}
|
|
|
|
currentIndex: {
|
|
var index = 0
|
|
|
|
if (appearance.fontPointSize <= 9)
|
|
index = 0
|
|
else if (appearance.fontPointSize <= 10)
|
|
index = 1
|
|
else if (appearance.fontPointSize <= 12)
|
|
index = 2
|
|
else if (appearance.fontPointSize <= 15)
|
|
index = 3
|
|
|
|
return index
|
|
}
|
|
|
|
onCurrentIndexChanged: {
|
|
var fontSize = 0
|
|
|
|
switch (currentIndex) {
|
|
case 0:
|
|
fontSize = 9
|
|
break;
|
|
case 1:
|
|
fontSize = 10
|
|
break;
|
|
case 2:
|
|
fontSize = 12
|
|
break;
|
|
case 3:
|
|
fontSize = 15
|
|
break;
|
|
}
|
|
|
|
appearance.setFontPointSize(fontSize)
|
|
}
|
|
}
|
|
|
|
Label {
|
|
text: qsTr("Hinting")
|
|
bottomPadding: FishUI.Units.smallSpacing
|
|
}
|
|
|
|
ComboBox {
|
|
model: fonts.hintingModel
|
|
textRole: "display"
|
|
Layout.fillWidth: true
|
|
currentIndex: fonts.hintingCurrentIndex
|
|
onCurrentIndexChanged: fonts.hintingCurrentIndex = currentIndex
|
|
}
|
|
|
|
Label {
|
|
text: qsTr("Anti-Aliasing")
|
|
bottomPadding: FishUI.Units.smallSpacing
|
|
}
|
|
|
|
Switch {
|
|
Layout.fillHeight: true
|
|
Layout.alignment: Qt.AlignRight
|
|
checked: fonts.antiAliasing
|
|
onCheckedChanged: fonts.antiAliasing = checked
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|