aboutsummaryrefslogtreecommitdiffstats
path: root/examples/winextras
diff options
context:
space:
mode:
Diffstat (limited to 'examples/winextras')
-rw-r--r--examples/winextras/CMakeLists.txt11
-rw-r--r--examples/winextras/iconextractor/CMakeLists.txt37
-rw-r--r--examples/winextras/iconextractor/doc/src/qtwinextras-example-iconextractor.qdoc36
-rw-r--r--examples/winextras/iconextractor/iconextractor.pro9
-rw-r--r--examples/winextras/iconextractor/main.cpp309
-rw-r--r--examples/winextras/musicplayer/CMakeLists.txt41
-rw-r--r--examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.pngbin123581 -> 0 bytes
-rw-r--r--examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.pngbin10067 -> 0 bytes
-rw-r--r--examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.pngbin56812 -> 0 bytes
-rw-r--r--examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc106
-rw-r--r--examples/winextras/musicplayer/images/qt-logo.icobin96079 -> 0 bytes
-rw-r--r--examples/winextras/musicplayer/main.cpp131
-rw-r--r--examples/winextras/musicplayer/musicplayer.cpp408
-rw-r--r--examples/winextras/musicplayer/musicplayer.h126
-rw-r--r--examples/winextras/musicplayer/musicplayer.pro18
-rw-r--r--examples/winextras/musicplayer/volumebutton.cpp106
-rw-r--r--examples/winextras/musicplayer/volumebutton.h84
-rw-r--r--examples/winextras/quickplayer/CMakeLists.txt79
-rw-r--r--examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-composited.pngbin52737 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-taskbar.pngbin9102 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-thumbnail.pngbin32726 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/doc/src/qtwinextras-quickplayer.qdoc74
-rw-r--r--examples/winextras/quickplayer/images/media-pause-16.pngbin142 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/images/media-pause-32.pngbin185 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/images/media-play-16.pngbin262 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/images/media-play-32.pngbin413 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/images/media-seek-backward-32.pngbin387 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/images/media-seek-forward-32.pngbin363 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/images/media-stop-32.pngbin176 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/images/qt-logo.icobin96079 -> 0 bytes
-rw-r--r--examples/winextras/quickplayer/main.cpp93
-rw-r--r--examples/winextras/quickplayer/qml/main.qml216
-rw-r--r--examples/winextras/quickplayer/quickplayer.pro18
-rw-r--r--examples/winextras/quickplayer/quickplayer.qrc12
-rw-r--r--examples/winextras/quickplayer/quickplayer.rc1
-rw-r--r--examples/winextras/winextras.pro7
36 files changed, 0 insertions, 1922 deletions
diff --git a/examples/winextras/CMakeLists.txt b/examples/winextras/CMakeLists.txt
deleted file mode 100644
index 4347a1a..0000000
--- a/examples/winextras/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-# Generated from winextras.pro.
-
-if(WIN32)
- add_subdirectory(iconextractor)
-endif()
-if(TARGET Qt::Multimedia AND TARGET Qt::Widgets AND WIN32)
- add_subdirectory(musicplayer)
-endif()
-if(TARGET Qt::Multimedia AND TARGET Qt::Quick AND WIN32)
- add_subdirectory(quickplayer)
-endif()
diff --git a/examples/winextras/iconextractor/CMakeLists.txt b/examples/winextras/iconextractor/CMakeLists.txt
deleted file mode 100644
index f0fc678..0000000
--- a/examples/winextras/iconextractor/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Generated from iconextractor.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(iconextractor LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/winextras/iconextractor")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS WinExtras)
-
-add_executable(iconextractor
- main.cpp
-)
-target_link_libraries(iconextractor PUBLIC
- Qt::Core
- Qt::Gui
- Qt::WinExtras
- shell32
- user32
-)
-
-install(TARGETS iconextractor
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/winextras/iconextractor/doc/src/qtwinextras-example-iconextractor.qdoc b/examples/winextras/iconextractor/doc/src/qtwinextras-example-iconextractor.qdoc
deleted file mode 100644
index f65fd8d..0000000
--- a/examples/winextras/iconextractor/doc/src/qtwinextras-example-iconextractor.qdoc
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \title Icon Extractor
- \ingroup examples-qtwinextras
- \example iconextractor
- \brief Demonstrates accessing icons contained in Windows binaries.
-
- This example shows how to extract Windows icons from executables,
- DLL or icon files, and write them out as numbered PNG files.
-*/
diff --git a/examples/winextras/iconextractor/iconextractor.pro b/examples/winextras/iconextractor/iconextractor.pro
deleted file mode 100644
index 66c6dad..0000000
--- a/examples/winextras/iconextractor/iconextractor.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = app
-TARGET = iconextractor
-CONFIG += console
-QT = core gui winextras
-LIBS += -lshell32 -luser32
-SOURCES += main.cpp
-
-target.path = $$[QT_INSTALL_EXAMPLES]/winextras/iconextractor
-INSTALLS += target
diff --git a/examples/winextras/iconextractor/main.cpp b/examples/winextras/iconextractor/main.cpp
deleted file mode 100644
index 6e11816..0000000
--- a/examples/winextras/iconextractor/main.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWinExtras module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWin>
-
-#include <QCommandLineParser>
-#include <QCommandLineOption>
-#include <QDir>
-#include <QFileInfo>
-#include <QGuiApplication>
-#include <QImage>
-#include <QPixmap>
-#include <QScopedArrayPointer>
-#include <QStringList>
-#include <QSysInfo>
-
-#include <iostream>
-
-#include <shellapi.h>
-#include <comdef.h>
-#include <commctrl.h>
-#include <objbase.h>
-#include <commoncontrols.h>
-
-/* This example demonstrates the Windows-specific image conversion
- * functions. */
-
-struct PixmapEntry {
- QString name;
- QPixmap pixmap;
-};
-
-using PixmapEntryList = QList<PixmapEntry>;
-
-static std::wostream &operator<<(std::wostream &str, const QString &s)
-{
-#ifdef Q_OS_WIN
- str << reinterpret_cast<const wchar_t *>(s.utf16());
-#else
- str << s.toStdWString();
-#endif
- return str;
-}
-
-static QString formatSize(const QSize &size)
-{
- return QString::number(size.width()) + u'x' + QString::number(size.height());
-}
-
-// Extract icons contained in executable or DLL using the Win32 API ExtractIconEx()
-static PixmapEntryList extractIcons(const QString &sourceFile, bool large)
-{
- const QString nativeName = QDir::toNativeSeparators(sourceFile);
- const auto *sourceFileC = reinterpret_cast<const wchar_t *>(nativeName.utf16());
- const UINT iconCount = ExtractIconEx(sourceFileC, -1, nullptr, nullptr, 0);
- if (!iconCount) {
- std::wcerr << sourceFile << " does not appear to contain icons.\n";
- return PixmapEntryList();
- }
-
- QScopedArrayPointer<HICON> icons(new HICON[iconCount]);
- const UINT extractedIconCount = large ?
- ExtractIconEx(sourceFileC, 0, icons.data(), nullptr, iconCount) :
- ExtractIconEx(sourceFileC, 0, nullptr, icons.data(), iconCount);
- if (!extractedIconCount) {
- qErrnoWarning("Failed to extract icons from %s", qPrintable(sourceFile));
- return PixmapEntryList();
- }
-
- PixmapEntryList result;
- result.reserve(int(extractedIconCount));
-
- std::wcout << sourceFile << " contains " << extractedIconCount << " icon(s).\n";
-
- for (UINT i = 0; i < extractedIconCount; ++i) {
- PixmapEntry entry;
- entry.pixmap = QtWin::fromHICON(icons[i]);
- if (entry.pixmap.isNull()) {
- std::wcerr << "Error converting icons.\n";
- return PixmapEntryList();
- }
- entry.name = QString::fromLatin1("%1_%2x%3").arg(i, 3, 10, QLatin1Char('0'))
- .arg(entry.pixmap.width()).arg(entry.pixmap.height());
- result.append(entry);
- }
- return result;
-}
-
-// Helper for extracting large/jumbo icons available from Windows Vista onwards
-// via SHGetImageList().
-static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info)
-{
- QPixmap result;
- // For MinGW:
- static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}};
-
- IImageList *imageList = nullptr;
- if (FAILED(SHGetImageList(iImageList, iID_IImageList, reinterpret_cast<void **>(&imageList))))
- return result;
-
- HICON hIcon = nullptr;
- if (SUCCEEDED(imageList->GetIcon(info.iIcon, ILD_TRANSPARENT, &hIcon))) {
- result = QtWin::fromHICON(hIcon);
- DestroyIcon(hIcon);
- }
- return result;
-}
-
-// Extract icons that would be displayed by the Explorer (shell)
-static PixmapEntryList extractShellIcons(const QString &sourceFile, bool addOverlays)
-{
- enum { // Shell image list ids
- sHIL_EXTRALARGE = 0x2, // 48x48 or user-defined
- sHIL_JUMBO = 0x4 // 256x256 (Vista or later)
- };
-
- struct FlagEntry {
- const char *name;
- unsigned flags;
- };
-
- const FlagEntry modeEntries[] =
- {
- {"", 0},
- {"open", SHGFI_OPENICON},
- {"sel", SHGFI_SELECTED},
- };
- const FlagEntry standardSizeEntries[] =
- {
- {"s", SHGFI_SMALLICON},
- {"l", SHGFI_LARGEICON},
- {"sh", SHGFI_SHELLICONSIZE},
- };
-
- const QString nativeName = QDir::toNativeSeparators(sourceFile);
- const auto *sourceFileC = reinterpret_cast<const wchar_t *>(nativeName.utf16());
-
- SHFILEINFO info;
- unsigned int baseFlags = SHGFI_ICON | SHGFI_SYSICONINDEX | SHGFI_ICONLOCATION;
- if (addOverlays)
- baseFlags |= SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX;
- if (!QFileInfo(sourceFile).isDir())
- baseFlags |= SHGFI_USEFILEATTRIBUTES;
-
- PixmapEntryList result;
- for (auto modeEntry : modeEntries) {
- const unsigned modeFlags = baseFlags | modeEntry.flags;
- QString modePrefix = QLatin1String("_shell_");
- if (modeEntry.name[0])
- modePrefix += QLatin1String(modeEntry.name) + u'_';
- for (auto standardSizeEntry : standardSizeEntries) {
- const unsigned flags = modeFlags | standardSizeEntry.flags;
- const QString prefix = modePrefix + QLatin1String(standardSizeEntry.name)
- + u'_';
- ZeroMemory(&info, sizeof(SHFILEINFO));
- const HRESULT hr = SHGetFileInfo(sourceFileC, 0, &info, sizeof(SHFILEINFO), flags);
- if (FAILED(hr)) {
- _com_error error(hr);
- std::wcerr << "SHGetFileInfo() failed for \"" << nativeName << "\", "
- << std::hex << std::showbase << flags << std::dec << std::noshowbase
- << " (" << prefix << "): " << error.ErrorMessage() << '\n';
- continue;
- }
-
- if (info.hIcon) {
- PixmapEntry entry;
- entry.pixmap = QtWin::fromHICON(info.hIcon);
- DestroyIcon(info.hIcon);
- if (entry.pixmap.isNull()) {
- std::wcerr << "Error converting icons.\n";
- return PixmapEntryList();
- }
- entry.name = prefix + formatSize(entry.pixmap.size());
-
- const int iconIndex = info.iIcon & 0xFFFFFF;
- const int overlayIconIndex = info.iIcon >> 24;
-
- std::wcout << "Obtained icon #" << iconIndex;
- if (addOverlays)
- std::wcout << " (overlay #" << overlayIconIndex << ')';
- if (info.szDisplayName[0])
- std::wcout << " from " << QString::fromWCharArray(info.szDisplayName);
- std::wcout << " (" << entry.pixmap.width() << 'x'
- << entry.pixmap.height() << ") for " << std::hex << std::showbase << flags
- << std::dec << std::noshowbase << '\n';
-
- result.append(entry);
- }
- } // for standardSizeEntryCount
- // Windows Vista onwards: extract large/jumbo icons
- if (info.hIcon) {
- const QPixmap extraLarge = pixmapFromShellImageList(sHIL_EXTRALARGE, info);
- if (!extraLarge.isNull()) {
- PixmapEntry entry;
- entry.pixmap = extraLarge;
- entry.name = modePrefix + QLatin1String("xl_") + formatSize(extraLarge.size());
- result.append(entry);
- }
- const QPixmap jumbo = pixmapFromShellImageList(sHIL_JUMBO, info);
- if (!jumbo.isNull()) {
- PixmapEntry entry;
- entry.pixmap = jumbo;
- entry.name = modePrefix + QLatin1String("jumbo_") + formatSize(extraLarge.size());
- result.append(entry);
- }
- }
- } // for modes
- return result;
-}
-
-static const char description[] =
- "\nExtracts Windows icons from executables, DLL or icon files and writes them\n"
- "out as numbered .png-files.\n"
- "When passing the --shell option, the icons displayed by Explorer are extracted.\n";
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
- QCoreApplication::setApplicationName(QStringLiteral("Icon Extractor"));
- QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
- QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
- QCommandLineParser parser;
- parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsCompactedShortOptions);
- parser.setApplicationDescription(QLatin1String(description));
- parser.addHelpOption();
- parser.addVersionOption();
- const QCommandLineOption largeIconOption(QStringLiteral("large"), QStringLiteral("Extract large icons"));
- parser.addOption(largeIconOption);
- const QCommandLineOption shellIconOption(QStringLiteral("shell"), QStringLiteral("Extract shell icons using SHGetFileInfo()"));
- parser.addOption(shellIconOption);
- const QCommandLineOption shellOverlayOption(QStringLiteral("overlay"), QStringLiteral("Extract shell overlay icons"));
- parser.addOption(shellOverlayOption);
- parser.addPositionalArgument(QStringLiteral("file"), QStringLiteral("The file to open."));
- parser.addPositionalArgument(QStringLiteral("image_file_folder"), QStringLiteral("The folder to store the images."));
- parser.process(app);
- const QStringList &positionalArguments = parser.positionalArguments();
- if (positionalArguments.isEmpty())
- parser.showHelp(0);
-
- QString imageFileRoot = positionalArguments.size() > 1 ? positionalArguments.at(1) : QDir::currentPath();
- const QFileInfo imageFileRootInfo(imageFileRoot);
- if (!imageFileRootInfo.isDir()) {
- std::wcerr << imageFileRoot << " is not a directory.\n";
- return 1;
- }
- const QString &sourceFile = positionalArguments.constFirst();
- imageFileRoot = imageFileRootInfo.absoluteFilePath() + u'/' + QFileInfo(sourceFile).baseName();
-
- const PixmapEntryList pixmaps = parser.isSet(shellIconOption)
- ? extractShellIcons(sourceFile, parser.isSet(shellOverlayOption))
- : extractIcons(sourceFile, parser.isSet(largeIconOption));
-
- for (const auto &entry : pixmaps) {
- const QString fileName = imageFileRoot + entry.name + QLatin1String(".png");
- if (!entry.pixmap.save(fileName)) {
- std::wcerr << "Error writing image file " << fileName << ".\n";
- return 1;
- }
- std::wcout << "Wrote " << QDir::toNativeSeparators(fileName) << ".\n";
- }
- return 0;
-}
diff --git a/examples/winextras/musicplayer/CMakeLists.txt b/examples/winextras/musicplayer/CMakeLists.txt
deleted file mode 100644
index 359be76..0000000
--- a/examples/winextras/musicplayer/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from musicplayer.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(musicplayer LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/winextras/musicplayer")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Multimedia)
-find_package(Qt6 COMPONENTS WinExtras)
-
-add_qt_gui_executable(musicplayer
- main.cpp
- musicplayer.cpp musicplayer.h
- volumebutton.cpp volumebutton.h
-)
-target_link_libraries(musicplayer PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Multimedia
- Qt::Widgets
- Qt::WinExtras
-)
-
-install(TARGETS musicplayer
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.png b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.png
deleted file mode 100644
index 3ae91f9..0000000
--- a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.png b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.png
deleted file mode 100644
index 8742da2..0000000
--- a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.png b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.png
deleted file mode 100644
index 2198ec8..0000000
--- a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc b/examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc
deleted file mode 100644
index c27ec0f..0000000
--- a/examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example musicplayer
- \title Music Player
- \ingroup examples-qtwinextras
- \brief Demonstrates managing Windows DWM features, jump lists,
- taskbar button overlay, and thumbnail toolbar.
-
- \image qtwinextras-musicplayer-composited.png Screenshot of the Music Player example
-
- The Music Player example demonstrates how to use the various features
- provided by the QtWinExtras module.
-
- \note The example uses QMediaPlayer from the QtMultimedia module to play
- the music, but this article focuses on the parts where QtWinExtras features
- are used.
-
- \section1 DWM Features
-
- The example uses Windows DWM (Desktop Window Manager) features to visually
- integrate the window content to the window frame and to make the main window
- and the volume popup translucent and blurred.
-
- \section1 Jump List
-
- The example creates a custom jump list to provide the user with fast
- access to recently played music files.
-
- \snippet musicplayer/musicplayer.cpp 4
-
- To enable the application jump list to show the desired recent files,
- the corresponding file types are registered using the following helper
- function.
-
- \snippet musicplayer/main.cpp 0
-
- \section1 Taskbar Overlay and Progress
-
- The example uses Windows Taskbar for two things; it sets an overlay icon
- that represents the current music playback state, and it indicates the
- playback progress in the taskbar button.
-
- \image qtwinextras-musicplayer-taskbar.png Screenshot of the Music Player taskbar
-
- The following snippets show how the taskbar button is prepared.
-
- For the taskbar and the thumbnail toolbar to work, a native window handle
- must be set by passing an instance of \c QWindow to
- \c QWinTaskbarButton::setWindow() or \c QWinThumbnailToolBar::setWindow(),
- respectively. This instance is created in the process of \c QWidget::show()
- and can be retrieved by calling \c QWidget::windowHandle() afterwards.
- We override \c QWidget::showEvent() for this purpose:
-
- \snippet musicplayer/musicplayer.cpp 7
-
- The playback progress is wired directly to the taskbar progress indicator
- by using signals and slots.
-
- \snippet musicplayer/musicplayer.cpp 5
-
- The overlay icon and the progress indicator are updated whenever the state
- of the music playback changes.
-
- \snippet musicplayer/musicplayer.cpp 2
-
- \section1 Thumbnail Toolbar
-
- \image qtwinextras-musicplayer-thumbnail.png Screenshot of the Music Player thumbnail
-
- The Windows Thumbnail Toolbar is used for providing basic music playback
- controls. These controls can be used to control the application without
- having to activate the application.
-
- \snippet musicplayer/musicplayer.cpp 6
-
- The buttons in the thumbnail toolbar are updated accordingly whenever the state
- of the music playback changes.
-
- \snippet musicplayer/musicplayer.cpp 3
-*/
diff --git a/examples/winextras/musicplayer/images/qt-logo.ico b/examples/winextras/musicplayer/images/qt-logo.ico
deleted file mode 100644
index b5ac59b..0000000
--- a/examples/winextras/musicplayer/images/qt-logo.ico
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/musicplayer/main.cpp b/examples/winextras/musicplayer/main.cpp
deleted file mode 100644
index 3dcf1bb..0000000
--- a/examples/winextras/musicplayer/main.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "musicplayer.h"
-
-#include <QApplication>
-#include <QCommandLineParser>
-#include <QCommandLineOption>
-#include <QDesktopWidget>
-#include <QFileInfo>
-#include <QMimeDatabase>
-#include <QSettings>
-#include <QIcon>
-#include <QDir>
-#include <QUrl>
-
-//! [0]
-static bool associateFileTypes()
-{
- QString displayName = QGuiApplication::applicationDisplayName();
- QString filePath = QCoreApplication::applicationFilePath();
- QString fileName = QFileInfo(filePath).fileName();
-
- const QString key = QStringLiteral("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\") + fileName;
- QSettings settings(key, QSettings::NativeFormat);
- if (settings.status() != QSettings::NoError) {
- qWarning() << "Cannot access registry key" << key;
- return false;
- }
- settings.setValue(QStringLiteral("FriendlyAppName"), displayName);
-
- settings.beginGroup(QStringLiteral("SupportedTypes"));
- QMimeDatabase mimeDatabase;
- const QStringList supportedMimeTypes = MusicPlayer::supportedMimeTypes();
- for (const QString &fileType : supportedMimeTypes) {
- const QStringList suffixes = mimeDatabase.mimeTypeForName(fileType).suffixes();
- for (QString suffix : suffixes) {
- suffix.prepend('.');
- settings.setValue(suffix, QString());
- }
- }
- settings.endGroup();
-
- settings.beginGroup(QStringLiteral("shell"));
- settings.beginGroup(QStringLiteral("open"));
- settings.setValue(QStringLiteral("FriendlyAppName"), displayName);
- settings.beginGroup(QStringLiteral("Command"));
- settings.setValue(QStringLiteral("."),
- u'"' + QDir::toNativeSeparators(filePath) + QStringLiteral("\" \"%1\""));
-
- return true;
-}
-//! [0]
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QCoreApplication::setApplicationName(QStringLiteral("MusicPlayer"));
- QCoreApplication::setApplicationVersion( QLatin1String(QT_VERSION_STR));
- QCoreApplication::setOrganizationName(QStringLiteral("QtWinExtras"));
- QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
- QGuiApplication::setApplicationDisplayName(QStringLiteral("QtWinExtras Music Player"));
-
- if (!associateFileTypes())
- return -1;
-
- QCommandLineParser parser;
- parser.setApplicationDescription(QGuiApplication::applicationDisplayName());
- parser.addHelpOption();
- parser.addVersionOption();
- parser.addPositionalArgument(QStringLiteral("url"), MusicPlayer::tr("The URL to open."));
- parser.process(app);
-
- MusicPlayer player;
-
- if (!parser.positionalArguments().isEmpty())
- player.playUrl(QUrl::fromUserInput(parser.positionalArguments().constFirst(), QDir::currentPath(), QUrl::AssumeLocalFile));
-
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(&player);
- player.resize(availableGeometry.width() / 6, availableGeometry.height() / 17);
- player.show();
-
- return app.exec();
-}
diff --git a/examples/winextras/musicplayer/musicplayer.cpp b/examples/winextras/musicplayer/musicplayer.cpp
deleted file mode 100644
index 0f335d2..0000000
--- a/examples/winextras/musicplayer/musicplayer.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "musicplayer.h"
-#include "volumebutton.h"
-
-#include <QtWidgets>
-#include <QtWinExtras>
-
-MusicPlayer::MusicPlayer(QWidget *parent) : QWidget(parent)
-{
- createWidgets();
- createShortcuts();
- createJumpList();
- createTaskbar();
- createThumbnailToolBar();
-
- connect(&mediaPlayer, &QMediaPlayer::positionChanged, this, &MusicPlayer::updatePosition);
- connect(&mediaPlayer, &QMediaPlayer::durationChanged, this, &MusicPlayer::updateDuration);
- connect(&mediaPlayer, &QMediaObject::metaDataAvailableChanged, this, &MusicPlayer::updateInfo);
-
- connect(&mediaPlayer, QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error),
- this, &MusicPlayer::handleError);
- connect(&mediaPlayer, &QMediaPlayer::stateChanged,
- this, &MusicPlayer::updateState);
-
- setAcceptDrops(true);
-}
-
-QStringList MusicPlayer::supportedMimeTypes()
-{
- QStringList result = QMediaPlayer::supportedMimeTypes();
- if (result.isEmpty())
- result.append(QStringLiteral("audio/mpeg"));
- return result;
-}
-
-void MusicPlayer::openFile()
-{
- QFileDialog fileDialog(this);
- fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
- fileDialog.setWindowTitle(tr("Open File"));
- fileDialog.setMimeTypeFilters(MusicPlayer::supportedMimeTypes());
- fileDialog.setDirectory(QStandardPaths::standardLocations(QStandardPaths::MusicLocation).value(0, QDir::homePath()));
- if (fileDialog.exec() == QDialog::Accepted)
- playUrl(fileDialog.selectedUrls().constFirst());
-}
-
-void MusicPlayer::playUrl(const QUrl &url)
-{
- playButton->setEnabled(true);
- if (url.isLocalFile()) {
- const QString filePath = url.toLocalFile();
- setWindowFilePath(filePath);
- infoLabel->setText(QDir::toNativeSeparators(filePath));
- fileName = QFileInfo(filePath).fileName();
- } else {
- setWindowFilePath(QString());
- infoLabel->setText(url.toString());
- fileName.clear();
- }
- mediaPlayer.setMedia(url);
- mediaPlayer.play();
-}
-
-void MusicPlayer::togglePlayback()
-{
- if (mediaPlayer.mediaStatus() == QMediaPlayer::NoMedia)
- openFile();
- else if (mediaPlayer.state() == QMediaPlayer::PlayingState)
- mediaPlayer.pause();
- else
- mediaPlayer.play();
-}
-
-void MusicPlayer::seekForward()
-{
- positionSlider->triggerAction(QSlider::SliderPageStepAdd);
-}
-
-void MusicPlayer::seekBackward()
-{
- positionSlider->triggerAction(QSlider::SliderPageStepSub);
-}
-
-//! [7]
-void MusicPlayer::showEvent(QShowEvent *event)
-{
- QWidget::showEvent(event);
- if (!taskbarButton->window()) {
- auto window = windowHandle();
- taskbarButton->setWindow(window);
- thumbnailToolBar->setWindow(window);
- }
-}
-//! [7]
-
-static bool canHandleDrop(const QDropEvent *event)
-{
- const auto urls = event->mimeData()->urls();
- if (urls.size() != 1)
- return false;
- QMimeDatabase mimeDatabase;
- return MusicPlayer::supportedMimeTypes().
- contains(mimeDatabase.mimeTypeForUrl(urls.constFirst()).name());
-}
-
-void MusicPlayer::dragEnterEvent(QDragEnterEvent *event)
-{
- event->setAccepted(canHandleDrop(event));
-}
-
-void MusicPlayer::dropEvent(QDropEvent *event)
-{
- event->accept();
- playUrl(event->mimeData()->urls().constFirst());
-}
-
-void MusicPlayer::mousePressEvent(QMouseEvent *event)
-{
- offset = event->globalPos() - pos();
- event->accept();
-}
-
-void MusicPlayer::mouseMoveEvent(QMouseEvent *event)
-{
- move(event->globalPos() - offset);
- event->accept();
-}
-
-void MusicPlayer::mouseReleaseEvent(QMouseEvent *event)
-{
- offset = QPoint();
- event->accept();
-}
-
-void MusicPlayer::updateState(QMediaPlayer::State state)
-{
- if (state == QMediaPlayer::PlayingState) {
- playButton->setToolTip(tr("Pause"));
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
- } else {
- playButton->setToolTip(tr("Play"));
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- }
-}
-
-static QString formatTime(qint64 timeMilliSeconds)
-{
- qint64 seconds = timeMilliSeconds / 1000;
- const qint64 minutes = seconds / 60;
- seconds -= minutes * 60;
- return QStringLiteral("%1:%2")
- .arg(minutes, 2, 10, QLatin1Char('0'))
- .arg(seconds, 2, 10, QLatin1Char('0'));
-}
-
-void MusicPlayer::updatePosition(qint64 position)
-{
- positionSlider->setValue(position);
- positionLabel->setText(formatTime(position));
-}
-
-void MusicPlayer::updateDuration(qint64 duration)
-{
- positionSlider->setRange(0, duration);
- positionSlider->setEnabled(duration > 0);
- positionSlider->setPageStep(duration / 10);
- updateInfo();
-}
-
-void MusicPlayer::setPosition(int position)
-{
- // avoid seeking when the slider value change is triggered from updatePosition()
- if (qAbs(mediaPlayer.position() - position) > 99)
- mediaPlayer.setPosition(position);
-}
-
-void MusicPlayer::updateInfo()
-{
- QStringList info;
- if (!fileName.isEmpty())
- info.append(fileName);
- if (mediaPlayer.isMetaDataAvailable()) {
- QString author = mediaPlayer.metaData(QStringLiteral("Author")).toString();
- if (!author.isEmpty())
- info.append(author);
- QString title = mediaPlayer.metaData(QStringLiteral("Title")).toString();
- if (!title.isEmpty())
- info.append(title);
- }
- info.append(formatTime(mediaPlayer.duration()));
- infoLabel->setText(info.join(tr(" - ")));
-}
-
-void MusicPlayer::handleError()
-{
- playButton->setEnabled(false);
- const QString errorString = mediaPlayer.errorString();
- infoLabel->setText(errorString.isEmpty()
- ? tr("Unknown error #%1").arg(int(mediaPlayer.error()))
- : tr("Error: %1").arg(errorString));
-}
-
-//! [2]
-void MusicPlayer::updateTaskbar()
-{
- switch (mediaPlayer.state()) {
- case QMediaPlayer::PlayingState:
- taskbarButton->setOverlayIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- taskbarProgress->show();
- taskbarProgress->resume();
- break;
- case QMediaPlayer::PausedState:
- taskbarButton->setOverlayIcon(style()->standardIcon(QStyle::SP_MediaPause));
- taskbarProgress->show();
- taskbarProgress->pause();
- break;
- case QMediaPlayer::StoppedState:
- taskbarButton->setOverlayIcon(style()->standardIcon(QStyle::SP_MediaStop));
- taskbarProgress->hide();
- break;
- }
-}
-//! [2]
-
-//! [3]
-void MusicPlayer::updateThumbnailToolBar()
-{
- playToolButton->setEnabled(mediaPlayer.duration() > 0);
- backwardToolButton->setEnabled(mediaPlayer.position() > 0);
- forwardToolButton->setEnabled(mediaPlayer.position() < mediaPlayer.duration());
-
- if (mediaPlayer.state() == QMediaPlayer::PlayingState) {
- playToolButton->setToolTip(tr("Pause"));
- playToolButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
- } else {
- playToolButton->setToolTip(tr("Play"));
- playToolButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- }
-}
-//! [3]
-
-void MusicPlayer::createWidgets()
-{
- playButton = new QToolButton(this);
- playButton->setEnabled(false);
- playButton->setToolTip(tr("Play"));
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- connect(playButton, &QAbstractButton::clicked, this, &MusicPlayer::togglePlayback);
-
- QAbstractButton *openButton = new QToolButton(this);
- openButton->setText(tr("..."));
- openButton->setToolTip(tr("Open a file..."));
- openButton->setFixedSize(playButton->sizeHint());
- connect(openButton, &QAbstractButton::clicked, this, &MusicPlayer::openFile);
-
- volumeButton = new VolumeButton(this);
- volumeButton->setToolTip(tr("Adjust volume"));
- volumeButton->setVolume(mediaPlayer.volume());
- connect(volumeButton, &VolumeButton::volumeChanged, &mediaPlayer, &QMediaPlayer::setVolume);
-
- positionSlider = new QSlider(Qt::Horizontal, this);
- positionSlider->setEnabled(false);
- positionSlider->setToolTip(tr("Seek"));
- connect(positionSlider, &QAbstractSlider::valueChanged, this, &MusicPlayer::setPosition);
-
- infoLabel = new QLabel(this);
- positionLabel = new QLabel(tr("00:00"), this);
- positionLabel->setMinimumWidth(positionLabel->sizeHint().width());
-
- QBoxLayout *controlLayout = new QHBoxLayout;
- controlLayout->setMargin(0);
- controlLayout->addWidget(openButton);
- controlLayout->addWidget(playButton);
- controlLayout->addWidget(positionSlider);
- controlLayout->addWidget(positionLabel);
- controlLayout->addWidget(volumeButton);
-
- QBoxLayout *mainLayout = new QVBoxLayout(this);
- mainLayout->addWidget(infoLabel);
- mainLayout->addLayout(controlLayout);
-}
-
-void MusicPlayer::createShortcuts()
-{
- QShortcut *quitShortcut = new QShortcut(QKeySequence::Quit, this);
- connect(quitShortcut, &QShortcut::activated, QCoreApplication::quit);
-
- QShortcut *openShortcut = new QShortcut(QKeySequence::Open, this);
- connect(openShortcut, &QShortcut::activated, this, &MusicPlayer::openFile);
-
- QShortcut *toggleShortcut = new QShortcut(Qt::Key_Space, this);
- connect(toggleShortcut, &QShortcut::activated, this, &MusicPlayer::togglePlayback);
-
- QShortcut *forwardShortcut = new QShortcut(Qt::Key_Right, this);
- connect(forwardShortcut, &QShortcut::activated, this, &MusicPlayer::seekForward);
-
- QShortcut *backwardShortcut = new QShortcut(Qt::Key_Left, this);
- connect(backwardShortcut, &QShortcut::activated, this, &MusicPlayer::seekBackward);
-
- QShortcut *increaseShortcut = new QShortcut(Qt::Key_Up, this);
- connect(increaseShortcut, &QShortcut::activated, volumeButton, &VolumeButton::increaseVolume);
-
- QShortcut *decreaseShortcut = new QShortcut(Qt::Key_Down, this);
- connect(decreaseShortcut, &QShortcut::activated, volumeButton, &VolumeButton::descreaseVolume);
-}
-
-//! [4]
-void MusicPlayer::createJumpList()
-{
- QWinJumpList jumplist;
- jumplist.recent()->setVisible(true);
-}
-//! [4]
-
-//! [5]
-void MusicPlayer::createTaskbar()
-{
- taskbarButton = new QWinTaskbarButton(this);
-
- taskbarProgress = taskbarButton->progress();
- connect(positionSlider, &QAbstractSlider::valueChanged, taskbarProgress, &QWinTaskbarProgress::setValue);
- connect(positionSlider, &QAbstractSlider::rangeChanged, taskbarProgress, &QWinTaskbarProgress::setRange);
-
- connect(&mediaPlayer, &QMediaPlayer::stateChanged, this, &MusicPlayer::updateTaskbar);
-}
-//! [5]
-
-//! [6]
-void MusicPlayer::createThumbnailToolBar()
-{
- thumbnailToolBar = new QWinThumbnailToolBar(this);
-
- playToolButton = new QWinThumbnailToolButton(thumbnailToolBar);
- playToolButton->setEnabled(false);
- playToolButton->setToolTip(tr("Play"));
- playToolButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- connect(playToolButton, &QWinThumbnailToolButton::clicked, this, &MusicPlayer::togglePlayback);
-
- forwardToolButton = new QWinThumbnailToolButton(thumbnailToolBar);
- forwardToolButton->setEnabled(false);
- forwardToolButton->setToolTip(tr("Fast forward"));
- forwardToolButton->setIcon(style()->standardIcon(QStyle::SP_MediaSeekForward));
- connect(forwardToolButton, &QWinThumbnailToolButton::clicked, this, &MusicPlayer::seekForward);
-
- backwardToolButton = new QWinThumbnailToolButton(thumbnailToolBar);
- backwardToolButton->setEnabled(false);
- backwardToolButton->setToolTip(tr("Rewind"));
- backwardToolButton->setIcon(style()->standardIcon(QStyle::SP_MediaSeekBackward));
- connect(backwardToolButton, &QWinThumbnailToolButton::clicked, this, &MusicPlayer::seekBackward);
-
- thumbnailToolBar->addButton(backwardToolButton);
- thumbnailToolBar->addButton(playToolButton);
- thumbnailToolBar->addButton(forwardToolButton);
-
- connect(&mediaPlayer, &QMediaPlayer::positionChanged, this, &MusicPlayer::updateThumbnailToolBar);
- connect(&mediaPlayer, &QMediaPlayer::durationChanged, this, &MusicPlayer::updateThumbnailToolBar);
- connect(&mediaPlayer, &QMediaPlayer::stateChanged, this, &MusicPlayer::updateThumbnailToolBar);
-}
-//! [6]
diff --git a/examples/winextras/musicplayer/musicplayer.h b/examples/winextras/musicplayer/musicplayer.h
deleted file mode 100644
index 58ea8c9..0000000
--- a/examples/winextras/musicplayer/musicplayer.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MUSICPLAYER_H
-#define MUSICPLAYER_H
-
-#include <QWidget>
-#include <QMediaPlayer>
-
-class VolumeButton;
-
-QT_FORWARD_DECLARE_CLASS(QLabel)
-QT_FORWARD_DECLARE_CLASS(QSlider)
-QT_FORWARD_DECLARE_CLASS(QAbstractButton)
-QT_FORWARD_DECLARE_CLASS(QWinTaskbarButton)
-QT_FORWARD_DECLARE_CLASS(QWinTaskbarProgress)
-QT_FORWARD_DECLARE_CLASS(QWinThumbnailToolBar)
-QT_FORWARD_DECLARE_CLASS(QWinThumbnailToolButton)
-
-class MusicPlayer : public QWidget
-{
- Q_OBJECT
-public:
- explicit MusicPlayer(QWidget *parent = nullptr);
-
- static QStringList supportedMimeTypes();
- static QStringList supportedSuffixes();
-
-public slots:
- void openFile();
- void playUrl(const QUrl& url);
- void togglePlayback();
- void seekForward();
- void seekBackward();
-
-protected:
- void showEvent(QShowEvent *event) override;
- void dragEnterEvent(QDragEnterEvent *event) override;
- void dropEvent(QDropEvent *event) override;
- void mousePressEvent(QMouseEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
-
-private slots:
- void updateState(QMediaPlayer::State state);
- void updatePosition(qint64 position);
- void updateDuration(qint64 duration);
- void setPosition(int position);
- void updateInfo();
- void handleError();
-
- void updateTaskbar();
- void updateThumbnailToolBar();
-
-private:
- void createWidgets();
- void createShortcuts();
- void createJumpList();
- void createTaskbar();
- void createThumbnailToolBar();
-
- QWinTaskbarButton *taskbarButton = nullptr;
- QWinTaskbarProgress *taskbarProgress = nullptr;
- QWinThumbnailToolBar *thumbnailToolBar = nullptr;
- QWinThumbnailToolButton *playToolButton = nullptr;
- QWinThumbnailToolButton *forwardToolButton = nullptr;
- QWinThumbnailToolButton *backwardToolButton = nullptr;
-
- QMediaPlayer mediaPlayer;
- QAbstractButton *playButton = nullptr;
- VolumeButton *volumeButton = nullptr;
- QSlider *positionSlider = nullptr;
- QLabel *positionLabel = nullptr;
- QLabel *infoLabel = nullptr;
- QPoint offset;
- QString fileName;
-};
-
-#endif // MUSICPLAYER_H
diff --git a/examples/winextras/musicplayer/musicplayer.pro b/examples/winextras/musicplayer/musicplayer.pro
deleted file mode 100644
index ae8f4eb..0000000
--- a/examples/winextras/musicplayer/musicplayer.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TEMPLATE = app
-TARGET = musicplayer
-
-QT += widgets multimedia winextras
-
-HEADERS = \
- musicplayer.h \
- volumebutton.h
-
-SOURCES = \
- main.cpp \
- musicplayer.cpp \
- volumebutton.cpp
-
-RC_ICONS = images/qt-logo.ico
-
-target.path = $$[QT_INSTALL_EXAMPLES]/winextras/musicplayer
-INSTALLS += target
diff --git a/examples/winextras/musicplayer/volumebutton.cpp b/examples/winextras/musicplayer/volumebutton.cpp
deleted file mode 100644
index 9a8cc44..0000000
--- a/examples/winextras/musicplayer/volumebutton.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "volumebutton.h"
-
-#include <QtWidgets>
-#include <QtWinExtras>
-
-VolumeButton::VolumeButton(QWidget *parent) :
- QToolButton(parent)
-{
- setIcon(style()->standardIcon(QStyle::SP_MediaVolume));
- setPopupMode(QToolButton::InstantPopup);
-
- QWidget *popup = new QWidget(this);
-
- slider = new QSlider(Qt::Horizontal, popup);
- slider->setRange(0, 100);
- connect(slider, &QAbstractSlider::valueChanged, this, &VolumeButton::volumeChanged);
-
- label = new QLabel(popup);
- label->setAlignment(Qt::AlignCenter);
- label->setNum(100);
- label->setMinimumWidth(label->sizeHint().width());
-
- connect(slider, &QAbstractSlider::valueChanged, label, QOverload<int>::of(&QLabel::setNum));
-
- QBoxLayout *popupLayout = new QHBoxLayout(popup);
- popupLayout->setMargin(2);
- popupLayout->addWidget(slider);
- popupLayout->addWidget(label);
-
- auto *action = new QWidgetAction(this);
- action->setDefaultWidget(popup);
-
- menu = new QMenu(this);
- menu->addAction(action);
- setMenu(menu);
-}
-
-void VolumeButton::increaseVolume()
-{
- slider->triggerAction(QSlider::SliderPageStepAdd);
-}
-
-void VolumeButton::descreaseVolume()
-{
- slider->triggerAction(QSlider::SliderPageStepSub);
-}
-
-int VolumeButton::volume() const
-{
- return slider->value();
-}
-
-void VolumeButton::setVolume(int volume)
-{
- slider->setValue(volume);
-}
diff --git a/examples/winextras/musicplayer/volumebutton.h b/examples/winextras/musicplayer/volumebutton.h
deleted file mode 100644
index cb193dc..0000000
--- a/examples/winextras/musicplayer/volumebutton.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VOLUMEBUTTON_H
-#define VOLUMEBUTTON_H
-
-#include <QToolButton>
-
-QT_FORWARD_DECLARE_CLASS(QMenu)
-QT_FORWARD_DECLARE_CLASS(QLabel)
-QT_FORWARD_DECLARE_CLASS(QSlider)
-
-class VolumeButton : public QToolButton
-{
- Q_OBJECT
- Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)
-
-public:
- explicit VolumeButton(QWidget *parent = nullptr);
-
- int volume() const;
-
-public slots:
- void increaseVolume();
- void descreaseVolume();
- void setVolume(int volume);
-
-signals:
- void volumeChanged(int volume);
-
-private:
- QMenu *menu = nullptr;
- QLabel *label = nullptr;
- QSlider *slider = nullptr;
-};
-
-#endif // VOLUMEBUTTON_H
diff --git a/examples/winextras/quickplayer/CMakeLists.txt b/examples/winextras/quickplayer/CMakeLists.txt
deleted file mode 100644
index 9c46fb9..0000000
--- a/examples/winextras/quickplayer/CMakeLists.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-# Generated from quickplayer.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(quickplayer LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/winextras/quickplayer")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-
-add_qt_gui_executable(quickplayer
- main.cpp
-)
-target_link_libraries(quickplayer PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Quick
-)
-
-
-# Resources:
-set_source_files_properties("images/media-pause-16.png"
- PROPERTIES QT_RESOURCE_ALIAS "pause-16.png"
-)
-set_source_files_properties("images/media-pause-32.png"
- PROPERTIES QT_RESOURCE_ALIAS "pause-32.png"
-)
-set_source_files_properties("images/media-play-16.png"
- PROPERTIES QT_RESOURCE_ALIAS "play-16.png"
-)
-set_source_files_properties("images/media-play-32.png"
- PROPERTIES QT_RESOURCE_ALIAS "play-32.png"
-)
-set_source_files_properties("images/media-seek-backward-32.png"
- PROPERTIES QT_RESOURCE_ALIAS "backward-32.png"
-)
-set_source_files_properties("images/media-seek-forward-32.png"
- PROPERTIES QT_RESOURCE_ALIAS "forward-32.png"
-)
-set_source_files_properties("images/media-stop-32.png"
- PROPERTIES QT_RESOURCE_ALIAS "stop-32.png"
-)
-set_source_files_properties("qml/main.qml"
- PROPERTIES QT_RESOURCE_ALIAS "main.qml"
-)
-set(quickplayer_resource_files
- "images/media-pause-16.png"
- "images/media-pause-32.png"
- "images/media-play-16.png"
- "images/media-play-32.png"
- "images/media-seek-backward-32.png"
- "images/media-seek-forward-32.png"
- "images/media-stop-32.png"
- "qml/main.qml"
-)
-
-qt6_add_resources(quickplayer "quickplayer"
- PREFIX
- "/"
- FILES
- ${quickplayer_resource_files}
-)
-
-install(TARGETS quickplayer
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-composited.png b/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-composited.png
deleted file mode 100644
index 76c8734..0000000
--- a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-composited.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-taskbar.png b/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-taskbar.png
deleted file mode 100644
index 17d62b8..0000000
--- a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-taskbar.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-thumbnail.png b/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-thumbnail.png
deleted file mode 100644
index 0312ee2..0000000
--- a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-thumbnail.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/doc/src/qtwinextras-quickplayer.qdoc b/examples/winextras/quickplayer/doc/src/qtwinextras-quickplayer.qdoc
deleted file mode 100644
index 1492865..0000000
--- a/examples/winextras/quickplayer/doc/src/qtwinextras-quickplayer.qdoc
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example quickplayer
- \title Quick Player
- \ingroup examples-qtwinextras
- \brief Demonstrates using QtWinExtras in Qt Quick.
-
- \image qtwinextras-quickplayer-composited.png Screenshot of the Quick Player example
-
- The Quick Player example demonstrates how to use the various features
- provided by the QtWinExtras module in Qt Quick.
-
- \note This example is a simplified Qt Quick-based version of the \l {Music Player} example.
-
- \section1 DWM Features
-
- The example uses Windows DWM (Desktop Window Manager) features to visually
- integrate the window content to the window frame and to make the window
- translucent and blurred.
-
- \snippet quickplayer/qml/main.qml dwm
-
- \section1 Taskbar Overlay and Progress
-
- The example uses Windows Taskbar for two things; it sets an overlay icon
- that represents the current music playback state, and it indicates the
- playback progress in the taskbar button.
-
- \image qtwinextras-quickplayer-taskbar.png Screenshot of the Quick Player taskbar
-
- The following snippet shows how the taskbar button is prepared. The taskbar progress
- indicator and the overlay icon are bound to the music playback, and will automatically
- change whenever the state or attributes of the music playback change.
-
- \snippet quickplayer/qml/main.qml taskbar
-
- \section1 Thumbnail Toolbar
-
- \image qtwinextras-quickplayer-thumbnail.png Screenshot of the Quick Player thumbnail
-
- The Windows Thumbnail Toolbar is used for providing basic music playback
- controls. These controls can be used to control the application without
- having to activate the application. The thumbnail toolbar buttons are bound
- to the music playback, and will automatically change whenever the state or
- attributes of the music playback changes.
-
- \snippet quickplayer/qml/main.qml thumbbar
-*/
diff --git a/examples/winextras/quickplayer/images/media-pause-16.png b/examples/winextras/quickplayer/images/media-pause-16.png
deleted file mode 100644
index 8d06287..0000000
--- a/examples/winextras/quickplayer/images/media-pause-16.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/images/media-pause-32.png b/examples/winextras/quickplayer/images/media-pause-32.png
deleted file mode 100644
index 3f172a0..0000000
--- a/examples/winextras/quickplayer/images/media-pause-32.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/images/media-play-16.png b/examples/winextras/quickplayer/images/media-play-16.png
deleted file mode 100644
index d7ee3cc..0000000
--- a/examples/winextras/quickplayer/images/media-play-16.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/images/media-play-32.png b/examples/winextras/quickplayer/images/media-play-32.png
deleted file mode 100644
index af8d2f7..0000000
--- a/examples/winextras/quickplayer/images/media-play-32.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/images/media-seek-backward-32.png b/examples/winextras/quickplayer/images/media-seek-backward-32.png
deleted file mode 100644
index c14112e..0000000
--- a/examples/winextras/quickplayer/images/media-seek-backward-32.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/images/media-seek-forward-32.png b/examples/winextras/quickplayer/images/media-seek-forward-32.png
deleted file mode 100644
index 00c0747..0000000
--- a/examples/winextras/quickplayer/images/media-seek-forward-32.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/images/media-stop-32.png b/examples/winextras/quickplayer/images/media-stop-32.png
deleted file mode 100644
index aae24ba..0000000
--- a/examples/winextras/quickplayer/images/media-stop-32.png
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/images/qt-logo.ico b/examples/winextras/quickplayer/images/qt-logo.ico
deleted file mode 100644
index b5ac59b..0000000
--- a/examples/winextras/quickplayer/images/qt-logo.ico
+++ /dev/null
Binary files differ
diff --git a/examples/winextras/quickplayer/main.cpp b/examples/winextras/quickplayer/main.cpp
deleted file mode 100644
index caf3a01..0000000
--- a/examples/winextras/quickplayer/main.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QQmlApplicationEngine>
-#include <QGuiApplication>
-#include <QCommandLineParser>
-#include <QCommandLineOption>
-#include <QWindow>
-#include <QQmlContext>
-#include <QStandardPaths>
-#include <QDir>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QGuiApplication app(argc, argv);
- QCoreApplication::setApplicationName(QStringLiteral("QuickPlayer"));
- QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
- QCoreApplication::setOrganizationName(QStringLiteral("QtWinExtras"));
- QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
- QGuiApplication::setApplicationDisplayName(QStringLiteral("QtWinExtras Quick Player"));
-
- QQmlApplicationEngine engine;
- const QStringList musicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
- const QUrl musicUrl = QUrl::fromLocalFile(musicPaths.isEmpty() ? QDir::homePath() : musicPaths.first());
- engine.rootContext()->setContextProperty(QStringLiteral("musicUrl"), musicUrl);
-
- QCommandLineParser parser;
- parser.setApplicationDescription(QGuiApplication::applicationDisplayName());
- parser.addHelpOption();
- parser.addVersionOption();
- parser.addPositionalArgument(QStringLiteral("url"), QStringLiteral("The URL to open."));
- parser.process(app);
- QUrl commandLineUrl;
- if (!parser.positionalArguments().isEmpty())
- commandLineUrl = QUrl::fromUserInput(parser.positionalArguments().constFirst(), QDir::currentPath(), QUrl::AssumeLocalFile);
- engine.rootContext()->setContextProperty(QStringLiteral("url"), commandLineUrl);
-
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- QObject *root = engine.rootObjects().value(0);
- if (QWindow *window = qobject_cast<QWindow *>(root))
- window->show();
- else
- return -1;
- return app.exec();
-}
diff --git a/examples/winextras/quickplayer/qml/main.qml b/examples/winextras/quickplayer/qml/main.qml
deleted file mode 100644
index ec309a5..0000000
--- a/examples/winextras/quickplayer/qml/main.qml
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.1
-import QtQuick.Window 2.1
-import QtQuick.Layouts 1.0
-import QtQuick.Controls 1.0
-import QtQuick.Dialogs 1.0
-import QtMultimedia 5.0
-import QtWinExtras 1.0 as Win
-
-Window {
- id: window
-
- title: qsTr("QtWinExtras Quick Player")
-
- width: 300
- height: 60
- minimumWidth: row.implicitWidth + 18
- minimumHeight: column.implicitHeight + 18
-
- //! [color]
- color: "transparent"
- //! [color]
-
- //! [dwm]
- Win.DwmFeatures {
- id: dwm
-
- topGlassMargin: -1
- leftGlassMargin: -1
- rightGlassMargin: -1
- bottomGlassMargin: -1
- }
- //! [dwm]
-
- //! [taskbar]
- Win.TaskbarButton {
- id: taskbar
-
- progress.value: mediaPlayer.position
- progress.maximum: mediaPlayer.duration
- progress.visible: mediaPlayer.hasAudio
- progress.paused: mediaPlayer.playbackState === MediaPlayer.PausedState
-
- overlay.iconSource: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/play-32.png" :
- mediaPlayer.playbackState === MediaPlayer.PausedState ? "qrc:/pause-32.png" : "qrc:/stop-32.png"
- }
- //! [taskbar]
-
- //! [thumbbar]
- Win.ThumbnailToolBar {
- id: thumbbar
-
- Win.ThumbnailToolButton {
- tooltip: qsTr("Rewind")
- iconSource: "qrc:/backward-32.png"
-
- enabled: mediaPlayer.position > 0
- onClicked: mediaPlayer.seek(mediaPlayer.position - mediaPlayer.duration / 10)
- }
-
- Win.ThumbnailToolButton {
- tooltip: mediaPlayer.playbackState === MediaPlayer.PlayingState ? qsTr("Pause") : qsTr("Play")
- iconSource: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/pause-32.png" : "qrc:/play-32.png"
-
- enabled: mediaPlayer.hasAudio
- onClicked: mediaPlayer.playbackState === MediaPlayer.PlayingState ? mediaPlayer.pause() : mediaPlayer.play()
- }
-
- Win.ThumbnailToolButton {
- tooltip: qsTr("Fast forward")
- iconSource: "qrc:/forward-32.png"
-
- enabled: mediaPlayer.position < mediaPlayer.duration
- onClicked: mediaPlayer.seek(mediaPlayer.position + mediaPlayer.duration / 10)
- }
- }
- //! [thumbbar]
-
- MediaPlayer {
- id: mediaPlayer
- autoPlay: true
- source : url
- readonly property string title: !!metaData.author && !!metaData.title
- ? qsTr("%1 - %2").arg(metaData.author).arg(metaData.title)
- : metaData.author || metaData.title || source
- }
-
- ColumnLayout {
- id: column
-
- anchors.margins: 9
- anchors.fill: parent
-
- Label {
- id: infoLabel
-
- elide: Qt.ElideLeft
- verticalAlignment: Qt.AlignVCenter
- text: mediaPlayer.errorString || mediaPlayer.title
- Layout.minimumHeight: infoLabel.implicitHeight
- Layout.fillWidth: true
- Layout.fillHeight: true
- }
-
- RowLayout {
- id: row
-
- Button {
- id: openButton
-
- text: qsTr("...")
- Layout.preferredWidth: openButton.implicitHeight
- onClicked: fileDialog.open()
-
- FileDialog {
- id: fileDialog
-
- folder : musicUrl
- title: qsTr("Open file")
- nameFilters: [qsTr("MP3 files (*.mp3)"), qsTr("All files (*.*)")]
- onAccepted: mediaPlayer.source = fileDialog.fileUrl
- }
- }
-
- Button {
- id: playButton
-
- enabled: mediaPlayer.hasAudio
- Layout.preferredWidth: playButton.implicitHeight
- iconSource: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/pause-16.png" : "qrc:/play-16.png"
- onClicked: mediaPlayer.playbackState === MediaPlayer.PlayingState ? mediaPlayer.pause() : mediaPlayer.play()
- }
-
- Slider {
- id: positionSlider
-
- Layout.fillWidth: true
- maximumValue: mediaPlayer.duration
-
- property bool sync: false
-
- onValueChanged: {
- if (!sync)
- mediaPlayer.seek(value)
- }
-
- Connections {
- target: mediaPlayer
- onPositionChanged: {
- positionSlider.sync = true
- positionSlider.value = mediaPlayer.position
- positionSlider.sync = false
- }
- }
- }
-
- Label {
- id: positionLabel
-
- readonly property int minutes: Math.floor(mediaPlayer.position / 60000)
- readonly property int seconds: Math.round((mediaPlayer.position % 60000) / 1000)
-
- text: Qt.formatTime(new Date(0, 0, 0, 0, minutes, seconds), qsTr("mm:ss"))
- }
- }
- }
-}
diff --git a/examples/winextras/quickplayer/quickplayer.pro b/examples/winextras/quickplayer/quickplayer.pro
deleted file mode 100644
index 77f9c97..0000000
--- a/examples/winextras/quickplayer/quickplayer.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TEMPLATE = app
-TARGET = quickplayer
-
-QT += quick
-
-SOURCES = \
- main.cpp
-
-OTHER_FILES += \
- qml/main.qml
-
-RESOURCES += \
- quickplayer.qrc
-
-RC_ICONS = images/qt-logo.ico
-
-target.path = $$[QT_INSTALL_EXAMPLES]/winextras/quickplayer
-INSTALLS += target
diff --git a/examples/winextras/quickplayer/quickplayer.qrc b/examples/winextras/quickplayer/quickplayer.qrc
deleted file mode 100644
index e046252..0000000
--- a/examples/winextras/quickplayer/quickplayer.qrc
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file alias="main.qml">qml/main.qml</file>
- <file alias="pause-16.png">images/media-pause-16.png</file>
- <file alias="pause-32.png">images/media-pause-32.png</file>
- <file alias="play-16.png">images/media-play-16.png</file>
- <file alias="play-32.png">images/media-play-32.png</file>
- <file alias="backward-32.png">images/media-seek-backward-32.png</file>
- <file alias="forward-32.png">images/media-seek-forward-32.png</file>
- <file alias="stop-32.png">images/media-stop-32.png</file>
-</qresource>
-</RCC>
diff --git a/examples/winextras/quickplayer/quickplayer.rc b/examples/winextras/quickplayer/quickplayer.rc
deleted file mode 100644
index 00a51ee..0000000
--- a/examples/winextras/quickplayer/quickplayer.rc
+++ /dev/null
@@ -1 +0,0 @@
-IDI_ICON1 ICON DISCARDABLE "images\\musicplayer.ico"
diff --git a/examples/winextras/winextras.pro b/examples/winextras/winextras.pro
deleted file mode 100644
index 467d53b..0000000
--- a/examples/winextras/winextras.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-win32 {
- SUBDIRS += \
- iconextractor
- qtHaveModule(widgets):qtHaveModule(multimedia): SUBDIRS += musicplayer
- qtHaveModule(quick):qtHaveModule(multimedia): SUBDIRS += quickplayer
-}