1
0
Fork 0
forked from lthn/blockchain

added zano url-scheme handler for MacOS, Windows, Linux (#311)

* added zano url-scheme handler MacOS, Windows, Linux setups

* pass parameters to executable and print console

* added event filter for url-scheme handling in MacOS

Co-authored-by: Barış Çelik <bariscelik@Barss-MacBook-Air.local>
This commit is contained in:
Barış ÇELİK 2021-11-23 22:59:43 +03:00 committed by GitHub
parent 3e74e4d581
commit 4db29d337d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 1 deletions

View file

@ -0,0 +1,18 @@
#include "urleventfilter.h"
#include <QMessageBox>
bool URLEventFilter::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event);
if(!fileEvent->url().isEmpty())
{
QMessageBox msg;
msg.setText(fileEvent->url().toString());
msg.exec();
}
} else {
// standard event processing
return QObject::eventFilter(obj, event);
}
};

View file

@ -0,0 +1,12 @@
#include <QObject>
#include <QFileOpenEvent>
#include <QDebug>
class URLEventFilter : public QObject
{
Q_OBJECT
public:
URLEventFilter() : QObject(){};
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
};

View file

@ -12,7 +12,9 @@
//#include "qtlogger.h"
#include "include_base_utils.h"
#include "currency_core/currency_config.h"
#ifdef Q_OS_DARWIN
#include "application/urleventfilter.h"
#endif
int main(int argc, char *argv[])
{
@ -27,6 +29,8 @@ int main(int argc, char *argv[])
// _set_FMA3_enable(0);
//#endif // ARCH_CPU_X86_64 && _MSC_VER <= 1800
if(argc > 1)
std::cout << argv[1] << std::endl;
#ifdef _MSC_VER
#ifdef _WIN64
@ -62,6 +66,12 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
#ifdef Q_OS_DARWIN
URLEventFilter url_event_filter;
app.installEventFilter(&url_event_filter);
#endif
MainWindow viewer;
if (!viewer.init_backend(argc, argv))
{