mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 17:15:09 -07:00
[DeckShare] Open shared decks via links with a gated preview flow
- Serialized url-chain dispatcher in IntentUrlParser; queue-drained urlChainFinished(bool) drives the startup auto-connect fallback - Open-shared-deck intent with sequential download state machine, 15s per-item timeout, partial-success offer, livable Cancel via ApplicationModal dlg_login_prompt interactive fallback - Preview dialog: download progress label, share vocab sweep, palette-highlight selection frame, Space/Enter keyboard toggle, NoFocus checkbox, double-click tile opens immediately - Confirm-before-server-migration with one-shot restore to the previous server on failed/cancelled chains (statusChanged settle deferral), hostname-only identity comparisons - Skip credential link when already connected; arrow-key navigation in FlowWidget; card glows use palette highlight - Address code-review M1-M4 and UI/UX QA blockers 1-2
This commit is contained in:
parent
812f2a88ea
commit
7faa2fca13
25 changed files with 1350 additions and 55 deletions
|
|
@ -507,6 +507,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
connectionController = new ConnectionController(this, this);
|
||||
urlParser = new IntentUrlParser(this, this);
|
||||
connect(urlParser, &IntentUrlParser::urlChainFinished, this, &MainWindow::onUrlChainFinished);
|
||||
|
||||
createActions();
|
||||
createMenus();
|
||||
|
|
@ -722,6 +723,7 @@ void MainWindow::applyStartupDestination()
|
|||
|
||||
connect(credentials, &Intent::finished, connector, &Intent::execute);
|
||||
connect(credentials, &Intent::failed, this, &MainWindow::startupDestinationFailed);
|
||||
connect(credentials, &Intent::cancelled, this, [this]() { startupDestinationFailed(tr("Sign-in cancelled")); });
|
||||
connect(connector, &Intent::finished, this,
|
||||
[this, destination, serverContext]() { onStartupDestinationConnected(destination, *serverContext); });
|
||||
connect(connector, &Intent::failed, this, &MainWindow::startupDestinationFailed);
|
||||
|
|
@ -862,18 +864,7 @@ void MainWindow::changeEvent(QEvent *event)
|
|||
} else if (event->type() == QEvent::ActivationChange) {
|
||||
if (isActiveWindow() && !bHasActivated) {
|
||||
bHasActivated = true;
|
||||
if (!connectTo.isEmpty()) {
|
||||
qCInfo(WindowMainStartupAutoconnectLog) << "Command line connect to " << connectTo;
|
||||
connectionController->connectToServerDirect(connectTo.host(), connectTo.port(), connectTo.userName(),
|
||||
connectTo.password());
|
||||
} else if (SettingsCache::instance().servers().getAutoConnect() &&
|
||||
!SettingsCache::instance().debug().getLocalGameOnStartup() &&
|
||||
!startupDestinationConnectsToServer()) {
|
||||
qCInfo(WindowMainStartupAutoconnectLog) << "Attempting auto-connect...";
|
||||
DlgConnect dlg(this);
|
||||
connectionController->connectToServerDirect(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()),
|
||||
dlg.getPlayerName(), dlg.getPassword());
|
||||
}
|
||||
attemptStartupAutoConnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -899,6 +890,40 @@ void MainWindow::handleCockatriceLink(const QString &url)
|
|||
urlParser->handle(url);
|
||||
}
|
||||
|
||||
void MainWindow::attemptStartupAutoConnect()
|
||||
{
|
||||
if (startupAutoConnectAttempted || skipStartupAutoConnect) {
|
||||
return;
|
||||
}
|
||||
startupAutoConnectAttempted = true;
|
||||
|
||||
if (!connectTo.isEmpty()) {
|
||||
qCInfo(WindowMainStartupAutoconnectLog) << "Command line connect to " << connectTo;
|
||||
connectionController->connectToServerDirect(connectTo.host(), connectTo.port(), connectTo.userName(),
|
||||
connectTo.password());
|
||||
} else if (SettingsCache::instance().servers().getAutoConnect() &&
|
||||
!SettingsCache::instance().debug().getLocalGameOnStartup() && !startupDestinationConnectsToServer()) {
|
||||
qCInfo(WindowMainStartupAutoconnectLog) << "Attempting auto-connect...";
|
||||
DlgConnect dlg(this);
|
||||
connectionController->connectToServerDirect(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()),
|
||||
dlg.getPlayerName(), dlg.getPassword());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onUrlChainFinished(bool connected)
|
||||
{
|
||||
// A cockatrice:// link owns the startup connection while it runs. When its
|
||||
// chain ended without connecting (declined, invalid, offline), fall back to
|
||||
// the startup connection so the activation launch still behaves like a
|
||||
// normal launch.
|
||||
if (connected || !skipStartupAutoConnect || getRemoteClient()->getStatus() != StatusDisconnected) {
|
||||
return;
|
||||
}
|
||||
qCInfo(WindowMainStartupAutoconnectLog) << "URL chain ended without a connection; retrying startup connect";
|
||||
skipStartupAutoConnect = false;
|
||||
attemptStartupAutoConnect();
|
||||
}
|
||||
|
||||
void MainWindow::cardDatabaseLoadingFailed()
|
||||
{
|
||||
if (askedForDbUpdater) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue