mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-30 07:03:46 +08:00
update
This commit is contained in:
parent
332c0ee54e
commit
939e04e4ca
@ -15,6 +15,13 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections{
|
||||||
|
target: FluApp
|
||||||
|
function onVsyncChanged(){
|
||||||
|
SettingsHelper.saveVsync(FluApp.vsync)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FluHttpInterceptor{
|
FluHttpInterceptor{
|
||||||
id:interceptor
|
id:interceptor
|
||||||
function onIntercept(request){
|
function onIntercept(request){
|
||||||
@ -33,6 +40,7 @@ Window {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluApp.init(app)
|
FluApp.init(app)
|
||||||
|
FluApp.vsync = SettingsHelper.getVsync()
|
||||||
FluTheme.darkMode = SettingsHelper.getDarkMode()
|
FluTheme.darkMode = SettingsHelper.getDarkMode()
|
||||||
FluTheme.enableAnimation = true
|
FluTheme.enableAnimation = true
|
||||||
FluApp.routes = {
|
FluApp.routes = {
|
||||||
|
@ -56,6 +56,23 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 50
|
||||||
|
paddings: 10
|
||||||
|
FluCheckBox{
|
||||||
|
text:"V-Sync"
|
||||||
|
checked: FluApp.vsync
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClicked: {
|
||||||
|
FluApp.vsync = !FluApp.vsync
|
||||||
|
dialog_restart.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -71,13 +88,13 @@ FluScrollablePage{
|
|||||||
}else{
|
}else{
|
||||||
SettingsHelper.saveRender("software")
|
SettingsHelper.saveRender("software")
|
||||||
}
|
}
|
||||||
dialog_render.open()
|
dialog_restart.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluContentDialog{
|
FluContentDialog{
|
||||||
id:dialog_render
|
id:dialog_restart
|
||||||
title:"友情提示"
|
title:"友情提示"
|
||||||
message:"此操作需要重启才能生效,是否重新启动?"
|
message:"此操作需要重启才能生效,是否重新启动?"
|
||||||
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
||||||
|
@ -15,6 +15,13 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections{
|
||||||
|
target: FluApp
|
||||||
|
function onVsyncChanged(){
|
||||||
|
SettingsHelper.saveVsync(FluApp.vsync)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FluHttpInterceptor{
|
FluHttpInterceptor{
|
||||||
id:interceptor
|
id:interceptor
|
||||||
function onIntercept(request){
|
function onIntercept(request){
|
||||||
@ -33,6 +40,7 @@ Window {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluApp.init(app)
|
FluApp.init(app)
|
||||||
|
FluApp.vsync = SettingsHelper.getVsync()
|
||||||
FluTheme.darkMode = SettingsHelper.getDarkMode()
|
FluTheme.darkMode = SettingsHelper.getDarkMode()
|
||||||
FluTheme.enableAnimation = true
|
FluTheme.enableAnimation = true
|
||||||
FluApp.routes = {
|
FluApp.routes = {
|
||||||
|
@ -59,6 +59,23 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 50
|
||||||
|
paddings: 10
|
||||||
|
FluCheckBox{
|
||||||
|
text:"V-Sync"
|
||||||
|
checked: FluApp.vsync
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClicked: {
|
||||||
|
FluApp.vsync = !FluApp.vsync
|
||||||
|
dialog_restart.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -74,13 +91,13 @@ FluScrollablePage{
|
|||||||
}else{
|
}else{
|
||||||
SettingsHelper.saveRender("software")
|
SettingsHelper.saveRender("software")
|
||||||
}
|
}
|
||||||
dialog_render.open()
|
dialog_restart.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluContentDialog{
|
FluContentDialog{
|
||||||
id:dialog_render
|
id:dialog_restart
|
||||||
title:"友情提示"
|
title:"友情提示"
|
||||||
message:"此操作需要重启才能生效,是否重新启动?"
|
message:"此操作需要重启才能生效,是否重新启动?"
|
||||||
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
||||||
|
@ -23,6 +23,8 @@ public:
|
|||||||
Q_INVOKABLE QString getRender(){return get("render").toString();}
|
Q_INVOKABLE QString getRender(){return get("render").toString();}
|
||||||
Q_INVOKABLE void saveDarkMode(int darkModel){save("darkMode",darkModel);}
|
Q_INVOKABLE void saveDarkMode(int darkModel){save("darkMode",darkModel);}
|
||||||
Q_INVOKABLE int getDarkMode(){return get("darkMode").toInt(0);}
|
Q_INVOKABLE int getDarkMode(){return get("darkMode").toInt(0);}
|
||||||
|
Q_INVOKABLE void saveVsync(bool vsync){save("vsync",vsync);}
|
||||||
|
Q_INVOKABLE bool getVsync(){return get("vsync").toBool();}
|
||||||
private:
|
private:
|
||||||
void save(const QString& key,QVariant val);
|
void save(const QString& key,QVariant val);
|
||||||
QVariant get(const QString& key);
|
QVariant get(const QString& key);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
FluApp::FluApp(QObject *parent):QObject{parent}{
|
FluApp::FluApp(QObject *parent):QObject{parent}{
|
||||||
|
vsync(false);
|
||||||
httpInterceptor(nullptr);
|
httpInterceptor(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
class FluApp : public QObject
|
class FluApp : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(bool,vsync)
|
||||||
Q_PROPERTY_AUTO(QString,initialRoute);
|
Q_PROPERTY_AUTO(QString,initialRoute);
|
||||||
Q_PROPERTY_AUTO(QJsonObject,routes);
|
Q_PROPERTY_AUTO(QJsonObject,routes);
|
||||||
Q_PROPERTY_AUTO(FluHttpInterceptor*,httpInterceptor);
|
Q_PROPERTY_AUTO(FluHttpInterceptor*,httpInterceptor);
|
||||||
|
@ -8,6 +8,7 @@ WindowLifecycle::WindowLifecycle(QObject *parent):QObject{parent}{
|
|||||||
|
|
||||||
void WindowLifecycle::onCompleted(QQuickWindow* window){
|
void WindowLifecycle::onCompleted(QQuickWindow* window){
|
||||||
this->_window = window;
|
this->_window = window;
|
||||||
|
vsyncEnable(FluApp::getInstance()->vsync());
|
||||||
FluApp::getInstance()->addWindow(this->_window);
|
FluApp::getInstance()->addWindow(this->_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,6 +22,12 @@ void WindowLifecycle::onDestruction(){
|
|||||||
void WindowLifecycle::onVisible(bool visible){
|
void WindowLifecycle::onVisible(bool visible){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowLifecycle::vsyncEnable(bool enable){
|
||||||
|
auto froamt = _window->format();
|
||||||
|
froamt.setSwapInterval(enable);
|
||||||
|
_window->setFormat(froamt);
|
||||||
|
}
|
||||||
|
|
||||||
QVariant WindowLifecycle::createRegister(QQuickWindow* window,const QString& path){
|
QVariant WindowLifecycle::createRegister(QQuickWindow* window,const QString& path){
|
||||||
FluRegister *p = new FluRegister(window);
|
FluRegister *p = new FluRegister(window);
|
||||||
p->from(window);
|
p->from(window);
|
||||||
|
@ -22,6 +22,7 @@ public:
|
|||||||
Q_INVOKABLE void onVisible(bool visible);
|
Q_INVOKABLE void onVisible(bool visible);
|
||||||
Q_INVOKABLE void onDestoryOnClose();
|
Q_INVOKABLE void onDestoryOnClose();
|
||||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||||
|
void vsyncEnable(bool enable);
|
||||||
private:
|
private:
|
||||||
QQuickWindow* _window;
|
QQuickWindow* _window;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user