mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 01:23:24 -08:00
* [Client] Improve card database update visibility Addresses Cockatrice/Cockatrice#7431. Cockatrice previously offered no in-client feedback while the card database updater ran: the only progress UI lived in the first-run wizard, stderr/stdout were not parsed in interactive runs, and starting a second update with Oracle already open or with a hidden background run active just showed a confusing 'already running' guard - even though Oracle is launched as a separate process with no lifecycle tracking. - Add a status-bar widget (CardDatabaseUpdateStatusBar) that appears while an update runs and shows the Downloading/Parsing/Importing stages with percent progress; it is also used in the quit-confirm prompt so users see an unfinished update before cancelling it. - Parse the updater's PROGRESS lines (new CardUpdateProgressParser, unit-tested) in both foreground and background runs and log stage changes to the new card_database.update category, throttled to at most one line per second; forward Oracle stderr to the logs. - Show a tray balloon when a background update starts and on finish or failure instead of staying silent. - Request a running Oracle instance to raise itself (QLocalServer CockatriceOracleRaise-<user>) when the user starts another update, and demote the 'already running' guard to an informative message only when no running instance can be found. - Emit download/scan/import progress unconditionally from Oracle so interactive and background runs behave the same. - Document the new log category in the troubleshooting guide. * [Client] Address card database update review feedback * [Client] Add setting to control card database update tray notifications * [Client] Address remaining card database update review nits - Rename card_update_progress_parser.{h,cpp} to card_update_progress.{h,cpp} - Store the CardUpdateProgress struct in the status bar widget * Lint. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
121 lines
3.3 KiB
C++
121 lines
3.3 KiB
C++
#include "updates_settings.h"
|
|
|
|
#include "libcockatrice/settings/settings_manager.h"
|
|
|
|
#include <QDate>
|
|
#include <QDateTime>
|
|
#include <QSharedPointer>
|
|
#include <QVariant>
|
|
|
|
class QObject;
|
|
|
|
UpdatesSettings::UpdatesSettings(const QString &settingPath, QObject *parent)
|
|
: SettingsManager(settingPath + "updates.ini", "updates", QString(), parent)
|
|
{
|
|
}
|
|
|
|
bool UpdatesSettings::getCheckUpdatesOnStartup() const
|
|
{
|
|
return getValue("startupUpdateCheck", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool UpdatesSettings::getStartupCardUpdateCheckPromptForUpdate()
|
|
{
|
|
return getValue("startupCardUpdateCheckPromptForUpdate", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool UpdatesSettings::getStartupCardUpdateCheckAlwaysUpdate()
|
|
{
|
|
return getValue("startupCardUpdateCheckAlwaysUpdate", QString(), QString(), false).toBool();
|
|
}
|
|
|
|
int UpdatesSettings::getCardUpdateCheckInterval() const
|
|
{
|
|
return getValue("cardUpdateCheckInterval", QString(), QString(), 7).toInt();
|
|
}
|
|
|
|
QDate UpdatesSettings::getLastCardUpdateCheck() const
|
|
{
|
|
return getValue("lastCardUpdateCheck", QString(), QString(), QDateTime::currentDateTime().date()).toDate();
|
|
}
|
|
|
|
bool UpdatesSettings::getCardUpdateCheckRequired() const
|
|
{
|
|
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
|
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
|
}
|
|
|
|
bool UpdatesSettings::getAlwaysEnableNewSets() const
|
|
{
|
|
return getValue("alwaysEnableNewSets", QString(), QString(), false).toBool();
|
|
}
|
|
|
|
bool UpdatesSettings::getNotifyAboutUpdates() const
|
|
{
|
|
return getValue("updateNotification", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool UpdatesSettings::getNotifyAboutNewVersion() const
|
|
{
|
|
return getValue("newVersionNotification", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool UpdatesSettings::getCardDatabaseUpdateTrayNotification() const
|
|
{
|
|
return getValue("cardDatabaseUpdateTrayNotification", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
int UpdatesSettings::getUpdateReleaseChannelIndex() const
|
|
{
|
|
return getValue("updateReleaseChannel", QString(), QString(), 0).toInt();
|
|
}
|
|
|
|
void UpdatesSettings::setCheckUpdatesOnStartup(bool value)
|
|
{
|
|
setValue(value, "startupUpdateCheck");
|
|
}
|
|
|
|
void UpdatesSettings::setStartupCardUpdateCheckPromptForUpdate(bool value)
|
|
{
|
|
setValue(value, "startupCardUpdateCheckPromptForUpdate");
|
|
}
|
|
|
|
void UpdatesSettings::setStartupCardUpdateCheckAlwaysUpdate(bool value)
|
|
{
|
|
setValue(value, "startupCardUpdateCheckAlwaysUpdate");
|
|
}
|
|
|
|
void UpdatesSettings::setCardUpdateCheckInterval(int value)
|
|
{
|
|
setValue(value, "cardUpdateCheckInterval");
|
|
}
|
|
|
|
void UpdatesSettings::setLastCardUpdateCheck(QDate value)
|
|
{
|
|
setValue(value, "lastCardUpdateCheck");
|
|
}
|
|
|
|
void UpdatesSettings::setAlwaysEnableNewSets(bool value)
|
|
{
|
|
setValue(value, "alwaysEnableNewSets");
|
|
}
|
|
|
|
void UpdatesSettings::setNotifyAboutUpdates(bool _notifyaboutupdate)
|
|
{
|
|
setValue(_notifyaboutupdate, "updateNotification");
|
|
}
|
|
|
|
void UpdatesSettings::setNotifyAboutNewVersion(bool _notifyaboutnewversion)
|
|
{
|
|
setValue(_notifyaboutnewversion, "newVersionNotification");
|
|
}
|
|
|
|
void UpdatesSettings::setCardDatabaseUpdateTrayNotification(bool value)
|
|
{
|
|
setValue(value, "cardDatabaseUpdateTrayNotification");
|
|
}
|
|
|
|
void UpdatesSettings::setUpdateReleaseChannelIndex(int value)
|
|
{
|
|
setValue(value, "updateReleaseChannel");
|
|
}
|