From 3cd2f316e64d8dc7892a0bc225d989fd8cdb19bf Mon Sep 17 00:00:00 2001 From: zhangtianze Date: Fri, 9 Sep 2022 14:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=B8=BB=E7=BA=BF=E6=94=B9?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 8 +- time-shutdown-daemon/timeshutdowndaemon.cpp | 4 +- time-shutdown.pro | 3 +- time-shutdown/time-shutdown.pro | 38 ++++- .../translations/time-shutdown_bo_CN.ts | 146 ++++++++++++++++++ .../translations/time-shutdown_zh_CN.qm | Bin 1395 -> 0 bytes .../translations/time-shutdown_zh_CN.ts | 50 +++--- .../translations/ukui-time-shutdown_bo_CN.ts | 117 -------------- time-shutdown/widget.cpp | 31 +++- 9 files changed, 238 insertions(+), 159 deletions(-) create mode 100644 time-shutdown/translations/time-shutdown_bo_CN.ts delete mode 100644 time-shutdown/translations/time-shutdown_zh_CN.qm delete mode 100644 time-shutdown/translations/ukui-time-shutdown_bo_CN.ts diff --git a/debian/changelog b/debian/changelog index 04becfc..9e1f01e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,12 @@ +time-shutdown (1.1.0.1.0034-ok1ubuntu2) yangtze; urgency=medium + + * 同步主线改动 + + -- zhangtianze Fri, 09 Sep 2022 14:06:07 +0800 + time-shutdown (1.1.0.1.0034-ok1) yangtze; urgency=medium * 修改为quilt格式 * 同步主线改动 - -- Xie Wei Thu, 02 Jun 2022 18:56:21 +0800 \ No newline at end of file + -- Xie Wei Thu, 02 Jun 2022 18:56:21 +0800 diff --git a/time-shutdown-daemon/timeshutdowndaemon.cpp b/time-shutdown-daemon/timeshutdowndaemon.cpp index 323ba42..afc5db2 100644 --- a/time-shutdown-daemon/timeshutdowndaemon.cpp +++ b/time-shutdown-daemon/timeshutdowndaemon.cpp @@ -105,7 +105,9 @@ void TimeShutdownDaemon::threadSlots() int currentMinute = currentTime.minute(); int currentHour = currentTime.hour(); - if (m_hour == currentHour && m_minite == currentMinute && currentSecond <= 2) { + bool isNeedShutdown = m_gsettings->get("timeshutdown").toBool(); + + if (isNeedShutdown && m_hour == currentHour && m_minite == currentMinute && currentSecond <= 2) { if (m_selectWeek.contains(ONLY_ONCE)) { m_gsettings->set("timeshutdown", false); } diff --git a/time-shutdown.pro b/time-shutdown.pro index 357dcaa..69e4995 100644 --- a/time-shutdown.pro +++ b/time-shutdown.pro @@ -1,6 +1,5 @@ TEMPLATE = subdirs SUBDIRS = \ - time-shutdown-daemon \ time-shutdown \ - + time-shutdown-daemon \ diff --git a/time-shutdown/time-shutdown.pro b/time-shutdown/time-shutdown.pro index 9dee30c..ccd396c 100644 --- a/time-shutdown/time-shutdown.pro +++ b/time-shutdown/time-shutdown.pro @@ -46,17 +46,41 @@ HEADERS += \ verticalscroll60.h \ widget.h -TRANSLATIONS += translations/time-shutdown_zh_CN.ts -translation.files += translations/*.qm -translation.path = /usr/share/ukui-time-shutdown/ +target.path = /usr/bin + +TRANSLATIONS += \ + translations/time-shutdown_bo_CN.ts \ + translations/time-shutdown_zh_CN.ts + +for (translation, TRANSLATIONS) { + translation = $$basename(translation) + QM_FILES += $$OUT_PWD/$$replace(translation, \\..*$, .qm) +} + +QM_FILES_INSTALL_PATH = /usr/share/ukui-time-shutdown/translations/ + +# CONFIG += lrelase not work for qt5.6, add those from lrelease.prf for compatibility +qtPrepareTool(QMAKE_LRELEASE, lrelease) +lrelease.name = lrelease +lrelease.input = TRANSLATIONS +lrelease.output = ${QMAKE_FILE_IN_BASE}.qm +lrelease.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +lrelease.CONFIG = no_link +QMAKE_EXTRA_COMPILERS += lrelease +PRE_TARGETDEPS += compiler_lrelease_make_all + +qm_files.files += $$QM_FILES +qm_files.path = $$QM_FILES_INSTALL_PATH +qm_files.CONFIG = no_check_exist schemes.files += data/org.ukui.time.shutdown.settings.gschema.xml schemes.path = /usr/share/glib-2.0/schemas/ -target.path = /usr/bin/ - -INSTALLS += target schemes translation +INSTALLS += target schemes qm_files # Default rules for deployment. +DEFINES += QM_FILES_INSTALL_PATH='\\"$${QM_FILES_INSTALL_PATH}\\"' DISTFILES += \ - data/org.ukui.time.shutdown.settings.gschema.xml + data/org.ukui.time.shutdown.settings.gschema.xml \ + translations/time-shutdown_bo_CN.ts \ + translations/time-shutdown_zh_CN.ts diff --git a/time-shutdown/translations/time-shutdown_bo_CN.ts b/time-shutdown/translations/time-shutdown_bo_CN.ts new file mode 100644 index 0000000..eec2e57 --- /dev/null +++ b/time-shutdown/translations/time-shutdown_bo_CN.ts @@ -0,0 +1,146 @@ + + + + + QObject + + + Shutdown + ཁ་གཏན་ཟློས་ཕྱོད་ + + + + Cancel + མེད་པར་བཟོ་བ་ + + + + Confirm + ངོས་འཛིན་ + + + + never + གཏན་ནས་མི་དགའ་བ་ + + + + Only this shutdown + ཐེངས་འདི་ཁ་གཏན་པ་ཡིན། + + + + Everyday + ཉིན་ལྟར་ + + + + Mon + གཟའ་ཟླ་བ་ + + + + Tue + གཟའ་མིག་དམར་ + + + + Wed + གཟའ་ལྷག་པའི་ཉིན་ + + + + Thu + གཟའ་ཕུར་བུ། + + + + Fri + གཟའ་པ་སངས་ + + + + Sat + གཟའ་སྤེན་པ། + + + + Sun + གཟའ་ཉི་མ། + + + + time-shutdown is already running! + དུས་བཀག་ཁ་བཀག་འཁོར་སྐྱོད་ཟིན་། + + + + hours + དུས་ + + + + + minute + སྐར་མ་ + + + + + time-shutdown + དུས་བཅད་ཁ་རྒྱག + + + + next shutdown + ཐེངས་རྗེས་མའི་ཁ་གཏན་དུས་ཚོད། + + + + hour + ཆུ་ཚོད། + + + + + OK + གཏན་ཁེལ་ + + + + VerticalScroll_60 + + + VerticalScroll_60 + + + + + Widget + + + Mi&nimize + ཆེས་ཆུང་ཅན་ + + + + &Restore + ཁ་འབྱེད་ + + + + &Quit + ཕྱིར་འབུད་ + + + + no set shutdown + མ་བཙུགས་པའི་ཁ་གཏན་ཟློས་ཕྱོད་ + + + + The shutdown time is shorter than the current time + ཁ་གཏན་དུས་ཚོད་མིག་སྔའི་དུས་ཚོད་ལས་ཆུང་། + + + diff --git a/time-shutdown/translations/time-shutdown_zh_CN.qm b/time-shutdown/translations/time-shutdown_zh_CN.qm deleted file mode 100644 index 31ef211e0b72ca1337fbbcf9862641aeda4433ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1395 zcmaKrOK1~O6oyZdNiuDX(Ne1m7YRtf7idAHA|e)rikUW@(9$+-oF=!KvB@2nhizOa zh+;~sR9zPU>~}0p>*k5sG5Zf^-QWa36mN~{>i=Hf6ke6?mhNA zxg-De{^VkC=gV^s=2lMvzzRTk6x9TX_M=V#bYDgN2GBDP;6SG52Py&ReTJF?=$k=( z44%R()Fs$E&H=ath<`eczFAPycW`|TjCZ*2Z05w~Yqg_4L>&2+h{r) zFl0p!=(1@f)nU7ji^`DkQ+?|AZr780Qkrsu?>!myoDz+A?BM z!gv{ClB!5e3F#t9I}-Dg0z)`iH8mUKEF;_&q1%xT4-4YSDAY8nR3j`2K1R7I!C~71 z)!$gn&I)w`tdEHlCciU_kCG8%<0>6HJy$hK48K2)%ANa0g<1~>JCLr zrFghJT}m=V{@$elF确认 - + never 从不 - + Only this shutdown 仅本次关机 - + Everyday 每天 - + Mon 周一 - + Tue 周二 - + Wed 周三 - + Thu 周四 - + Fri 周五 - + Sat 周六 - + Sun 周日 @@ -75,26 +75,32 @@ - + minute - - + + time-shutdown 定时关机 - + next shutdown 距离下一次关机时间 - + hour 小时 + + + + OK + 确定 + time-shutdown is already running! @@ -112,33 +118,31 @@ Widget - + Mi&nimize 最小化 - + &Restore 打开 - + &Quit 退出 - + The shutdown time is shorter than the current time 关机时间小于当前时间 - - warning - 警告 + 警告 - + no set shutdown 未设置关机频率 diff --git a/time-shutdown/translations/ukui-time-shutdown_bo_CN.ts b/time-shutdown/translations/ukui-time-shutdown_bo_CN.ts deleted file mode 100644 index c8dd59f..0000000 --- a/time-shutdown/translations/ukui-time-shutdown_bo_CN.ts +++ /dev/null @@ -1,117 +0,0 @@ - - - - - QObject - - Fri - གཟའ་པ་སངས། - - - Mon - Mono - - - Sat - གཟའ་སྤེན་པ། - - - Sun - ཉིན། - - - Thu - གཟའ་ཕུར་བུ། - - - Tue - གཟའ་མིག་དམར། - - - Wed - གཟའ་ལྷག་པ། - - - hour - དུས་ཚོད། - - - Only this shutdown - སྒོ་གཏན་ཐེངས་འདི་ཁོ་ན། - - - hours - དུས་ཚོད། - - - never - གཏན་མིན། - - - Cancel - མེད་པར་བཟོ་བ - - - time-shutdown - དུས་བཅད་སྒོ་གཏན། - - - minute - སྐར་མ། - - - Confirm - གཏན་འཁེལ། - - - time-shutdown is already running! - དུས་བཅད་སྒོ་གཏན་མགོ་བརྩམས་ཟིན། - - - next shutdown - ཐེངས་རྗེས་མའི་དུས་བཅད་སྒོ་གཏན་བར་གྱི་དུས་ཚོད། - - - Everyday - ཉིན་རེ་རེ། - - - Shutdown - ཁ་རྒྱག - - - - Widget - - &Quit - ཕྱིར་འབུད། - - - never - གཏན་མིན། - - - no set shutdown - སྒོ་གཏན་ཕྱོད་ལ་སྒྲིག་འགོད་བྱས་མེད། - - - &Restore - ཕྱིར་ལོག - - - Mi&nimize - ཆེས་ཆུང་པ་ཅན།(&N) - - - warning - ཉེན་བརྡ - - - - VerticalScroll_60 - - VerticalScroll_60 - - - - \ No newline at end of file diff --git a/time-shutdown/widget.cpp b/time-shutdown/widget.cpp index eb6be44..7bd28fc 100644 --- a/time-shutdown/widget.cpp +++ b/time-shutdown/widget.cpp @@ -52,7 +52,7 @@ Widget::Widget(QWidget *parent) // 初始化当前的托盘栏图标 createTrayIcon(); - setIcon(QIcon::fromTheme("kylin-alarm-clock", QIcon("://image/time_shutdown.svg"))); + setIcon(QIcon::fromTheme("time-shutdown", QIcon("://image/time_shutdown.svg"))); // 获取保存在gsetting中的定时关机设置状态 getTimedShutdownState(); @@ -70,7 +70,7 @@ Widget::Widget(QWidget *parent) initDropDownBoxLabelStatus(); this->setAttribute(Qt::WA_TranslucentBackground); this->setWindowState(Qt::WindowNoState); - this->setWindowIcon(QIcon::fromTheme("kylin-alarm-clock", QIcon("://image/time_shutdown.svg"))); + this->setWindowIcon(QIcon::fromTheme("time-shutdown", QIcon("://image/time_shutdown.svg"))); QDesktopWidget *pDesk = QApplication::desktop(); move((pDesk->width() - this->width()) / 2, (pDesk->height() - this->height()) / 2); } @@ -85,7 +85,8 @@ void Widget::initTranslation() m_ptranslator = new QTranslator; QTranslator *translator_qt = new QTranslator; //获取系统语言环境 选择翻译文件 - if (m_ptranslator->load(QLocale(), QLatin1String("time-shutdown"), QLatin1String("_"), QLatin1String("/usr/share/ukui-time-shutdown/"))) + if (m_ptranslator->load(QLocale(), QLatin1String("time-shutdown"), + QLatin1String("_"), QM_FILES_INSTALL_PATH)) QApplication::installTranslator(m_ptranslator); else qDebug() << "cannot load translator ukui-time-shutdown" << QLocale::system().name() << ".qm!"; @@ -515,14 +516,28 @@ void Widget::updatedropDownBoxSelectSlots() void Widget::confirmButtonSlots() { if (m_weekSelect[0] == NEVER_SHUTDON) { - QMessageBox::warning(NULL, tr("warning"), tr("no set shutdown"), QMessageBox::Ok ); + QMessageBox *msg = new QMessageBox(this); + msg->setIcon(QMessageBox::Warning); + msg->setText(tr("no set shutdown")); + QPushButton *button = new QPushButton(QObject::tr("OK")); + button->setProperty("useButtonPalette", true); + msg->addButton(button, QMessageBox::RejectRole); + msg->show(); +// QMessageBox::warning(NULL, tr("warning"), tr("no set shutdown"), QMessageBox::Ok); return; } if (determineShutdownTime()) { - QMessageBox::warning(NULL, tr("warning"), \ - tr("The shutdown time is shorter than the current time"), \ - QMessageBox::Ok); + QMessageBox *msg = new QMessageBox(this); + msg->setIcon(QMessageBox::Warning); + msg->setText(tr("The shutdown time is shorter than the current time")); + QPushButton *button = new QPushButton(QObject::tr("OK")); + button->setProperty("useButtonPalette", true); + msg->addButton(button, QMessageBox::RejectRole); + msg->show(); +// QMessageBox::warning(NULL, tr("warning"), \ +// tr("The shutdown time is shorter than the current time"), \ +// QMessageBox::Ok); return; } @@ -543,7 +558,7 @@ void Widget::confirmButtonSlots() setFrequencyValue(m_selectIndexGsetting); m_pConfirmAreaWidget->m_pConfirmButton->setEnabled(false); m_pConfirmAreaWidget->m_pCancelButton->setEnabled(true); - m_pTimeRemainLabel->setVisible(true); + setNextShutDownTime(); m_pComBoxWidget->setEnabled(false); QProcess p(0);