修复无法延迟弹出的问题
This commit is contained in:
parent
76ee71ae4e
commit
0bf343f852
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.11.0, 2022-07-21T18:26:42. -->
|
||||
<!-- Written by QtCreator 4.11.0, 2022-08-23T14:03:45. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -282,10 +282,9 @@
|
|||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">kylin-background-upgrade2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/kylin-background-upgrade/OpenKylin/make_deb/kylin-background-upgrade/kylin-background-upgrade.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/lxy/kylin-background-upgrade/OpenKylin/make_deb/kylin-background-upgrade/kylin-background-upgrade.pro</value>
|
||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro</value>
|
||||
<value type="QString" key="RunConfiguration.Arguments">--check-upgrade</value>
|
||||
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
|
||||
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
|
@ -295,7 +294,7 @@
|
|||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Debug</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
|
|
|
@ -149,6 +149,6 @@ int main(int argc, char *argv[])
|
|||
qunsetenv("SESSION_MANAGER");
|
||||
QApplication a(argc, argv);
|
||||
core *m_core= new core(arg);
|
||||
QObject::connect(m_core,SIGNAL(execSignal()),&a,SLOT(quit()));
|
||||
// QObject::connect(m_core,SIGNAL(execSignal()),&a,SLOT(quit()));
|
||||
return a.exec();
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ void updatehandle::UpdateDectCheck()
|
|||
{
|
||||
//判断是否有系统更新
|
||||
// if(!checktime()){
|
||||
qDebug()<<"Detection update has been opened ...";
|
||||
qDebug()<<"wait for upgrade ...";
|
||||
// connect(m_updateMutual,&update_dbus::UpdateDectFinished,this,&updatehandle::UpdateDectSlot);
|
||||
QDBusConnection::systemBus().connect(QString(),QString("/"),"com.kylin.update.notification","DownloadFinish",this,SLOT(UpdateDectSlot()));
|
||||
// bool ret= m_updateMutual->checkForUpdateDect();
|
||||
|
@ -487,6 +487,8 @@ void updatehandle::InstallFinsih(bool state,QStringList pkgname,QString error,QS
|
|||
*/
|
||||
void updatehandle::execslots()
|
||||
{
|
||||
choice_window->hide();
|
||||
qDebug()<<"Hide choice_window.";
|
||||
emit execSignal();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ updatewidget::updatewidget(QWidget *parent) :
|
|||
|
||||
comboBox = new QComboBox();
|
||||
comboBox->clear();
|
||||
strList<<tr("In 30 minutes")<<tr("one hours later")<<tr("five hours later")<<tr("one day later")<<tr("three day later")<<tr("five day later");
|
||||
strList<<tr("In 30 minutes")<<tr("three hours later")<<tr("one day later");
|
||||
comboBox->addItems(strList);
|
||||
|
||||
labelwidget = new QWidget();
|
||||
|
@ -313,63 +313,44 @@ void updatewidget::set_window_position()
|
|||
*/
|
||||
char *updatewidget::insideTime()
|
||||
{
|
||||
qDebug()<<comboBox->currentText();
|
||||
qDebug()<<"Current index: "<<comboBox->currentText();
|
||||
QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间
|
||||
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
||||
QByteArray str2char2 = str.toLatin1(); // must
|
||||
char *nowtime = str2char2.data();
|
||||
|
||||
delayTimer = new QTimer();
|
||||
connect(delayTimer, SIGNAL(timeout()), this, SLOT(delayTimeout()));
|
||||
if(comboBox->currentText() == strList.at(0)) {
|
||||
QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间
|
||||
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
||||
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(1800);
|
||||
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QByteArray str2char2 = str1.toLatin1(); // must
|
||||
nowtime = str2char2.data();
|
||||
return nowtime;
|
||||
delaytime = 1800;
|
||||
delayTimer->start(delaytime * 1000);
|
||||
qDebug()<<"Delay trigger for: "<<delaytime;
|
||||
} else if (comboBox->currentText() == strList.at(1)) {
|
||||
QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间
|
||||
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
||||
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(3600);
|
||||
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(3600 * 3);
|
||||
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QByteArray str2char2 = str1.toLatin1(); // must
|
||||
nowtime = str2char2.data();
|
||||
return nowtime;
|
||||
} else if (comboBox->currentText() == strList.at(2)) {
|
||||
QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间
|
||||
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
||||
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addSecs(18000);
|
||||
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QByteArray str2char2 = str1.toLatin1(); // must
|
||||
nowtime = str2char2.data();
|
||||
return nowtime;
|
||||
} else if (comboBox->currentText() == strList.at(3)) {
|
||||
QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间
|
||||
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
||||
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addDays(1);
|
||||
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QByteArray str2char2 = str1.toLatin1(); // must
|
||||
nowtime = str2char2.data();
|
||||
return nowtime;
|
||||
} else if (comboBox->currentText() == strList.at(4)) {
|
||||
QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间
|
||||
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
||||
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addDays(3);
|
||||
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QByteArray str2char2 = str1.toLatin1(); // must
|
||||
nowtime = str2char2.data();
|
||||
return nowtime;
|
||||
} else if (comboBox->currentText() == strList.at(5)) {
|
||||
QDateTime time = QDateTime::currentDateTime(); //获取系统现在的时间
|
||||
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
||||
QDateTime bojb = QDateTime::fromString(str,"yyyy-MM-dd hh:mm:ss").addDays(5);
|
||||
QString str1 = bojb.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QByteArray str2char2 = str1.toLatin1(); // must
|
||||
nowtime = str2char2.data();
|
||||
return nowtime;
|
||||
delaytime = 3600 * 3;
|
||||
delayTimer->start(delaytime * 1000);
|
||||
qDebug()<<"Delay trigger for: "<<delaytime;
|
||||
}
|
||||
return nowtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief updatehandle::delayTimeout
|
||||
* 延时超时函数
|
||||
*/
|
||||
void updatewidget::delayTimeout()
|
||||
{
|
||||
qDebug() << "delayTimeout, Retest the update.";
|
||||
delayTimer->stop();
|
||||
QProcess p(0);
|
||||
p.startDetached("/usr/share/kylin-update-notify/checkUpdate.py");
|
||||
p.waitForStarted();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -379,12 +360,11 @@ char *updatewidget::insideTime()
|
|||
void updatewidget::agreeBtnClicked()
|
||||
{
|
||||
emit agreeBtnSignals();
|
||||
qDebug()<<"WifiButtonClickSlot is running";
|
||||
// qDebug()<<"WifiButtonClickSlot is running";
|
||||
QProcess p(0);
|
||||
p.startDetached("update-manager");
|
||||
p.waitForStarted();
|
||||
qDebug()<<"Open the control panel and start updating immediately, exit tray program!";
|
||||
// exit(0);
|
||||
this->hide();
|
||||
}
|
||||
|
||||
|
@ -417,8 +397,8 @@ void updatewidget::disAgreeBtnClicked()
|
|||
timersettings->endGroup();
|
||||
}
|
||||
emit disAgreeBtnSignals();
|
||||
qDebug()<<"Users do not update, exit tray program!";
|
||||
exit(0);
|
||||
qDebug()<<"Delay updating the system.";
|
||||
// exit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -500,4 +480,3 @@ void updateTip::paintEvent(QPaintEvent *e)
|
|||
QWidget::paintEvent(e);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QScreen>
|
||||
#include <QDBusReply>
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -45,6 +46,8 @@ public:
|
|||
QLabel *update_lab;
|
||||
QLabel *tip_lab;
|
||||
QLabel *tip_lab1;
|
||||
QTimer *delayTimer;
|
||||
unsigned int delaytime;
|
||||
|
||||
QPushButton *agreebtn;
|
||||
QPushButton *disagreebtn;
|
||||
|
@ -78,7 +81,8 @@ public:
|
|||
void initset_window_position();
|
||||
void listenPanelChange();
|
||||
void initPanelDbusGsetting(); // 初始化与任务栏gsetting和dbus
|
||||
|
||||
public slots:
|
||||
void delayTimeout();
|
||||
private:
|
||||
Ui::Form *ui;
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
|
Binary file not shown.
|
@ -27,7 +27,7 @@
|
|||
<context>
|
||||
<name>updateTip</name>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="464"/>
|
||||
<location filename="../src/updatewidget.cpp" line="445"/>
|
||||
<source>The system is updating silently</source>
|
||||
<translation>系统正在静默更新</translation>
|
||||
</message>
|
||||
|
@ -39,9 +39,9 @@
|
|||
<translation type="vanished">系统已经完成一项关键更新,建议您立即重启</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatehandle.cpp" line="303"/>
|
||||
<location filename="../src/updatehandle.cpp" line="310"/>
|
||||
<location filename="../src/updatehandle.cpp" line="315"/>
|
||||
<location filename="../src/updatehandle.cpp" line="298"/>
|
||||
<location filename="../src/updatehandle.cpp" line="306"/>
|
||||
<location filename="../src/updatehandle.cpp" line="312"/>
|
||||
<source>The system is updating silently</source>
|
||||
<translation>系统正在静默更新</translation>
|
||||
</message>
|
||||
|
@ -50,8 +50,8 @@
|
|||
<translation type="vanished">检测到有系统更新</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatehandle.cpp" line="105"/>
|
||||
<location filename="../src/updatehandle.cpp" line="336"/>
|
||||
<location filename="../src/updatehandle.cpp" line="100"/>
|
||||
<location filename="../src/updatehandle.cpp" line="334"/>
|
||||
<source>System update detected</source>
|
||||
<translation>检测到有系统更新</translation>
|
||||
</message>
|
||||
|
@ -60,42 +60,33 @@
|
|||
<translation type="obsolete">系统完成一项关键更新,部分软件包更新失败,建议您立即重启</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatehandle.cpp" line="482"/>
|
||||
<location filename="../src/updatehandle.cpp" line="483"/>
|
||||
<location filename="../src/updatehandle.cpp" line="471"/>
|
||||
<source>The system has completed an important update, It is recommended that you restart immediately.</source>
|
||||
<translation>系统完成一项关键更新,建议您立即重启</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatehandle.cpp" line="485"/>
|
||||
<location filename="../src/updatehandle.cpp" line="473"/>
|
||||
<source>update error</source>
|
||||
<translation>升级失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatehandle.cpp" line="518"/>
|
||||
<location filename="../src/updatehandle.cpp" line="508"/>
|
||||
<source>kylin-background-upgrade</source>
|
||||
<translation>后台更新程序</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatehandle.cpp" line="521"/>
|
||||
<location filename="../src/updatehandle.cpp" line="511"/>
|
||||
<source>update</source>
|
||||
<translation>系统升级</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>updatewidget</name>
|
||||
<message>
|
||||
<source>Please remind me later</source>
|
||||
<translation type="vanished">请在以下时间段之后提醒我</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="40"/>
|
||||
<source>at</source>
|
||||
<translation>在</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No more reminders</source>
|
||||
<translation type="vanished">内不再提醒</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="42"/>
|
||||
<source>No reminders</source>
|
||||
|
@ -108,18 +99,8 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="53"/>
|
||||
<source>one hours later</source>
|
||||
<translation>一个小时</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="53"/>
|
||||
<source>three day later</source>
|
||||
<translation>三天</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="53"/>
|
||||
<source>five day later</source>
|
||||
<translation>五天</translation>
|
||||
<source>three hours later</source>
|
||||
<translation>三个小时</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="60"/>
|
||||
|
@ -131,31 +112,10 @@
|
|||
<source>Delay</source>
|
||||
<translation>推迟</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Two hours later</source>
|
||||
<translation type="vanished">两个小时</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="53"/>
|
||||
<source>five hours later</source>
|
||||
<translation>五个小时</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/updatewidget.cpp" line="53"/>
|
||||
<source>one day later</source>
|
||||
<translation>一天</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>two day later</source>
|
||||
<translation type="vanished">两天</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Agree</source>
|
||||
<translation type="vanished">立即更新</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Disagree</source>
|
||||
<translation type="vanished">推迟</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
Loading…
Reference in New Issue