From ef2d8ff5ec20ee62682e7e582676b039cbe69a5b Mon Sep 17 00:00:00 2001 From: kateleet Date: Wed, 22 Dec 2021 15:55:29 +0800 Subject: [PATCH] feat: add system update --- src/about.cpp | 6 ++++++ src/about.h | 2 ++ src/qml/About/Main.qml | 15 ++++++++------- translations/en_US.ts | 7 ++++++- translations/zh_CN.ts | 7 ++++++- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/about.cpp b/src/about.cpp index 4156f10..31bc206 100644 --- a/src/about.cpp +++ b/src/about.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef Q_OS_LINUX #include @@ -178,6 +179,11 @@ QString About::cpuInfo() return QString(); } +void About::openUpdator() +{ + QProcess::startDetached("cutefish-updator", QStringList()); +} + qlonglong About::calculateTotalRam() const { qlonglong ret = -1; diff --git a/src/about.h b/src/about.h index 44ee7ff..f6d975f 100644 --- a/src/about.h +++ b/src/about.h @@ -59,6 +59,8 @@ public: QString internalStorage(); QString cpuInfo(); + Q_INVOKABLE void openUpdator(); + private: qlonglong calculateTotalRam() const; }; diff --git a/src/qml/About/Main.qml b/src/qml/About/Main.qml index 537e003..8b90b63 100644 --- a/src/qml/About/Main.qml +++ b/src/qml/About/Main.qml @@ -122,13 +122,14 @@ ItemPage { height: FishUI.Units.smallSpacing } -// StandardButton { -// Layout.fillWidth: true -// text: qsTr("System Update") -// onClicked: { -// rootWindow.stackView.push(Qt.resolvedUrl("qrc:/qml/Update/Main.qml")) -// } -// } + StandardButton { + Layout.fillWidth: true + visible: about.isCutefishOS + text: qsTr("System Update") + onClicked: { + about.openUpdator() + } + } } } } diff --git a/translations/en_US.ts b/translations/en_US.ts index 0ec7ee4..eb000c2 100644 --- a/translations/en_US.ts +++ b/translations/en_US.ts @@ -92,6 +92,11 @@ Internal Storage Internal Storage + + + System Update + + Appearance @@ -783,7 +788,7 @@ - + Input Devices diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index e221d5b..822a54d 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -92,6 +92,11 @@ Internal Storage 内部存储 + + + System Update + 系统更新 + Appearance @@ -783,7 +788,7 @@ 输出设备 - + Input Devices 输入设备