mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
DBus enabling of base classes plus sample for testing / show how to use them. Also qdbuscpp2xml plugin for blackmisc classes.
This commit is contained in:
32
samples/blackmiscquantities_dbus/testservicetool.cpp
Normal file
32
samples/blackmiscquantities_dbus/testservicetool.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "testservicetool.h"
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
/*
|
||||
* Start a new process
|
||||
*/
|
||||
QProcess * TestserviceTool::startNewProcess(const QString &executable, QObject *parent = 0)
|
||||
{
|
||||
QProcess *process = new QProcess(parent);
|
||||
process->startDetached(executable);
|
||||
return process;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sleep
|
||||
*/
|
||||
void TestserviceTool::sleep(qint32 ms)
|
||||
{
|
||||
if (ms < 1) return;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
Sleep(uint(ms));
|
||||
#else
|
||||
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
|
||||
nanosleep(&ts, NULL);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user