diff --git a/Time.qml b/Time.qml
deleted file mode 100644
index 2affe21..0000000
--- a/Time.qml
+++ /dev/null
@@ -1,340 +0,0 @@
-import QtQuick 2.0
-import QtQml 2.12
-import QtQuick.Layouts 1.12
-import org.ukui.appwidget 1.0
-import QtGraphicalEffects 1.0
-//import QtQuick.Controls 2.0
-AppWidget {
- id:appwidget
- appname: "time"
- visible: true
- width: 448*scalefactor
- height: 162*scalefactor
- anchors.centerIn: parent
- property double scalefactor: 1.00
- property string timeformat: "12";
- property string dateformat: "cn"
- property string hour;
- property string minute;
- property int hournumber;
- property string week;
- property string amorpm;
- property bool v: false
- property string themename;
- property bool qmleffect: false
-
- Timer {
- id: gettime;
- interval: 100;
- running: true;
- repeat: true;
- triggeredOnStart: true
- onTriggered: {
- appwidget.hour = Qt.formatTime(new Date(),"hh");
- appwidget.minute = Qt.formatTime(new Date(),"mm");
- if(appwidget.timeformat === "12") {
- appwidget.hournumber = Number(appwidget.hour);
- if(appwidget.hournumber > 12) {
- if(appwidget.dateformat == "cn") {
- ampm.text = "下午"
- }
- else if(appwidget.dateformat == "en") {
- ampm.text = "PM"
- }
- appwidget.hournumber -= 12;
- }
- else {
- if(appwidget.dateformat == "cn") {
- ampm.text = "上午"
- }
- else if(appwidget.dateformat == "en") {
- ampm.text = "AM"
- }
- }
-
- if(appwidget.hournumber < 10) {
- time1rec.width = 244
- time1.width = 244
-// console.log("=12制 宽度=",time1rec.width);
- }else {
- time1rec.width = 294
- time1.width = 294
-// console.log("=12制 宽度=",time1rec.width);
- }
-
- appwidget.hour = appwidget.hournumber.toString();
- time1.text = appwidget.hour + ":" + appwidget.minute
-// console.log("=12制=",time1.text);
- }
- else {
- time2.text = appwidget.hour + ":" + appwidget.minute
-// console.log("=24制=",time2.text);
- }
- week1.text = Qt.formatDate(new Date(),"ddd")
- week2.text = Qt.formatDate(new Date(),"ddd")
-
- if(dateformat == "cn") {
- date1.text = Qt.formatDate(new Date(),"MM/dd");
- date2.text = Qt.formatDate(new Date(),"MM/dd");
- }
- if(dateformat == "en") {
- date1.text = Qt.formatDate(new Date(),"MM-dd");
- date2.text = Qt.formatDate(new Date(),"MM-dd");
- }
- }
- }
-
-
- Rectangle {
- id :twelverec
- color: "transparent"
-// radius: 15
- anchors.fill: parent
- anchors.left: parent.left
- anchors.verticalCenter: parent.verticalCenter
- visible: !v
- Rectangle {
- id :time1rec
- color: "transparent"
-// border.color: "green"
- anchors.verticalCenter: parent.verticalCenter
- width: 244*appwidget.scalefactor
- height: 112*appwidget.scalefactor
- Text {
- id: time1
- anchors.fill:parent
- verticalAlignment: TextInput.AlignVCenter
- color: "#FAFAFA"
- font.pixelSize:112*appwidget.scalefactor
- font.letterSpacing: 0
- font.family: "STxihei"
-
- layer.enabled: appwidget.qmleffect
- layer.effect: DropShadow {
- verticalOffset: 1
- color: "#40262626"
- samples: 4
- }
- }
- }
- Rectangle {
- //间隔
- id :spacing1
- width: 16*appwidget.scalefactor
- height: 112*appwidget.scalefactor
- anchors.left: time1rec.right
- anchors.verticalCenter: parent.verticalCenter
- color: "transparent"
- }
- Rectangle {
- id :daterec
- color: "transparent"
-// border.color: "pink"
- width: 137*appwidget.scalefactor
- height: 96*appwidget.scalefactor
- anchors.verticalCenter: parent.verticalCenter
- Layout.fillWidth: true
- anchors.left: spacing1.right
-
- ColumnLayout{
- width: 137*appwidget.scalefactor
- height: 96*appwidget.scalefactor
- anchors.centerIn: parent
- Text {
- id: ampm
- color: "#FAFAFA";
- font.pixelSize:40*appwidget.scalefactor;
- font.letterSpacing: 0
- font.family: "STxihei"
- verticalAlignment: TextInput.AlignVCenter
-
- layer.enabled: appwidget.qmleffect
- layer.effect: DropShadow {
- verticalOffset: 1
- color: "#40262626"
- samples: 4
- }
- }
- RowLayout {
- Text {
- id: week1
- color: "#FAFAFA";
- font.pixelSize: 28*appwidget.scalefactor;
- font.letterSpacing: 0
- font.family: "STxihei"
- verticalAlignment: TextInput.AlignVCenter
-
- layer.enabled: appwidget.qmleffect
- layer.effect: DropShadow {
- verticalOffset: 1
- color: "#40262626"
- samples: 4
- }
- }
- Text {
- id: date1
- color: "#FAFAFA";
- font.pixelSize: 28*appwidget.scalefactor;
- font.letterSpacing: 0
- font.family: "STxihei"
- verticalAlignment: TextInput.AlignVCenter
-
- layer.enabled: appwidget.qmleffect
- layer.effect: DropShadow {
- verticalOffset: 1
- color: "#40262626"
- samples: 4
- }
- }
- }
- }
- }
- }
-
-
- Rectangle{
- id :twentyfoursystem
- color: "transparent"
-// radius: 15
- anchors.fill: parent
- anchors.left: parent.left
- anchors.verticalCenter: parent.verticalCenter
- visible: v
- Rectangle {
- id :time2rec
- color: "transparent"
-// border.color: "pink"
- anchors.verticalCenter: parent.verticalCenter
- width: 294*appwidget.scalefactor
- height: 112*appwidget.scalefactor
- Text {
- id: time2
- anchors.fill:parent
- verticalAlignment: TextInput.AlignVCenter
- color: "#FAFAFA"
- font.pixelSize:112*appwidget.scalefactor
- font.letterSpacing:0
- font.family: "STxihei"
-
- layer.enabled: appwidget.qmleffect
- layer.effect: DropShadow {
- verticalOffset: 1
- color: "#40262626"
- samples: 4
- }
- }
- }
- Rectangle {
- //间隔
- id :spacing2
- width: 16*appwidget.scalefactor
- height: 112*appwidget.scalefactor
- anchors.left: time2rec.right
- anchors.verticalCenter: parent.verticalCenter
- color: "transparent"
- }
- Rectangle {
- color: "transparent"
- width: 87*appwidget.scalefactor
- height: 112*appwidget.scalefactor
- Layout.fillWidth: true
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: spacing2.right
-
- ColumnLayout{
- width: 87*appwidget.scalefactor
- height: 112*appwidget.scalefactor
- anchors.centerIn: parent
- Layout.fillWidth: true
- Text {
- id: week2
- color: "#FAFAFA";
- font.pixelSize:40*appwidget.scalefactor;
- font.letterSpacing: 0
- font.family: "STxihei"
- verticalAlignment: TextInput.AlignVCenter
-
- layer.enabled: appwidget.qmleffect
- layer.effect: DropShadow {
- verticalOffset: 1
- color: "#40262626"
- samples: 4
- }
- }
- Text {
- id: date2
- color: "#FAFAFA";
- font.pixelSize:40*appwidget.scalefactor;
- font.letterSpacing: 0
- font.family: "STxihei"
- verticalAlignment: TextInput.AlignVCenter
-
- layer.enabled: appwidget.qmleffect
- layer.effect: DropShadow {
- verticalOffset: 1
- color: "#40262626"
- samples: 4
- }
- }
- }
- }
- }
-
- Component.onCompleted: {
-
- initScalefactor()
- gettime.start();
-// appwidget.update.connect(appwidget.onupdate);
- console.log("qml 接收到数据更新信号");
-
- appwidget.creatGsetting("org.ukui.control-center.panel.plugins");
- appwidget.gsettingUpdate.connect(appwidget.onGsettingUpdate);
- timeformat = appwidget.getGsettingValue("org.ukui.control-center.panel.plugins","hoursystem");
- dateformat = appwidget.getGsettingValue("org.ukui.control-center.panel.plugins","date");
- if(timeformat == "24") {
- v = true
- }else {
- v = false
- }
- console.log("当前gsetting为", timeformat, dateformat);
- }
- function onGsettingUpdate(key, value)
- {
- if(key === "hoursystem")
- {
- timeformat = value
- if(timeformat == "24") {
- v = true
- }else {
- v = false
- }
- }
- if(key === "date")
- {
- dateformat = value
- }
- }
- function initScalefactor()
- {
- //按宽计算缩放比例,计算在这个比例系数下的小插件宽高,如果高超出父类的高,则更换比例系数的计算方式
- //按高计算缩放比例
- //console.log("父类窗口大小", appwidget.parent.width,appwidget.parent.height);
- if(appwidget.parent.width == 0 || appwidget.parent.height == 0) {
- appwidget.scalefactor = 1.0
- console.log("父类窗口大小为 0 默认缩放比为1.0")
- return
- }
- appwidget.scalefactor = appwidget.parent.width/448
- //console.log("当前比例系数", appwidget.scalefactor);
- var tw = appwidget.scalefactor *448
- var th = appwidget.scalefactor *162
- //console.log("大小:", tw,th ,appwidget.height);
- if(th > appwidget.parent.height) {
- appwidget.scalefactor = appwidget.parent.height/162
- //console.log("以宽度计算比例系数", appwidget.scalefactor);
- }
- }
-}
-
-
-
diff --git a/qml.qrc b/qml.qrc
deleted file mode 100644
index 8c114e5..0000000
--- a/qml.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- main.qml
- data/time/time.conf
- data/time/time.png
- data/time/time.qml
- Time.qml
-
-
diff --git a/time/time.pro b/time/time.pro
new file mode 100644
index 0000000..214522c
--- /dev/null
+++ b/time/time.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ ukui-appwidget-time \
+ ukui-appwidget-time-service
diff --git a/time/ukui-appwidget-time-service/data/org.ukui.appwidget.provider.time.service b/time/ukui-appwidget-time-service/data/org.ukui.appwidget.provider.time.service
new file mode 100644
index 0000000..55b1881
--- /dev/null
+++ b/time/ukui-appwidget-time-service/data/org.ukui.appwidget.provider.time.service
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.ukui.appwidget.provider.time
+Exec=/usr/bin/ukui-appwidget-time-service
diff --git a/time/ukui-appwidget-time-service/main.cpp b/time/ukui-appwidget-time-service/main.cpp
new file mode 100644
index 0000000..5eefb90
--- /dev/null
+++ b/time/ukui-appwidget-time-service/main.cpp
@@ -0,0 +1,8 @@
+#include
+#include
+int main(int argc, char *argv[])
+{
+ QCoreApplication a(argc, argv);
+ TimeProvider time;
+ return a.exec();
+}
diff --git a/time/ukui-appwidget-time-service/src.qrc b/time/ukui-appwidget-time-service/src.qrc
new file mode 100644
index 0000000..0c9e90f
--- /dev/null
+++ b/time/ukui-appwidget-time-service/src.qrc
@@ -0,0 +1,5 @@
+
+
+ data/org.ukui.appwidget.provider.time.service
+
+
diff --git a/time/ukui-appwidget-time-service/timeprovider.cpp b/time/ukui-appwidget-time-service/timeprovider.cpp
new file mode 100644
index 0000000..c6cdf75
--- /dev/null
+++ b/time/ukui-appwidget-time-service/timeprovider.cpp
@@ -0,0 +1,65 @@
+#include "timeprovider.h"
+#include
+#include
+#define UKUI_CONTROL_CENTER_SERVER "org.freedesktop.Accounts"
+//#define UKUI_CONTROL_CENTER_PATH "/org/freedesktop/Accounts/User1000"
+#define UKUI_CONTROL_CENTER_INTERFACE "org.freedesktop.Accounts.User"
+#define PROPERTIES_NAME "FormatsLocale"
+TimeProvider::TimeProvider(QString providername, QObject *parent)
+: KAppWidgetProvider(providername, parent)
+{
+ QString UKUI_CONTROL_CENTER_PATH = "/org/freedesktop/Accounts/User" + QString("%1").arg(QString::number(getuid()));
+ m_interface = new QDBusInterface(UKUI_CONTROL_CENTER_SERVER,
+ UKUI_CONTROL_CENTER_PATH,
+ UKUI_CONTROL_CENTER_INTERFACE,
+ QDBusConnection::systemBus());
+ m_local = m_interface->property(PROPERTIES_NAME);
+ qDebug() << "当前FormatsLocale为:" << m_local;
+
+}
+TimeProvider::~TimeProvider()
+{
+ delete m_manager;
+}
+void TimeProvider::appWidgetRecevie(const QString &eventname,
+ const QString &widgetname,
+ const QDBusVariant &value)
+{
+ Q_UNUSED(eventname);
+ Q_UNUSED(widgetname);
+ Q_UNUSED(value);
+}
+void TimeProvider::appWidgetUpdate()
+{
+ QVariantMap m;
+ m.insert("FormatsLocale", m_local);
+ if(m_manager) {
+ m_manager->updateAppWidget("time", m);
+ qDebug() <<"更新时间小插件";
+ }
+}
+void TimeProvider::appWidgetDisable()
+{
+
+}
+void TimeProvider::appWidgetDeleted()
+{
+
+}
+void TimeProvider::appWidgetEnable()
+{
+ if(!m_manager) {
+ m_manager = new AppWidget::KAppWidgetManager(this);
+ }
+ QVariantMap m;
+ m.insert("FormatsLocale" , m_local);
+ if(m_manager) {
+ m_manager->updateAppWidget("time", m);
+ qDebug() <<"更新时间小插件";
+ }
+}
+void TimeProvider::appWidgetClicked(const QString &widgetname, const QDBusVariant &value)
+{
+ Q_UNUSED(widgetname);
+ Q_UNUSED(value);
+}
diff --git a/time/ukui-appwidget-time-service/timeprovider.h b/time/ukui-appwidget-time-service/timeprovider.h
new file mode 100644
index 0000000..1f2100a
--- /dev/null
+++ b/time/ukui-appwidget-time-service/timeprovider.h
@@ -0,0 +1,25 @@
+#ifndef TIMEPROVIDER_H
+#define TIMEPROVIDER_H
+#include
+#include
+namespace AppWidget {
+class KAppWidgetManager;
+}
+class TimeProvider:public AppWidget::KAppWidgetProvider
+{
+public:
+ TimeProvider(QString providername = "time",QObject *parent = nullptr);
+ ~TimeProvider();
+ void appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value);
+ void appWidgetUpdate();
+ void appWidgetDisable();
+ void appWidgetDeleted();
+ void appWidgetEnable();
+ void appWidgetClicked(const QString &widgetname, const QDBusVariant &value);
+private:
+ AppWidget::KAppWidgetManager * m_manager = nullptr;
+ QDBusInterface *m_interface = nullptr;
+ QVariant m_local;
+};
+
+#endif // TIMEPROVIDER_H
diff --git a/time/ukui-appwidget-time-service/ukui-appwidget-time-service.pro b/time/ukui-appwidget-time-service/ukui-appwidget-time-service.pro
new file mode 100644
index 0000000..f504286
--- /dev/null
+++ b/time/ukui-appwidget-time-service/ukui-appwidget-time-service.pro
@@ -0,0 +1,34 @@
+QT -= gui
+QT += dbus
+
+CONFIG += c++11 console
+CONFIG -= app_bundle
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+LIBS += -lukui-appwidget-manager -lukui-appwidget-provider
+
+SOURCES += \
+ main.cpp \
+ timeprovider.cpp
+
+# Default rules for deployment.
+qnx: target.path = /usr/bin/
+else: unix:!android: target.path = /usr/bin/
+timeservice.files += data/org.ukui.appwidget.provider.time.service
+timeservice.path += /usr/share/dbus-1/services/
+INSTALLS += target timeservice
+
+HEADERS += \
+ timeprovider.h
+
+RESOURCES += \
+ src.qrc
diff --git a/data/time/time.conf b/time/ukui-appwidget-time/data/time.conf
similarity index 76%
rename from data/time/time.conf
rename to time/ukui-appwidget-time/data/time.conf
index db6a6d2..be56695 100644
--- a/data/time/time.conf
+++ b/time/ukui-appwidget-time/data/time.conf
@@ -1,7 +1,7 @@
[AppWidget]
name = time
-providerName = clock
-previewPath = /usr/share/appwidgetdemo/clock/time.png
+providerName = time
+previewPath = /usr/share/appwidgetdemo/time/time.png
qmlFile = /usr/share/appwidget/qml/time.qml
zoom = false
rightButton = false
diff --git a/data/time/time.png b/time/ukui-appwidget-time/data/time.png
similarity index 100%
rename from data/time/time.png
rename to time/ukui-appwidget-time/data/time.png
diff --git a/data/time/time.qml b/time/ukui-appwidget-time/data/time.qml
similarity index 89%
rename from data/time/time.qml
rename to time/ukui-appwidget-time/data/time.qml
index 2affe21..35cf00b 100644
--- a/data/time/time.qml
+++ b/time/ukui-appwidget-time/data/time.qml
@@ -13,7 +13,8 @@ AppWidget {
anchors.centerIn: parent
property double scalefactor: 1.00
property string timeformat: "12";
- property string dateformat: "cn"
+ property string dateformat: "cn";
+ property string locale: "zh_CN.UTF-8"
property string hour;
property string minute;
property int hournumber;
@@ -22,6 +23,8 @@ AppWidget {
property bool v: false
property string themename;
property bool qmleffect: false
+ property bool qmlenable: true
+
Timer {
id: gettime;
@@ -35,19 +38,19 @@ AppWidget {
if(appwidget.timeformat === "12") {
appwidget.hournumber = Number(appwidget.hour);
if(appwidget.hournumber > 12) {
- if(appwidget.dateformat == "cn") {
+ if(appwidget.locale == "zh_CN.UTF-8") {
ampm.text = "下午"
}
- else if(appwidget.dateformat == "en") {
+ else if(appwidget.locale == "en_US.UTF-8") {
ampm.text = "PM"
}
appwidget.hournumber -= 12;
}
else {
- if(appwidget.dateformat == "cn") {
+ if(appwidget.locale == "zh_CN.UTF-8") {
ampm.text = "上午"
}
- else if(appwidget.dateformat == "en") {
+ else if(appwidget.locale == "en_US.UTF-8") {
ampm.text = "AM"
}
}
@@ -93,6 +96,11 @@ AppWidget {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
visible: !v
+ Component.onCompleted:{
+ console.log("===aaaa=======",twelverec.width,twelverec.height)
+ console.log("=====",appwidget.scalefactor)
+ }
+
Rectangle {
id :time1rec
color: "transparent"
@@ -241,6 +249,7 @@ AppWidget {
anchors.verticalCenter: parent.verticalCenter
anchors.left: spacing2.right
+
ColumnLayout{
width: 87*appwidget.scalefactor
height: 112*appwidget.scalefactor
@@ -284,7 +293,9 @@ AppWidget {
initScalefactor()
gettime.start();
-// appwidget.update.connect(appwidget.onupdate);
+
+ appwidget.update.connect(appwidget.onupdate);
+ userStatusChangedSignal.connect(onUserStatusChanged)
console.log("qml 接收到数据更新信号");
appwidget.creatGsetting("org.ukui.control-center.panel.plugins");
@@ -298,6 +309,17 @@ AppWidget {
}
console.log("当前gsetting为", timeformat, dateformat);
}
+ function onupdate()
+ {
+ for (var i in appwidget.datavalue)
+ {
+ var info = appwidget.datavalue[i];
+ if( i === "FormatsLocale") {
+ console.log("date", info);
+ appwidget.locale = info;
+ }
+ }
+ }
function onGsettingUpdate(key, value)
{
if(key === "hoursystem")
@@ -318,7 +340,7 @@ AppWidget {
{
//按宽计算缩放比例,计算在这个比例系数下的小插件宽高,如果高超出父类的高,则更换比例系数的计算方式
//按高计算缩放比例
- //console.log("父类窗口大小", appwidget.parent.width,appwidget.parent.height);
+ console.log("父类窗口大小", appwidget.parent.width,appwidget.parent.height);
if(appwidget.parent.width == 0 || appwidget.parent.height == 0) {
appwidget.scalefactor = 1.0
console.log("父类窗口大小为 0 默认缩放比为1.0")
@@ -334,6 +356,16 @@ AppWidget {
//console.log("以宽度计算比例系数", appwidget.scalefactor);
}
}
+ function onUserStatusChanged(status)
+ {
+ console.log("qml Appwidget demosearch user status changed ", status);
+ if(status === "Normal") {
+ appwidget.qmlenable = true;
+ }else if(status === "Editable") {
+ appwidget.qmlenable = false;
+ }
+ }
+
}
diff --git a/main.cpp b/time/ukui-appwidget-time/main.cpp
similarity index 100%
rename from main.cpp
rename to time/ukui-appwidget-time/main.cpp
diff --git a/main.qml b/time/ukui-appwidget-time/main.qml
similarity index 50%
rename from main.qml
rename to time/ukui-appwidget-time/main.qml
index 9539a4c..a8e8485 100644
--- a/main.qml
+++ b/time/ukui-appwidget-time/main.qml
@@ -1,23 +1,25 @@
import QtQuick 2.12
import QtQuick.Window 2.12
-
+//import QtQuick.Controls 2.12
Window {
visible: true
width: 640
height: 480
- color: "transparent"
title: qsTr("Hello World")
-
-
Rectangle{
- width: 300
- height: 200
-// color: "transparent"
+ id:rec
+ anchors.centerIn: parent
+ width: 448
+ height:162
+ color: "transparent"
border.color: "green"
- Time{
-
+ Loader{
+ source: "/data/time.qml"
}
}
+
+
+
}
diff --git a/time/ukui-appwidget-time/qml.qrc b/time/ukui-appwidget-time/qml.qrc
new file mode 100644
index 0000000..0bf2ebc
--- /dev/null
+++ b/time/ukui-appwidget-time/qml.qrc
@@ -0,0 +1,8 @@
+
+
+ main.qml
+ data/time.qml
+ data/time.png
+ data/time.conf
+
+
diff --git a/time/ukui-appwidget-time/ukui-appwidget-time.pro b/time/ukui-appwidget-time/ukui-appwidget-time.pro
new file mode 100644
index 0000000..b19d567
--- /dev/null
+++ b/time/ukui-appwidget-time/ukui-appwidget-time.pro
@@ -0,0 +1,36 @@
+QT += quick
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Refer to the documentation for the
+# deprecated API to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += qml.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH =
+
+# Additional import path used to resolve QML modules just for Qt Quick Designer
+QML_DESIGNER_IMPORT_PATH =
+
+# Default rules for deployment.
+target.path = /usr/bin
+timeqml.files += data/time.qml
+timeqml.path = /usr/share/appwidget/qml/
+timeconf.files += data/time.conf
+timeconf.path = /usr/share/appwidget/config/
+timepreview.files += data/time.png
+timepreview.path = /usr/share/appwidgetdemo/time/
+
+INSTALLS += target timeqml timepreview timeconf
diff --git a/ukui-system-appwidget.pro b/ukui-system-appwidget.pro
index 467c0b0..429babc 100644
--- a/ukui-system-appwidget.pro
+++ b/ukui-system-appwidget.pro
@@ -1,36 +1,4 @@
-QT += quick
+TEMPLATE = subdirs
-CONFIG += c++11
-
-# The following define makes your compiler emit warnings if you use
-# any Qt feature that has been marked deprecated (the exact warnings
-# depend on your compiler). Refer to the documentation for the
-# deprecated API to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-# You can also make your code fail to compile if it uses deprecated APIs.
-# In order to do so, uncomment the following line.
-# You can also select to disable deprecated APIs only up to a certain version of Qt.
-#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-
-SOURCES += \
- main.cpp
-
-RESOURCES += qml.qrc
-
-# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH =
-
-# Additional import path used to resolve QML modules just for Qt Quick Designer
-QML_DESIGNER_IMPORT_PATH =
-
-# Default rules for deployment.
-target.path = /usr/bin
-timeqml.files += data/time/time.qml
-timeqml.path = /usr/share/appwidget/qml/
-timecong.files += data/time/time.conf
-timecong.path = /usr/share/appwidget/config/
-timepreview.files += data/time/time.png
-timepreview.path = /usr/share/appwidgetdemo/clock/
-
-INSTALLS += target timeqml timepreview timecong
+SUBDIRS += \
+ time