mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 16:13:54 -07:00
Better handler.
Took 6 minutes
This commit is contained in:
parent
20e5b52bae
commit
5eac9acc58
2 changed files with 9 additions and 12 deletions
|
|
@ -40,22 +40,19 @@ public:
|
|||
if (event->type() == QEvent::FileOpen) {
|
||||
auto *fileEvent = static_cast<QFileOpenEvent *>(event);
|
||||
|
||||
qWarning() << "[MAC][FileOpenEvent] raw url:" << fileEvent->url()
|
||||
<< "toString:" << fileEvent->url().toString() << "schemePrefix:" << m_prefixes;
|
||||
const QUrl url = fileEvent->url();
|
||||
|
||||
const QString url = fileEvent->url().toString();
|
||||
|
||||
qWarning() << "[MAC][FileOpenEvent] extracted url:" << url;
|
||||
|
||||
for (auto m_prefix : m_prefixes) {
|
||||
if (url.startsWith(m_prefix)) {
|
||||
qWarning() << "[MAC][FileOpenEvent] MATCH prefix → emitting urlReceived";
|
||||
emit urlReceived(url);
|
||||
for (auto prefix : m_prefixes) {
|
||||
if (url.scheme() == prefix) {
|
||||
emit urlReceived(url.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
qWarning() << "[MAC][FileOpenEvent] ignored (wrong scheme)";
|
||||
if (url.isLocalFile()) {
|
||||
emit urlReceived(url.toLocalFile());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ int main(int argc, char *argv[])
|
|||
QApplication app(argc, argv);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
UrlSchemeEventFilter cockatriceFilter(QStringList{QStringLiteral("cockatrice://"), QStringLiteral("file://")});
|
||||
UrlSchemeEventFilter cockatriceFilter(QStringList{QStringLiteral("cockatrice")});
|
||||
|
||||
QStringList pendingMacUrls;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue