同步主线改动

This commit is contained in:
zhangtianze 2022-09-09 14:14:23 +08:00
parent 8430129551
commit 3cd2f316e6
9 changed files with 238 additions and 159 deletions

8
debian/changelog vendored
View File

@ -1,6 +1,12 @@
time-shutdown (1.1.0.1.0034-ok1ubuntu2) yangtze; urgency=medium
* 同步主线改动
-- zhangtianze <zhangtianze@kylinos.cn> Fri, 09 Sep 2022 14:06:07 +0800
time-shutdown (1.1.0.1.0034-ok1) yangtze; urgency=medium
* 修改为quilt格式
* 同步主线改动
-- Xie Wei <xiewei@kylinos.cn> Thu, 02 Jun 2022 18:56:21 +0800
-- Xie Wei <xiewei@kylinos.cn> Thu, 02 Jun 2022 18:56:21 +0800

View File

@ -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);
}

View File

@ -1,6 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
time-shutdown-daemon \
time-shutdown \
time-shutdown-daemon \

View File

@ -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

View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="bo_CN">
<context>
<name>QObject</name>
<message>
<location filename="../comboxwidget.cpp" line="39"/>
<source>Shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../confirmareawidget.cpp" line="35"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../confirmareawidget.cpp" line="39"/>
<source>Confirm</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="76"/>
<source>never</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="77"/>
<source>Only this shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="78"/>
<source>Everyday</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="79"/>
<source>Mon</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="80"/>
<source>Tue</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="81"/>
<source>Wed</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="82"/>
<source>Thu</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="83"/>
<source>Fri</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="84"/>
<source>Sat</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="85"/>
<source>Sun</source>
<translation></translation>
</message>
<message>
<location filename="../main.cpp" line="63"/>
<source>time-shutdown is already running!</source>
<translation></translation>
</message>
<message>
<location filename="../timeshowwidget.cpp" line="58"/>
<source>hours</source>
<translation></translation>
</message>
<message>
<location filename="../timeshowwidget.cpp" line="64"/>
<location filename="../widget.cpp" line="124"/>
<source>minute</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="104"/>
<location filename="../widget.cpp" line="224"/>
<source>time-shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="122"/>
<source>next shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="123"/>
<source>hour</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="522"/>
<location filename="../widget.cpp" line="534"/>
<source>OK</source>
<translation></translation>
</message>
</context>
<context>
<name>VerticalScroll_60</name>
<message>
<location filename="../verticalscroll60.cpp" line="271"/>
<source>VerticalScroll_60</source>
<translation></translation>
</message>
</context>
<context>
<name>Widget</name>
<message>
<location filename="../widget.cpp" line="204"/>
<source>Mi&amp;nimize</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="207"/>
<source>&amp;Restore</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="210"/>
<source>&amp;Quit</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="521"/>
<source>no set shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="533"/>
<source>The shutdown time is shorter than the current time</source>
<translation></translation>
</message>
</context>
</TS>

View File

@ -19,52 +19,52 @@
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="74"/>
<location filename="../dropdownmenu.h" line="76"/>
<source>never</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="75"/>
<location filename="../dropdownmenu.h" line="77"/>
<source>Only this shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="76"/>
<location filename="../dropdownmenu.h" line="78"/>
<source>Everyday</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="77"/>
<location filename="../dropdownmenu.h" line="79"/>
<source>Mon</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="78"/>
<location filename="../dropdownmenu.h" line="80"/>
<source>Tue</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="79"/>
<location filename="../dropdownmenu.h" line="81"/>
<source>Wed</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="80"/>
<location filename="../dropdownmenu.h" line="82"/>
<source>Thu</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="81"/>
<location filename="../dropdownmenu.h" line="83"/>
<source>Fri</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="82"/>
<location filename="../dropdownmenu.h" line="84"/>
<source>Sat</source>
<translation></translation>
</message>
<message>
<location filename="../dropdownmenu.h" line="83"/>
<location filename="../dropdownmenu.h" line="85"/>
<source>Sun</source>
<translation></translation>
</message>
@ -75,26 +75,32 @@
</message>
<message>
<location filename="../timeshowwidget.cpp" line="64"/>
<location filename="../widget.cpp" line="123"/>
<location filename="../widget.cpp" line="124"/>
<source>minute</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="103"/>
<location filename="../widget.cpp" line="223"/>
<location filename="../widget.cpp" line="104"/>
<location filename="../widget.cpp" line="224"/>
<source>time-shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="121"/>
<location filename="../widget.cpp" line="122"/>
<source>next shutdown</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="122"/>
<location filename="../widget.cpp" line="123"/>
<source>hour</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="522"/>
<location filename="../widget.cpp" line="534"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="../main.cpp" line="63"/>
<source>time-shutdown is already running!</source>
@ -112,33 +118,31 @@
<context>
<name>Widget</name>
<message>
<location filename="../widget.cpp" line="203"/>
<location filename="../widget.cpp" line="204"/>
<source>Mi&amp;nimize</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="206"/>
<location filename="../widget.cpp" line="207"/>
<source>&amp;Restore</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="209"/>
<location filename="../widget.cpp" line="210"/>
<source>&amp;Quit</source>
<translation>退</translation>
</message>
<message>
<location filename="../widget.cpp" line="524"/>
<location filename="../widget.cpp" line="533"/>
<source>The shutdown time is shorter than the current time</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="518"/>
<location filename="../widget.cpp" line="523"/>
<source>warning</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="518"/>
<location filename="../widget.cpp" line="521"/>
<source>no set shutdown</source>
<translation></translation>
</message>

View File

@ -1,117 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TS>
<TS version="2.1" language="bo_CN">
<context>
<name>QObject</name>
<message>
<source>Fri</source>
<translation></translation>
</message>
<message>
<source>Mon</source>
<translation>Mono</translation>
</message>
<message>
<source>Sat</source>
<translation></translation>
</message>
<message>
<source>Sun</source>
<translation> </translation>
</message>
<message>
<source>Thu</source>
<translation></translation>
</message>
<message>
<source>Tue</source>
<translation></translation>
</message>
<message>
<source>Wed</source>
<translation></translation>
</message>
<message>
<source>hour</source>
<translation></translation>
</message>
<message>
<source>Only this shutdown</source>
<translation></translation>
</message>
<message>
<source>hours</source>
<translation></translation>
</message>
<message>
<source>never</source>
<translation></translation>
</message>
<message>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<source>time-shutdown</source>
<translation></translation>
</message>
<message>
<source>minute</source>
<translation></translation>
</message>
<message>
<source>Confirm</source>
<translation></translation>
</message>
<message>
<source>time-shutdown is already running!</source>
<translation></translation>
</message>
<message>
<source>next shutdown</source>
<translation></translation>
</message>
<message>
<source>Everyday</source>
<translation></translation>
</message>
<message>
<source>Shutdown</source>
<translation></translation>
</message>
</context>
<context>
<name>Widget</name>
<message>
<source>&amp;Quit</source>
<translation></translation>
</message>
<message>
<source>never</source>
<translation></translation>
</message>
<message>
<source>no set shutdown</source>
<translation></translation>
</message>
<message>
<source>&amp;Restore</source>
<translation></translation>
</message>
<message>
<source>Mi&amp;nimize</source>
<translation>(&amp;N)</translation>
</message>
<message>
<source>warning</source>
<translation></translation>
</message>
</context>
<context>
<name>VerticalScroll_60</name>
<message>
<source>VerticalScroll_60</source>
<translation/>
</message>
</context>
</TS>

View File

@ -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);