添加壁纸透明功能,为动态壁纸铺路
This commit is contained in:
parent
03f44ef7be
commit
821a05d067
4 changed files with 15 additions and 5 deletions
|
@ -41,6 +41,11 @@ QString DesktopSettings::wallpaper() const
|
||||||
return m_wallpaper;
|
return m_wallpaper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DesktopSettings::backgroundVisible() const
|
||||||
|
{
|
||||||
|
return m_interface.property("backgroundVisible").toBool();
|
||||||
|
}
|
||||||
|
|
||||||
bool DesktopSettings::dimsWallpaper() const
|
bool DesktopSettings::dimsWallpaper() const
|
||||||
{
|
{
|
||||||
return m_interface.property("darkModeDimsWallpaer").toBool();
|
return m_interface.property("darkModeDimsWallpaer").toBool();
|
||||||
|
@ -71,7 +76,7 @@ void DesktopSettings::init()
|
||||||
connect(&m_interface, SIGNAL(darkModeDimsWallpaerChanged()), this, SIGNAL(dimsWallpaperChanged()));
|
connect(&m_interface, SIGNAL(darkModeDimsWallpaerChanged()), this, SIGNAL(dimsWallpaperChanged()));
|
||||||
connect(&m_interface, SIGNAL(backgroundTypeChanged()), this, SIGNAL(backgroundTypeChanged()));
|
connect(&m_interface, SIGNAL(backgroundTypeChanged()), this, SIGNAL(backgroundTypeChanged()));
|
||||||
connect(&m_interface, SIGNAL(backgroundColorChanged()), this, SIGNAL(backgroundColorChanged()));
|
connect(&m_interface, SIGNAL(backgroundColorChanged()), this, SIGNAL(backgroundColorChanged()));
|
||||||
|
connect(&m_interface, SIGNAL(backgroundVisibleChanged()), this, SIGNAL(backgroundVisibleChanged()));
|
||||||
m_wallpaper = m_interface.property("wallpaper").toString();
|
m_wallpaper = m_interface.property("wallpaper").toString();
|
||||||
emit wallpaperChanged();
|
emit wallpaperChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class DesktopSettings : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString wallpaper READ wallpaper NOTIFY wallpaperChanged)
|
Q_PROPERTY(QString wallpaper READ wallpaper NOTIFY wallpaperChanged)
|
||||||
Q_PROPERTY(bool dimsWallpaper READ dimsWallpaper NOTIFY dimsWallpaperChanged)
|
Q_PROPERTY(bool dimsWallpaper READ dimsWallpaper NOTIFY dimsWallpaperChanged)
|
||||||
|
Q_PROPERTY(bool backgroundVisible READ backgroundVisible NOTIFY backgroundVisibleChanged)
|
||||||
Q_PROPERTY(int backgroundType READ backgroundType NOTIFY backgroundTypeChanged)
|
Q_PROPERTY(int backgroundType READ backgroundType NOTIFY backgroundTypeChanged)
|
||||||
Q_PROPERTY(QString backgroundColor READ backgroundColor NOTIFY backgroundColorChanged)
|
Q_PROPERTY(QString backgroundColor READ backgroundColor NOTIFY backgroundColorChanged)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public:
|
||||||
|
|
||||||
QString wallpaper() const;
|
QString wallpaper() const;
|
||||||
bool dimsWallpaper() const;
|
bool dimsWallpaper() const;
|
||||||
|
bool backgroundVisible() const;
|
||||||
int backgroundType() const;
|
int backgroundType() const;
|
||||||
QString backgroundColor() const;
|
QString backgroundColor() const;
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ signals:
|
||||||
void dimsWallpaperChanged();
|
void dimsWallpaperChanged();
|
||||||
void backgroundColorChanged();
|
void backgroundColorChanged();
|
||||||
void backgroundTypeChanged();
|
void backgroundTypeChanged();
|
||||||
|
void backgroundVisibleChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void init();
|
void init();
|
||||||
void onWallpaperChanged(QString);
|
void onWallpaperChanged(QString);
|
||||||
|
|
|
@ -35,12 +35,14 @@ DesktopView::DesktopView(QScreen *screen, QQuickView *parent)
|
||||||
, m_screen(screen)
|
, m_screen(screen)
|
||||||
{
|
{
|
||||||
m_screenRect = m_screen->geometry();
|
m_screenRect = m_screen->geometry();
|
||||||
|
this->setFlag(Qt::FramelessWindowHint);
|
||||||
|
this->setColor(QColor(Qt::transparent));
|
||||||
KWindowSystem::setType(winId(), NET::Desktop);
|
KWindowSystem::setType(winId(), NET::Desktop);
|
||||||
KWindowSystem::setState(winId(), NET::KeepBelow);
|
KWindowSystem::setState(winId(), NET::KeepBelow);
|
||||||
|
|
||||||
engine()->rootContext()->setContextProperty("desktopView", this);
|
engine()->rootContext()->setContextProperty("desktopView", this);
|
||||||
engine()->rootContext()->setContextProperty("Dock", DockDBusInterface::self());
|
engine()->rootContext()->setContextProperty("Dock", DockDBusInterface::self());
|
||||||
|
QWindow::fromWinId(winId())->setOpacity(0.99);
|
||||||
engine()->addImageProvider("thumbnailer", new ThumbnailProvider());
|
engine()->addImageProvider("thumbnailer", new ThumbnailProvider());
|
||||||
|
|
||||||
setTitle(tr("Desktop"));
|
setTitle(tr("Desktop"));
|
||||||
|
|
|
@ -26,6 +26,7 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
visible: settings.backgroundVisible
|
||||||
color: settings.backgroundColor
|
color: settings.backgroundColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +40,7 @@ Item {
|
||||||
height * Screen.devicePixelRatio)
|
height * Screen.devicePixelRatio)
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
clip: true
|
clip: true
|
||||||
|
visible: settings.backgroundVisible
|
||||||
cache: false
|
cache: false
|
||||||
|
|
||||||
// Clear cache
|
// Clear cache
|
||||||
|
|
Loading…
Reference in a new issue