diff options
author | Gatis Paeglis <gatis.paeglis@nokia.com> | 2012-06-11 16:09:20 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-11 17:13:22 +0200 |
commit | 8a897fc929f34f6b8292bf0ec2371f74ed964401 (patch) | |
tree | 12c234b849716b7b01a8088b07b40144aef7370f /examples | |
parent | 8f7a6217e99f0e4b6becfb6f0763e3dd7290ba23 (diff) | |
download | qtsvg-8a897fc929f34f6b8292bf0ec2371f74ed964401.tar.gz |
Remove unnecessary systray example.
Removing example which is almost identical to the example from the qtbase module.
Task-number: QTBUG-26113
Change-Id: Ied83969d4ee9fb8bef1528472957f66593a9f15c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/desktop/desktop.pro | 3 | ||||
-rw-r--r-- | examples/desktop/systray/images/bad.svg | 64 | ||||
-rw-r--r-- | examples/desktop/systray/images/heart.svg | 55 | ||||
-rw-r--r-- | examples/desktop/systray/images/trash.svg | 58 | ||||
-rw-r--r-- | examples/desktop/systray/main.cpp | 62 | ||||
-rw-r--r-- | examples/desktop/systray/systray.pro | 25 | ||||
-rw-r--r-- | examples/desktop/systray/systray.qrc | 7 | ||||
-rw-r--r-- | examples/desktop/systray/window.cpp | 258 | ||||
-rw-r--r-- | examples/desktop/systray/window.h | 112 | ||||
-rw-r--r-- | examples/examples.pro | 2 |
10 files changed, 1 insertions, 645 deletions
diff --git a/examples/desktop/desktop.pro b/examples/desktop/desktop.pro deleted file mode 100644 index 0e4d00c..0000000 --- a/examples/desktop/desktop.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += systray -QT+=widgets diff --git a/examples/desktop/systray/images/bad.svg b/examples/desktop/systray/images/bad.svg deleted file mode 100644 index 186dba9..0000000 --- a/examples/desktop/systray/images/bad.svg +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" -"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> -<svg viewBox="-10 -10 178 178" height="177.523" id="svg1" inkscape:version="0.40" sodipodi:docbase="/mnt/donnees/09-Mes_images/Travaux/Travaux vectoriel/pictogrammes/sécu SVG/produits chimiques" sodipodi:docname="XiIrritant.svg" sodipodi:version="0.32" width="155.932" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink"> -<metadata> -<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> -<cc:Work rdf:about=""> -<dc:title>Irritant</dc:title> -<dc:description>produit chimique</dc:description> -<dc:subject> -<rdf:Bag> -<rdf:li></rdf:li> -<rdf:li>symbol</rdf:li> -<rdf:li>signs_and_symbols</rdf:li> -</rdf:Bag> -</dc:subject> -<dc:publisher> -<cc:Agent rdf:about="http://www.openclipart.org"> -<dc:title>yves GUILLOU</dc:title> -</cc:Agent> -</dc:publisher> -<dc:creator> -<cc:Agent> -<dc:title>yves GUILLOU</dc:title> -</cc:Agent> -</dc:creator> -<dc:rights> -<cc:Agent> -<dc:title>yves GUILLOU</dc:title> -</cc:Agent> -</dc:rights> -<dc:date></dc:date> -<dc:format>image/svg+xml</dc:format> -<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> -<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/> -<dc:language>en</dc:language> -</cc:Work> -<cc:License rdf:about="http://web.resource.org/cc/PublicDomain"> -<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> -<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> -<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> -</cc:License> -</rdf:RDF> -</metadata> -<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="svg1" inkscape:cx="62.372805" inkscape:cy="34.864537" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="1121" inkscape:window-width="1590" inkscape:window-x="200" inkscape:window-y="0" inkscape:zoom="6.6399849" pagecolor="#ffffff"/> -<defs id="defs2"> -<marker id="ArrowEnd" markerHeight="3" markerUnits="strokeWidth" markerWidth="4" orient="auto" refX="0" refY="5" viewBox="0 0 10 10"> -<path d="M 0 0 L 10 5 L 0 10 z" id="path4"/> -</marker> -<marker id="ArrowStart" markerHeight="3" markerUnits="strokeWidth" markerWidth="4" orient="auto" refX="10" refY="5" viewBox="0 0 10 10"> -<path d="M 10 0 L 0 5 L 10 10 z" id="path6"/> -</marker> -</defs> -<g id="g7"> -<g id="g8"> -<path d="M 155.932 155.932L 155.932 0L 0 0L 0 155.932L 155.932 155.932z" id="path9" style="stroke:none; fill:#000000"/> -<path d="M 150.83 150.83L 150.83 5.1011L 5.1011 5.1011L 5.1011 150.83L 150.83 150.83z" id="path10" style="stroke:none; fill:#ff9900"/> -</g> -<g id="g11"> -<path d="M 140.823 111.783L 44.3677 14.0771L 15.1084 44.1489L 111.564 141.854L 140.823 111.783z" id="path12" style="stroke:none; fill:#000000"/> -<path d="M 111.783 15.1084L 14.0771 111.564L 44.1489 140.823L 141.855 44.3677L 111.783 15.1084z" id="path13" style="stroke:none; fill:#000000"/> -</g> -</g> -</svg> diff --git a/examples/desktop/systray/images/heart.svg b/examples/desktop/systray/images/heart.svg deleted file mode 100644 index ba5f050..0000000 --- a/examples/desktop/systray/images/heart.svg +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="595.27559pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"> -<metadata> -<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> -<cc:Work rdf:about=""> -<dc:title>Heart Left-Highlight</dc:title> -<dc:description>This is a normal valentines day heart.</dc:description> -<dc:subject> -<rdf:Bag> -<rdf:li>holiday</rdf:li> -<rdf:li>valentines</rdf:li> -<rdf:li></rdf:li> -<rdf:li>valentine</rdf:li> -<rdf:li>hash(0x8a091c0)</rdf:li> -<rdf:li>hash(0x8a0916c)</rdf:li> -<rdf:li>signs_and_symbols</rdf:li> -<rdf:li>hash(0x8a091f0)</rdf:li> -<rdf:li>day</rdf:li> -</rdf:Bag> -</dc:subject> -<dc:publisher> -<cc:Agent rdf:about="http://www.openclipart.org"> -<dc:title>Jon Phillips</dc:title> -</cc:Agent> -</dc:publisher> -<dc:creator> -<cc:Agent> -<dc:title>Jon Phillips</dc:title> -</cc:Agent> -</dc:creator> -<dc:rights> -<cc:Agent> -<dc:title>Jon Phillips</dc:title> -</cc:Agent> -</dc:rights> -<dc:date></dc:date> -<dc:format>image/svg+xml</dc:format> -<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> -<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/> -<dc:language>en</dc:language> -</cc:Work> -<cc:License rdf:about="http://web.resource.org/cc/PublicDomain"> -<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> -<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> -<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> -</cc:License> -</rdf:RDF> -</metadata> -<defs id="defs3"/> -<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/> -<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1"> -<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/> -<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/> -</g> -</svg> diff --git a/examples/desktop/systray/images/trash.svg b/examples/desktop/systray/images/trash.svg deleted file mode 100644 index c44e4c7..0000000 --- a/examples/desktop/systray/images/trash.svg +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generator: Adobe Illustrator 10, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) --><svg enable-background="new 0 0 347 348" height="348" i:pageBounds="0 792 612 0" i:rulerOrigin="0 0" i:viewOrigin="131 567" overflow="visible" space="preserve" viewBox="-20 -20 387 388" width="347" xmlns="http://www.w3.org/2000/svg" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:xlink="http://www.w3.org/1999/xlink"> -<metadata> -<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> -<cc:Work rdf:about=""> -<dc:title>Keep Tidy Inside</dc:title> -<dc:description></dc:description> -<dc:subject> -<rdf:Bag> -<rdf:li></rdf:li> -<rdf:li>symbol</rdf:li> -<rdf:li>bin</rdf:li> -<rdf:li>signs_and_symbols</rdf:li> -<rdf:li>clean</rdf:li> -<rdf:li>rubish</rdf:li> -<rdf:li>trash</rdf:li> -<rdf:li>inside</rdf:li> -<rdf:li>garbage</rdf:li> -<rdf:li>sign</rdf:li> -</rdf:Bag> -</dc:subject> -<dc:publisher> -<cc:Agent rdf:about="http://www.openclipart.org"> -<dc:title>Martin Owens</dc:title> -</cc:Agent> -</dc:publisher> -<dc:creator> -<cc:Agent> -<dc:title>Martin Owens</dc:title> -</cc:Agent> -</dc:creator> -<dc:rights> -<cc:Agent> -<dc:title>Martin Owens</dc:title> -</cc:Agent> -</dc:rights> -<dc:date></dc:date> -<dc:format>image/svg+xml</dc:format> -<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> -<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/> -<dc:language>en</dc:language> -</cc:Work> -<cc:License rdf:about="http://web.resource.org/cc/PublicDomain"> -<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> -<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> -<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> -</cc:License> -</rdf:RDF> -</metadata> -<g i:dimmedPercent="50" i:knockout="Off" i:layer="yes" i:rgbTrio="#4F008000FFFF" id="Layer_1"> -<path d="M347,174c0,96.098-77.679,174-173.5,174C77.679,348,0,270.098,0,174 C0,77.902,77.679,0,173.5,0C269.321,0,347,77.902,347,174z" fill="#10A040" i:knockout="Off"/> -<path d="M238,53c0,13.807-11.864,25-26.5,25S185,66.807,185,53s11.864-25,26.5-25 S238,39.193,238,53z" fill="#FFFFFF" i:knockout="Off"/> -<path d="M66,175c1.055,6.355,19.333,126.417,19.333,126.417h68.333 c0,0,14.105-122.524,14.333-126.417c6.224-0.622,6.667-13-2-13c-12.164,0-89.205-0.059-98,0S61.167,174.487,66,175z" fill="#FFFFFF" i:knockout="Off"/> -<path d="M78,141c17.292-5.325,24.179-23.532,27-31c14.513,6.596,40.333,12.265,59,8 c3.683,19.419-28.043,19.31-23,37C132.577,145.705,89.404,167.292,78,141z" fill="#FFFFFF" i:knockout="Off"/> -<path d="M103,82l139-1c-0.6,3.421,33.633,57.497,29,67c-4.089,0.418-67,5-67,5 c6.109-9.379-13-43-13-43L103,82z" fill="#FFFFFF" i:knockout="Off"/> -<path d="M270,156l-66-3c0,0-23.565,143.355-24,145s1.855,2.536,3,1s51-82,51-82 s19.754,80.701,20,82s3.721,1.209,4,0S270,156,270,156z" fill="#FFFFFF" i:knockout="Off"/> -</g> -</svg> diff --git a/examples/desktop/systray/main.cpp b/examples/desktop/systray/main.cpp deleted file mode 100644 index 70e35d6..0000000 --- a/examples/desktop/systray/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtWidgets> - -#include "window.h" - -int main(int argc, char *argv[]) -{ - Q_INIT_RESOURCE(systray); - - QApplication app(argc, argv); - - if (!QSystemTrayIcon::isSystemTrayAvailable()) { - QMessageBox::critical(0, QObject::tr("Systray"), - QObject::tr("I couldn't detect any system tray " - "on this system.")); - return 1; - } - QApplication::setQuitOnLastWindowClosed(false); - - Window window; - window.show(); - return app.exec(); -} diff --git a/examples/desktop/systray/systray.pro b/examples/desktop/systray/systray.pro deleted file mode 100644 index 8ce8a3a..0000000 --- a/examples/desktop/systray/systray.pro +++ /dev/null @@ -1,25 +0,0 @@ -HEADERS = window.h -SOURCES = main.cpp \ - window.cpp -RESOURCES = systray.qrc -QT += xml svg - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtsvg/desktop/systray -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS systray.pro resources images -sources.path = $$[QT_INSTALL_EXAMPLES]/qtsvg/desktop/systray -INSTALLS += target sources - -wince* { - CONFIG(debug, release|debug) { - addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qsvgd4.dll - } - CONFIG(release, release|debug) { - addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qsvg4.dll - } - addPlugins.path = imageformats - DEPLOYMENT += addPlugins -} - -simulator: warning(This example does not work on Simulator platform) -QT+=widgets diff --git a/examples/desktop/systray/systray.qrc b/examples/desktop/systray/systray.qrc deleted file mode 100644 index b0d5e0c..0000000 --- a/examples/desktop/systray/systray.qrc +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/"> - <file>images/bad.svg</file> - <file>images/heart.svg</file> - <file>images/trash.svg</file> -</qresource> -</RCC> diff --git a/examples/desktop/systray/window.cpp b/examples/desktop/systray/window.cpp deleted file mode 100644 index 37446fb..0000000 --- a/examples/desktop/systray/window.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtWidgets> - -#include "window.h" - -//! [0] -Window::Window() -{ - createIconGroupBox(); - createMessageGroupBox(); - - iconLabel->setMinimumWidth(durationLabel->sizeHint().width()); - - createActions(); - createTrayIcon(); - - connect(showMessageButton, SIGNAL(clicked()), this, SLOT(showMessage())); - connect(showIconCheckBox, SIGNAL(toggled(bool)), - trayIcon, SLOT(setVisible(bool))); - connect(iconComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(setIcon(int))); - connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked())); - connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(iconGroupBox); - mainLayout->addWidget(messageGroupBox); - setLayout(mainLayout); - - iconComboBox->setCurrentIndex(1); - trayIcon->show(); - - setWindowTitle(tr("Systray")); - resize(400, 300); -} -//! [0] - -//! [1] -void Window::setVisible(bool visible) -{ - minimizeAction->setEnabled(visible); - maximizeAction->setEnabled(!isMaximized()); - restoreAction->setEnabled(isMaximized() || !visible); - QDialog::setVisible(visible); -} -//! [1] - -//! [2] -void Window::closeEvent(QCloseEvent *event) -{ - if (trayIcon->isVisible()) { - QMessageBox::information(this, tr("Systray"), - tr("The program will keep running in the " - "system tray. To terminate the program, " - "choose <b>Quit</b> in the context menu " - "of the system tray entry.")); - hide(); - event->ignore(); - } -} -//! [2] - -//! [3] -void Window::setIcon(int index) -{ - QIcon icon = iconComboBox->itemIcon(index); - trayIcon->setIcon(icon); - setWindowIcon(icon); - - trayIcon->setToolTip(iconComboBox->itemText(index)); -} -//! [3] - -//! [4] -void Window::iconActivated(QSystemTrayIcon::ActivationReason reason) -{ - switch (reason) { - case QSystemTrayIcon::Trigger: - case QSystemTrayIcon::DoubleClick: - iconComboBox->setCurrentIndex((iconComboBox->currentIndex() + 1) - % iconComboBox->count()); - break; - case QSystemTrayIcon::MiddleClick: - showMessage(); - break; - default: - ; - } -} -//! [4] - -//! [5] -void Window::showMessage() -{ - QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon( - typeComboBox->itemData(typeComboBox->currentIndex()).toInt()); - trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon, - durationSpinBox->value() * 1000); -} -//! [5] - -//! [6] -void Window::messageClicked() -{ - QMessageBox::information(0, tr("Systray"), - tr("Sorry, I already gave what help I could.\n" - "Maybe you should try asking a human?")); -} -//! [6] - -void Window::createIconGroupBox() -{ - iconGroupBox = new QGroupBox(tr("Tray Icon")); - - iconLabel = new QLabel("Icon:"); - - iconComboBox = new QComboBox; - iconComboBox->addItem(QIcon(":/images/bad.svg"), tr("Bad")); - iconComboBox->addItem(QIcon(":/images/heart.svg"), tr("Heart")); - iconComboBox->addItem(QIcon(":/images/trash.svg"), tr("Trash")); - - showIconCheckBox = new QCheckBox(tr("Show icon")); - showIconCheckBox->setChecked(true); - - QHBoxLayout *iconLayout = new QHBoxLayout; - iconLayout->addWidget(iconLabel); - iconLayout->addWidget(iconComboBox); - iconLayout->addStretch(); - iconLayout->addWidget(showIconCheckBox); - iconGroupBox->setLayout(iconLayout); -} - -void Window::createMessageGroupBox() -{ - messageGroupBox = new QGroupBox(tr("Balloon Message")); - - typeLabel = new QLabel(tr("Type:")); - - typeComboBox = new QComboBox; - typeComboBox->addItem(tr("None"), QSystemTrayIcon::NoIcon); - typeComboBox->addItem(style()->standardIcon( - QStyle::SP_MessageBoxInformation), tr("Information"), - QSystemTrayIcon::Information); - typeComboBox->addItem(style()->standardIcon( - QStyle::SP_MessageBoxWarning), tr("Warning"), - QSystemTrayIcon::Warning); - typeComboBox->addItem(style()->standardIcon( - QStyle::SP_MessageBoxCritical), tr("Critical"), - QSystemTrayIcon::Critical); - typeComboBox->setCurrentIndex(1); - - durationLabel = new QLabel(tr("Duration:")); - - durationSpinBox = new QSpinBox; - durationSpinBox->setRange(5, 60); - durationSpinBox->setSuffix(" s"); - durationSpinBox->setValue(15); - - durationWarningLabel = new QLabel(tr("(some systems might ignore this " - "hint)")); - durationWarningLabel->setIndent(10); - - titleLabel = new QLabel(tr("Title:")); - - titleEdit = new QLineEdit(tr("Cannot connect to network")); - - bodyLabel = new QLabel(tr("Body:")); - - bodyEdit = new QTextEdit; - bodyEdit->setPlainText(tr("Don't believe me. Honestly, I don't have a " - "clue.\nClick this balloon for details.")); - - showMessageButton = new QPushButton(tr("Show Message")); - showMessageButton->setDefault(true); - - QGridLayout *messageLayout = new QGridLayout; - messageLayout->addWidget(typeLabel, 0, 0); - messageLayout->addWidget(typeComboBox, 0, 1, 1, 2); - messageLayout->addWidget(durationLabel, 1, 0); - messageLayout->addWidget(durationSpinBox, 1, 1); - messageLayout->addWidget(durationWarningLabel, 1, 2, 1, 3); - messageLayout->addWidget(titleLabel, 2, 0); - messageLayout->addWidget(titleEdit, 2, 1, 1, 4); - messageLayout->addWidget(bodyLabel, 3, 0); - messageLayout->addWidget(bodyEdit, 3, 1, 2, 4); - messageLayout->addWidget(showMessageButton, 5, 4); - messageLayout->setColumnStretch(3, 1); - messageLayout->setRowStretch(4, 1); - messageGroupBox->setLayout(messageLayout); -} - -void Window::createActions() -{ - minimizeAction = new QAction(tr("Mi&nimize"), this); - connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide())); - - maximizeAction = new QAction(tr("Ma&ximize"), this); - connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized())); - - restoreAction = new QAction(tr("&Restore"), this); - connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal())); - - quitAction = new QAction(tr("&Quit"), this); - connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); -} - -void Window::createTrayIcon() -{ - trayIconMenu = new QMenu(this); - trayIconMenu->addAction(minimizeAction); - trayIconMenu->addAction(maximizeAction); - trayIconMenu->addAction(restoreAction); - trayIconMenu->addSeparator(); - trayIconMenu->addAction(quitAction); - - trayIcon = new QSystemTrayIcon(this); - trayIcon->setContextMenu(trayIconMenu); -} diff --git a/examples/desktop/systray/window.h b/examples/desktop/systray/window.h deleted file mode 100644 index 80b7a20..0000000 --- a/examples/desktop/systray/window.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples 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 Nokia Corporation and its Subsidiary(-ies) 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 WINDOW_H -#define WINDOW_H - -#include <QSystemTrayIcon> -#include <QDialog> - -QT_BEGIN_NAMESPACE -class QAction; -class QCheckBox; -class QComboBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QMenu; -class QPushButton; -class QSpinBox; -class QTextEdit; -QT_END_NAMESPACE - -//! [0] -class Window : public QDialog -{ - Q_OBJECT - -public: - Window(); - - void setVisible(bool visible); - -protected: - void closeEvent(QCloseEvent *event); - -private slots: - void setIcon(int index); - void iconActivated(QSystemTrayIcon::ActivationReason reason); - void showMessage(); - void messageClicked(); - -private: - void createIconGroupBox(); - void createMessageGroupBox(); - void createActions(); - void createTrayIcon(); - - QGroupBox *iconGroupBox; - QLabel *iconLabel; - QComboBox *iconComboBox; - QCheckBox *showIconCheckBox; - - QGroupBox *messageGroupBox; - QLabel *typeLabel; - QLabel *durationLabel; - QLabel *durationWarningLabel; - QLabel *titleLabel; - QLabel *bodyLabel; - QComboBox *typeComboBox; - QSpinBox *durationSpinBox; - QLineEdit *titleEdit; - QTextEdit *bodyEdit; - QPushButton *showMessageButton; - - QAction *minimizeAction; - QAction *maximizeAction; - QAction *restoreAction; - QAction *quitAction; - - QSystemTrayIcon *trayIcon; - QMenu *trayIconMenu; -}; -//! [0] - -#endif diff --git a/examples/examples.pro b/examples/examples.pro index ba15860..d96fdb9 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -SUBDIRS += embedded richtext draganddrop painting network desktop +SUBDIRS += embedded richtext draganddrop painting network contains(QT_CONFIG,opengl):!contains(QT_CONFIG,opengles2):SUBDIRS += opengl QT+=widgets |