Use Cutefish.Wallpaper interface

pull/1/head
reionwong 5 years ago
parent 8e922e41c3
commit db688d4771

@ -6,7 +6,6 @@ set(PROJECT_SOURCES
main.cpp
application.cpp
authenticator.cpp
wallpaper.cpp
kcheckpass-enums.h
fixx11h.h
qml.qrc
@ -27,4 +26,4 @@ target_link_libraries(cutefish-screenlocker
${X11_LIBRARIES}
)
install(TARGETS cutefish-screenlocker RUNTIME DESTINATION /usr/bin)
install(TARGETS cutefish-screenlocker RUNTIME DESTINATION /usr/bin)

@ -1,5 +1,4 @@
#include "application.h"
#include "wallpaper.h"
// Qt Core
#include <QAbstractNativeEventFilter>
@ -101,7 +100,6 @@ void Application::desktopResized()
// engine stuff
QQmlContext *context = view->engine()->rootContext();
context->setContextProperty(QStringLiteral("authenticator"), m_authenticator);
context->setContextProperty(QStringLiteral("wallpaper"), new Wallpaper);
view->setSource(QUrl("qrc:/qml/LockScreen.qml"));
view->setResizeMode(QQuickView::SizeRootObjectToView);

@ -24,6 +24,7 @@ import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import Cutefish.Accounts 1.0 as Accounts
import Cutefish.System 1.0 as System
import FishUI 1.0 as FishUI
Item {
@ -34,6 +35,10 @@ Item {
LayoutMirroring.enabled: Qt.locale().textDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
System.Wallpaper {
id: wallpaper
}
Image {
id: wallpaperImage
anchors.fill: parent
@ -158,7 +163,7 @@ Item {
id: _mainLayout
anchors.fill: parent
anchors.margins: FishUI.Units.largeSpacing * 1.5
spacing: FishUI.Units.smallSpacing
spacing: FishUI.Units.smallSpacing * 1.5
Image {
id: userIcon
@ -269,6 +274,20 @@ Item {
opacity: text == "" ? 0 : 1
}
DropShadow {
anchors.fill: message
source: message
z: -1
horizontalOffset: 1
verticalOffset: 1
radius: 10
samples: radius * 4
spread: 0.35
color: Qt.rgba(0, 0, 0, 0.8)
opacity: 0.1
visible: true
}
function tryUnlock() {
if (!password.text) {
root.notification = qsTr("Please enter your password")

@ -1,24 +0,0 @@
#include "wallpaper.h"
Wallpaper::Wallpaper(QObject *parent)
: QObject(parent)
, m_interface("org.cutefish.Settings",
"/Theme", "org.cutefish.Theme",
QDBusConnection::sessionBus(), this)
{
if (m_interface.isValid()) {
connect(&m_interface, SIGNAL(wallpaperChanged(QString)), this, SLOT(onPathChanged(QString)));
}
}
QString Wallpaper::path() const
{
return m_interface.property("wallpaper").toString();
}
void Wallpaper::onPathChanged(QString path)
{
Q_UNUSED(path);
emit pathChanged();
}

@ -1,28 +0,0 @@
#ifndef WALLPAPER_H
#define WALLPAPER_H
#include <QObject>
#include <QDBusInterface>
class Wallpaper : public QObject
{
Q_OBJECT
Q_PROPERTY(QString path READ path NOTIFY pathChanged)
public:
explicit Wallpaper(QObject *parent = nullptr);
QString path() const;
signals:
void pathChanged();
private slots:
void onPathChanged(QString path);
private:
QDBusInterface m_interface;
QString m_wallpaper;
};
#endif // WALLPAPER_H
Loading…
Cancel
Save