9 #include <QCoreApplication>
10 #include <QDBusServer>
15 #include <QStringList>
16 #include <QTextStream>
32 int main(
int argc,
char *argv[])
41 const bool verbose =
false;
45 if (cmdlineArgs.
length() < 1)
47 qFatal(
"Missing name of executable");
57 bool useSessionBusForServer =
false;
61 useSessionBusForServer =
true;
66 useSessionBusForServer =
false;
67 if (cmdlineArgs.
length() > 2)
69 ip = cmdlineArgs.
at(cmdlineArgs.
length() - 2);
70 port = cmdlineArgs.
at(cmdlineArgs.
length() - 1);
73 QString addressTcp = QStringLiteral(
"tcp:host=%1,port=%2").
arg(ip, port);
74 QString address(useSessionBusForServer ?
"session" : addressTcp);
97 out <<
"1 .. Run testservice to test data transfer" << addressTcp <<
Qt::endl;
98 out <<
"1sb. Run testservice via session bus" <<
Qt::endl;
99 out <<
"2 .. Show signatures" <<
Qt::endl;
100 out <<
"----- Change address / port (no validation, do before starting server)" <<
Qt::endl;
101 out <<
"loop Address to loopback, 127.0.0.1" <<
Qt::endl;
102 out <<
"ip some IP address, e.g " << ip <<
Qt::endl;
103 out <<
"port some port, e.g 12345" <<
Qt::endl;
111 addressTcp = QStringLiteral(
"tcp:host=%1,port=%2").
arg(ip, port);
120 addressTcp = QStringLiteral(
"tcp:host=%1,port=%2").
arg(ip, port);
130 addressTcp = QStringLiteral(
"tcp:host=%1,port=%2").
arg(ip, port);
136 out <<
"---------------------------------" <<
Qt::endl;
138 out <<
"---------------------------------" <<
Qt::endl;
143 address =
QString(useSessionBusForServer ?
"session" : addressTcp);
145 if (mode.
startsWith(
"1")) { mode =
"testservice"; }
150 out <<
"--------------------------------------------------------" <<
Qt::endl;
162 if (address ==
"session")
bool hasQDBusServer() const
True if using P2P.
const QDBusServer * qDBusServer() const
DBus server (if using P2P)
static bool startDetached(const QString &program, const QStringList &arguments, bool withConsoleWindow)
Start a programm detached and without any console window.
static QStringList getKnownLocalIpV4Addresses()
Find out my IPv4 addresses including loopback, empty if not possible.
Free functions in swift::misc.
void registerMetadata()
Register all relevant metadata in Misc.
QString address() const const
bool isConnected() const const
QList< T >::const_reference at(qsizetype i) const const
bool isEmpty() const const
qsizetype length() const const
QString arg(Args &&... args) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QString toLower() const const
QString trimmed() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QTextStream & endl(QTextStream &stream)
QString readLine(qint64 maxlen)
int main(int argc, char *argv[])
main