mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-22 10:40:10 +08:00
update
This commit is contained in:
parent
9296b18606
commit
e8c47e0fd8
@ -13,7 +13,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluFrame{
|
FluFrame{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 400
|
Layout.preferredHeight: 420
|
||||||
padding: 10
|
padding: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
#include <QThreadPool>
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
#include "FluentIconDef.h"
|
#include "FluentIconDef.h"
|
||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
@ -91,6 +92,8 @@ bool FluTheme::dark() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FluTheme::updateDesktopImage(){
|
void FluTheme::updateDesktopImage(){
|
||||||
|
QThreadPool::globalInstance()->start([=]() {
|
||||||
|
_mutex.lock();
|
||||||
auto path = FluTools::getInstance()->getWallpaperFilePath();
|
auto path = FluTools::getInstance()->getWallpaperFilePath();
|
||||||
if(_desktopImagePath != path){
|
if(_desktopImagePath != path){
|
||||||
if(!_desktopImagePath.isEmpty()){
|
if(!_desktopImagePath.isEmpty()){
|
||||||
@ -99,6 +102,8 @@ void FluTheme::updateDesktopImage(){
|
|||||||
desktopImagePath(path);
|
desktopImagePath(path);
|
||||||
_watcher.addPath(path);
|
_watcher.addPath(path);
|
||||||
}
|
}
|
||||||
|
_mutex.unlock();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluTheme::timerEvent(QTimerEvent *event)
|
void FluTheme::timerEvent(QTimerEvent *event)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
|
#include <QMutex>
|
||||||
#include "FluAccentColor.h"
|
#include "FluAccentColor.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "singleton.h"
|
#include "singleton.h"
|
||||||
@ -70,6 +71,7 @@ SINGLETON(FluTheme)
|
|||||||
private:
|
private:
|
||||||
bool _systemDark;
|
bool _systemDark;
|
||||||
QFileSystemWatcher _watcher;
|
QFileSystemWatcher _watcher;
|
||||||
|
QMutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUTHEME_H
|
#endif // FLUTHEME_H
|
||||||
|
@ -281,6 +281,18 @@ QString FluTools::getWallpaperFilePath() {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif defined(Q_OS_MACOS)
|
||||||
|
QProcess process;
|
||||||
|
QStringList args;
|
||||||
|
args << "-e";
|
||||||
|
args << R"(tell application "Finder" to get POSIX path of (desktop picture as alias))";
|
||||||
|
process.start("osascript", args);
|
||||||
|
process.waitForFinished();
|
||||||
|
QByteArray result = process.readAllStandardOutput().trimmed();
|
||||||
|
if(result.isEmpty()){
|
||||||
|
return "/System/Library/CoreServices/DefaultDesktop.heic";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
#else
|
#else
|
||||||
return {};
|
return {};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user