Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/common/dbus/updatedbusproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@
return qvariant_cast<bool>(m_managerInter->property("AutoClean"));
}

uint UpdateDBusProxy::updateMode()
quint64 UpdateDBusProxy::updateMode()

Check warning on line 169 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'updateMode' is never used.
{
return qvariant_cast<uint>(m_managerInter->property("UpdateMode"));
return qvariant_cast<quint64>(m_managerInter->property("UpdateMode"));
}

void UpdateDBusProxy::setUpdateMode(qulonglong value)
void UpdateDBusProxy::setUpdateMode(quint64 value)

Check warning on line 174 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'setUpdateMode' is never used.
{
m_managerInter->setProperty("UpdateMode", QVariant::fromValue(value));
}
Expand All @@ -191,12 +191,12 @@
return qvariant_cast<QString>(m_managerInter->property("HardwareId"));
}

int UpdateDBusProxy::checkUpdateMode()
quint64 UpdateDBusProxy::checkUpdateMode()

Check warning on line 194 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'checkUpdateMode' is never used.
{
return qvariant_cast<int>(m_managerInter->property("CheckUpdateMode"));
return qvariant_cast<quint64>(m_managerInter->property("CheckUpdateMode"));
}

void UpdateDBusProxy::setCheckUpdateMode(int value)
void UpdateDBusProxy::setCheckUpdateMode(quint64 value)
{
m_managerInter->setProperty("CheckUpdateMode", QVariant::fromValue(value));
}
Expand Down
8 changes: 4 additions & 4 deletions src/common/dbus/updatedbusproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class UpdateDBusProxy : public QObject
bool autoClean();

Q_PROPERTY(qulonglong UpdateMode READ updateMode WRITE setUpdateMode NOTIFY UpdateModeChanged)
uint updateMode();
void setUpdateMode(qulonglong value);
quint64 updateMode();
void setUpdateMode(quint64 value);

Q_PROPERTY(QList<QDBusObjectPath> JobList READ jobList NOTIFY JobListChanged)
QList<QDBusObjectPath> jobList();
Expand All @@ -69,8 +69,8 @@ class UpdateDBusProxy : public QObject

QString hardwareId();

int checkUpdateMode();
void setCheckUpdateMode(int value);
quint64 checkUpdateMode();
void setCheckUpdateMode(quint64 value);

QString idleDownloadConfig();
QString downloadSpeedLimitConfig();
Expand Down
14 changes: 11 additions & 3 deletions src/dcc-update-plugin/operation/updatemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void UpdateModel::setLastCheckUpdateTime(const QString& lastTime)
emit lastCheckUpdateTimeChanged();
}

void UpdateModel::setCheckUpdateMode(int value)
void UpdateModel::setCheckUpdateMode(quint64 value)
{
qCInfo(DCC_UPDATE_MODEL) << "Set check update mode: " << value;
if (m_checkUpdateMode == value)
Expand All @@ -297,9 +297,17 @@ void UpdateModel::setCheckUpdateMode(int value)
Q_EMIT checkUpdateModeChanged(value);

// 升级时切换用户,再切回来的时候收到的信号时乱序,可能会先收到updateStatusChanged再收到checkUpdateModeChanged
refreshUpdateItemsChecked();
refreshUpdateStatus();
}

void UpdateModel::refreshUpdateItemsChecked()
{
for (const auto item : m_allUpdateInfos.values()) {
item->setIsChecked(m_checkUpdateMode & item->updateType());
}
}

void UpdateModel::setPreUpdatelistModel(UpdateListModel *newPreUpdatelistModel)
{
if (m_preUpdatelistModel == newPreUpdatelistModel)
Expand Down Expand Up @@ -1156,9 +1164,9 @@ void UpdateModel::onUpdatePropertiesChanged(const QString& interfaceName, const
if (changedProperties.contains("CheckUpdateMode")) {
// 用户A、B都打开控制中心,用户A多次修改CheckUpdateMode后切换到用户B,控制中心会立刻收到多个改变信号
// 增加一个100ms的防抖,只取最后一次的数值
static int tmpValue = 0;
static quint64 tmpValue = 0;
static QTimer* timer = nullptr;
tmpValue = changedProperties.value("CheckUpdateMode").toInt();
tmpValue = changedProperties.value("CheckUpdateMode").toULongLong();
if (!timer) {
timer = new QTimer(this);
timer->setInterval(100);
Expand Down
10 changes: 5 additions & 5 deletions src/dcc-update-plugin/operation/updatemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class UpdateModel : public QObject
QString lastCheckUpdateTime() const { return m_lastCheckUpdateTime; }
void setLastCheckUpdateTime(const QString &lastTime);

int checkUpdateMode() const { return m_checkUpdateMode; }
void setCheckUpdateMode(int value);

quint64 checkUpdateMode() const { return m_checkUpdateMode; }
void setCheckUpdateMode(quint64 value);
void refreshUpdateItemsChecked();

// ---------------下载、备份、安装列表数据---------------
UpdateListModel *preUpdatelistModel() const { return m_preUpdatelistModel; }
Expand Down Expand Up @@ -326,7 +326,7 @@ public slots:
void checkUpdateErrTipsChanged();
void checkBtnTextChanged();
void lastCheckUpdateTimeChanged();
void checkUpdateModeChanged(int);
void checkUpdateModeChanged(quint64);

// 下载、备份、安装列表数据
void preUpdatelistModelChanged();
Expand Down Expand Up @@ -396,7 +396,7 @@ public slots:
QString m_checkUpdateErrTips;
QString m_checkBtnText;
QString m_lastCheckUpdateTime;
int m_checkUpdateMode;
quint64 m_checkUpdateMode;

// 下载、备份、安装列表数据
UpdateListModel *m_preUpdatelistModel; // preUpdateList qml data
Expand Down
5 changes: 3 additions & 2 deletions src/dcc-update-plugin/operation/updatework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ void UpdateWorker::setUpdateInfo()
isUpdated = false;
}
}
m_model->refreshUpdateItemsChecked();
m_model->refreshUpdateStatus();
m_model->updateAvailableState();
m_model->setLastStatus(isUpdated ? Updated : UpdatesAvailable, __LINE__);
Expand Down Expand Up @@ -1264,8 +1265,8 @@ void UpdateWorker::onRequestRetry(int type, int updateTypes)

void UpdateWorker::setCheckUpdateMode(int type, bool isChecked)
{
const int currentMode = m_model->checkUpdateMode();
const int outMode = isChecked ? (currentMode | type) : (currentMode & ~type);
quint64 currentMode = m_model->checkUpdateMode();
quint64 outMode = isChecked ? (currentMode | type) : (currentMode & ~type);

m_updateInter->setCheckUpdateMode(outMode);
}
Expand Down