This commit is contained in:
朱子楚\zhuzi 2023-11-23 19:58:54 +08:00
parent 35d85aa801
commit 2f3ed2bd0f
11 changed files with 50 additions and 3 deletions

View File

@ -19,6 +19,9 @@ Item {
function onVsyncChanged(){
SettingsHelper.saveVsync(FluApp.vsync)
}
function onUseSystemAppBarChanged(){
SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar)
}
}
FluHttpInterceptor{
@ -39,6 +42,7 @@ Item {
Component.onCompleted: {
FluApp.init(app)
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluApp.vsync = SettingsHelper.getVsync()
FluTheme.darkMode = SettingsHelper.getDarkMode()
FluTheme.enableAnimation = true

View File

@ -39,6 +39,7 @@ FluContentPage{
bottom: parent.bottom
left: parent.left
}
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: FluScrollBar {}
contentHeight:layout_column.height
Column{

View File

@ -72,6 +72,22 @@ FluScrollablePage{
}
}
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 50
paddings: 10
FluCheckBox{
text:"Use System AppBar"
checked: FluApp.useSystemAppBar
anchors.verticalCenter: parent.verticalCenter
onClicked: {
FluApp.useSystemAppBar = !FluApp.useSystemAppBar
dialog_restart.open()
}
}
}
FluArea{
Layout.fillWidth: true

View File

@ -19,6 +19,9 @@ Item {
function onVsyncChanged(){
SettingsHelper.saveVsync(FluApp.vsync)
}
function onUseSystemAppBarChanged(){
SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar)
}
}
FluHttpInterceptor{
@ -39,6 +42,7 @@ Item {
Component.onCompleted: {
FluApp.init(app)
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluApp.vsync = SettingsHelper.getVsync()
FluTheme.darkMode = SettingsHelper.getDarkMode()
FluTheme.enableAnimation = true

View File

@ -75,6 +75,21 @@ FluScrollablePage{
}
}
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 50
paddings: 10
FluCheckBox{
text:"Use System AppBar"
checked: FluApp.useSystemAppBar
anchors.verticalCenter: parent.verticalCenter
onClicked: {
FluApp.useSystemAppBar = !FluApp.useSystemAppBar
dialog_restart.open()
}
}
}
FluArea{
Layout.fillWidth: true

View File

@ -25,6 +25,8 @@ public:
Q_INVOKABLE QVariant getDarkMode(){return get("darkMode",QVariant(0));}
Q_INVOKABLE void saveVsync(bool vsync){save("vsync",vsync);}
Q_INVOKABLE QVariant getVsync(){return get("vsync",QVariant(true));}
Q_INVOKABLE void saveUseSystemAppBar(bool useSystemAppBar){save("useSystemAppBar",useSystemAppBar);}
Q_INVOKABLE QVariant getUseSystemAppBar(){return get("useSystemAppBar",QVariant(false));}
private:
void save(const QString& key,QVariant val);
QVariant get(const QString& key,QVariant def={});

@ -1 +1 @@
Subproject commit 694967e930d2dd9f15c5429674005cc0a4217060
Subproject commit 49c72fb4f85421f770a6a14657ba73a9912ee833

View File

@ -14,8 +14,10 @@
FRAMELESSHELPER_USE_NAMESPACE
FluApp::FluApp(QObject *parent):QObject{parent}{
connect(this,&FluApp::useSystemAppBarChanged,this,[=]{FramelessConfig::instance()->set(Global::Option::UseSystemAppBar,_useSystemAppBar);});
vsync(true);
httpInterceptor(nullptr);
useSystemAppBar(false);
}
FluApp::~FluApp(){

View File

@ -23,6 +23,7 @@ class FluApp : public QObject
Q_PROPERTY_AUTO(QString,initialRoute);
Q_PROPERTY_AUTO(QJsonObject,routes);
Q_PROPERTY_AUTO(FluHttpInterceptor*,httpInterceptor);
Q_PROPERTY_AUTO(bool,useSystemAppBar);
QML_NAMED_ELEMENT(FluApp)
QML_SINGLETON
private:

View File

@ -38,7 +38,7 @@ Window {
property bool showMinimize: true
property bool showMaximize: true
property bool showStayTop: true
property bool useSystemAppBar: false
property bool useSystemAppBar
property var closeListener: function(event){
if(closeDestory){
destoryOnClose()
@ -58,6 +58,7 @@ Window {
d.changedStayTop()
}
Component.onCompleted: {
useSystemAppBar = FluApp.useSystemAppBar
lifecycle.onCompleted(window)
initArgument(argument)
d.changedStayTop()

View File

@ -37,7 +37,7 @@ Window {
property bool showMinimize: true
property bool showMaximize: true
property bool showStayTop: true
property bool useSystemAppBar: false
property bool useSystemAppBar
property var closeListener: function(event){
if(closeDestory){
destoryOnClose()
@ -57,6 +57,7 @@ Window {
d.changedStayTop()
}
Component.onCompleted: {
useSystemAppBar = FluApp.useSystemAppBar
lifecycle.onCompleted(window)
initArgument(argument)
d.changedStayTop()