Skip to content

Commit

Permalink
Committing qtwinextras files
Browse files Browse the repository at this point in the history
  • Loading branch information
RaymondMitchell-GG committed Jan 26, 2016
1 parent 843b507 commit 88c236a
Show file tree
Hide file tree
Showing 29 changed files with 602 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/****************************************************************************
**
** 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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.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.
*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/****************************************************************************
**
** 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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://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: 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
*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/****************************************************************************
**
** 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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.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.

The example applies a different look based on whether composition is enabled
or not. When composition is enabled, the 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.

\snippet quickplayer/qml/main.qml dwm

When composition is disabled, the colorization color is used as a background
color for the window.

\snippet quickplayer/qml/main.qml color

The following screenshot illustrates how the Quick Player example looks when
composition is disabled.

\image qtwinextras-quickplayer-non-composited.png Screenshot of the Quick Player example

\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
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwineventfilter_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwinfunctions_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwinjumplist_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwinjumplistcategory_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwinjumplistitem_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwintaskbarbutton_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwinthumbnailtoolbar_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/qwinthumbnailtoolbutton_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/windowsguidsdefs_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/winpropkey_p.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../../src/winextras/winshobjidl_p.h"
62 changes: 62 additions & 0 deletions qt-5/qtwinextras/src/winextras/doc/snippets/code/jumplist.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/****************************************************************************
**
** Copyright (C) 2013 Ivan Vizir <[email protected]>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 <QWinJumpList>

void foo()
{
//! [jumplist]
QWinJumpList jumplist;
jumplist.begin();
jumplist.setKnownCategoryShown(QWinJumpList::RecentCategory);

jumplist.beginTasks();

QWinJumpListItem *newProject = new QWinJumpListItem(QWinJumpListItem::Link);
newProject->setTitle(tr("Create new project"));
newProject->setFilePath(QDir::toNativeSeparators(QCoreApplication::applicationFilePath()));
newProject->setArguments(QStringList("--new-project"));
jumplist.addItem(newProject);

jumplist.addLink(tr("Launch SDK Manager"), QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "\\sdk-manager.exe");

jumplist.commit();
//! [jumplist]
}
55 changes: 55 additions & 0 deletions qt-5/qtwinextras/src/winextras/doc/snippets/code/taskbar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/****************************************************************************
**
** 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:BSD$
** 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 <QtWinExtras>

void initializeTaskbarButton(QWidget *widget)
{
Q_ASSERT(widget->windowHandle()); // Note: this requires the window to be shown.
//! [taskbar_cpp]
QWinTaskbarButton *button = new QWinTaskbarButton(widget);
button->setWindow(widget->windowHandle());
button->setOverlayIcon(QIcon(":/loading.png"));

QWinTaskbarProgress *progress = button->progress();
progress->setVisible(true);
progress->setValue(50);
//! [taskbar_cpp]
}
Loading

0 comments on commit 88c236a

Please sign in to comment.