diff options
Diffstat (limited to 'src/settingsui/qtbuttonimageproviderplugin')
6 files changed, 0 insertions, 340 deletions
diff --git a/src/settingsui/qtbuttonimageproviderplugin/CMakeLists.txt b/src/settingsui/qtbuttonimageproviderplugin/CMakeLists.txt deleted file mode 100644 index d799013..0000000 --- a/src/settingsui/qtbuttonimageproviderplugin/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -##################################################################### -## qtbuttonimageproviderplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qtbuttonimageproviderplugin - URI "QtDeviceUtilities.QtButtonImageProvider" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASS_NAME QtButtonImageProviderQmlPlugin - PLUGIN_TARGET qtbuttonimageproviderplugin - NO_PLUGIN_OPTIONAL - NO_GENERATE_PLUGIN_SOURCE - CLASS_NAME QtButtonImageProviderPlugin - PAST_MAJOR_VERSIONS 1 - DEPENDENCIES - QtQml - SOURCES - plugin.cpp plugin_p.h - qtbuttonimageprovider.cpp qtbuttonimageprovider.h - LIBRARIES - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick - QML_FILES - "QtButton.qml" -) diff --git a/src/settingsui/qtbuttonimageproviderplugin/QtButton.qml b/src/settingsui/qtbuttonimageproviderplugin/QtButton.qml deleted file mode 100644 index d65ae23..0000000 --- a/src/settingsui/qtbuttonimageproviderplugin/QtButton.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick - -Image { - id: root - source: "image://QtButton/" + cutSize + "/" + fillColor + "/" + borderColor - sourceSize: Qt.size(width, height) - property string state: "enabled" - property int cutSize: 10 - property color fillColor: viewSettings.buttonGreenColor - property color borderColor: mouseArea.pressed ? viewSettings.buttonActiveColor : viewSettings.buttonGreenColor - property alias text: buttonText.text - signal clicked() - - width: buttonText.contentWidth + cutSize * 4 - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: root.clicked() - } - Text { - id: buttonText - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: parent.height * 0.65 - font.family: appFont - color: "white" - } -} diff --git a/src/settingsui/qtbuttonimageproviderplugin/plugin.cpp b/src/settingsui/qtbuttonimageproviderplugin/plugin.cpp deleted file mode 100644 index 30ede2a..0000000 --- a/src/settingsui/qtbuttonimageproviderplugin/plugin.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "plugin_p.h" diff --git a/src/settingsui/qtbuttonimageproviderplugin/plugin_p.h b/src/settingsui/qtbuttonimageproviderplugin/plugin_p.h deleted file mode 100644 index 9fa479d..0000000 --- a/src/settingsui/qtbuttonimageproviderplugin/plugin_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QTBUTTONIMAGEPROVIDERQMLPLUGIN_H -#define QTBUTTONIMAGEPROVIDERQMLPLUGIN_H - -#include <qqmlextensionplugin.h> -#include <qqmlengine.h> - -#include "qtbuttonimageprovider.h" - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -extern void qml_register_types_QtDeviceUtilities_QtButtonImageProvider(); - -QT_BEGIN_NAMESPACE - -struct QtButtonForeign -{ - Q_GADGET - QML_NAMED_ELEMENT(QtButton) - QML_ADDED_IN_VERSION(1, 0) -}; - -class QtButtonImageProviderQmlPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) - -public: - QtButtonImageProviderQmlPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { - volatile auto registration = &qml_register_types_QtDeviceUtilities_QtButtonImageProvider; - Q_UNUSED(registration); - } - - void initializeEngine(QQmlEngine *engine, const char *uri) override - { - Q_UNUSED(uri); - QtButtonImageProvider *provider = new QtButtonImageProvider(); - engine->addImageProvider("QtButton", provider); - } -}; - -QT_END_NAMESPACE -#endif //QTBUTTONIMAGEPROVIDERQMLPLUGIN_H diff --git a/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp b/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp deleted file mode 100644 index 5bf162b..0000000 --- a/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QQuickImageProvider> -#include <QImage> -#include <QPainter> -#include <QPainterPath> - -#include "qtbuttonimageprovider.h" - -QtButtonImageProvider::QtButtonImageProvider() - : QQuickImageProvider(QQuickImageProvider::Pixmap) -{ -} - -QPixmap QtButtonImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - bool ok = false; - - QStringList params = id.split("/"); - - int cutSize = params.at(0).toInt(&ok); - - if (!ok) - cutSize = 10; - - QColor fillColor; - QColor borderColor; - - if (params.length() > 1) { - fillColor = QColor(params.at(1)); - } - - if (params.length() > 2) - borderColor = QColor(params.at(2)); - - if (!fillColor.isValid()) - fillColor = "#00eb00"; - - if (!borderColor.isValid()) - borderColor ="white"; - - int width = 100; - int height = 50; - - if (size) - *size = QSize(requestedSize.width(), requestedSize.height()); - - QPixmap pixmap(requestedSize.width() > 0 ? requestedSize.width() : width, - requestedSize.height() > 0 ? requestedSize.height() : height); - pixmap.fill(Qt::transparent); - - QPainter painter(&pixmap); - const qreal borderPenWidth = 2; - QPen borderPen(QBrush(borderColor), borderPenWidth); - borderPen.setJoinStyle(Qt::MiterJoin); - painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(borderPen); - painter.setBrush(fillColor); - - QPainterPath path; - qreal top = borderPenWidth - 1; - qreal left = borderPenWidth - 1; - qreal bottom = pixmap.height() - borderPenWidth; - qreal right = pixmap.width() - borderPenWidth; - path.moveTo(left + cutSize, top); - path.lineTo(right, top); - path.lineTo(right, bottom - cutSize); - path.lineTo(right - cutSize, bottom); - path.lineTo(left, bottom); - path.lineTo(left, top + cutSize); - path.lineTo(left + cutSize, top); - painter.drawPath(path); - - return pixmap; -} diff --git a/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.h b/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.h deleted file mode 100644 index 94f410e..0000000 --- a/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QTBUTTONIMAGEPROVIDER_H -#define QTBUTTONIMAGEPROVIDER_H - -#include <QQuickImageProvider> -#include <QPixmap> - -class QtButtonImageProvider : public QQuickImageProvider -{ -public: - QtButtonImageProvider(); - - QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override; - - void setCutSize(int size) { m_cutSize = size; } -private: - int m_cutSize; -}; - -#endif // QTBUTTONIMAGEPROVIDER_H |