mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 11:03:25 -08:00
[Client] Improve card database update visibility (#7458)
* [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>
This commit is contained in:
parent
6bed5d6f67
commit
a44757bd11
26 changed files with 702 additions and 67 deletions
|
|
@ -27,10 +27,12 @@
|
|||
|
||||
#include "../client/lag_monitor.h"
|
||||
#include "../client/network/update/client/release_channel.h"
|
||||
#include "card_database_update/card_update_progress.h"
|
||||
#include "connection_controller/remote_connection_controller.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMainWindow>
|
||||
|
|
@ -52,11 +54,13 @@ inline Q_LOGGING_CATEGORY(WindowMainStartupLog, "window_main.startup");
|
|||
inline Q_LOGGING_CATEGORY(WindowMainStartupVersionLog, "window_main.startup.version");
|
||||
inline Q_LOGGING_CATEGORY(WindowMainStartupShortcutsLog, "window_main.startup.shortcuts");
|
||||
inline Q_LOGGING_CATEGORY(WindowMainStartupAutoconnectLog, "window_main.startup.autoconnect");
|
||||
inline Q_LOGGING_CATEGORY(CardDatabaseUpdateLog, "card_database.update");
|
||||
|
||||
class DlgViewLog;
|
||||
class GameReplay;
|
||||
class LocalServer;
|
||||
class LatencyStatusWidget;
|
||||
class CardDatabaseUpdateStatusBar;
|
||||
class RemoteClient;
|
||||
class TabSupervisor;
|
||||
class WndSets;
|
||||
|
|
@ -68,13 +72,13 @@ class MainWindow : public QMainWindow
|
|||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
/** @brief Emitted after the background card-database update subprocess exits. */
|
||||
/** @brief Emitted after the card-database update subprocess exits. */
|
||||
void cardDatabaseUpdateFinished(bool success);
|
||||
|
||||
/** @brief Emitted while the background card-database update subprocess runs.
|
||||
* @p stage is one of "download", "scan" or "import"; @p done/@p total
|
||||
* are byte counts for the first two stages and set indices for "import". */
|
||||
void cardDatabaseUpdateProgress(const QString &stage, qint64 done, qint64 total);
|
||||
/** @brief Emitted while the card-database update subprocess runs.
|
||||
* @p progress.done/@p progress.total are byte counts for the first two stages
|
||||
* and set indices for "import". */
|
||||
void cardDatabaseUpdateProgress(const CardUpdateProgress &progress);
|
||||
|
||||
public slots:
|
||||
void actCheckCardUpdates();
|
||||
|
|
@ -106,6 +110,7 @@ private slots:
|
|||
void cardUpdateError(QProcess::ProcessError err);
|
||||
void cardUpdateFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void cardUpdateProgressOutput();
|
||||
void cardUpdateStandardError();
|
||||
void refreshShortcuts();
|
||||
void cardDatabaseLoadingFailed();
|
||||
void cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknownSetsNames);
|
||||
|
|
@ -150,6 +155,15 @@ private:
|
|||
}
|
||||
void createCardUpdateProcess(bool background = false);
|
||||
void exitCardDatabaseUpdate();
|
||||
/**
|
||||
* @brief Tries to bring the open card database updater window to the front.
|
||||
* @return true when the updater acknowledged the request
|
||||
*/
|
||||
bool requestCardUpdateRaise();
|
||||
/** @brief Tells the user an update is running without blocking, honoring a hidden status bar. */
|
||||
void announceCardUpdateRunning();
|
||||
/** @brief Posts a tray notification when the status bar cannot show progress. */
|
||||
void notifyCardUpdateFinishedFromTray(bool success);
|
||||
|
||||
void startLocalGame(const LocalGameOptions &options);
|
||||
|
||||
|
|
@ -176,6 +190,11 @@ private:
|
|||
bool firstRunWizardActive = false;
|
||||
QProcess *cardUpdateProcess;
|
||||
QByteArray cardUpdateOutputBuffer;
|
||||
QByteArray cardUpdateErrorOutput; ///< diagnostic output collected from the updater's stderr
|
||||
QByteArray cardUpdateErrorPartial; ///< incomplete trailing stderr line, kept for line-based logging
|
||||
CardUpdateStage cardUpdateLoggedStage = CardUpdateStage::Unknown; ///< stage of the last logged progress update
|
||||
QElapsedTimer cardUpdateProgressLogTimer; ///< throttles progress logging to the running stage
|
||||
CardDatabaseUpdateStatusBar *cardUpdateStatusBar = nullptr; ///< status bar widget tracking the card database update
|
||||
DlgViewLog *logviewDialog;
|
||||
GameReplay *replay;
|
||||
DlgTipOfTheDay *tip;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue