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