Adds latest migration results
This commit is contained in:
829 files changed
+35074
-70886
No files matched your search
@@ -2,6 +2,14 @@
|
||||
# http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Utilities/qtsingleapplication
|
||||
# LGPL
|
||||
|
||||
# Make ${Qt6_Widgets} optional
|
||||
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
|
||||
set(Qt6_Widgets ${Qt6_Widgets})
|
||||
else()
|
||||
set(Qt6_Widgets "")
|
||||
endif()
|
||||
|
||||
|
||||
SET(qtsapp_common_SRCS
|
||||
qtlocalpeer.cpp
|
||||
qtlocalpeer.h
|
||||
@@ -29,7 +37,7 @@ NGL_TARGET_LINK_LIBRARIES(qtsingleapplication
|
||||
qtsa_common
|
||||
PUBLIC
|
||||
Qt6::Core
|
||||
Qt6::Widgets
|
||||
Qt6::Gui
|
||||
)
|
||||
|
||||
SET(qtscoreapp_SRCS
|
||||
|
||||
@@ -4,68 +4,56 @@
|
||||
|
||||
#include "qtsingleapplication.h"
|
||||
#include "qtlocalpeer.h"
|
||||
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
void QtSingleApplication::sysInit(const QString &appId)
|
||||
{
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
actWin = nullptr;
|
||||
#endif
|
||||
peer = new QtLocalPeer(this, appId);
|
||||
connect(peer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::messageReceived);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QtSingleApplication::QtSingleApplication(int &argc, char **argv, bool GUIenabled)
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
: QApplication(argc, argv, GUIenabled)
|
||||
#else
|
||||
: QCoreApplication(argc, argv)
|
||||
#endif
|
||||
{
|
||||
sysInit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
: QApplication(argc, argv)
|
||||
#else
|
||||
: QCoreApplication(argc, argv)
|
||||
#endif
|
||||
{
|
||||
sysInit(appId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool QtSingleApplication::isRunning()
|
||||
{
|
||||
return peer->isClient();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool QtSingleApplication::sendMessage(const QString &message, int timeout)
|
||||
{
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString QtSingleApplication::id() const
|
||||
{
|
||||
return peer->applicationId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage)
|
||||
{
|
||||
actWin = aw;
|
||||
@@ -75,17 +63,11 @@ void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessag
|
||||
disconnect(peer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::activateWindow);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QWidget* QtSingleApplication::activationWindow() const
|
||||
{
|
||||
return actWin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void QtSingleApplication::activateWindow()
|
||||
{
|
||||
if (actWin) {
|
||||
@@ -94,6 +76,7 @@ void QtSingleApplication::activateWindow()
|
||||
actWin->activateWindow();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,13 @@
|
||||
#ifndef QTSINGLEAPPLICATION_H
|
||||
#define QTSINGLEAPPLICATION_H
|
||||
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
#include <QtWidgets/QApplication>
|
||||
#define QTSINGLEAPPLICATION_BASE QApplication
|
||||
#else
|
||||
#include <QCoreApplication>
|
||||
#define QTSINGLEAPPLICATION_BASE QCoreApplication
|
||||
#endif
|
||||
|
||||
class QtLocalPeer;
|
||||
|
||||
@@ -20,7 +26,7 @@ class QtLocalPeer;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
class QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication
|
||||
class QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QTSINGLEAPPLICATION_BASE
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -31,16 +37,19 @@ public:
|
||||
bool isRunning();
|
||||
QString id() const;
|
||||
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
void setActivationWindow(QWidget* aw, bool activateOnMessage = true);
|
||||
QWidget* activationWindow() const;
|
||||
|
||||
#endif
|
||||
|
||||
void initialize(bool dummy = true)
|
||||
{ isRunning(); Q_UNUSED(dummy) }
|
||||
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QString &message, int timeout = 5000);
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
void activateWindow();
|
||||
#endif
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -50,7 +59,9 @@ Q_SIGNALS:
|
||||
private:
|
||||
void sysInit(const QString &appId = QString());
|
||||
QtLocalPeer *peer;
|
||||
#ifdef QT6_GUI_AVAILABLE
|
||||
QWidget *actWin;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user