From a8699963b98fe2d1dcc33658ac006100b69444b1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 30 Sep 2013 23:02:58 +0200 Subject: A music player example Change-Id: Ie28baa6373a8852b31137ed3c076ab4309d1c98f Reviewed-by: Friedemann Kleint --- .../images/qtwinextras-musicplayer-composited.png | Bin 0 -> 123581 bytes .../qtwinextras-musicplayer-non-composited.png | Bin 0 -> 59305 bytes .../doc/images/qtwinextras-musicplayer-taskbar.png | Bin 0 -> 12622 bytes .../images/qtwinextras-musicplayer-thumbnail.png | Bin 0 -> 56812 bytes .../doc/src/qtwinextras-musicplayer.qdoc | 128 +++++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.png create mode 100644 examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-non-composited.png create mode 100644 examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.png create mode 100644 examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.png create mode 100644 examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc (limited to 'examples/winextras/musicplayer/doc') diff --git a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.png b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.png new file mode 100644 index 0000000..3ae91f9 Binary files /dev/null and b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-composited.png differ diff --git a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-non-composited.png b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-non-composited.png new file mode 100644 index 0000000..682449b Binary files /dev/null and b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-non-composited.png differ diff --git a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.png b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.png new file mode 100644 index 0000000..b03d192 Binary files /dev/null and b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-taskbar.png differ diff --git a/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.png b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.png new file mode 100644 index 0000000..2198ec8 Binary files /dev/null and b/examples/winextras/musicplayer/doc/images/qtwinextras-musicplayer-thumbnail.png differ diff --git a/examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc b/examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc new file mode 100644 index 0000000..d6b088b --- /dev/null +++ b/examples/winextras/musicplayer/doc/src/qtwinextras-musicplayer.qdoc @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 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 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: http://www.gnu.org/copyleft/fdl.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. + + The example applies a different look based on whether composition is enabled + or not. When composition is enabled, the main window is made translucent and + the window frame is extended to the client area to make the window content + integrate seamlessly to the window frame as shown above. When composition + is disabled, the colorization color is used as a background color. The + following screenshot illustrates how the Music Player example looks when + composition is disabled. + + \image qtwinextras-musicplayer-non-composited.png Screenshot of the Music Player example + + The respective code is a combination of extending or resetting the system + frame, adjusting the necessary QWidget attributes, and setting an appropriate + style sheet to achieve the desired look. + + \snippet musicplayer/musicplayer.cpp 1 + + The volume popup does not have a window frame so it is enough to make the + popup blurred when composition is enabled. Additionally, a style sheet is + applied to get a border that follows the colorization color. Just like for + the main window, when composition is disabled, the colorization color is + used as a background color. + + \snippet musicplayer/volumebutton.cpp 0 + + The example application respects the user's composition settings, reacts + to dynamic composition changes, and looks solid regardless of whether + composition is enabled or not. It accomplishes this by catching + QWinEvent::CompositionChange and QWinEvent::ColorizationChange events + and adjusting its looks accordingly. + + \snippet musicplayer/musicplayer.cpp 0 + + \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 snippet shows how the taskbar button is prepared. 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 +*/ -- cgit v1.2.3