mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Remove the use of single application
This commit is contained in:
parent
faf4235bed
commit
34eb6e9f71
@ -18,10 +18,10 @@
|
|||||||
#include "machine_info.h"
|
#include "machine_info.h"
|
||||||
#include "qet.h"
|
#include "qet.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include "singleapplication.h"
|
|
||||||
#include "utils/macosxopenevent.h"
|
#include "utils/macosxopenevent.h"
|
||||||
|
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief myMessageOutput
|
@brief myMessageOutput
|
||||||
@ -174,7 +174,7 @@ int main(int argc, char **argv)
|
|||||||
#pragma message("@TODO remove code for QT 6 or later")
|
#pragma message("@TODO remove code for QT 6 or later")
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
SingleApplication app(argc, argv, true);
|
QApplication app(argc, argv, true);
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
||||||
//or drop these same files to the QET icon of the dock
|
//or drop these same files to the QET icon of the dock
|
||||||
@ -182,23 +182,8 @@ int main(int argc, char **argv)
|
|||||||
app.installEventFilter(&open_event);
|
app.installEventFilter(&open_event);
|
||||||
app.setStyle(QStyleFactory::create("Fusion"));
|
app.setStyle(QStyleFactory::create("Fusion"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (app.isSecondary())
|
|
||||||
{
|
|
||||||
QStringList arg_list = app.arguments();
|
|
||||||
//Remove the first argument, it's the binary file
|
|
||||||
arg_list.takeFirst();
|
|
||||||
QETArguments qetarg(arg_list);
|
|
||||||
QString message = "launched-with-args: " + QET::joinWithSpaces(
|
|
||||||
QStringList(qetarg.arguments()));
|
|
||||||
app.sendMessage(message.toUtf8());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QETApp qetapp;
|
QETApp qetapp;
|
||||||
QETApp::instance()->installEventFilter(&qetapp);
|
QETApp::instance()->installEventFilter(&qetapp);
|
||||||
QObject::connect(&app, &SingleApplication::receivedMessage,
|
|
||||||
&qetapp, &QETApp::receiveMessage);
|
|
||||||
|
|
||||||
// for debugging
|
// for debugging
|
||||||
qInstallMessageHandler(myMessageOutput);
|
qInstallMessageHandler(myMessageOutput);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user