diff --git a/ui/StatusQ/CMakeLists.txt b/ui/StatusQ/CMakeLists.txt index 28137c8c2c..ece1246d5e 100644 --- a/ui/StatusQ/CMakeLists.txt +++ b/ui/StatusQ/CMakeLists.txt @@ -92,8 +92,8 @@ endif() add_library(StatusQ SHARED ${STATUSQ_QRC_COMPILED} - include/StatusQ/QClipboardProxy.h include/StatusQ/aggregator.h + include/StatusQ/clipboardutils.h include/StatusQ/concatmodel.h include/StatusQ/fastexpressionfilter.h include/StatusQ/fastexpressionrole.h @@ -121,11 +121,11 @@ add_library(StatusQ SHARED include/StatusQ/stringutilsinternal.h include/StatusQ/submodelproxymodel.h include/StatusQ/sumaggregator.h - include/StatusQ/undefinedfilter.h include/StatusQ/systemutilsinternal.h + include/StatusQ/undefinedfilter.h include/StatusQ/writableproxymodel.h - src/QClipboardProxy.cpp src/aggregator.cpp + src/clipboardutils.cpp src/concatmodel.cpp src/fastexpressionfilter.cpp src/fastexpressionrole.cpp diff --git a/ui/StatusQ/include/StatusQ/QClipboardProxy.h b/ui/StatusQ/include/StatusQ/clipboardutils.h similarity index 91% rename from ui/StatusQ/include/StatusQ/QClipboardProxy.h rename to ui/StatusQ/include/StatusQ/clipboardutils.h index f95592dc8c..1a4644c2e1 100644 --- a/ui/StatusQ/include/StatusQ/QClipboardProxy.h +++ b/ui/StatusQ/include/StatusQ/clipboardutils.h @@ -7,11 +7,11 @@ class QClipboard; class QJSEngine; class QQmlEngine; -class QClipboardProxy : public QObject +class ClipboardUtils : public QObject { Q_OBJECT - Q_DISABLE_COPY(QClipboardProxy) + Q_DISABLE_COPY(ClipboardUtils) Q_PROPERTY(bool hasText READ hasText NOTIFY contentChanged) Q_PROPERTY(QString text READ text NOTIFY contentChanged) @@ -26,7 +26,7 @@ class QClipboardProxy : public QObject Q_PROPERTY(bool hasUrls READ hasUrls NOTIFY contentChanged) Q_PROPERTY(QList urls READ urls NOTIFY contentChanged) - QClipboardProxy(); + ClipboardUtils(); bool hasText() const; QString text() const; @@ -49,7 +49,7 @@ public: Q_UNUSED(engine); Q_UNUSED(scriptEngine); - return new QClipboardProxy; + return new ClipboardUtils; } Q_INVOKABLE bool isValidImageUrl(const QUrl &url, const QStringList &acceptedExtensions) const; diff --git a/ui/StatusQ/src/QClipboardProxy.cpp b/ui/StatusQ/src/clipboardutils.cpp similarity index 69% rename from ui/StatusQ/src/QClipboardProxy.cpp rename to ui/StatusQ/src/clipboardutils.cpp index ab95751265..cabf9bcdd4 100644 --- a/ui/StatusQ/src/QClipboardProxy.cpp +++ b/ui/StatusQ/src/clipboardutils.cpp @@ -1,4 +1,4 @@ -#include "StatusQ/QClipboardProxy.h" +#include "StatusQ/clipboardutils.h" #include #include @@ -10,7 +10,7 @@ #include -QClipboardProxy::QClipboardProxy() +ClipboardUtils::ClipboardUtils() : m_clipboard(QGuiApplication::clipboard()) { connect(m_clipboard, &QClipboard::changed, this, [this](QClipboard::Mode mode) { @@ -19,38 +19,38 @@ QClipboardProxy::QClipboardProxy() }); } -bool QClipboardProxy::hasText() const +bool ClipboardUtils::hasText() const { return m_clipboard->mimeData()->hasText(); } -QString QClipboardProxy::text() const +QString ClipboardUtils::text() const { return m_clipboard->text(); } -bool QClipboardProxy::hasHtml() const +bool ClipboardUtils::hasHtml() const { return m_clipboard->mimeData()->hasHtml(); } -QString QClipboardProxy::html() const +QString ClipboardUtils::html() const { auto mimeData = m_clipboard->mimeData(); return mimeData ? mimeData->html() : QString{}; } -bool QClipboardProxy::hasImage() const +bool ClipboardUtils::hasImage() const { return m_clipboard->mimeData()->hasImage(); } -QImage QClipboardProxy::image() const +QImage ClipboardUtils::image() const { return m_clipboard->image(); } -QString QClipboardProxy::imageBase64() const +QString ClipboardUtils::imageBase64() const { if (!hasImage()) return {}; @@ -62,17 +62,17 @@ QString QClipboardProxy::imageBase64() const return QByteArrayLiteral("data:image/jpeg;base64,") + byteArray.toBase64(); } -bool QClipboardProxy::hasUrls() const +bool ClipboardUtils::hasUrls() const { return m_clipboard->mimeData()->hasUrls(); } -QList QClipboardProxy::urls() const +QList ClipboardUtils::urls() const { return m_clipboard->mimeData()->urls(); } -bool QClipboardProxy::isValidImageUrl(const QUrl& url, const QStringList& acceptedExtensions) const +bool ClipboardUtils::isValidImageUrl(const QUrl& url, const QStringList& acceptedExtensions) const { const auto strippedUrl = url.url(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); return std::any_of(acceptedExtensions.constBegin(), acceptedExtensions.constEnd(), [strippedUrl](const auto & ext) { @@ -80,7 +80,7 @@ bool QClipboardProxy::isValidImageUrl(const QUrl& url, const QStringList& accept }); } -qint64 QClipboardProxy::getFileSize(const QUrl& url) const +qint64 ClipboardUtils::getFileSize(const QUrl& url) const { if (url.isLocalFile()) { return QFile(url.toLocalFile()).size(); @@ -88,12 +88,12 @@ qint64 QClipboardProxy::getFileSize(const QUrl& url) const return 0; } -void QClipboardProxy::copyTextToClipboard(const QString &text) +void ClipboardUtils::copyTextToClipboard(const QString &text) { m_clipboard->setText(text); } -void QClipboardProxy::clear() +void ClipboardUtils::clear() { m_clipboard->clear(); } diff --git a/ui/StatusQ/src/plugin.cpp b/ui/StatusQ/src/plugin.cpp index bcc8733a32..78d9b51e3d 100644 --- a/ui/StatusQ/src/plugin.cpp +++ b/ui/StatusQ/src/plugin.cpp @@ -3,7 +3,7 @@ #include #include -#include "StatusQ/QClipboardProxy.h" +#include "StatusQ/clipboardutils.h" #include "StatusQ/concatmodel.h" #include "StatusQ/fastexpressionfilter.h" #include "StatusQ/fastexpressionrole.h" @@ -28,8 +28,8 @@ #include "StatusQ/stringutilsinternal.h" #include "StatusQ/submodelproxymodel.h" #include "StatusQ/sumaggregator.h" -#include "StatusQ/undefinedfilter.h" #include "StatusQ/systemutilsinternal.h" +#include "StatusQ/undefinedfilter.h" #include "StatusQ/writableproxymodel.h" #include "wallet/managetokenscontroller.h" @@ -77,7 +77,7 @@ public: qmlRegisterType("StatusQ", 0, 1, "WritableProxyModel"); qmlRegisterType("StatusQ", 0, 1, "FormattedDoubleProperty"); - qmlRegisterSingletonType("StatusQ", 0, 1, "QClipboardProxy", &QClipboardProxy::qmlInstance); + qmlRegisterSingletonType("StatusQ", 0, 1, "QClipboardProxy", &ClipboardUtils::qmlInstance); qmlRegisterType("StatusQ", 0, 1, "ModelEntry"); qmlRegisterType("StatusQ", 0, 1, "SnapshotObject");