mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-17 16:26:08 +03:00
Compare commits
2 Commits
checking-L
...
fix/disabl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c492f4033 | ||
|
|
471958479e |
@@ -31,9 +31,8 @@
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_CLASS(argc, argv)
|
||||
#else
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[], bool allowSecondary, SingleApplication::Options options, int timeout,
|
||||
const QString &userData)
|
||||
: SingleApplication(argc, argv, allowSecondary, options, timeout, userData)
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[])
|
||||
: QApplication(argc, argv)
|
||||
#endif
|
||||
{
|
||||
setQuitOnLastWindowClosed(false);
|
||||
@@ -181,14 +180,14 @@ void AmneziaApplication::init()
|
||||
#endif
|
||||
|
||||
// TODO - fix
|
||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||
if (isPrimary()) {
|
||||
QObject::connect(this, &SingleApplication::instanceStarted, m_pageController.get(), [this]() {
|
||||
qDebug() << "Secondary instance started, showing this window instead";
|
||||
emit m_pageController->raiseMainWindow();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
// #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||
// if (isPrimary()) {
|
||||
// QObject::connect(this, &SingleApplication::instanceStarted, m_pageController.get(), [this]() {
|
||||
// qDebug() << "Secondary instance started, showing this window instead";
|
||||
// emit m_pageController->raiseMainWindow();
|
||||
// });
|
||||
// }
|
||||
// #endif
|
||||
|
||||
// Android TextArea clipboard workaround
|
||||
// Text from TextArea always has "text/html" mime-type:
|
||||
|
||||
@@ -53,9 +53,8 @@
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
#define AMNEZIA_BASE_CLASS QGuiApplication
|
||||
#else
|
||||
#define AMNEZIA_BASE_CLASS SingleApplication
|
||||
#define AMNEZIA_BASE_CLASS QApplication
|
||||
#define QAPPLICATION_CLASS QApplication
|
||||
#include "singleapplication.h"
|
||||
#endif
|
||||
|
||||
class AmneziaApplication : public AMNEZIA_BASE_CLASS
|
||||
@@ -65,9 +64,7 @@ public:
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication(int &argc, char *argv[]);
|
||||
#else
|
||||
AmneziaApplication(int &argc, char *argv[], bool allowSecondary = false,
|
||||
SingleApplication::Options options = SingleApplication::User, int timeout = 1000,
|
||||
const QString &userData = {});
|
||||
AmneziaApplication(int &argc, char *argv[]);
|
||||
#endif
|
||||
virtual ~AmneziaApplication();
|
||||
|
||||
|
||||
@@ -35,13 +35,12 @@ int main(int argc, char *argv[])
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication app(argc, argv);
|
||||
#else
|
||||
AmneziaApplication app(argc, argv, true,
|
||||
SingleApplication::Mode::User | SingleApplication::Mode::SecondaryNotification);
|
||||
AmneziaApplication app(argc, argv);
|
||||
|
||||
if (!app.isPrimary()) {
|
||||
QTimer::singleShot(1000, &app, [&]() { app.quit(); });
|
||||
return app.exec();
|
||||
}
|
||||
// if (!app.isPrimary()) {
|
||||
// QTimer::singleShot(1000, &app, [&]() { app.quit(); });
|
||||
// return app.exec();
|
||||
// }
|
||||
#endif
|
||||
|
||||
// Allow to raise app window if secondary instance launched
|
||||
|
||||
Reference in New Issue
Block a user