diff --git a/vendor/DOtherSide/lib/include/DOtherSide/Status/QClipboardProxy.h b/vendor/DOtherSide/lib/include/DOtherSide/Status/QClipboardProxy.h new file mode 100644 index 0000000000..27b2026984 --- /dev/null +++ b/vendor/DOtherSide/lib/include/DOtherSide/Status/QClipboardProxy.h @@ -0,0 +1,39 @@ +#ifndef QCLIPBOARDPROXY_HPP +#define QCLIPBOARDPROXY_HPP + +#include +#include +#include +#include + +class QClipboard; + +class QClipboardProxy : public QObject +{ + Q_OBJECT + Q_DISABLE_COPY(QClipboardProxy) + Q_PROPERTY(QString text READ text NOTIFY textChanged) + + QClipboardProxy() {} + +public: + explicit QClipboardProxy(QClipboard*); + + QString text() const; + + static QObject *qmlInstance(QQmlEngine *engine, QJSEngine *scriptEngine) + { + Q_UNUSED(engine); + Q_UNUSED(scriptEngine); + + return new QClipboardProxy; + } + +signals: + void textChanged(); + +private: + QClipboard* clipboard; +}; + +#endif // QCLIPBOARDPROXY_HPP diff --git a/vendor/DOtherSide/lib/src/DOtherSide.cpp b/vendor/DOtherSide/lib/src/DOtherSide.cpp index 970b9976d6..4094c7645b 100644 --- a/vendor/DOtherSide/lib/src/DOtherSide.cpp +++ b/vendor/DOtherSide/lib/src/DOtherSide.cpp @@ -69,6 +69,7 @@ #include "DOtherSide/Status/OSNotification.h" #include "DOtherSide/Status/KeychainManager.h" #include "DOtherSide/Status/SoundManager.h" +#include "DOtherSide/Status/QClipboardProxy.h" #include "DOtherSide/DosSpellchecker.h" namespace { @@ -79,6 +80,8 @@ void register_meta_types() qmlRegisterType("DotherSide", 0 , 1, "StatusWindow"); qmlRegisterType("DotherSide", 0 , 1, "StatusSyntaxHighlighter"); qmlRegisterType("DotherSide", 0, 1, "SpellChecker"); + qmlRegisterSingletonType("DotherSide", 0 , 1, "QClipboardProxy", &QClipboardProxy::qmlInstance); + } } @@ -1562,4 +1565,4 @@ void dos_app_make_it_active(::DosQQmlApplicationEngine* vptr) window->requestActivate(); } } -} \ No newline at end of file +} diff --git a/vendor/DOtherSide/lib/src/Status/QClipboardProxy.cpp b/vendor/DOtherSide/lib/src/Status/QClipboardProxy.cpp new file mode 100644 index 0000000000..0ced67ee92 --- /dev/null +++ b/vendor/DOtherSide/lib/src/Status/QClipboardProxy.cpp @@ -0,0 +1,13 @@ +#include "DOtherSide/Status/QClipboardProxy.h" + +#include + +QClipboardProxy::QClipboardProxy(QClipboard* c) : clipboard(c) +{ + QObject::connect(c, SIGNAL (dataChanged()), this, SLOT(textChanged())); +} + +QString QClipboardProxy::text() const +{ + return clipboard->text(); +}