1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Add SysInfo Plugin

This commit is contained in:
kelteseth 2018-09-19 13:19:51 +02:00
parent 240c4c3245
commit 758a967c04
7 changed files with 91 additions and 0 deletions

View File

@ -2,6 +2,7 @@ TEMPLATE = subdirs
SUBDIRS = \
ScreenPlay/ScreenPlay.pro \
ScreenPlaySDK/Screenplaysdk.pro \
ScreenPlaySysInfo/ScreenPlaySysInfo.pro \
ScreenPlayWindow/ScreenPlayWindow.pro \
ScreenPlay/ThirdParty/qt-google-analytics/qt-google-analytics.pro \
ScreenPlay/ThirdParty/stomt-qt-sdk/sdk/stomt-qt-sdk.pro \

View File

@ -0,0 +1,34 @@
TEMPLATE = lib
TARGET = ScreenPlaySysInfo
QT += qml quick
CONFIG += plugin c++11
TARGET = $$qtLibraryTarget($$TARGET)
uri = net.aimber.sysinfo
# Input
SOURCES += \
screenplaysysinfo_plugin.cpp \
sysinfo.cpp
HEADERS += \
screenplaysysinfo_plugin.h \
sysinfo.h
DISTFILES = qmldir
!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
copy_qmldir.target = $$OUT_PWD/qmldir
copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
QMAKE_EXTRA_TARGETS += copy_qmldir
PRE_TARGETDEPS += $$copy_qmldir.target
}
qmldir.files = qmldir
installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
qmldir.path = $$installPath
target.path = $$installPath
INSTALLS += target qmldir

2
ScreenPlaySysInfo/qmldir Normal file
View File

@ -0,0 +1,2 @@
module net.aimber.sysinfo
plugin ScreenPlaySysInfo

View File

@ -0,0 +1,11 @@
#include "screenplaysysinfo_plugin.h"
#include "sysinfo.h"
#include <qqml.h>
void ScreenPlaySysInfoPlugin::registerTypes(const char *uri)
{
// @uri net.aimber.sysinfo
qmlRegisterType<SysInfo>(uri, 1, 0, "SysInfo");
}

View File

@ -0,0 +1,12 @@
#pragma once
#include <QQmlExtensionPlugin>
class ScreenPlaySysInfoPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
void registerTypes(const char *uri);
};

View File

@ -0,0 +1,15 @@
#include "sysinfo.h"
SysInfo::SysInfo(QQuickItem *parent):
QQuickItem(parent)
{
// By default, QQuickItem does not draw anything. If you subclass
// QQuickItem to create a visual item, you will need to uncomment the
// following line and re-implement updatePaintNode()
// setFlag(ItemHasContents, true);
}
SysInfo::~SysInfo()
{
}

View File

@ -0,0 +1,16 @@
#ifndef SYSINFO_H
#define SYSINFO_H
#include <QQuickItem>
class SysInfo : public QQuickItem
{
Q_OBJECT
Q_DISABLE_COPY(SysInfo)
public:
SysInfo(QQuickItem *parent = nullptr);
~SysInfo();
};
#endif // SYSINFO_H