mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -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
c4ffc789cd
commit
210a0fa76a
25 changed files with 1350 additions and 55 deletions
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
#include <QDir>
|
||||
|
||||
namespace
|
||||
{
|
||||
// Sent by the primary instance after it has read a forwarded payload. Without
|
||||
// an acknowledgment, a second instance cannot tell a live primary apart from a
|
||||
// stale socket left behind by a process that is still shutting down.
|
||||
const QByteArray ACK_MESSAGE = QByteArrayLiteral("COCKATRICE_ACK");
|
||||
} // namespace
|
||||
|
||||
SingleInstanceManager::SingleInstanceManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
|
@ -72,7 +80,14 @@ bool SingleInstanceManager::forwardToPrimary(const QStringList &filesToSend)
|
|||
socket.flush();
|
||||
socket.waitForBytesWritten(1000);
|
||||
|
||||
return true;
|
||||
// Only report a successful hand-off once the primary has acknowledged that
|
||||
// it actually read the payload. A socket that connects but never answers
|
||||
// belongs to a process that is dying, so the caller must not treat this as
|
||||
// a hand-off (otherwise it would exit without anyone handling the files).
|
||||
if (!socket.waitForReadyRead(1000)) {
|
||||
return false;
|
||||
}
|
||||
return socket.readAll() == ACK_MESSAGE;
|
||||
}
|
||||
|
||||
void SingleInstanceManager::handleNewConnection()
|
||||
|
|
@ -111,6 +126,14 @@ void SingleInstanceManager::handleNewConnection()
|
|||
QStringList files;
|
||||
payloadStream >> files;
|
||||
|
||||
// Acknowledge receipt as soon as the payload is parsed, before the
|
||||
// primary starts handling it. The handlers run synchronously and can
|
||||
// take longer than the sender's readiness timeout (e.g. a modal
|
||||
// confirmation box), which would otherwise make a live primary look
|
||||
// dead and cause duplicate handling.
|
||||
socket->write(ACK_MESSAGE);
|
||||
socket->flush();
|
||||
|
||||
emit filesReceived(files);
|
||||
|
||||
// Reset buffer (single message use-case)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue