diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-10-09 15:32:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-10 11:32:57 +0200 |
commit | 429abebf7728d073b93a5726297ee8673cc38bd1 (patch) | |
tree | f8c8a56a78d760c7ecbfefb9ef44ba815b561667 | |
parent | 7a8575566fca28d04337e2d2a41918ab45a57da1 (diff) |
Restore the former jumplist/dwmfeatures apps as manual testsv5.2.0-beta1
Change-Id: I7f8b79b01832224a1eeeaf2e6c6489ff1b46e495
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r-- | tests/manual/dwmfeatures/dwmfeatures.pro | 11 | ||||
-rw-r--r-- | tests/manual/dwmfeatures/main.cpp | 52 | ||||
-rw-r--r-- | tests/manual/dwmfeatures/testwidget.cpp | 179 | ||||
-rw-r--r-- | tests/manual/dwmfeatures/testwidget.h | 80 | ||||
-rw-r--r-- | tests/manual/dwmfeatures/testwidget.ui | 319 | ||||
-rw-r--r-- | tests/manual/jumplist/jumplist.pro | 11 | ||||
-rw-r--r-- | tests/manual/jumplist/main.cpp | 83 | ||||
-rw-r--r-- | tests/manual/jumplist/testwidget.cpp | 135 | ||||
-rw-r--r-- | tests/manual/jumplist/testwidget.h | 77 | ||||
-rw-r--r-- | tests/manual/jumplist/testwidget.ui | 198 | ||||
-rw-r--r-- | tests/manual/manual.pro | 6 | ||||
-rw-r--r-- | tests/tests.pro | 2 |
12 files changed, 1152 insertions, 1 deletions
diff --git a/tests/manual/dwmfeatures/dwmfeatures.pro b/tests/manual/dwmfeatures/dwmfeatures.pro new file mode 100644 index 0000000..2848d9c --- /dev/null +++ b/tests/manual/dwmfeatures/dwmfeatures.pro @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..4890074 --- /dev/null +++ b/tests/manual/dwmfeatures/main.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** 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 Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.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 new file mode 100644 index 0000000..2d02d14 --- /dev/null +++ b/tests/manual/dwmfeatures/testwidget.cpp @@ -0,0 +1,179 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** 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 Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include "testwidget.h" +#include "ui_testwidget.h" + +#include <QWinFunctions> +#include <QWinEvent> +#include <QDebug> +#include <qt_windows.h> + +TestWidget::TestWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::TestWidget) +{ + ui->setupUi(this); + + connect(ui->btnPeekDisallow, SIGNAL(clicked()), SLOT(onDisallowPeekClicked())); + connect(ui->btnPeekExclude, SIGNAL(clicked()), SLOT(onExcludeFromPeekClicked())); + connect(ui->radioFlipDefault, SIGNAL(clicked()), SLOT(onFlip3DPolicyChanged())); + connect(ui->radioFlipAbove, SIGNAL(clicked()), SLOT(onFlip3DPolicyChanged())); + connect(ui->radioFlipBelow, SIGNAL(clicked()), SLOT(onFlip3DPolicyChanged())); + connect(ui->btnFrameReset, SIGNAL(clicked()), SLOT(onResetGlassFrameClicked())); + connect(ui->frameTop, SIGNAL(valueChanged(int)), SLOT(onGlassMarginsChanged())); + connect(ui->frameRight, SIGNAL(valueChanged(int)), SLOT(onGlassMarginsChanged())); + connect(ui->frameBottom, SIGNAL(valueChanged(int)), SLOT(onGlassMarginsChanged())); + connect(ui->frameLeft, SIGNAL(valueChanged(int)), SLOT(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) { + QWinCompositionChangeEvent *event = static_cast<QWinCompositionChangeEvent *>(e); + qDebug() << "Composition state change: " << event->isCompositionEnabled(); + } 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::onGlassMarginsChanged() +{ + if (!QtWin::isCompositionEnabled()) + return; + + // 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 new file mode 100644 index 0000000..5ae8ec7 --- /dev/null +++ b/tests/manual/dwmfeatures/testwidget.h @@ -0,0 +1,80 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** 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 Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.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 = 0); + ~TestWidget(); + +protected: + void changeEvent(QEvent *e); + bool event(QEvent *); + +private: + Ui::TestWidget *ui; + +private slots: + void onDisallowPeekClicked(); + void onExcludeFromPeekClicked(); + void onFlip3DPolicyChanged(); + void onGlassMarginsChanged(); + void onResetGlassFrameClicked(); +}; + +#endif // TESTWIDGET_H diff --git a/tests/manual/dwmfeatures/testwidget.ui b/tests/manual/dwmfeatures/testwidget.ui new file mode 100644 index 0000000..329ba61 --- /dev/null +++ b/tests/manual/dwmfeatures/testwidget.ui @@ -0,0 +1,319 @@ +<?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>331</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="margin"> + <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="margin"> + <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_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="margin"> + <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/jumplist/jumplist.pro b/tests/manual/jumplist/jumplist.pro new file mode 100644 index 0000000..c8a061d --- /dev/null +++ b/tests/manual/jumplist/jumplist.pro @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..af393c5 --- /dev/null +++ b/tests/manual/jumplist/main.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** 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 Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include "testwidget.h" + +#include <QApplication> +#include <QSettings> +#include <QDir> + +void associateFileType() +{ + QString exeFileName = QCoreApplication::applicationFilePath(); + exeFileName = exeFileName.right(exeFileName.length() - exeFileName.lastIndexOf("/") - 1); + QString appName = "QtWinExtras JumpList Test"; + + QSettings regApplications("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\" + exeFileName, QSettings::NativeFormat); + regApplications.setValue("FriendlyAppName", appName); + + regApplications.beginGroup("SupportedTypes"); + regApplications.setValue(".txt", QString()); + regApplications.endGroup(); + + regApplications.beginGroup("shell"); + regApplications.beginGroup("open"); + regApplications.setValue("FriendlyAppName", appName); + regApplications.beginGroup("command"); + regApplications.setValue(".", '"' + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "\" \"%1\""); + regApplications.endGroup(); + regApplications.endGroup(); + regApplications.endGroup(); +} + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + associateFileType(); + + TestWidget w; + if (QCoreApplication::arguments().contains("-fullscreen")) + w.showFullScreen(); + else + w.show(); + + return a.exec(); +} diff --git a/tests/manual/jumplist/testwidget.cpp b/tests/manual/jumplist/testwidget.cpp new file mode 100644 index 0000000..bb5235d --- /dev/null +++ b/tests/manual/jumplist/testwidget.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** 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 Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include "testwidget.h" +#include "ui_testwidget.h" + +#include <QApplication> +#include <QStyle> +#include <QFile> +#include <QFileDialog> +#include <QMessageBox> +#include <QWinJumpList> +#include <QWinJumpListItem> +#include <QWinJumpListCategory> +#include <QDebug> + +TestWidget::TestWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::TestWidget) +{ + ui->setupUi(this); + + if (QCoreApplication::arguments().contains("-text")) + ui->text->setPlainText("Hello, world!"); + if (!QCoreApplication::arguments().contains("-fullscreen")) + ui->btnClose->hide(); + + for (int i = 1; i < QCoreApplication::arguments().size(); i++) { + const QString arg = QCoreApplication::arguments().at(i); + if (!arg.isEmpty() && arg.at(0) != '-' && QFile(arg).exists()) { + showFile(arg); + break; + } + } + + connect(ui->btnUpdate, SIGNAL(clicked()), SLOT(updateJumpList())); + connect(ui->btnOpenFile, SIGNAL(clicked()), SLOT(openFile())); + connect(ui->btnClose, SIGNAL(clicked()), qApp, SLOT(quit())); +} + +TestWidget::~TestWidget() +{ + delete ui; +} + +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)) + ui->text->setPlainText(QString::fromUtf8(file.readAll())); + else + QMessageBox::warning(this, "Error", "Failed to open file"); +} + +void TestWidget::updateJumpList() +{ + QWinJumpList jumplist; + jumplist.recent()->setVisible(ui->cbShowRecent->isChecked()); + jumplist.frequent()->setVisible(ui->cbShowFrequent->isChecked()); + if (ui->cbRunFullscreen->isChecked()) { + QWinJumpListItem *item = new QWinJumpListItem(QWinJumpListItem::Link); + item->setTitle(ui->cbRunFullscreen->text()); + item->setFilePath(QDir::toNativeSeparators(QCoreApplication::applicationFilePath())); + 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(), QDir::toNativeSeparators(QCoreApplication::applicationFilePath()), (QStringList() << "-style" << "fusion")); + } + if (ui->cbRunText->isChecked()) { + jumplist.tasks()->addSeparator(); + jumplist.tasks()->addLink(ui->cbRunText->text(), QDir::toNativeSeparators(QCoreApplication::applicationFilePath()), QStringList("-text")); + } + jumplist.tasks()->setVisible(!jumplist.tasks()->isEmpty()); +} + +void TestWidget::openFile() +{ + QString filePath = QFileDialog::getOpenFileName(this, "Open a text file", QString(), "Text files (*.txt)"); + if (filePath.isEmpty()) + return; + else + showFile(filePath); +} diff --git a/tests/manual/jumplist/testwidget.h b/tests/manual/jumplist/testwidget.h new file mode 100644 index 0000000..41e42c8 --- /dev/null +++ b/tests/manual/jumplist/testwidget.h @@ -0,0 +1,77 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** 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 Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.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 = 0); + ~TestWidget(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::TestWidget *ui; + void showFile(const QString &path); + +private slots: + void updateJumpList(); + void openFile(); +}; + +#endif // TESTWIDGET_H diff --git a/tests/manual/jumplist/testwidget.ui b/tests/manual/jumplist/testwidget.ui new file mode 100644 index 0000000..82b9a0d --- /dev/null +++ b/tests/manual/jumplist/testwidget.ui @@ -0,0 +1,198 @@ +<?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>695</width> + <height>394</height> + </rect> + </property> + <property name="windowTitle"> + <string>QtWinExtras JumpList</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1"> + <property name="spacing"> + <number>3</number> + </property> + <property name="margin"> + <number>3</number> + </property> + <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="margin"> + <number>3</number> + </property> + <item> + <widget class="QCheckBox" name="cbShowFrequent"> + <property name="text"> + <string>Frequent</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbShowRecent"> + <property name="text"> + <string>Recent</string> + </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="margin"> + <number>3</number> + </property> + <item> + <widget class="QCheckBox" name="cbRunFullscreen"> + <property name="text"> + <string>Run in fullscreen</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbRunFusion"> + <property name="text"> + <string>Run with Fusion style</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbRunText"> + <property name="text"> + <string>Run with some text displayed</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <spacer name="horizontalSpacer_2"> + <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="btnUpdate"> + <property name="text"> + <string>Update</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <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> + <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> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="spacing"> + <number>3</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="btnOpenFile"> + <property name="text"> + <string>Open a file</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <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="btnClose"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </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> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro new file mode 100644 index 0000000..14a08ef --- /dev/null +++ b/tests/manual/manual.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +qtHaveModule(widgets) { + SUBDIRS += \ + dwmfeatures \ + jumplist +} diff --git a/tests/tests.pro b/tests/tests.pro index c701bb2..1a05245 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -win32: SUBDIRS += auto +win32: SUBDIRS += auto manual |