mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-05-13 16:44:02 +08:00
Compare commits
No commits in common. "2c4cf82f63526148ad793b6369ee83cb59bf8924" and "9296b186067df903b2797726bfede7cc60d3ba39" have entirely different histories.
2c4cf82f63
...
9296b18606
@ -13,7 +13,7 @@ FluScrollablePage{
|
||||
|
||||
FluFrame{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 408
|
||||
Layout.preferredHeight: 400
|
||||
padding: 10
|
||||
|
||||
ColumnLayout{
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QPalette>
|
||||
#include <QImage>
|
||||
#include <QThreadPool>
|
||||
#include "Def.h"
|
||||
#include "FluentIconDef.h"
|
||||
#include "FluColors.h"
|
||||
@ -25,7 +24,7 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} {
|
||||
_blurBehindWindowEnabled = false;
|
||||
QGuiApplication::instance()->installEventFilter(this);
|
||||
refreshColors();
|
||||
checkUpdateDesktopImage();
|
||||
updateDesktopImage();
|
||||
connect(this, &FluTheme::darkModeChanged, this, [=] {
|
||||
Q_EMIT darkChanged();
|
||||
});
|
||||
@ -49,7 +48,7 @@ void FluTheme::refreshColors() {
|
||||
fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255));
|
||||
itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0));
|
||||
frameColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09)));
|
||||
frameActiveColor(isDark ? QColor(48, 48, 48, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6)));
|
||||
frameActiveColor(isDark ? QColor(32, 32, 32, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6)));
|
||||
itemHoverColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.06)) : QColor(0, 0, 0, qRound(255 * 0.03)));
|
||||
itemPressColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.09)) : QColor(0, 0, 0, qRound(255 * 0.06)));
|
||||
itemCheckColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09)));
|
||||
@ -91,24 +90,18 @@ bool FluTheme::dark() const {
|
||||
}
|
||||
}
|
||||
|
||||
void FluTheme::checkUpdateDesktopImage(){
|
||||
QThreadPool::globalInstance()->start([=]() {
|
||||
_mutex.lock();
|
||||
auto path = FluTools::getInstance()->getWallpaperFilePath();
|
||||
if(_desktopImagePath != path){
|
||||
if(!_desktopImagePath.isEmpty()){
|
||||
_watcher.removePath(_desktopImagePath);
|
||||
}
|
||||
desktopImagePath(path);
|
||||
_watcher.addPath(path);
|
||||
void FluTheme::updateDesktopImage(){
|
||||
auto path = FluTools::getInstance()->getWallpaperFilePath();
|
||||
if(_desktopImagePath != path){
|
||||
if(!_desktopImagePath.isEmpty()){
|
||||
_watcher.removePath(_desktopImagePath);
|
||||
}
|
||||
_mutex.unlock();
|
||||
});
|
||||
desktopImagePath(path);
|
||||
_watcher.addPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
void FluTheme::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if(_blurBehindWindowEnabled){
|
||||
checkUpdateDesktopImage();
|
||||
}
|
||||
updateDesktopImage();
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <QColor>
|
||||
#include <QTimer>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QMutex>
|
||||
#include "FluAccentColor.h"
|
||||
#include "stdafx.h"
|
||||
#include "singleton.h"
|
||||
@ -55,7 +54,7 @@ protected:
|
||||
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
void checkUpdateDesktopImage();
|
||||
void updateDesktopImage();
|
||||
|
||||
public:
|
||||
SINGLETON(FluTheme)
|
||||
@ -71,7 +70,6 @@ SINGLETON(FluTheme)
|
||||
private:
|
||||
bool _systemDark;
|
||||
QFileSystemWatcher _watcher;
|
||||
QMutex _mutex;
|
||||
};
|
||||
|
||||
#endif // FLUTHEME_H
|
||||
|
@ -281,18 +281,6 @@ QString FluTools::getWallpaperFilePath() {
|
||||
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
|
||||
return {};
|
||||
#endif
|
||||
|
@ -118,8 +118,6 @@ Window {
|
||||
id:img_back
|
||||
visible: false
|
||||
cache: false
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
Component.onCompleted: {
|
||||
var geometry = FluTools.desktopAvailableGeometry(window)
|
||||
width = geometry.width
|
||||
|
@ -117,8 +117,6 @@ Window {
|
||||
id:img_back
|
||||
visible: false
|
||||
cache: false
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
Component.onCompleted: {
|
||||
var geometry = FluTools.desktopAvailableGeometry(window)
|
||||
width = geometry.width
|
||||
|
Loading…
x
Reference in New Issue
Block a user