2017-09-05 11:06:21 +00:00
|
|
|
#include "osutil.h"
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QClipboard>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QImage>
|
|
|
|
|
2017-09-11 11:17:27 +00:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
|
|
|
2017-09-05 11:06:21 +00:00
|
|
|
#include "processinfo.h"
|
|
|
|
|
|
|
|
OsUtil::OsUtil(QObject *parent) :
|
|
|
|
QObject(parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OsUtil::setClipboardData(const QVariant &data)
|
|
|
|
{
|
|
|
|
QClipboard *clipboard = QApplication::clipboard();
|
|
|
|
|
|
|
|
switch (data.type()) {
|
|
|
|
case QVariant::Pixmap:
|
|
|
|
clipboard->setPixmap(data.value<QPixmap>());
|
|
|
|
break;
|
|
|
|
case QVariant::Image:
|
|
|
|
clipboard->setImage(data.value<QImage>());
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
clipboard->setText(data.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString OsUtil::pidToDosPath(quint32 pid)
|
|
|
|
{
|
|
|
|
const ProcessInfo pi(pid);
|
|
|
|
return pi.dosPath();
|
|
|
|
}
|
2017-09-11 11:17:27 +00:00
|
|
|
|
|
|
|
bool OsUtil::createGlobalMutex(const char *name)
|
|
|
|
{
|
|
|
|
return !CreateMutexA(NULL, FALSE, name);
|
|
|
|
}
|