diff options
Diffstat (limited to 'tests/manual')
32 files changed, 0 insertions, 2709 deletions
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt deleted file mode 100644 index 7b01593..0000000 --- a/tests/manual/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Generated from manual.pro. - -if(TARGET Qt::Widgets) - add_subdirectory(dwmfeatures) - add_subdirectory(jumplist) - add_subdirectory(thumbnail) - add_subdirectory(imageconversion) -endif() diff --git a/tests/manual/dwmfeatures/.prev_CMakeLists.txt b/tests/manual/dwmfeatures/.prev_CMakeLists.txt deleted file mode 100644 index 60c8dd1..0000000 --- a/tests/manual/dwmfeatures/.prev_CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from dwmfeatures.pro. - -##################################################################### -## dwmfeatures Binary: -##################################################################### - -qt_add_executable(dwmfeatures - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:dwmfeatures.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/dwmfeatures/CMakeLists.txt b/tests/manual/dwmfeatures/CMakeLists.txt deleted file mode 100644 index 30a090d..0000000 --- a/tests/manual/dwmfeatures/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from dwmfeatures.pro. - -##################################################################### -## dwmfeatures Binary: -##################################################################### - -qt_add_manual_test(dwmfeatures # special case - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:dwmfeatures.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/dwmfeatures/dwmfeatures.pro b/tests/manual/dwmfeatures/dwmfeatures.pro deleted file mode 100644 index 2848d9c..0000000 --- a/tests/manual/dwmfeatures/dwmfeatures.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT += widgets winextras - -TARGET = dwmfeatures -TEMPLATE = app - -SOURCES += main.cpp\ - testwidget.cpp - -HEADERS += testwidget.h - -FORMS += testwidget.ui diff --git a/tests/manual/dwmfeatures/main.cpp b/tests/manual/dwmfeatures/main.cpp deleted file mode 100644 index d29a989..0000000 --- a/tests/manual/dwmfeatures/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 "testwidget.h" -#include <QApplication> - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - TestWidget w; - w.show(); - - return a.exec(); -} diff --git a/tests/manual/dwmfeatures/testwidget.cpp b/tests/manual/dwmfeatures/testwidget.cpp deleted file mode 100644 index 189a44c..0000000 --- a/tests/manual/dwmfeatures/testwidget.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 "testwidget.h" -#include "ui_testwidget.h" - -#include <QtWin> -#include <QWinEvent> -#include <QDebug> -#include <qt_windows.h> - -TestWidget::TestWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::TestWidget) -{ - ui->setupUi(this); - - connect(ui->btnPeekDisallow, &QAbstractButton::clicked, this, &TestWidget::onDisallowPeekClicked); - connect(ui->btnPeekExclude, &QAbstractButton::clicked, this, &TestWidget::onExcludeFromPeekClicked); - connect(ui->radioFlipDefault, &QAbstractButton::clicked, this, &TestWidget::onFlip3DPolicyChanged); - connect(ui->radioFlipAbove, &QAbstractButton::clicked, this, &TestWidget::onFlip3DPolicyChanged); - connect(ui->radioFlipBelow, &QAbstractButton::clicked, this, &TestWidget::onFlip3DPolicyChanged); - connect(ui->radioNcrpUseWindowStyle, &QAbstractButton::clicked, this, &TestWidget::onNonClientAreaRenderingPolicyChanged); - connect(ui->radioNcrpDisable, &QAbstractButton::clicked, this, &TestWidget::onNonClientAreaRenderingPolicyChanged); - connect(ui->radioNcrpEnable, &QAbstractButton::clicked, this, &TestWidget::onNonClientAreaRenderingPolicyChanged); - connect(ui->btnFrameReset, &QAbstractButton::clicked, this, &TestWidget::onResetGlassFrameClicked); - connect(ui->frameTop, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); - connect(ui->frameRight, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); - connect(ui->frameBottom, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); - connect(ui->frameLeft, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); -} - -TestWidget::~TestWidget() -{ - delete ui; -} - -void TestWidget::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -bool TestWidget::event(QEvent *e) -{ - if (e->type() == QWinEvent::CompositionChange) { - qDebug() << "Composition state change."; - } else if (e->type() == QWinEvent::ThemeChange) { - qDebug() << "Theme change."; - } - return QWidget::event(e); -} - -void TestWidget::onDisallowPeekClicked() -{ - QtWin::setWindowDisallowPeek(this, ui->btnPeekDisallow->isChecked()); -} - -void TestWidget::onExcludeFromPeekClicked() -{ - QtWin::setWindowExcludedFromPeek(this, ui->btnPeekExclude->isChecked()); -} - -void TestWidget::onFlip3DPolicyChanged() -{ - QtWin::WindowFlip3DPolicy policy; - if (ui->radioFlipAbove->isChecked()) - policy = QtWin::FlipExcludeAbove; - else if (ui->radioFlipBelow->isChecked()) - policy = QtWin::FlipExcludeBelow; - else - policy = QtWin::FlipDefault; - QtWin::setWindowFlip3DPolicy(this, policy); -} - -void TestWidget::onNonClientAreaRenderingPolicyChanged() -{ - QtWin::WindowNonClientRenderingPolicy policy; - if (ui->radioNcrpDisable->isChecked()) - policy = QtWin::NonClientRenderingDisabled; - else if (ui->radioNcrpEnable->isChecked()) - policy = QtWin::NonClientRenderingEnabled; - else - policy = QtWin::NonClientRenderingUseWindowStyle; - QtWin::setWindowNonClientAreaRenderingPolicy(this, policy); -} - -void TestWidget::onGlassMarginsChanged() -{ - // what you see here is the only way to force widget to redraw itself - // so it actually redraws itself without caching and without any glitch - // but causes flickering :( - // and yes, update() and redraw() do nothing - - if (!testAttribute(Qt::WA_NoSystemBackground)) { - - QSize original = size(); - QSize modified = original; - modified.setWidth(original.height() + 1); - resize(modified); - - setAttribute(Qt::WA_NoSystemBackground); - QtWin::extendFrameIntoClientArea(this, - ui->frameTop->value(), - ui->frameRight->value(), - ui->frameBottom->value(), - ui->frameLeft->value()); - - resize(original); - - ui->groupBox_2->setAutoFillBackground(true); - ui->groupBox_3->setAutoFillBackground(true); - ui->groupBox_4->setAutoFillBackground(true); - } else { - QtWin::extendFrameIntoClientArea(this, - ui->frameLeft->value(), - ui->frameTop->value(), - ui->frameRight->value(), - ui->frameBottom->value()); - } -} - -void TestWidget::onResetGlassFrameClicked() -{ - if (!testAttribute(Qt::WA_NoSystemBackground)) - return; - - ui->frameTop->setValue(0); - ui->frameRight->setValue(0); - ui->frameBottom->setValue(0); - ui->frameLeft->setValue(0); - - QtWin::resetExtendedFrame(this); - setAttribute(Qt::WA_NoSystemBackground, false); - - QSize original = size(); - QSize modified = original; - modified.setHeight(original.height() + 1); - resize(modified); - - ui->groupBox_2->setAutoFillBackground(false); - ui->groupBox_3->setAutoFillBackground(false); - ui->groupBox_4->setAutoFillBackground(false); - - resize(original); -} diff --git a/tests/manual/dwmfeatures/testwidget.h b/tests/manual/dwmfeatures/testwidget.h deleted file mode 100644 index 70c39c6..0000000 --- a/tests/manual/dwmfeatures/testwidget.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 TESTWIDGET_H -#define TESTWIDGET_H - -#include <QWidget> - -QT_BEGIN_NAMESPACE -namespace Ui { -class TestWidget; -} -QT_END_NAMESPACE - -#if defined(QT_NAMESPACE) -namespace Ui = QT_NAMESPACE::Ui; -#endif - -class TestWidget : public QWidget -{ - Q_OBJECT - -public: - explicit TestWidget(QWidget *parent = nullptr); - ~TestWidget(); - -protected: - void changeEvent(QEvent *e) override; - bool event(QEvent *) override; - -private: - Ui::TestWidget *ui; - -private slots: - void onDisallowPeekClicked(); - void onExcludeFromPeekClicked(); - void onFlip3DPolicyChanged(); - void onNonClientAreaRenderingPolicyChanged(); - void onGlassMarginsChanged(); - void onResetGlassFrameClicked(); -}; - -#endif // TESTWIDGET_H diff --git a/tests/manual/dwmfeatures/testwidget.ui b/tests/manual/dwmfeatures/testwidget.ui deleted file mode 100644 index 2ef17d8..0000000 --- a/tests/manual/dwmfeatures/testwidget.ui +++ /dev/null @@ -1,379 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>TestWidget</class> - <widget class="QWidget" name="TestWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>569</width> - <height>451</height> - </rect> - </property> - <property name="windowTitle"> - <string>QtWinExtras DWM Features</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="title"> - <string>Aero Peek</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>4</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <item> - <spacer name="horizontalSpacer_11"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnPeekDisallow"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Disallow peek</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_12"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <spacer name="horizontalSpacer_13"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnPeekExclude"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Exclude from peek</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Flip3D</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>4</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <item> - <widget class="QRadioButton" name="radioFlipDefault"> - <property name="text"> - <string>Default</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioFlipAbove"> - <property name="text"> - <string>Exclude above</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioFlipBelow"> - <property name="text"> - <string>Exclude below</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Non-client area rendering</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QRadioButton" name="radioNcrpUseWindowStyle"> - <property name="text"> - <string>Use window style</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioNcrpDisable"> - <property name="text"> - <string>Disable</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioNcrpEnable"> - <property name="text"> - <string>Enable</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="title"> - <string>Glass frame</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <property name="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>4</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Left</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Right</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Top</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Bottom</string> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnFrameReset"> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="frameLeft"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="frameRight"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="frameTop"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QSpinBox" name="frameBottom"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <layoutdefault spacing="6" margin="11"/> - <resources/> - <connections/> -</ui> diff --git a/tests/manual/imageconversion/.prev_CMakeLists.txt b/tests/manual/imageconversion/.prev_CMakeLists.txt deleted file mode 100644 index b75901a..0000000 --- a/tests/manual/imageconversion/.prev_CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Generated from imageconversion.pro. - -##################################################################### -## imageconversion Binary: -##################################################################### - -qt_add_executable(imageconversion - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - gdi32 - user32 -) - -#### Keys ignored in scope 1:.:.:imageconversion.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/imageconversion/CMakeLists.txt b/tests/manual/imageconversion/CMakeLists.txt deleted file mode 100644 index a90d080..0000000 --- a/tests/manual/imageconversion/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Generated from imageconversion.pro. - -##################################################################### -## imageconversion Binary: -##################################################################### - -qt_add_manual_test(imageconversion # special case - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - gdi32 - user32 -) - -#### Keys ignored in scope 1:.:.:imageconversion.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/imageconversion/imageconversion.pro b/tests/manual/imageconversion/imageconversion.pro deleted file mode 100644 index 3442e28..0000000 --- a/tests/manual/imageconversion/imageconversion.pro +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG += console c++11 -QT += widgets winextras -TEMPLATE = app -SOURCES += main.cpp -LIBS += -luser32 -lgdi32 diff --git a/tests/manual/imageconversion/main.cpp b/tests/manual/imageconversion/main.cpp deleted file mode 100644 index d2899f2..0000000 --- a/tests/manual/imageconversion/main.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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 <QtWinExtras/QtWin> - -#include <QtGui/QAction> -#include <QtGui/QShortcut> -#include <QtWidgets/QApplication> -#include <QtWidgets/QDialogButtonBox> -#include <QtWidgets/QFileDialog> -#include <QtWidgets/QLabel> -#include <QtWidgets/QMainWindow> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> -#include <QtWidgets/QPushButton> -#include <QtWidgets/QVBoxLayout> - -#include <QtGui/QImage> -#include <QtGui/QPainter> -#include <QtGui/QPaintEvent> - -#include <QtCore/QCommandLineOption> -#include <QtCore/QCommandLineParser> -#include <QtCore/QDebug> -#include <QtCore/QTimer> -#include <QtCore/qt_windows.h> - -static void formatData(QDebug d, const void *data, qsizetype size) -{ - QDebugStateSaver saver(d); - d.noquote(); - d.nospace(); - const qsizetype minSize = 20; - d << "\nData: " << QByteArray(reinterpret_cast<const char *>(data), qMin(minSize, size)).toHex(); - if (size > minSize) - d << "..."; - d << "\n 0000000011111111222222223333333344444444"; -} - -QDebug operator<<(QDebug d, const BITMAP &b) -{ - QDebugStateSaver saver(d); - d.nospace(); - d << "BITMAP(type=" << b.bmType << ", " << b.bmWidth << 'x' << b.bmHeight - << ", widthBytes=" << b.bmWidthBytes << ", planes=" << b.bmPlanes - << ", bitsPixel=" << b.bmBitsPixel << ", bits=" << b.bmBits << ')'; - return d; -} - -QDebug operator<<(QDebug d, const BITMAPINFOHEADER &bih) -{ - QDebugStateSaver saver(d); - d.nospace(); - d << "BITMAPINFOHEADER(" << bih.biWidth << 'x' << qAbs(bih.biHeight) - << (bih.biHeight < 0 ? ", top-down" : ", bottom-up") - << ", planes=" << bih.biPlanes << ", bitCount=" << bih.biBitCount - << ", compression=" << bih.biCompression << ", size=" - << bih.biSizeImage << ')'; - return d; -} - -static void formatImage(QDebug d, const QImage &image) -{ - QDebugStateSaver s(d); - d.noquote(); - d.nospace(); - d << image; - if (const int colorTableSize = image.colorCount()) { - QList<QRgb> colorTable = image.colorTable(); - d << " Color table: " << colorTableSize << " (" << Qt::showbase << Qt::hex; // 256 by standard - int c = 0; - for ( ; c < qMin(8, colorTableSize); ++c) { - if (c) - d << ", "; - d << colorTable[c]; - } - if (c < colorTableSize) - d << "..."; - d << ')' << Qt::noshowbase << Qt::dec; - } - formatData(d, image.constBits(), image.sizeInBytes()); -} - -enum ParseOptionResult { - OptionError, - OptionUnset, - OptionSet -}; - -static ParseOptionResult parseIntOption(const QCommandLineParser &parser, const QCommandLineOption &option, - int minValue, int maxValue, int *target) -{ - if (!parser.isSet(option)) - return OptionUnset; - - const QString spec = parser.value(option); - bool ok; - const int value = spec.toInt(&ok); - if (!ok || value < minValue || value > maxValue) { - qWarning() << "Invalid value" << spec << "for" << option.names(); - return OptionError; - } - *target = value; - return OptionSet; -} - -template <typename Enum> -static ParseOptionResult parseEnumOption(const QCommandLineParser &parser, const QCommandLineOption &option, - Enum minValue, Enum maxValue, Enum *target) -{ - int intValue; - const ParseOptionResult result = parseIntOption(parser, option, int(minValue), int(maxValue), &intValue); - if (result == OptionSet) - *target = static_cast<Enum>(intValue); - return result; -} - -// Display a QImage in a dialog. -class PreviewDialog : public QDialog -{ -public: - explicit PreviewDialog(const QImage &image, QWidget *parent = nullptr); -}; - -PreviewDialog::PreviewDialog(const QImage &image, QWidget *parent) : QDialog(parent) -{ - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - QString description; - QDebug(&description) << image.size() << ", format=" << image.format(); - QLabel *descriptionLabel = new QLabel(description, this); - descriptionLabel->setWordWrap(true); - auto *layout = new QVBoxLayout(this); - layout->addWidget(descriptionLabel); - auto *hLayout = new QHBoxLayout; - QLabel *label = new QLabel(this); - label->setFrameShape(QFrame::Box); - label->setPixmap(QPixmap::fromImage(image)); - hLayout->addStretch(); - hLayout->addWidget(label); - hLayout->addStretch(); - layout->addLayout(hLayout); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); - connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - layout->addWidget(buttonBox); -} - -// Widget that paints a HBITMAP using GDI API in WM_PAINT. -class PaintWidget : public QWidget -{ - Q_OBJECT -public: - explicit PaintWidget(HBITMAP hBitmap, QWidget *p = nullptr) : QWidget(p), m_hBitmap(hBitmap) { } - -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; -#else - bool nativeEvent(const QByteArray &eventType, void *message, long *result) override; -#endif - -public slots: - void saveBitmap(); - void convertBack(); - -protected: - void contextMenuEvent(QContextMenuEvent *) override; - -private: - const HBITMAP m_hBitmap; -}; - -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -bool PaintWidget::nativeEvent(const QByteArray &eventType, void *messageIn, qintptr *result) -#else -bool PaintWidget::nativeEvent(const QByteArray &eventType, void *messageIn, long *result) -#endif -{ - MSG *message = reinterpret_cast<MSG *>(messageIn); - if (message->message != WM_PAINT) - return QWidget::nativeEvent(eventType, message, result); - - PAINTSTRUCT paintStruct; - BITMAP bitmap; - - const HDC hdc = BeginPaint(message->hwnd, &paintStruct); - SelectObject(hdc, GetStockObject(BLACK_PEN)); - Rectangle(hdc, 1, 1, width() - 1, height() - 1); - - const HDC hdcMem = CreateCompatibleDC(hdc); - const HGDIOBJ oldBitmap = SelectObject(hdcMem, m_hBitmap); - - GetObject(m_hBitmap, sizeof(bitmap), &bitmap); - { - QDebug d = qDebug(); - d << __FUNCTION__ << bitmap; - formatData(d, bitmap.bmBits, bitmap.bmHeight * bitmap.bmWidthBytes); - } - BitBlt(hdc, 5, 5, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY); - SelectObject(hdcMem, oldBitmap); - DeleteDC(hdcMem); - - EndPaint(message->hwnd, &paintStruct); - return true; -} - -void PaintWidget::convertBack() -{ - QImage image = QtWin::imageFromHBITMAP(m_hBitmap); - formatImage(qDebug(), image); - auto *dialog = new PreviewDialog(image, this); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setModal(false); - dialog->setWindowTitle(QLatin1String("QImage - Qt ") + QLatin1String(QT_VERSION_STR)); - dialog->show(); -} - -void PaintWidget::saveBitmap() -{ - QImage image = QtWin::imageFromHBITMAP(m_hBitmap); - formatImage(qDebug(), image); - QFileDialog fileDialog(this); - fileDialog.setAcceptMode(QFileDialog::AcceptSave); - fileDialog.setMimeTypeFilters(QStringList(QStringLiteral("image/png"))); - fileDialog.setDefaultSuffix(QStringLiteral("png")); - fileDialog.selectFile(QStringLiteral("test.png")); - while (fileDialog.exec() == QDialog::Accepted) { - const QString fileName = fileDialog.selectedFiles().first(); - if (image.save(fileName)) { - qDebug().noquote() << "saved" << QDir::toNativeSeparators(fileName); - break; - } - qWarning().noquote() << "Could not save" << QDir::toNativeSeparators(fileName); - } -} - -void PaintWidget::contextMenuEvent(QContextMenuEvent *e) -{ - QMenu contextMenu; - contextMenu.addAction(QStringLiteral("Convert into QImage"), this, &PaintWidget::convertBack); - QAction *saveAction = contextMenu.addAction(QStringLiteral("Save"), this, &PaintWidget::saveBitmap); - saveAction->setShortcut(Qt::CTRL | Qt::Key_S); - contextMenu.exec(e->globalPos()); -} - -static const char description[] = -"\nCreates a HBITMAP from a QImage either passed as file name or by drawing in a\n" -"format determined by a command line option and draws it onto a native window\n" -"for comparison. Provides a context menu for converting the HBITMAP back to a\n" -"QImage and saving that for checking the reverse conversion."; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QCoreApplication::setApplicationName("imageconversion"); - QCoreApplication::setOrganizationName("QtProject"); - QCoreApplication::setApplicationVersion(QT_VERSION_STR); - QCommandLineParser parser; - parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); - parser.setApplicationDescription("Qt Windows Extras Image Conversion Tester"); - parser.addHelpOption(); - parser.addVersionOption(); - parser.setApplicationDescription(description); - - const QCommandLineOption formatOption(QStringList{"format", "f"}, - "QImage format", "format"); - parser.addOption(formatOption); - const QCommandLineOption colorOption(QStringList{"color", "c"}, - "Fill color", "color-spec"); - parser.addOption(colorOption); - const QCommandLineOption globalColorOption(QStringList{"globalColor", "g"}, - "Fill color (global color enum value)", "global-color"); - parser.addOption(globalColorOption); - const QCommandLineOption widthOption(QStringList{"width", "w"}, - "Width", "width"); - parser.addOption(widthOption); - const QCommandLineOption heightOption(QStringList{"height", "h"}, - "Height", "height"); - parser.addOption(heightOption); - const QCommandLineOption previewOption(QStringList{"preview", "p"}, - "Show a preview"); - parser.addOption(previewOption); - - parser.addPositionalArgument("file", "The image file to open."); - parser.process(app); - - QColor defaultColor(Qt::red); - if (parser.isSet(colorOption)) { - const QString spec = parser.value(colorOption); - defaultColor = QColor(spec); - if (!defaultColor.isValid()) { - qWarning() << "Invalid color specification" << spec; - return -1; - } - } else { - // Color 0: color0, 1: color1, 2: black, 3: white, 7:red, 9: blue, 8: green - Qt::GlobalColor globalColor = Qt::color0; - if (!parseEnumOption(parser, globalColorOption, Qt::black, Qt::transparent, &globalColor)) - return -1; - if (globalColor != Qt::color0) - defaultColor = QColor(defaultColor); - } - - // Format: 1: mono, 3: Indexed8, 7: RGB 16, 11: RGB555, 13: RGB888 - QImage::Format targetFormat = QImage::Format_ARGB32_Premultiplied; - if (!parseEnumOption(parser, formatOption, QImage::Format_Mono, QImage::Format_Grayscale8, &targetFormat)) - return -1; - // Can't paint on indexed nor mono, need transform? - const QImage::Format drawFormat = targetFormat == QImage::Format_Indexed8 - || targetFormat == QImage::Format_Mono || targetFormat == QImage::Format_MonoLSB - ? QImage::Format_ARGB32_Premultiplied : targetFormat; - - if (targetFormat == QImage::Format_Mono || targetFormat == QImage::Format_MonoLSB) - defaultColor = Qt::white; - - int width = 73; - int height = 57; - if (!parseIntOption(parser, widthOption, 1, 2000, &width) || !parseIntOption(parser, heightOption, 1, 2000, &height)) - return -1; - - const bool preview = parser.isSet(previewOption); - - QImage image; - if (!parser.positionalArguments().isEmpty()) { - QString fileName = parser.positionalArguments().constFirst(); - image = QImage(fileName); - if (image.isNull() || image.size().isEmpty()) { - qWarning().noquote() << "Image load fail" << QDir::toNativeSeparators(fileName); - return -1; - } - } - - if (image.isNull()) { - qDebug() << "Default image color=" << defaultColor - << Qt::showbase << Qt::hex << defaultColor.rgba() << Qt::noshowbase << Qt::dec - << ", format=" << drawFormat; - image = QImage(width, height, drawFormat); - image.fill(defaultColor); - QPainter painter(&image); - painter.drawLine(0, 0, image.width(), image.height()); - } - - if (image.format() != targetFormat) { - qDebug() << "Converting " << image.format() << targetFormat; - image = image.convertToFormat(targetFormat); - } - - formatImage(qDebug(), image); - - const HBITMAP bitmap = QtWin::imageToHBITMAP(image); - if (!bitmap) { - qWarning() << "Failed to create HBITMAP"; - return -1; - } - - int exitCode = 0; - { - PaintWidget paintWidget(bitmap); - auto *quitShortcut = new QShortcut(&paintWidget); - quitShortcut->setKey(Qt::CTRL | Qt::Key_Q); - quitShortcut->setContext(Qt::ApplicationShortcut); - QObject::connect(quitShortcut, &QShortcut::activated, qApp, &QCoreApplication::quit); - paintWidget.setWindowTitle(QLatin1String("HBITMAP - Qt ") + QLatin1String(QT_VERSION_STR)); - paintWidget.show(); - if (preview) { - auto *dialog = new PreviewDialog(image); - dialog->setModal(false); - dialog->setWindowTitle(QLatin1String("QImage - Qt ") + QLatin1String(QT_VERSION_STR)); - dialog->move(paintWidget.frameGeometry().topRight() + QPoint(50, 0)); - dialog->show(); - } - exitCode = app.exec(); - } - - DeleteObject(bitmap); - - return exitCode; -} - -#include "main.moc" diff --git a/tests/manual/jumplist/.prev_CMakeLists.txt b/tests/manual/jumplist/.prev_CMakeLists.txt deleted file mode 100644 index b73180a..0000000 --- a/tests/manual/jumplist/.prev_CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from jumplist.pro. - -##################################################################### -## jumplist Binary: -##################################################################### - -qt_add_executable(jumplist - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:jumplist.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/jumplist/CMakeLists.txt b/tests/manual/jumplist/CMakeLists.txt deleted file mode 100644 index 916c125..0000000 --- a/tests/manual/jumplist/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from jumplist.pro. - -##################################################################### -## jumplist Binary: -##################################################################### - -qt_add_manual_test(jumplist # special case - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:jumplist.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/jumplist/jumplist.pro b/tests/manual/jumplist/jumplist.pro deleted file mode 100644 index c8a061d..0000000 --- a/tests/manual/jumplist/jumplist.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT += widgets winextras - -TARGET = jumplist -TEMPLATE = app - -SOURCES += main.cpp\ - testwidget.cpp - -HEADERS += testwidget.h - -FORMS += testwidget.ui diff --git a/tests/manual/jumplist/main.cpp b/tests/manual/jumplist/main.cpp deleted file mode 100644 index 464b915..0000000 --- a/tests/manual/jumplist/main.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 "testwidget.h" - -#include <QApplication> -#include <QCommandLineParser> -#include <QCommandLineOption> -#include <QDir> -#include <QDebug> -#include <QMimeDatabase> -#include <QSettings> -#include <QStatusBar> - -#include <algorithm> -#include <iterator> - -static bool associateFileType() -{ - const QString applicationBinary = QCoreApplication::applicationFilePath(); - QString exeFileName = applicationBinary; - const int lastSlashPos = exeFileName.lastIndexOf(u'/'); - exeFileName.remove(0, lastSlashPos + 1); - QSettings regApplications("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\" + exeFileName, QSettings::NativeFormat); - regApplications.setValue("FriendlyAppName", QGuiApplication::applicationDisplayName()); - - regApplications.beginGroup("SupportedTypes"); - QMimeDatabase mimeDatabase; - const auto types = TestWidget::supportedMimeTypes(); - for (const QString &t : types) { - const auto suffixes = mimeDatabase.mimeTypeForName(t).suffixes(); - for (const QString &s : suffixes) - regApplications.setValue('.' + s, QString()); - } - regApplications.endGroup(); - - regApplications.beginGroup("shell"); - regApplications.beginGroup("open"); - regApplications.setValue("FriendlyAppName", QGuiApplication::applicationDisplayName()); - regApplications.beginGroup("command"); - regApplications.setValue(".", '"' + QDir::toNativeSeparators(applicationBinary) + "\" \"%1\""); - regApplications.endGroup(); - regApplications.endGroup(); - regApplications.endGroup(); - return regApplications.status() == QSettings::NoError; -} - -int main(int argc, char *argv[]) -{ - QStringList allArgs; // Show all arguments including style. - std::copy(argv + 1, argv + argc, std::back_inserter(allArgs)); - - QApplication app(argc, argv); - QGuiApplication::setApplicationDisplayName(QStringLiteral("QtWinExtras JumpList Test")); - if (!associateFileType()) { - qWarning() << "Unable to create registry entries."; - return -1; - } - - QCoreApplication::setOrganizationName("QtProject"); - QCoreApplication::setApplicationVersion(QT_VERSION_STR); - QCommandLineParser parser; - parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); - parser.setApplicationDescription(QGuiApplication::applicationDisplayName()); - parser.addHelpOption(); - parser.addVersionOption(); - QCommandLineOption textOption("text", "Show some text"); - parser.addOption(textOption); - QCommandLineOption fullScreenOption("fullscreen", "Show fullscreen"); - parser.addOption(fullScreenOption); - QCommandLineOption idOption("id", "Jump list identifier", "id"); - parser.addOption(idOption); - parser.addPositionalArgument("file", "The file to open."); - parser.process(app); - - TestWidget w; - - if (parser.isSet(idOption)) - w.setId(parser.value(idOption)); - - if (parser.isSet(fullScreenOption)) - w.showFullScreen(); - else - w.show(); - - if (parser.isSet(textOption)) - w.setText("Hello, world!"); - - if (!parser.positionalArguments().isEmpty()) - w.showFile(parser.positionalArguments().first()); - - if (allArgs.isEmpty()) - w.statusBar()->showMessage("Remember to run windeployqt"); - else - w.statusBar()->showMessage("Arguments: " + allArgs.join(' ')); - - return app.exec(); -} diff --git a/tests/manual/jumplist/testwidget.cpp b/tests/manual/jumplist/testwidget.cpp deleted file mode 100644 index 01a1275..0000000 --- a/tests/manual/jumplist/testwidget.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 "testwidget.h" -#include "ui_testwidget.h" - -#include <QApplication> -#include <QStyle> -#include <QFile> -#include <QFileDialog> -#include <QDesktopServices> -#include <QMessageBox> -#include <QProcess> -#include <QStatusBar> -#include <QUrl> -#include <QWinJumpList> -#include <QWinJumpListItem> -#include <QWinJumpListCategory> -#include <QDebug> - -TestWidget::TestWidget(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::TestWidget) -{ - ui->setupUi(this); - - connect(ui->actionUpdate, &QAction::triggered, this, &TestWidget::updateJumpList); - connect(ui->actionOpen, &QAction::triggered, this, &TestWidget::openFile); - connect(ui->actionExit, &QAction::triggered, QCoreApplication::quit); - connect(ui->actionShow_in_Explorer, &QAction::triggered, this, &TestWidget::showInExplorer); - connect(ui->actionRun_JumpListView, &QAction::triggered, this, &TestWidget::runJumpListView); -} - -TestWidget::~TestWidget() -{ - delete ui; -} - -QStringList TestWidget::supportedMimeTypes() -{ - return QStringList() << "text/x-c++src" << "text/x-csrc" << "text/x-chdr" - << "text/x-c++hdr" << "text/x-qml" << "text/plain"; -} - -void TestWidget::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -void TestWidget::showFile(const QString &path) -{ - QFile file(path); - if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) { - const QString error = "Failed to open file " + QDir::toNativeSeparators(path) - + ": " + file.errorString(); - QMessageBox::warning(this, "Error", error); - return; - } - setText(QString::fromUtf8(file.readAll())); -} - -void TestWidget::setText(const QString &text) -{ - ui->text->setPlainText(text); -} - -void TestWidget::updateJumpList() -{ - QWinJumpList jumplist; - if (!m_id.isEmpty()) - jumplist.setIdentifier(m_id); - const QString applicationBinary = QDir::toNativeSeparators(QCoreApplication::applicationFilePath()); - jumplist.recent()->setVisible(ui->cbShowRecent->isChecked()); - jumplist.frequent()->setVisible(ui->cbShowFrequent->isChecked()); - if (ui->cbRunFullscreen->isChecked()) { - auto *item = new QWinJumpListItem(QWinJumpListItem::Link); - item->setTitle(ui->cbRunFullscreen->text()); - item->setFilePath(applicationBinary); - item->setArguments(QStringList("-fullscreen")); - item->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton)); - jumplist.tasks()->addItem(item); - } - if (ui->cbRunFusion->isChecked()) { - jumplist.tasks()->addLink(style()->standardIcon(QStyle::SP_DesktopIcon), - ui->cbRunFusion->text(), - applicationBinary, - (QStringList() << "-style" << "fusion")); - } - if (ui->cbRunText->isChecked()) { - jumplist.tasks()->addSeparator(); - jumplist.tasks()->addLink(ui->cbRunText->text(), - applicationBinary, - QStringList("-text")); - } - jumplist.tasks()->setVisible(!jumplist.tasks()->isEmpty()); -} - -void TestWidget::openFile() -{ - QFileDialog fileDialog(this, "Open a Text File"); - fileDialog.setAcceptMode(QFileDialog::AcceptOpen); - fileDialog.setMimeTypeFilters(TestWidget::supportedMimeTypes()); - // Note: The native file dialog creates the frequent/recent entries. - if (!ui->actionUse_Native_File_Dialog->isChecked()) - fileDialog.setOption(QFileDialog::DontUseNativeDialog); - if (fileDialog.exec() == QDialog::Accepted) - showFile(fileDialog.selectedFiles().first()); -} - -void TestWidget::showInExplorer() -{ - const QString path = QFile::decodeName(qgetenv("APPDATA")) - + "/Microsoft/Windows/Recent/Automaticdestinations"; - QDesktopServices::openUrl(QUrl::fromLocalFile(path)); -} - -void TestWidget::runJumpListView() -{ - const char binary[] = "JumpListsView"; - if (!QProcess::startDetached(binary, QStringList())) - statusBar()->showMessage(QLatin1String("Unable to run ") + binary); -} diff --git a/tests/manual/jumplist/testwidget.h b/tests/manual/jumplist/testwidget.h deleted file mode 100644 index 0cae1ea..0000000 --- a/tests/manual/jumplist/testwidget.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 TESTWIDGET_H -#define TESTWIDGET_H - -#include <QMainWindow> - -QT_BEGIN_NAMESPACE -namespace Ui { -class TestWidget; -} -QT_END_NAMESPACE - -#if defined(QT_NAMESPACE) -namespace Ui = QT_NAMESPACE::Ui; -#endif - -class TestWidget : public QMainWindow -{ - Q_OBJECT - -public: - explicit TestWidget(QWidget *parent = nullptr); - ~TestWidget(); - - void showFile(const QString &path); - void setText(const QString &text); - - static QStringList supportedMimeTypes(); - - QString id() const { return m_id; } - void setId(const QString &id) { m_id = id; } - -protected: - void changeEvent(QEvent *e) Q_DECL_OVERRIDE; - -private slots: - void updateJumpList(); - void showInExplorer(); - void runJumpListView(); - void openFile(); - -private: - Ui::TestWidget *ui; - QString m_id; -}; - -#endif // TESTWIDGET_H diff --git a/tests/manual/jumplist/testwidget.ui b/tests/manual/jumplist/testwidget.ui deleted file mode 100644 index abcb078..0000000 --- a/tests/manual/jumplist/testwidget.ui +++ /dev/null @@ -1,237 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>TestWidget</class> - <widget class="QMainWindow" name="TestWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>800</width> - <height>600</height> - </rect> - </property> - <widget class="QWidget" name="centralwidget"> - <property name="windowTitle"> - <string>QtWinExtras JumpList</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Known categories</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QCheckBox" name="cbShowFrequent"> - <property name="text"> - <string>Frequent</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cbShowRecent"> - <property name="text"> - <string>Recent</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Tasks</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QCheckBox" name="cbRunFullscreen"> - <property name="text"> - <string>Run in fullscreen</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cbRunFusion"> - <property name="text"> - <string>Run with Fusion style</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cbRunText"> - <property name="text"> - <string>Run with some text displayed</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QTextEdit" name="text"> - <property name="font"> - <font> - <family>Consolas</family> - <pointsize>10</pointsize> - </font> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menuBar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>800</width> - <height>21</height> - </rect> - </property> - <widget class="QMenu" name="menuFile"> - <property name="title"> - <string>File</string> - </property> - <addaction name="actionOpen"/> - <addaction name="actionExit"/> - </widget> - <widget class="QMenu" name="menuJumplist"> - <property name="title"> - <string>Jumplist</string> - </property> - <addaction name="actionUpdate"/> - <addaction name="actionShow_in_Explorer"/> - <addaction name="actionRun_JumpListView"/> - </widget> - <widget class="QMenu" name="menuSettings"> - <property name="title"> - <string>Settings</string> - </property> - <addaction name="actionUse_Native_File_Dialog"/> - </widget> - <addaction name="menuFile"/> - <addaction name="menuJumplist"/> - <addaction name="menuSettings"/> - </widget> - <action name="actionOpen"> - <property name="text"> - <string>Open</string> - </property> - <property name="shortcut"> - <string>Ctrl+O</string> - </property> - </action> - <action name="actionExit"> - <property name="text"> - <string>Exit</string> - </property> - <property name="shortcut"> - <string>Ctrl+Q</string> - </property> - </action> - <action name="actionUpdate"> - <property name="text"> - <string>Update</string> - </property> - <property name="shortcut"> - <string>Ctrl+U</string> - </property> - </action> - <action name="actionShow_in_Explorer"> - <property name="text"> - <string>Show in Explorer</string> - </property> - <property name="shortcut"> - <string>Ctrl+E</string> - </property> - </action> - <action name="actionRun_JumpListView"> - <property name="text"> - <string>Run JumpListView</string> - </property> - <property name="toolTip"> - <string>Run JumpListView utility</string> - </property> - </action> - <action name="actionUse_Native_File_Dialog"> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="text"> - <string>Use Native File Dialog</string> - </property> - </action> - </widget> - <layoutdefault spacing="6" margin="11"/> - <resources/> - <connections/> -</ui> diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro deleted file mode 100644 index be1698c..0000000 --- a/tests/manual/manual.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = subdirs -qtHaveModule(widgets) { - SUBDIRS += \ - dwmfeatures \ - jumplist \ - thumbnail \ - imageconversion -} diff --git a/tests/manual/quickdwmfeatures/main.qml b/tests/manual/quickdwmfeatures/main.qml deleted file mode 100644 index 0d32c98..0000000 --- a/tests/manual/quickdwmfeatures/main.qml +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtWinExtras module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Window 2.0 -import QtQuick.Layouts 1.0 -import QtWinExtras 1.0 -import QtGraphicalEffects 1.0 - -Window { - title: "DWM Features QtWinExtras manual test" - width: 350 - height: 261 - - DwmFeatures { - id: dwm - leftGlassMargin: sboxLeft.value - rightGlassMargin: sboxRight.value - topGlassMargin: sboxTop.value - bottomGlassMargin: sboxBottom.value - blurBehindEnabled: cbBlurBehind.checked - - excludedFromPeek: cbExcludedFromPeek.checked - peekDisallowed: cbPeekDisallowed.checked - } - - Rectangle { - anchors.fill: parent - anchors.leftMargin: dwm.leftGlassMargin - anchors.rightMargin: dwm.rightGlassMargin - anchors.topMargin: dwm.topGlassMargin - anchors.bottomMargin: dwm.bottomGlassMargin - - visible: dwm.topGlassMargin > -1 && dwm.leftGlassMargin > -1 && dwm.rightGlassMargin > -1 && dwm.bottomGlassMargin > -1 && !cbBlurBehind.checked - } - - GridLayout { - anchors.fill: parent - anchors.margins: 2 - columns: 2 - - CheckBox { - id: cbBlurBehind - text: "Blur behind enabled" - Layout.columnSpan: 2 - } - - Label { text: "Top glass frame margin" } - SpinBox { id: sboxTop; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight } - Label { text: "Right glass frame margin" } - SpinBox { id: sboxRight; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight } - Label { text: "Bottom glass frame margin" } - SpinBox { id: sboxBottom; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight } - Label { text: "Left glass frame margin" } - SpinBox { id: sboxLeft; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight } - - CheckBox { - id: cbExcludedFromPeek - text: "Excluded from peek" - Layout.columnSpan: 2 - } - - CheckBox { - id: cbPeekDisallowed - text: "Peek disallowed" - Layout.columnSpan: 2 - } - - Rectangle { - id: rcColorization - width: parent.width - height: 32 - color: dwm.realColorizationColor - Layout.fillWidth: true - Layout.columnSpan: 2 - border.width: 4 - border.color: ''+dwm.realColorizationColor - - Label { text: "Real colorization color"; anchors.centerIn: parent} - } - - Rectangle { - width: parent.width - height: 32 - color: dwm.colorizationColor - Layout.fillWidth: true - Layout.columnSpan: 2 - border.width: 4 - border.color: ''+dwm.colorizationColor - - Label { text: "API-given colorization color (blended)"; anchors.centerIn: parent} - } - - Item { Layout.fillHeight: true } - } -} diff --git a/tests/manual/quickdwmfeatures/quickdwmfeatures.qmlproject b/tests/manual/quickdwmfeatures/quickdwmfeatures.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quickdwmfeatures/quickdwmfeatures.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/quickjumplist/main.qml b/tests/manual/quickjumplist/main.qml deleted file mode 100644 index ba32654..0000000 --- a/tests/manual/quickjumplist/main.qml +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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 2.1 -import QtWinExtras 1.0 -import QtQuick.Dialogs 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 - -ApplicationWindow { - id: window - - title: "JumpList" - - width: 800 - height: 400 - minimumWidth: groupBox.implicitWidth + 40 - minimumHeight: groupBox.implicitHeight + 40 - - JumpList { - id: jumpList - recent.visible: recentBox.checked - frequent.visible: frequentBox.checked - tasks: JumpListCategory { - visible: tasksBox.checked - JumpListLink { - title: "qmlscene" - description: "qmlscene main.qml" - executablePath: Qt.application.arguments[0] - arguments: Qt.application.arguments[1] - } - } - JumpListCategory { - title: "Custom" - visible: customBox.checked - JumpListLink { - title: "qmlscene" - description: "qmlscene main.qml" - executablePath: Qt.application.arguments[0] - arguments: Qt.application.arguments[1] - } - } - } - - GroupBox { - id: groupBox - title: "JumpList" - anchors.centerIn: parent - RowLayout { - anchors.fill: parent - anchors.margins: 20 - ColumnLayout { - CheckBox { - id: recentBox - text: "Recent" - } - CheckBox { - id: frequentBox - text: "Frequent" - } - CheckBox { - id: tasksBox - text: "Tasks" - } - CheckBox { - id: customBox - text: "Custom" - } - } - Button { - text: "Open..." - onClicked: dialog.open() - FileDialog { - id: dialog - } - } - } - } -} diff --git a/tests/manual/quickjumplist/quickjumplist.qmlproject b/tests/manual/quickjumplist/quickjumplist.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quickjumplist/quickjumplist.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/quicktaskbar/main.qml b/tests/manual/quicktaskbar/main.qml deleted file mode 100644 index 9dbbb88..0000000 --- a/tests/manual/quicktaskbar/main.qml +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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 2.1 -import QtWinExtras 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 - -ApplicationWindow { - id: window - - title: "TaskbarButton" - - width: column.implicitWidth + 240 - height: column.implicitHeight + 160 - minimumWidth: column.implicitWidth + 40 - minimumHeight: column.implicitHeight + 40 - - TaskbarButton { - id: taskbar - - progress.visible: progressBox.checked - progress.minimum: indeterminateBox.checked ? 0 : minSpinBox.value - progress.maximum: indeterminateBox.checked ? 0 : maxSpinBox.value - progress.value: indeterminateBox.checked ? 0 : valueSlider.value - - overlay.iconSource: overlayBox.checked && overlayCombo.currentIndex >= 0 ? overlayModel.get(overlayCombo.currentIndex).source : "" - overlay.accessibleDescription: "TaskbarButton" - } - - ColumnLayout { - id: column - - spacing: 20 - anchors.centerIn: parent - Layout.preferredWidth: window.width / 2 - - GroupBox { - id: overlayBox - - checked: false - checkable: true - title: "Overlay icon" - Layout.fillWidth: true - - ComboBox { - id: overlayCombo - - anchors.fill: parent - anchors.margins: 10 - - textRole: "name" - model: ListModel { - id: overlayModel - ListElement { name: "Qt logo (64)"; source: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" } - ListElement { name: "Up (16)"; source: "qrc:/qt-project.org/styles/commonstyle/images/up-16.png" } - ListElement { name: "Left (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/left-32.png" } - ListElement { name: "Right (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/right-32.png" } - ListElement { name: "Down (128)"; source: "qrc:/qt-project.org/styles/commonstyle/images/down-128.png" } - ListElement { name: "Remote"; source: "http://qt-project.org/images/qt13a/Qt-logo.png" } - ListElement { name: "Non-existing"; source: "do not crash explorer" } - } - } - } - - GroupBox { - id: progressBox - - checked: false - checkable: true - title: qsTr("Progress (%1)").arg(taskbar.progress.value) - Layout.fillWidth: true - - GridLayout { - columns: 3 - rowSpacing: 10 - columnSpacing: 20 - anchors.fill: parent - anchors.margins: 10 - - Label { text: "Value:" } - Slider { - id: valueSlider - - value: 82 - stepSize: 1 - minimumValue: minSpinBox.value - maximumValue: maxSpinBox.value - enabled: !indeterminateBox.checked - Layout.columnSpan: 2 - } - - Label { text: "Minimum:" } - SpinBox { - id: minSpinBox - - value: 0 - stepSize: 1 - minimumValue: -1000 - maximumValue: 1000 - enabled: !indeterminateBox.checked - Layout.fillWidth: true - } - - Button { - readonly property string playSymbol: "\u25BA" // BLACK RIGHT-POINTING POINTER - readonly property string pauseSymbol: "\u25AE\u25AE" // BLACK VERTICAL RECTANGLE - readonly property string stopSymbol: "\u2587" // BLACK SQUARE - - text: taskbar.progress.stopped ? playSymbol : taskbar.progress.paused ? stopSymbol : pauseSymbol - onClicked: taskbar.progress.stopped ? taskbar.progress.resume() : taskbar.progress.paused ? taskbar.progress.stop() : taskbar.progress.pause() - Layout.fillHeight: true - Layout.rowSpan: 3 - } - - Label { text: "Maximum:" } - SpinBox { - id: maxSpinBox - - value: 100 - stepSize: 1 - minimumValue: -1000 - maximumValue: 1000 - enabled: !indeterminateBox.checked - Layout.fillWidth: true - } - - Item { Layout.fillWidth: true } - - CheckBox { - id: indeterminateBox - text: "Indeterminate" - } - } - } - } -} diff --git a/tests/manual/quicktaskbar/quicktaskbar.qmlproject b/tests/manual/quicktaskbar/quicktaskbar.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quicktaskbar/quicktaskbar.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/quickthumbnail/main.qml b/tests/manual/quickthumbnail/main.qml deleted file mode 100644 index e73b59f..0000000 --- a/tests/manual/quickthumbnail/main.qml +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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 2.1 -import QtWinExtras 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 - -ApplicationWindow { - id: window - - title: "ThumbnailToolBar" - - width: 800 - height: 400 - minimumWidth: 480 - minimumHeight: 320 - - ThumbnailToolBar { - id: toolBar - iconicThumbnailSource : "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - iconicLivePreviewSource : "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - - ThumbnailToolButton { - tooltip: "Button #1" - iconSource: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - } - - Component { - id: buttonComponent - ThumbnailToolButton { - iconSource: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - } - } - } - - RowLayout { - id: row - - spacing: 10 - anchors.margins: 10 - anchors.fill: parent - - Item { - width: window.width / 3 * 2 - Layout.fillWidth: true - Layout.fillHeight: true - - GroupBox { - anchors.fill: parent - title: qsTr("Buttons (%1)").arg(toolBar.count) - - ColumnLayout { - anchors.fill: parent - anchors.margins: 10 - - TableView { - id: tableView - - currentRow: 0 - model: toolBar.buttons - - Layout.fillWidth: true - Layout.fillHeight: true - - TableViewColumn { role: "tooltip"; title: "Tooltip"; width: 132 } - TableViewColumn { role: "iconSource"; title: "Icon"; width: 88 } - TableViewColumn { role: "visible"; title: "Visible"; width: 64 } - TableViewColumn { role: "enabled"; title: "Enabled"; width: 64 } - TableViewColumn { role: "interactive"; title: "Interactive"; width: 64 } - TableViewColumn { role: "flat"; title: "Flat"; width: 64 } - TableViewColumn { role: "dismissOnClick"; title: "Dismissable"; width: 64 } - } - - RowLayout { - spacing: 10 - anchors.horizontalCenter: parent.horizontalCenter - - ToolButton { - property int counter: 1 - - text: "Add" - onClicked: { - var btn = buttonComponent.createObject(toolBar) - btn.tooltip = qsTr("Button #%1").arg(++counter) - toolBar.addButton(btn) - tableView.currentRow = toolBar.count - 1 - } - } - - ToolButton { - text: "Remove" - enabled: toolBar.count > 0 && tableView.currentRow !== -1 - onClicked: { - toolBar.removeButton(toolBar.buttons[tableView.currentRow]) - } - } - - ToolButton { - text: "Clear" - enabled: toolBar.count > 0 - onClicked: { - toolBar.clear() - } - } - } - } - } - } - - Item { - Layout.fillHeight: true - width: repeater.count ? repeater.itemAt(0).implicitWidth : 0 - - Repeater { - id: repeater - - model: toolBar.buttons - - GroupBox { - title: "Properties" - - anchors.fill: parent - visible: index === tableView.currentRow - implicitWidth: grid.implicitWidth + 20 - - GridLayout { - id: grid - - columns: 2 - rowSpacing: 10 - columnSpacing: 10 - anchors.fill: parent - anchors.margins: 10 - - property ThumbnailToolButton button: toolBar.buttons[index] - - Label { text: "Tooltip:" } - TextField { - text: grid.button ? grid.button.tooltip : "" - onTextChanged: if (grid.button) grid.button.tooltip = text - Layout.fillWidth: true - } - - Label { text: "Icon:" } - ComboBox { - currentIndex: 1 - textRole: "name" - Layout.fillWidth: true - model: ListModel { - id: iconModel - ListElement { name: "None"; source: "" } - ListElement { name: "Qt logo (64)"; source: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" } - ListElement { name: "Up (16)"; source: "qrc:/qt-project.org/styles/commonstyle/images/up-16.png" } - ListElement { name: "Left (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/left-32.png" } - ListElement { name: "Right (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/right-32.png" } - ListElement { name: "Down (128)"; source: "qrc:/qt-project.org/styles/commonstyle/images/down-128.png" } - ListElement { name: "Non-existing"; source: "something that does not exist" } - } - onCurrentIndexChanged: { - if (grid.button && currentIndex !== -1) - grid.button.iconSource = iconModel.get(currentIndex).source - } - } - - CheckBox { - text: "Visible" - checked: grid.button && grid.button.visible - onCheckedChanged: if (grid.button) grid.button.visible = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Enabled" - checked: grid.button && grid.button.enabled - onCheckedChanged: if (grid.button) grid.button.enabled = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Interactive" - checked: grid.button && grid.button.interactive - onCheckedChanged: if (grid.button) grid.button.interactive = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Flat" - checked: grid.button && grid.button.flat - onCheckedChanged: if (grid.button) grid.button.flat = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Dismissable" - checked: grid.button && grid.button.dismissOnClick - onCheckedChanged: if (grid.button) grid.button.dismissOnClick = checked - Layout.columnSpan: 2 - } - - Item { Layout.fillHeight: true } - } - } - } - } - } -} diff --git a/tests/manual/quickthumbnail/quickthumbnail.qmlproject b/tests/manual/quickthumbnail/quickthumbnail.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quickthumbnail/quickthumbnail.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/thumbnail/.prev_CMakeLists.txt b/tests/manual/thumbnail/.prev_CMakeLists.txt deleted file mode 100644 index 9c1d8e3..0000000 --- a/tests/manual/thumbnail/.prev_CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Generated from thumbnail.pro. - -##################################################################### -## thumbnail Binary: -##################################################################### - -qt_add_executable(thumbnail - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras -) - -#### Keys ignored in scope 1:.:.:thumbnail.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/thumbnail/CMakeLists.txt b/tests/manual/thumbnail/CMakeLists.txt deleted file mode 100644 index 03c66c4..0000000 --- a/tests/manual/thumbnail/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Generated from thumbnail.pro. - -##################################################################### -## thumbnail Binary: -##################################################################### - -qt_add_manual_test(thumbnail # special case - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras -) - -#### Keys ignored in scope 1:.:.:thumbnail.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/thumbnail/main.cpp b/tests/manual/thumbnail/main.cpp deleted file mode 100644 index 8c2eeec..0000000 --- a/tests/manual/thumbnail/main.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 The Qt Company Ltd. - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** 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 <QApplication> -#include <QMainWindow> -#include <QPlainTextEdit> -#include <QMenuBar> -#include <QMenu> -#include <QAction> -#include <QStyle> -#include <QScreen> -#include <QShortcut> -#include <QPixmap> -#include <QPainter> -#include <QFontMetrics> -#include <QtWinExtras> -#include <QDebug> - -static QPixmap drawColoredPixmap(const QSize &size, const QColor &color, - const QString &text = QString()) -{ - QPixmap result(size); - result.fill(color); - QPainter painter(&result); - painter.drawRect(QRect(QPoint(0, 0), size - QSize(1, 1))); - if (!text.isEmpty()) { - QFont font = painter.font(); - font.setPointSize(20); - painter.setFont(font); - const QFontMetrics fontMetrics(font); - QRect boundingRect(fontMetrics.boundingRect(text)); - const int x = (size.width() - boundingRect.width()) / 2; - const int y = size.height() - (size.height() - boundingRect.height()) / 2; - painter.drawText(x, y, text); - } - return result; -} - -class MainWindow : public QMainWindow { - Q_OBJECT -public: - MainWindow(); - void initThumbnailToolBar(); - -public slots: - void testButtonClicked(); - void updateIconicThumbnailPixmap(); - void updateIconicLivePreviewPixmap(); - void logText(const QString &text); - -private: - QWinThumbnailToolBar *m_thumbnailToolBar; - QPlainTextEdit *m_logEdit; - QAction *m_enableIconicPixmapAction; - QAction *m_enableIconicLivePreviewAction; -}; - -MainWindow::MainWindow() - : m_thumbnailToolBar(new QWinThumbnailToolBar(this)) - , m_logEdit(new QPlainTextEdit) - , m_enableIconicPixmapAction(new QAction("Enable Iconic Pixmap", this)) - , m_enableIconicLivePreviewAction(new QAction("Enable LivePreview", this)) -{ - setMinimumWidth(400); - setWindowTitle(QStringLiteral("QWinThumbnailToolBar ") + QLatin1String(QT_VERSION_STR)); - QMenu *fileMenu = menuBar()->addMenu("&File"); - m_enableIconicPixmapAction->setCheckable(true); - m_enableIconicPixmapAction->setChecked(true); - m_enableIconicLivePreviewAction->setCheckable(true); - m_enableIconicLivePreviewAction->setChecked(true); - fileMenu->addAction(m_enableIconicPixmapAction); - fileMenu->addAction(m_enableIconicLivePreviewAction); - QAction *quitAction = fileMenu->addAction("&Quit"); - quitAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q)); - connect(quitAction, &QAction::triggered, QCoreApplication::quit); - setCentralWidget(m_logEdit); -} - -void MainWindow::initThumbnailToolBar() -{ - m_thumbnailToolBar->setWindow(windowHandle()); - auto *testButton = new QWinThumbnailToolButton(m_thumbnailToolBar); - testButton->setToolTip("Test"); - testButton->setIcon(style()->standardIcon(QStyle::SP_ComputerIcon)); - connect(testButton, &QWinThumbnailToolButton::clicked, this, &MainWindow::testButtonClicked); - m_thumbnailToolBar->addButton(testButton); - m_thumbnailToolBar->setIconicPixmapNotificationsEnabled(true); - connect(m_thumbnailToolBar, &QWinThumbnailToolBar::iconicLivePreviewPixmapRequested, - this, &MainWindow::updateIconicLivePreviewPixmap); - connect(m_thumbnailToolBar, &QWinThumbnailToolBar::iconicThumbnailPixmapRequested, - this, &MainWindow::updateIconicThumbnailPixmap); -} - -void MainWindow::logText(const QString &text) -{ - m_logEdit->appendPlainText(text); - qDebug("%s", qPrintable(text)); -} - -void MainWindow::testButtonClicked() -{ - static int n = 1; - logText(QStringLiteral("Clicked #") + QString::number(n++)); -} - -void MainWindow::updateIconicThumbnailPixmap() -{ - static int n = 1; - if (!m_enableIconicPixmapAction->isChecked()) - return; - const QString number = QString::number(n++); - logText(QLatin1String(__FUNCTION__) + u' ' + number); - const QPixmap pixmap = - drawColoredPixmap(QSize(200, 50), Qt::yellow, QStringLiteral("ITP ") + number); - m_thumbnailToolBar->setIconicThumbnailPixmap(pixmap); -} - -void MainWindow::updateIconicLivePreviewPixmap() -{ - static int n = 1; - if (!m_enableIconicLivePreviewAction->isChecked()) - return; - const QString number = QString::number(n++); - logText(QLatin1String(__FUNCTION__) + u' ' + number); - const QPixmap pixmap = - drawColoredPixmap(QSize(200, 50), Qt::red, QStringLiteral("ILP ") + number); - m_thumbnailToolBar->setIconicLivePreviewPixmap(pixmap); -} - -int main(int argc, char* argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.move(QGuiApplication::primaryScreen()->availableGeometry().center() - - QPoint(w.width() / 2, w.height() / 2)); - w.show(); - w.initThumbnailToolBar(); - return a.exec(); -} - -#include "main.moc" diff --git a/tests/manual/thumbnail/thumbnail.pro b/tests/manual/thumbnail/thumbnail.pro deleted file mode 100644 index 2259b9b..0000000 --- a/tests/manual/thumbnail/thumbnail.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = app -QT += widgets winextras -CONFIG -= app_bundle -SOURCES += main.cpp |