KDSingleApplication API Documentation
1.1
Loading...
Searching...
No Matches
source
src
kdsingleapplication.h
Go to the documentation of this file.
1
/*
2
This file is part of KDSingleApplication.
3
4
SPDX-FileCopyrightText: 2019 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5
6
SPDX-License-Identifier: MIT
7
8
Contact KDAB at <info@kdab.com> for commercial licensing options.
9
*/
10
#ifndef KDSINGLEAPPLICATION_H
11
#define KDSINGLEAPPLICATION_H
12
13
#include <QtCore/QObject>
14
#include <QtCore/QFlags>
15
16
#include <memory>
17
18
#include "
kdsingleapplication_lib.h
"
19
20
class
KDSingleApplicationPrivate;
21
22
class
KDSINGLEAPPLICATION_EXPORT
KDSingleApplication
:
public
QObject
23
{
24
Q_OBJECT
25
Q_PROPERTY
(
QString
name READ name CONSTANT)
26
Q_PROPERTY(
bool
isPrimaryInstance READ isPrimaryInstance CONSTANT)
27
28
public:
29
// IncludeUsernameInSocketName - Include the username in the socket name.
30
// IncludeSessionInSocketName - Include the graphical session in the socket name.
31
enum class
Option
{
32
None = 0x0,
33
IncludeUsernameInSocketName = 0x1,
34
IncludeSessionInSocketName = 0x2,
35
};
36
Q_DECLARE_FLAGS(Options, Option)
37
38
explicit
KDSingleApplication
(
QObject
*parent =
nullptr
);
39
explicit
KDSingleApplication
(
const
QString
&name,
QObject
*parent =
nullptr
);
40
explicit
KDSingleApplication
(
const
QString
&name, Options options,
QObject
*parent =
nullptr
);
41
~KDSingleApplication
();
42
43
QString
name()
const
;
44
bool
isPrimaryInstance()
const
;
45
46
public
Q_SLOTS
:
47
// avoid default arguments and overloads, as they don't mix with connections
48
bool
sendMessage(
const
QByteArray
&message);
49
bool
sendMessageWithTimeout(
const
QByteArray
&message,
int
timeout);
50
51
Q_SIGNALS
:
52
void
messageReceived
(
const
QByteArray
&message);
53
54
private
:
55
Q_DECLARE_PRIVATE(
KDSingleApplication
)
56
std::unique_ptr<KDSingleApplicationPrivate> d_ptr;
57
};
58
59
Q_DECLARE_OPERATORS_FOR_FLAGS(KDSingleApplication::Options)
60
61
#endif
// KDSINGLEAPPLICATION_H
KDSingleApplication
Definition
kdsingleapplication.h:23
KDSingleApplication::messageReceived
void messageReceived(const QByteArray &message)
KDSingleApplication::~KDSingleApplication
~KDSingleApplication()
KDSingleApplication::Option
Option
Definition
kdsingleapplication.h:31
kdsingleapplication_lib.h
KDSINGLEAPPLICATION_EXPORT
#define KDSINGLEAPPLICATION_EXPORT
Definition
kdsingleapplication_lib.h:20
QByteArray
QObject
QObject::Q_PROPERTY
Q_PROPERTY(...)
QObject::Q_SIGNALS
Q_SIGNALSQ_SIGNALS
QObject::Q_SLOTS
Q_SLOTSQ_SLOTS
QString
© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDSingleApplication
A helper class for single-instance policy Qt applications
Generated on Tue Jul 9 2024 00:00:38 for KDSingleApplication API Documentation by doxygen 1.9.8