避免用户能够多次点击更新

This commit is contained in:
zhangdongwei 2021-10-30 15:36:07 +08:00
parent 7a88e09f2f
commit 40e4e1bea7
9 changed files with 26 additions and 46 deletions

View File

@ -7,6 +7,3 @@ plugins:
cd plugin && make -j8
updater:
cd backend && ./setup.py build
clean:
cd plugin && make clean

14
debian/control vendored
View File

@ -19,10 +19,6 @@ Build-Depends: debhelper (>= 9),
libqt5x11extras5-dev,
libxklavier-dev,
libkf5widgetsaddons-dev,
libkf5config-dev,
libkf5configwidgets-dev,
libkf5screen-dev,
libkf5screen-bin,
libkf5i18n-dev,
libkf5windowsystem-dev,
libkf5guiaddons-dev,
@ -30,31 +26,23 @@ Build-Depends: debhelper (>= 9),
libkf5xmlgui-dev,
libkf5globalaccel-dev,
qtdeclarative5-dev,
libopencv-dev,
libdconf-dev,
libmatemixer-dev,
qtmultimedia5-dev,
libxml2-dev,
qtbase5-dev,
libcanberra-dev,
libx11-dev,
libxkbfile-dev,
libboost-dev,
qttools5-dev-tools,
libxcb-xkb-dev,
libpolkit-qt5-1-dev,
libpulse-dev,
libkf5bluezqt-dev,
libkysec-dev,
libpwquality-dev,
libudev-dev,
xserver-xorg-dev,
libupower-glib-dev,
libpam0g-dev,
yhkylin-backup-tools-dev(>=4.0.13-kylin19)[!sw64],
libukui-log4qt-dev[!sw64],
libmate-desktop-dev,
ukui-control-center(>=3.1.1+2021-1026separate9),
libukcc-dev
Build-Depends-Indep: libxml-parser-perl,
intltool
Standards-Version: 3.8.0

View File

@ -13,4 +13,4 @@ backend/build/lib/SystemUpdater/UpdateManagerVersion.py /usr/lib/python3.8/dist-
backend/build/lib/SystemUpdater/__init__.py /usr/lib/python3.8/dist-packages/SystemUpdater/
backend/build/lib/SystemUpdater/Core /usr/lib/python3.8/dist-packages/SystemUpdater/
/plugin/libupgrade.so /usr/lib/*/ukui-control-center
plugin/libupgrade.so /usr/lib/

2
debian/postinst vendored
View File

@ -8,3 +8,5 @@ if [ ! -f /var/cache/kylin-system-updater/kylin-system-updater.db ];then
fi
systemctl enable kylin-system-updater
mkdir -p /usr/lib/`dpkg-architecture -qDEB_TARGET_MULTIARCH`/ukui-control-center/
mv /usr/lib/libupgrade.so /usr/lib/`dpkg-architecture -qDEB_TARGET_MULTIARCH`/ukui-control-center/

4
debian/rules vendored
View File

@ -1,7 +1,9 @@
#!/usr/bin/make -f
export DEB_HOST_GNU_TYPE=x86_64-linux-gnu
export DEB_TARGET_MULTIARCH=x86_64-linux-gnu
#export PYBUILD_INTERPRETERS=python3
%:
dh $@
#override_dh_makeshlibs:
#--with=python3 --buildsystem=pybuild

View File

@ -98,7 +98,7 @@ void AppUpdateWid::showInstallStatues(QStringList appAptName,int progress,QStrin
if (!isUpdateAll && progress>50) {
updateAPPBtn->hide();
appVersion->setText(tr("Being installed"));
appVersion->setToolTip(tr("Being installed"));
appVersion->setToolTip("");
}
}
@ -632,6 +632,8 @@ void AppUpdateWid::updateOneApp(bool status)
void AppUpdateWid::distUpgradePartial(bool status)
{
if(status)
emit startoneappupdate();
QStringList pkgname;
pkgname.append(appAllMsg.name);
m_updateMutual->interface->asyncCall("DistUpgradePartial",status,pkgname);

View File

@ -140,6 +140,7 @@ signals:
void sendProgress(QString pkgName, int Progress, QString type);
void changeupdateall();
void allappupdatefinishsignal();
void startoneappupdate();
// void aptFinish();

View File

@ -120,7 +120,6 @@ void TabWid::getAutoUpgradeStatus()
updateSource->killProcessSignal(pid.toInt(), 10);
checkUpdateBtn->setEnabled(true);
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
checkUpdateBtnClicked();
} else if (!ret.compare("install")){
isAutoUpgrade = true;
@ -128,7 +127,6 @@ void TabWid::getAutoUpgradeStatus()
isAllUpgrade = true;
checkUpdateBtn->hide();
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
bool ret = autoUpdateLoadUpgradeList(false);
if (!ret)
updateMutual->disconnectDbusSignal();
@ -136,13 +134,11 @@ void TabWid::getAutoUpgradeStatus()
/*如果没有进行自动更新,那就不需要操作 */
checkUpdateBtn->setEnabled(true);
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
checkUpdateBtnClicked();
} else {
/*如果读不到,默认也不进行操作*/
checkUpdateBtn->setEnabled(true);
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
checkUpdateBtnClicked();
}
}
@ -172,7 +168,6 @@ bool TabWid::autoUpdateLoadUpgradeList(bool isBackUp)
lastRefreshTime->setText(tr("Last refresh:")+ updatetime);
lastRefreshTime->show();
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
return false;
} else {
QStringList list;
@ -226,7 +221,6 @@ void TabWid::backupMessageBox(QString str)
// checkUpdateBtn->setText(tr("全部更新"));
versionInformationLab->setText(tr("Updatable app detected on your system!"));
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
foreach (AppUpdateWid *wid, widgetList) {
wid->updateAPPBtn->show();
}
@ -276,12 +270,10 @@ void TabWid::isCancelabled(bool status)
if(status)
{
checkUpdateBtn->setText(tr("Cancel"));
checkUpdateBtn->setToolTip(tr("Cancel"));
checkUpdateBtn->setEnabled(true);
}
else{
checkUpdateBtn->setText(tr("Cancel"));
checkUpdateBtn->setToolTip(tr("Cancel"));
checkUpdateBtn->setEnabled(false);
}
@ -291,7 +283,6 @@ void TabWid::DependResloveResult(bool ResloveStatus,bool ResloveResult,QStringLi
{
checkUpdateBtn->stop();
checkUpdateBtn->setText(tr("Calculated"));
checkUpdateBtn->setToolTip(tr("Calculated"));
if (!ResloveResult)
{
emit updateAllSignal(true);
@ -431,7 +422,7 @@ void TabWid::backupProgress(int progress)
return;
}
versionInformationLab->setText(tr("System is backing up..."));
//allProgressBar->setValue(progress);
allProgressBar->setValue(progress);
checkUpdateBtn->hide();
allProgressBar->show();
lastRefreshTime->hide();
@ -471,7 +462,6 @@ void TabWid::backupHideUpdateBtn(int result)
checkUpdateBtn->setEnabled(true);
// checkUpdateBtn->setText(tr("全部更新"));
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
}
}
@ -602,7 +592,6 @@ void TabWid::slotUpdateCache(bool result,QStringList pkgname, QString error ,QSt
checkUpdateBtn->stop();
// checkUpdateBtn->setText(tr("检查更新"));
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
// versionInformationLab->setText(tr("软件源更新失败:")+failedInfo );
versionInformationLab->setText(tr("Software source update failed: ")+error);
disconnect(updateSource->serviceInterface,SIGNAL(updateTemplateStatus(QString)),this,SLOT(slotUpdateTemplate(QString)));
@ -635,7 +624,6 @@ void TabWid::allComponents()
scrollArea = new QScrollArea(this);
updateTab = new QWidget(this); //更新页面
updateTab->setMaximumSize(960,960);
AppMessage = new QVBoxLayout();
AppMessage->setAlignment(Qt::AlignTop);
updateTab->setLayout(AppMessage);
@ -675,7 +663,6 @@ void TabWid::allComponents()
QHBoxLayout *historyUpdateLogLayout = new QHBoxLayout();
historyUpdateLog = new QPushButton(this); // 历史日志弹出窗口控制按钮
// historyUpdateLog->setText(tr("查看更新历史"));
//~ contents_path /upgrade/View history
historyUpdateLog->setText(tr("View history"));
historyUpdateLogWid->setLayout(historyUpdateLogLayout);
historyUpdateLogLayout->setAlignment(Qt::AlignLeft);
@ -745,7 +732,7 @@ void TabWid::allComponents()
updateSettingLab = new TitleLabel();
// updateSettingLab->setText(tr("更新设置"));
//~ contents_path /Upgrade/Update Settings
//~ contents_path /upgrade/Update Settings
updateSettingLab->setText(tr("Update Settings"));
updateSettingLab->setFixedHeight(27);
updateSettingWidget = new QWidget(this);
@ -757,7 +744,6 @@ void TabWid::allComponents()
isAutoCheckLayout = new QHBoxLayout();
isAutoCheckedLab = new QLabel();
// isAutoCheckedLab->setText(tr("允许通知可更新的应用"));
//~ contents_path /Upgrade/Allowed to renewable notice
isAutoCheckedLab->setText(tr("Allowed to renewable notice"));
isAutoCheckSBtn = new SwitchButton();
isAutoCheckWidget->setLayout(isAutoCheckLayout);
@ -825,7 +811,6 @@ void TabWid::allComponents()
isAutoUpgradeWidget->setFrameShape(QFrame::Box);
isAutoUpgradeLayout = new QVBoxLayout();
isAutoUpgradeLab = new QLabel();
//~ contents_path /Upgrade/Automatically download and install updates
isAutoUpgradeLab->setText(tr("Automatically download and install updates"));
autoUpgradeLab = new QLabel();
autoUpgradeLab->setText(tr("After it is turned on, the system will automatically download and install updates when there is an available network and available backup and restore partitions."));
@ -898,6 +883,7 @@ void TabWid::loadingOneUpdateMsgSlot(AppAllMsg msg)
connect(updateMutual,&UpdateDbus::sendFinishGetMsgSignal,appWidget,&AppUpdateWid::showUpdateBtn);
connect(appWidget,&AppUpdateWid::filelockedSignal,this,&TabWid::waitCrucialInstalled);
connect(backup,&BackUp::bakeupFinish,appWidget,&AppUpdateWid::hideOrShowUpdateBtnSlot);
connect(appWidget,&AppUpdateWid::startoneappupdate,this,&TabWid::startoneappupdateslot);
/*判断是否是后台自动更新*/
if (isAutoUpgrade) {
// connect(appWidget, &AppUpdateWid::sendProgress, this, &TabWid::getAllProgress);
@ -945,7 +931,6 @@ void TabWid::loadingFinishedSlot(int size)
checkUpdateBtn->stop();
// checkUpdateBtn->setText(tr("检查更新"));
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
// versionInformationLab->setText(tr("您的系统已是最新!"));
versionInformationLab->setText(tr("Your system is the latest!"));
disconnect(updateMutual->interface,SIGNAL(UpdateDloadAndInstStaChanged(QStringList,int,QString,QString)),this,SLOT(getAllProgress(QStringList,int,QString,QString)));
@ -970,7 +955,6 @@ void TabWid::loadingFinishedSlot(int size)
checkUpdateBtn->setEnabled(true);
// checkUpdateBtn->setText(tr("全部更新"));
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
// versionInformationLab->setText(tr("检测到你的系统有可更新的应用!"));
if (!isAutoUpgrade) {
versionInformationLab->setText(tr("Updatable app detected on your system!"));
@ -988,7 +972,6 @@ void TabWid::allappupdatefinishSlot()
checkUpdateBtn->stop();
// checkUpdateBtn->setText(tr("检查更新"));
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
// versionInformationLab->setText(tr("您的系统已是最新!"));
versionInformationLab->setText(tr("Your system is the latest!"));
disconnect(updateMutual->interface,SIGNAL(UpdateDloadAndInstStaChanged(QStringList,int,QString,QString)),this,SLOT(getAllProgress(QStringList,int,QString,QString)));
@ -1271,11 +1254,18 @@ void TabWid::slotCancelDownload()
checkUpdateBtn->setEnabled(true);
// checkUpdateBtn->setText("全部更新");
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
checkUpdateBtn->setCheckable(true);
versionInformationLab->setText(tr("update has been canceled!"));
}
void TabWid::startoneappupdateslot()
{
foreach (AppUpdateWid *wid, widgetList) {
if(wid->updateAPPBtn->text() == tr("Update"))
wid->updateAPPBtn->setEnabled(false);
}
}
void TabWid::hideUpdateBtnSlot(bool state,QStringList pkgname,QString error,QString reason)
{
Q_UNUSED(pkgname);
@ -1283,7 +1273,6 @@ void TabWid::hideUpdateBtnSlot(bool state,QStringList pkgname,QString error,QStr
checkUpdateBtn->stop();
// checkUpdateBtn->setText(tr("检查更新"));
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
if(state) {
versionInformationLab->setText(tr("Your system is the latest!"));
systemPortraitLab->setPixmap(QPixmap(":/img/plugins/upgrade/normal.png").scaled(96,96));
@ -1335,7 +1324,9 @@ void TabWid::oneappUpdateresultSlot(bool state,QStringList pkgname,QString error
checkUpdateBtn->stop();
// checkUpdateBtn->setText(tr("检查更新"));
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
foreach (AppUpdateWid *wid, widgetList) {
wid->updateAPPBtn->setEnabled(true);
}
if(state) {
versionInformationLab->setText(tr("Part of the update success!"));
systemPortraitLab->setPixmap(QPixmap(":/img/plugins/upgrade/normal.png").scaled(96,96));
@ -1370,7 +1361,6 @@ void TabWid::oneappUpdateresultSlot(bool state,QStringList pkgname,QString error
checkUpdateBtn->stop();
// checkUpdateBtn->setText(tr("检查更新"));
checkUpdateBtn->setText(tr("Check Update"));
checkUpdateBtn->setToolTip(tr("Check Update"));
versionInformationLab->setText(tr("Your system is the latest!"));
systemPortraitLab->setPixmap(QPixmap(":/img/plugins/upgrade/normal.png").scaled(96,96));
checkUpdateBtn->hide();
@ -1402,7 +1392,6 @@ void TabWid::updatecancel(void)
checkUpdateBtn->stop();
// checkUpdateBtn->setText(tr("检查更新"));
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
versionInformationLab->setText(tr("update has been canceled!"));
checkUpdateBtn->show();
}
@ -1416,7 +1405,6 @@ void TabWid::changeUpdateAllSlot(bool isUpdate)
if(checkUpdateBtn->isEnabled() == false)
{
checkUpdateBtn->setText(tr("UpdateAll"));
checkUpdateBtn->setToolTip(tr("UpdateAll"));
checkUpdateBtn->setEnabled(true);
}
}
@ -1561,7 +1549,6 @@ void TabWid::updateAllApp(bool status)
{
if(!status){
checkUpdateBtn->setText(tr("Calculating"));
checkUpdateBtn->setToolTip(tr("Calculating"));
}else{
foreach (AppUpdateWid *wid, widgetList) {
wid->updateAPPBtn->hide();

View File

@ -166,6 +166,7 @@ public slots:
void allappupdatefinishSlot();
void changeUpdateAllSlot(bool isUpdate);
void updatecancel(void);
void startoneappupdateslot(void);
void DownloadLimitSwitchChanged();
void DownloadLimitValueChanged(const QString &);