diff --git a/CMakeLists.txt b/CMakeLists.txt
index bee03dd..a491ed9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,10 +23,9 @@ set(SRCS
src/main.cpp
src/pagemodel.cpp
src/ucunits.cpp
+ src/wallpaper.cpp
src/listmodelmanager.cpp
src/iconitem.cpp
- src/wallpaperitem.cpp
- src/modelmanager.cpp
)
set(RESOURCES
diff --git a/debian/control b/debian/control
index feb37d1..48c1564 100644
--- a/debian/control
+++ b/debian/control
@@ -24,7 +24,6 @@ Depends: qml-module-qtquick-controls2,
qml-module-qtqml,
qml-module-qtquick-window2,
qml-module-qtquick-shapes,
- qml-module-qtquick-dialogs,
${misc:Depends},
${shlibs:Depends}
Description: CutefishOS Launcher
diff --git a/qml.qrc b/qml.qrc
index 9030bef..f6d1235 100755
--- a/qml.qrc
+++ b/qml.qrc
@@ -4,6 +4,5 @@
qml/LauncherGridDelegate.qml
qml/PageView.qml
qml/LauncherGridView.qml
- qml/AppView.qml
diff --git a/qml/AppView.qml b/qml/AppView.qml
deleted file mode 100644
index b511489..0000000
--- a/qml/AppView.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-import QtQuick 2.12
-import QtQuick.Layouts 1.12
-import QtQuick.Controls 2.12
-import MeuiKit 1.0 as Meui
-
-ListView {
- id: control
-
- focus: true
- snapMode: ListView.SnapToItem
- maximumFlickVelocity: 9000
- highlightMoveDuration: 100
-
- preferredHighlightBegin: 0
- preferredHighlightEnd: 0
- highlightRangeMode: ListView.StrictlyEnforceRange
- highlightFollowsCurrentItem: true
- cacheBuffer: control.width * control.count
- clip: true
-
- displaced: Transition {
- SpringAnimation {
- property: "y"
- spring: 3
- damping: 0.1
- epsilon: 0.25
- duration: 1000
- }
- }
-
- Component {
- id: listDelegate
-
- Flow {
- id: launcherGrid
- width: control.width
- height: control.height
-
- move: Transition {
- NumberAnimation {
- duration: 200
- easing.type: Easing.InOutQuad
- properties: "x,y"
- }
- }
-
- Repeater {
- id: repeaterHandle
-
- delegate: DropArea {
- id: delegate
- width: control.width / 6
- height: control.height / 4
- opacity: 1
- }
- }
- }
- }
-}
diff --git a/qml/LauncherGridDelegate.qml b/qml/LauncherGridDelegate.qml
index 83d88db..2122cbc 100755
--- a/qml/LauncherGridDelegate.qml
+++ b/qml/LauncherGridDelegate.qml
@@ -69,9 +69,11 @@ Item {
}
}
- Meui.TopLevelMenu {
+ Menu {
id: _itemMenu
+ modal: true
+
MenuItem {
text: qsTr("Open")
onTriggered: launcherModel.launch(model.appId)
diff --git a/qml/main.qml b/qml/main.qml
index 46901b7..b1e606b 100755
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -13,9 +13,19 @@ Item {
property real horizontalSpacing: root.width * 0.01
property real verticalSpacing: root.height * 0.01
- WallpaperItem {
+ Wallpaper {
+ id: backend
+ }
+
+ Image {
id: wallpaper
anchors.fill: parent
+ source: "file://" + backend.wallpaper
+ sourceSize: Qt.size(width, height)
+ fillMode: Image.PreserveAspectCrop
+ clip: true
+ cache: true
+ smooth: false
}
FastBlur {
@@ -29,7 +39,7 @@ Item {
anchors.fill: parent
source: wallpaperBlur
color: "#000000"
- opacity: 0.5
+ opacity: 0.6
visible: true
}
diff --git a/src/main.cpp b/src/main.cpp
index d598280..fa6e6e8 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -25,7 +25,7 @@
#include "launcheritem.h"
#include "launchermodel.h"
#include "pagemodel.h"
-#include "wallpaperitem.h"
+#include "wallpaper.h"
#include "iconitem.h"
#include
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
qmlRegisterUncreatableType(uri, 1, 0, "LauncherItem", "cannot init application");
qmlRegisterType(uri, 1, 0, "LauncherModel");
qmlRegisterType(uri, 1, 0, "PageModel");
- qmlRegisterType(uri, 1, 0, "WallpaperItem");
+ qmlRegisterType(uri, 1, 0, "Wallpaper");
qmlRegisterType(uri, 1, 0, "IconItem");
QApplication app(argc, argv);
diff --git a/src/modelmanager.cpp b/src/modelmanager.cpp
deleted file mode 100644
index b8fc80c..0000000
--- a/src/modelmanager.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "modelmanager.h"
-
-ModelManager::ModelManager(QObject *parent) : QObject(parent)
-{
-
-}
-
-int ModelManager::count() const
-{
- return m_appList.count();
-}
diff --git a/src/modelmanager.h b/src/modelmanager.h
deleted file mode 100644
index 28ca925..0000000
--- a/src/modelmanager.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef MODELMANAGER_H
-#define MODELMANAGER_H
-
-#include
-
-struct ApplicationData {
- QString name;
- QString icon;
- QStringList args;
-};
-
-class ModelManager : public QObject
-{
- Q_OBJECT
-
-public:
- explicit ModelManager(QObject *parent = nullptr);
-
- int count() const;
-
-private:
- QList m_appList;
-};
-
-#endif // MODELMANAGER_H
diff --git a/src/wallpaper.cpp b/src/wallpaper.cpp
new file mode 100644
index 0000000..cb391af
--- /dev/null
+++ b/src/wallpaper.cpp
@@ -0,0 +1,34 @@
+#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(onWallpaperChanged(QString)));
+ connect(&m_interface, SIGNAL(darkModeDimsWallpaerChanged()), this, SIGNAL(dimsWallpaperChanged()));
+
+ m_wallpaper = m_interface.property("wallpaper").toString();
+ emit wallpaperChanged();
+ }
+}
+
+QString Wallpaper::wallpaper() const
+{
+ return m_wallpaper;
+}
+
+bool Wallpaper::dimsWallpaper() const
+{
+ return m_interface.property("darkModeDimsWallpaer").toBool();
+}
+
+void Wallpaper::onWallpaperChanged(QString path)
+{
+ if (path != m_wallpaper) {
+ m_wallpaper = path;
+ emit wallpaperChanged();
+ }
+}
diff --git a/src/wallpaper.h b/src/wallpaper.h
new file mode 100644
index 0000000..7d316ab
--- /dev/null
+++ b/src/wallpaper.h
@@ -0,0 +1,32 @@
+#ifndef WALLPAPER_H
+#define WALLPAPER_H
+
+#include
+#include
+#include
+
+class Wallpaper : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString wallpaper READ wallpaper NOTIFY wallpaperChanged)
+ Q_PROPERTY(bool dimsWallpaper READ dimsWallpaper NOTIFY dimsWallpaperChanged)
+
+public:
+ explicit Wallpaper(QObject *parent = nullptr);
+
+ QString wallpaper() const;
+ bool dimsWallpaper() const;
+
+signals:
+ void wallpaperChanged();
+ void dimsWallpaperChanged();
+
+private slots:
+ void onWallpaperChanged(QString);
+
+private:
+ QDBusInterface m_interface;
+ QString m_wallpaper;
+};
+
+#endif // WALLPAPER_H
diff --git a/src/wallpaperitem.cpp b/src/wallpaperitem.cpp
deleted file mode 100644
index 167e6a1..0000000
--- a/src/wallpaperitem.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "wallpaperitem.h"
-#include
-#include
-
-WallpaperItem::WallpaperItem(QQuickItem *parent)
- : QQuickPaintedItem(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(onWallpaperChanged(QString)));
- m_wallpaper = m_interface.property("wallpaper").toString();
- loadWallpaperPixmap();
- }
-}
-
-void WallpaperItem::paint(QPainter *painter)
-{
- painter->drawPixmap(QRect(0, 0, width(), height()), m_pixmap);
-}
-
-void WallpaperItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_UNUSED(newGeometry);
- Q_UNUSED(oldGeometry);
-
- loadWallpaperPixmap();
-}
-
-void WallpaperItem::loadWallpaperPixmap()
-{
- // Clear cache.
- m_pixmap = QPixmap();
- QPixmapCache::clear();
-
- if (m_wallpaper.isEmpty())
- return;
-
- m_pixmap = QPixmap(m_wallpaper).scaled(QSize(width(), height()),
- Qt::KeepAspectRatioByExpanding);
-
- QQuickPaintedItem::update();
-}
-
-void WallpaperItem::onWallpaperChanged(QString wallpaper)
-{
- m_wallpaper = wallpaper;
- loadWallpaperPixmap();
-}
diff --git a/src/wallpaperitem.h b/src/wallpaperitem.h
deleted file mode 100644
index 63c7ac3..0000000
--- a/src/wallpaperitem.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef WALLPAPERITEM_H
-#define WALLPAPERITEM_H
-
-#include
-#include
-#include
-
-class WallpaperItem : public QQuickPaintedItem
-{
- Q_OBJECT
-
-public:
- explicit WallpaperItem(QQuickItem *parent = nullptr);
-
- void paint(QPainter *painter) override;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
-
-private:
- void loadWallpaperPixmap();
-
-private slots:
- void onWallpaperChanged(QString wallpaper);
-
-private:
- QPixmap m_pixmap;
- QDBusInterface m_interface;
- QString m_wallpaper;
-};
-
-#endif // WALLPAPERITEM_H