mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
Define Cockatrice as an editor/handler for .cod files and cockatrice:// protocol on all platforms (#6775)
* [Application] Add single instance guard and mime types. Took 2 hours 39 minutes Took 18 minutes Took 5 minutes Took 12 seconds Took 11 seconds * Rework Took 30 minutes Took 50 seconds * Only enforce single instance if launched with arguments. Took 5 minutes * Prototype intents Took 53 minutes Took 6 seconds * Connect/disconnect and join game/room intents. Took 3 hours 14 minutes Took 2 seconds Took 15 seconds * Fix include. Took 1 minute Took 23 seconds Took 2 seconds * Mac handling. Took 10 minutes Took 12 seconds Took 3 minutes * Lint. Took 3 minutes * Rebase. Took 3 minutes Took 17 seconds * Implement UrlSchemeEventFilter Took 10 minutes Took 7 seconds * Qt Moc Took 3 minutes * Modern PList. Took 21 minutes Took 1 minute * Debug output. Took 6 minutes Took 19 minutes * Watch file:// prefix. Took 15 minutes Took 7 seconds * Better handler. Took 6 minutes * Don't store reference in member Took 5 minutes * Move impl to cpp, fix lifetime issues. Took 11 minutes Took 2 minutes * Better single-instance handoff, url intent harded copy game link context-menu Polish for installers Took 35 minutes Took 8 seconds --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
27fb5e51de
commit
59d90db3c7
43 changed files with 1372 additions and 13 deletions
48
cockatrice/src/interface/intents/intent.cpp
Normal file
48
cockatrice/src/interface/intents/intent.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "intent.h"
|
||||
|
||||
Intent::Intent(QObject *parent) : QObject(parent)
|
||||
{
|
||||
// An intent is done as soon as it reports success or failure. Deleting it
|
||||
// also tears down its dependency chain and disconnects any signal wiring.
|
||||
connect(this, &Intent::finished, this, &QObject::deleteLater);
|
||||
connect(this, &Intent::failed, this, &QObject::deleteLater);
|
||||
}
|
||||
|
||||
Intent::~Intent() = default;
|
||||
|
||||
void Intent::execute()
|
||||
{
|
||||
if (checkPrecondition()) {
|
||||
onPreconditionSatisfied();
|
||||
} else {
|
||||
onPreconditionNotSatisfied();
|
||||
}
|
||||
}
|
||||
|
||||
void Intent::runDependency(Intent *dependency)
|
||||
{
|
||||
dependency->setParent(this);
|
||||
connect(dependency, &Intent::finished, this, [this]() {
|
||||
// Re-check after dependency finishes
|
||||
this->execute();
|
||||
});
|
||||
connect(dependency, &Intent::failed, this, &Intent::failed);
|
||||
|
||||
dependency->execute();
|
||||
}
|
||||
|
||||
void Intent::emitFinished()
|
||||
{
|
||||
if (!completed) {
|
||||
completed = true;
|
||||
emit finished();
|
||||
}
|
||||
}
|
||||
|
||||
void Intent::emitFailed(const QString &reason)
|
||||
{
|
||||
if (!completed) {
|
||||
completed = true;
|
||||
emit failed(reason);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue