mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Add File Integrity Check
This commit is contained in:
@@ -511,6 +511,25 @@ int AutoUpdateThread::queryUpdate(bool localManualUpdate, const char *text_utf8)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool AutoUpdateThread::queryRepairSlot()
|
||||
{
|
||||
QMessageBox::StandardButton res = OBSMessageBox::question(
|
||||
App()->GetMainWindow(), QTStr("Updater.RepairConfirm.Title"),
|
||||
QTStr("Updater.RepairConfirm.Text"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel);
|
||||
|
||||
return res == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
bool AutoUpdateThread::queryRepair()
|
||||
{
|
||||
bool ret = false;
|
||||
QMetaObject::invokeMethod(this, "queryRepairSlot",
|
||||
Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AutoUpdateThread::run()
|
||||
try {
|
||||
long responseCode;
|
||||
@@ -615,11 +634,15 @@ try {
|
||||
if (!success)
|
||||
throw string("Failed to parse manifest");
|
||||
|
||||
if (!updatesAvailable) {
|
||||
if (!updatesAvailable && !repairMode) {
|
||||
if (manualUpdate)
|
||||
info(QTStr("Updater.NoUpdatesAvailable.Title"),
|
||||
QTStr("Updater.NoUpdatesAvailable.Text"));
|
||||
return;
|
||||
} else if (updatesAvailable && repairMode) {
|
||||
info(QTStr("Updater.RepairButUpdatesAvailable.Title"),
|
||||
QTStr("Updater.RepairButUpdatesAvailable.Text"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* ----------------------------------- *
|
||||
@@ -627,7 +650,7 @@ try {
|
||||
|
||||
int skipUpdateVer = config_get_int(GetGlobalConfig(), "General",
|
||||
"SkipUpdateVersion");
|
||||
if (!manualUpdate && updateVer == skipUpdateVer)
|
||||
if (!manualUpdate && updateVer == skipUpdateVer && !repairMode)
|
||||
return;
|
||||
|
||||
/* ----------------------------------- *
|
||||
@@ -639,20 +662,25 @@ try {
|
||||
/* ----------------------------------- *
|
||||
* query user for update */
|
||||
|
||||
int queryResult = queryUpdate(manualUpdate, notes.c_str());
|
||||
if (repairMode) {
|
||||
if (!queryRepair())
|
||||
return;
|
||||
} else {
|
||||
int queryResult = queryUpdate(manualUpdate, notes.c_str());
|
||||
|
||||
if (queryResult == OBSUpdate::No) {
|
||||
if (!manualUpdate) {
|
||||
long long t = (long long)time(nullptr);
|
||||
if (queryResult == OBSUpdate::No) {
|
||||
if (!manualUpdate) {
|
||||
long long t = (long long)time(nullptr);
|
||||
config_set_int(GetGlobalConfig(), "General",
|
||||
"LastUpdateCheck", t);
|
||||
}
|
||||
return;
|
||||
|
||||
} else if (queryResult == OBSUpdate::Skip) {
|
||||
config_set_int(GetGlobalConfig(), "General",
|
||||
"LastUpdateCheck", t);
|
||||
"SkipUpdateVersion", updateVer);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
} else if (queryResult == OBSUpdate::Skip) {
|
||||
config_set_int(GetGlobalConfig(), "General",
|
||||
"SkipUpdateVersion", updateVer);
|
||||
return;
|
||||
}
|
||||
|
||||
/* ----------------------------------- *
|
||||
|
||||
Reference in New Issue
Block a user