summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Keller <rainer.keller@digia.com>2014-09-16 12:55:09 +0200
committerRainer Keller <rainer.keller@digia.com>2014-09-17 12:38:32 +0200
commit58f54745124f140717b2908f99c0ab647874e7c7 (patch)
tree3df514b7f3c6a19ebd486fd5848cd5af437ec400
parentb67eac373bdf8ed85bab942614e37fdb3f4cf6d5 (diff)
downloadqtdoc-58f54745124f140717b2908f99c0ab647874e7c7.tar.gz
Doc: Remove qtdemo example
QtDemo was unmaintained for several years and did not work successfully in the current state. Task-number: QTBUG-38922 Task-number: QTBUG-32906 Change-Id: I43fd666a0977793ecbb092573fb469ecfbed6bc7 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
-rw-r--r--.gitignore1
-rw-r--r--demos/demos.pro2
-rw-r--r--demos/qtdemo/Info_mac.plist18
-rw-r--r--demos/qtdemo/colors.cpp368
-rw-r--r--demos/qtdemo/colors.h120
-rw-r--r--demos/qtdemo/demoitem.cpp272
-rw-r--r--demos/qtdemo/demoitem.h116
-rw-r--r--demos/qtdemo/demoitemanimation.cpp211
-rw-r--r--demos/qtdemo/demoitemanimation.h93
-rw-r--r--demos/qtdemo/demoscene.cpp46
-rw-r--r--demos/qtdemo/demoscene.h49
-rw-r--r--demos/qtdemo/demotextitem.cpp115
-rw-r--r--demos/qtdemo/demotextitem.h66
-rw-r--r--demos/qtdemo/dockitem.cpp100
-rw-r--r--demos/qtdemo/dockitem.h61
-rw-r--r--demos/qtdemo/examplecontent.cpp159
-rw-r--r--demos/qtdemo/examplecontent.h69
-rw-r--r--demos/qtdemo/guide.cpp136
-rw-r--r--demos/qtdemo/guide.h65
-rw-r--r--demos/qtdemo/guidecircle.cpp80
-rw-r--r--demos/qtdemo/guidecircle.h64
-rw-r--r--demos/qtdemo/guideline.cpp73
-rw-r--r--demos/qtdemo/guideline.h57
-rw-r--r--demos/qtdemo/headingitem.cpp96
-rw-r--r--demos/qtdemo/headingitem.h55
-rw-r--r--demos/qtdemo/imageitem.cpp106
-rw-r--r--demos/qtdemo/imageitem.h58
-rwxr-xr-xdemos/qtdemo/images/demobg.pngbin20675 -> 0 bytes
-rw-r--r--demos/qtdemo/images/qtlogo_large.pngbin23547 -> 0 bytes
-rw-r--r--demos/qtdemo/images/qtlogo_small.pngbin3546 -> 0 bytes
-rw-r--r--demos/qtdemo/itemcircleanimation.cpp500
-rw-r--r--demos/qtdemo/itemcircleanimation.h102
-rw-r--r--demos/qtdemo/letteritem.cpp77
-rw-r--r--demos/qtdemo/letteritem.h54
-rw-r--r--demos/qtdemo/main.cpp66
-rw-r--r--demos/qtdemo/mainwindow.cpp468
-rw-r--r--demos/qtdemo/mainwindow.h103
-rw-r--r--demos/qtdemo/menucontent.cpp132
-rw-r--r--demos/qtdemo/menucontent.h69
-rw-r--r--demos/qtdemo/menumanager.cpp979
-rw-r--r--demos/qtdemo/menumanager.h136
-rw-r--r--demos/qtdemo/qmlShell.qml169
-rw-r--r--demos/qtdemo/qtdemo.icnsbin129539 -> 0 bytes
-rw-r--r--demos/qtdemo/qtdemo.icobin355574 -> 0 bytes
-rw-r--r--demos/qtdemo/qtdemo.pro74
-rw-r--r--demos/qtdemo/qtdemo.qrc11
-rw-r--r--demos/qtdemo/qtdemo.rc32
-rw-r--r--demos/qtdemo/scanitem.cpp72
-rw-r--r--demos/qtdemo/scanitem.h52
-rw-r--r--demos/qtdemo/score.cpp141
-rw-r--r--demos/qtdemo/score.h78
-rw-r--r--demos/qtdemo/textbutton.cpp376
-rw-r--r--demos/qtdemo/textbutton.h92
-rw-r--r--demos/qtdemo/xml/examples.xml280
-rw-r--r--doc/src/diagrams/qtdemo-example.pngbin66312 -> 0 bytes
-rw-r--r--doc/src/diagrams/qtdemo.pngbin158843 -> 0 bytes
-rw-r--r--doc/src/examples/qtdemo.qdoc50
-rw-r--r--doc/src/images/qtdemo-small.pngbin23755 -> 0 bytes
-rw-r--r--doc/src/images/qtdemo.pngbin243710 -> 0 bytes
-rw-r--r--qtdoc.pro2
60 files changed, 1 insertions, 6770 deletions
diff --git a/.gitignore b/.gitignore
index e0d1a93d..98d11d12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,7 +68,6 @@ bin/makeqpf*
bin/pixeltool*
bin/qmake*
bin/qdoc3*
-bin/qtdemo*
bin/qttracereplay*
bin/rcc*
bin/uic*
diff --git a/demos/demos.pro b/demos/demos.pro
deleted file mode 100644
index 25b811dd..00000000
--- a/demos/demos.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += qtdemo
diff --git a/demos/qtdemo/Info_mac.plist b/demos/qtdemo/Info_mac.plist
deleted file mode 100644
index 71b00591..00000000
--- a/demos/qtdemo/Info_mac.plist
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.9">
-<dict>
- <key>CFBundleIconFile</key>
- <string>@ICON@</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleIdentifier</key>
- <string>com.trolltech.qt.demo</string>
- <key>CFBundleExecutable</key>
- <string>@EXECUTABLE@</string>
-</dict>
-</plist>
diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp
deleted file mode 100644
index 7d54f37a..00000000
--- a/demos/qtdemo/colors.cpp
+++ /dev/null
@@ -1,368 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "colors.h"
-
-#include <QMessageBox>
-
-#ifndef QT_NO_OPENGL
- #include <QGLWidget>
-#endif
-//#define QT_NO_OPENGL
-
-// Colors:
-QColor Colors::sceneBg1(QColor(91, 91, 91));
-QColor Colors::sceneBg1Line(QColor(114, 108, 104));
-QColor Colors::sceneBg2(QColor(0, 0, 0));
-QColor Colors::sceneLine(255, 255, 255);
-QColor Colors::paperBg(QColor(100, 100, 100));
-QColor Colors::menuTextFg(QColor(255, 0, 0));
-QColor Colors::buttonBgLow(QColor(255, 255, 255, 90));
-QColor Colors::buttonBgHigh(QColor(255, 255, 255, 20));
-QColor Colors::buttonText(QColor(255, 255, 255));
-QColor Colors::tt_green(QColor(166, 206, 57));
-QColor Colors::fadeOut(QColor(206, 246, 117, 0));
-QColor Colors::heading(QColor(190,230,80));
-QString Colors::contentColor("<font color='#eeeeee'>");
-QString Colors::glVersion("Not detected!");
-
-// Guides:
-int Colors::stageStartY = 8;
-int Colors::stageHeight = 536;
-int Colors::stageStartX = 8;
-int Colors::stageWidth = 785;
-int Colors::contentStartY = 22;
-int Colors::contentHeight = 510;
-
-// Properties:
-bool Colors::openGlRendering = false;
-bool Colors::softwareRendering = false;
-bool Colors::openGlAvailable = true;
-bool Colors::xRenderPresent = true;
-
-bool Colors::noTicker = false;
-bool Colors::noRescale = false;
-bool Colors::noAnimations = false;
-bool Colors::noBlending = false;
-bool Colors::noScreenSync = false;
-bool Colors::fullscreen = false;
-bool Colors::usePixmaps = false;
-bool Colors::useLoop = false;
-bool Colors::showBoundingRect = false;
-bool Colors::showFps = false;
-bool Colors::noAdapt = false;
-bool Colors::noWindowMask = true;
-bool Colors::useButtonBalls = false;
-bool Colors::useEightBitPalette = false;
-bool Colors::noTimerUpdate = false;
-bool Colors::noTickerMorph = false;
-bool Colors::adapted = false;
-bool Colors::verbose = false;
-bool Colors::pause = true;
-int Colors::fps = 60;
-int Colors::menuCount = 18;
-float Colors::animSpeed = 1.0;
-float Colors::animSpeedButtons = 1.0;
-float Colors::benchmarkFps = -1;
-int Colors::tickerLetterCount = 80;
-float Colors::tickerMoveSpeed = 0.4f;
-float Colors::tickerMorphSpeed = 2.5f;
-QString Colors::tickerText = ".EROM ETAERC .SSEL EDOC";
-QString Colors::rootMenuName = "Qt Examples and Demos";
-
-QFont Colors::contentFont()
-{
- QFont font;
- font.setStyleStrategy(QFont::PreferAntialias);
-#if defined(Q_OS_MAC)
- font.setPixelSize(14);
- font.setFamily("Arial");
-#else
- font.setPixelSize(13);
- font.setFamily("Verdana");
-#endif
- return font;
-}
-
-QFont Colors::headingFont()
-{
- QFont font;
- font.setStyleStrategy(QFont::PreferAntialias);
- font.setPixelSize(23);
- font.setBold(true);
- font.setFamily("Verdana");
- return font;
-}
-
-QFont Colors::buttonFont()
-{
- QFont font;
- font.setStyleStrategy(QFont::PreferAntialias);
-#if 0//defined(Q_OS_MAC)
- font.setPixelSize(11);
- font.setFamily("Silom");
-#else
- font.setPixelSize(11);
- font.setFamily("Verdana");
-#endif
- return font;
-}
-
-QFont Colors::tickerFont()
-{
- QFont font;
- font.setStyleStrategy(QFont::PreferAntialias);
-#if defined(Q_OS_MAC)
- font.setPixelSize(11);
- font.setBold(true);
- font.setFamily("Arial");
-#else
- font.setPixelSize(10);
- font.setBold(true);
- font.setFamily("sans serif");
-#endif
- return font;
-}
-
-float parseFloat(const QString &argument, const QString &name)
-{
- if (name.length() == argument.length()){
- QMessageBox::warning(0, "Arguments",
- QString("No argument number found for ")
- + name
- + ". Remember to put name and value adjacent! (e.g. -fps100)");
- exit(0);
- }
- float value = argument.mid(name.length()).toFloat();
- return value;
-}
-
-QString parseText(const QString &argument, const QString &name)
-{
- if (name.length() == argument.length()){
- QMessageBox::warning(0, "Arguments",
- QString("No argument number found for ")
- + name
- + ". Remember to put name and value adjacent! (e.g. -fps100)");
- exit(0);
- }
- QString value = argument.mid(name.length());
- return value;
-}
-
-void Colors::parseArgs(int argc, char *argv[])
-{
- // some arguments should be processed before
- // others. Handle them now:
- for (int i=1; i<argc; i++){
- QString s(argv[i]);
- if (s == "-verbose")
- Colors::verbose = true;
- }
-
- Colors::detectSystemResources();
-
- // Handle the rest of the arguments. They may
- // override attributes already set:
- for (int i=1; i<argc; i++){
- QString s(argv[i]);
- if (s == "-opengl")
- Colors::openGlRendering = true;
- else if (s == "-software")
- Colors::softwareRendering = true;
- else if (s == "-no-opengl") // support old style
- Colors::softwareRendering = true;
- else if (s == "-no-ticker") // support old style
- Colors::noTicker = true;
- else if (s.startsWith("-ticker"))
- Colors::noTicker = !bool(parseFloat(s, "-ticker"));
- else if (s == "-no-animations")
- Colors::noAnimations = true; // support old style
- else if (s.startsWith("-animations"))
- Colors::noAnimations = !bool(parseFloat(s, "-animations"));
- else if (s == "-no-adapt")
- Colors::noAdapt = true;
- else if (s == "-low")
- Colors::setLowSettings();
- else if (s == "-no-rescale")
- Colors::noRescale = true;
- else if (s == "-use-pixmaps")
- Colors::usePixmaps = true;
- else if (s == "-fullscreen")
- Colors::fullscreen = true;
- else if (s == "-show-br")
- Colors::showBoundingRect = true;
- else if (s == "-show-fps")
- Colors::showFps = true;
- else if (s == "-no-blending")
- Colors::noBlending = true;
- else if (s == "-no-sync")
- Colors::noScreenSync = true;
- else if (s.startsWith("-menu"))
- Colors::menuCount = int(parseFloat(s, "-menu"));
- else if (s.startsWith("-use-timer-update"))
- Colors::noTimerUpdate = !bool(parseFloat(s, "-use-timer-update"));
- else if (s.startsWith("-pause"))
- Colors::pause = bool(parseFloat(s, "-pause"));
- else if (s == "-no-ticker-morph")
- Colors::noTickerMorph = true;
- else if (s == "-use-window-mask")
- Colors::noWindowMask = false;
- else if (s == "-use-loop")
- Colors::useLoop = true;
- else if (s == "-use-8bit")
- Colors::useEightBitPalette = true;
- else if (s.startsWith("-8bit"))
- Colors::useEightBitPalette = bool(parseFloat(s, "-8bit"));
- else if (s == "-use-balls")
- Colors::useButtonBalls = true;
- else if (s.startsWith("-ticker-letters"))
- Colors::tickerLetterCount = int(parseFloat(s, "-ticker-letters"));
- else if (s.startsWith("-ticker-text"))
- Colors::tickerText = parseText(s, "-ticker-text");
- else if (s.startsWith("-ticker-speed"))
- Colors::tickerMoveSpeed = parseFloat(s, "-ticker-speed");
- else if (s.startsWith("-ticker-morph-speed"))
- Colors::tickerMorphSpeed = parseFloat(s, "-ticker-morph-speed");
- else if (s.startsWith("-animation-speed"))
- Colors::animSpeed = parseFloat(s, "-animation-speed");
- else if (s.startsWith("-fps"))
- Colors::fps = int(parseFloat(s, "-fps"));
- else if (s.startsWith("-h") || s.startsWith("-help")){
- QMessageBox::warning(0, "Arguments",
- QString("Usage: qtdemo [-verbose] [-no-adapt] [-opengl] [-software] [-fullscreen] [-ticker[0|1]] ")
- + "[-animations[0|1]] [-no-blending] [-no-sync] [-use-timer-update[0|1]] [-pause[0|1]] "
- + "[-use-window-mask] [-no-rescale] "
- + "[-use-pixmaps] [-show-fps] [-show-br] [-8bit[0|1]] [-menu<int>] [-use-loop] [-use-balls] "
- + "[-animation-speed<float>] [-fps<int>] "
- + "[-low] [-ticker-letters<int>] [-ticker-speed<float>] [-no-ticker-morph] "
- + "[-ticker-morph-speed<float>] [-ticker-text<string>]");
- exit(0);
- } else if (s == "-verbose") {
- // this option was already handled above
- } else{
- QMessageBox::warning(0, "QtDemo", QString("Unrecognized argument:\n") + s);
- exit(0);
- }
- }
-
- Colors::postConfigure();
-}
-
-void Colors::setLowSettings()
-{
- Colors::openGlRendering = false;
- Colors::softwareRendering = true;
- Colors::noTicker = true;
- Colors::noTimerUpdate = true;
- Colors::fps = 30;
- Colors::usePixmaps = true;
- Colors::noAnimations = true;
- Colors::noBlending = true;
-}
-
-void Colors::detectSystemResources()
-{
-#ifndef QT_NO_OPENGL
- if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)
- Colors::glVersion = "2.0 or higher";
- else if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_5)
- Colors::glVersion = "1.5";
- else if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_4)
- Colors::glVersion = "1.4";
- else if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_3)
- Colors::glVersion = "1.3 or lower";
- if (Colors::verbose)
- qDebug() << "- OpenGL version:" << Colors::glVersion;
-
- QGLWidget glw;
- if (!QGLFormat::hasOpenGL()
- || !glw.format().directRendering()
- || !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_5)
- || glw.depth() < 24
- )
-#else
- if (Colors::verbose)
- qDebug() << "- OpenGL not supported by current build of Qt";
-#endif
- {
- Colors::openGlAvailable = false;
- if (Colors::verbose)
- qDebug("- OpenGL not recommended on this system");
- }
-
-#if defined(Q_WS_X11)
- // check if X render is present:
- QPixmap tmp(1, 1);
- if (!tmp.x11PictureHandle() && tmp.paintEngine()->type() == QPaintEngine::X11){
- Colors::xRenderPresent = false;
- if (Colors::verbose)
- qDebug("- X render not present");
- }
-
-#endif
-
- QWidget w;
- if (Colors::verbose)
- qDebug() << "- Color depth: " << QString::number(w.depth());
-}
-
-void Colors::postConfigure()
-{
- if (!Colors::noAdapt){
- QWidget w;
- if (w.depth() < 16){
- Colors::useEightBitPalette = true;
- Colors::adapted = true;
- if (Colors::verbose)
- qDebug() << "- Adapt: Color depth less than 16 bit. Using 8 bit palette";
- }
-
- if (!Colors::xRenderPresent){
- Colors::setLowSettings();
- Colors::adapted = true;
- if (Colors::verbose)
- qDebug() << "- Adapt: X renderer not present. Using low settings";
- }
- }
-
- if (!Colors::openGlRendering && !Colors::softwareRendering){
- // The user has not decided rendering system. So we do it instead:
- if (Colors::openGlAvailable)
- Colors::openGlRendering = true;
- else
- Colors::softwareRendering = true;
- }
-}
-
-
diff --git a/demos/qtdemo/colors.h b/demos/qtdemo/colors.h
deleted file mode 100644
index 19e3733e..00000000
--- a/demos/qtdemo/colors.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef COLORS_H
-#define COLORS_H
-
-#include <QtGui>
-#include <QBrush>
-
-class Colors
-{
-private:
- Colors(){};
-
-public:
- static void parseArgs(int argc, char *argv[]);
- static void detectSystemResources();
- static void postConfigure();
- static void setLowSettings();
-
- // Colors:
- static QColor sceneBg1;
- static QColor sceneBg2;
- static QColor sceneBg1Line;
- static QColor paperBg;
- static QColor menuTextFg;
- static QColor buttonText;
- static QColor buttonBgLow;
- static QColor buttonBgHigh;
- static QColor tt_green;
- static QColor fadeOut;
- static QColor sceneLine;
- static QColor heading;
- static QString contentColor;
- static QString glVersion;
-
- // Guides:
- static int stageStartY;
- static int stageHeight;
- static int stageStartX;
- static int stageWidth;
- static int contentStartY;
- static int contentHeight;
-
- // properties:
- static bool openGlAvailable;
- static bool openGlRendering;
- static bool softwareRendering;
- static bool xRenderPresent;
- static bool noAdapt;
- static bool noTicker;
- static bool noRescale;
- static bool noAnimations;
- static bool noBlending;
- static bool noScreenSync;
- static bool useLoop;
- static bool noWindowMask;
- static bool usePixmaps;
- static bool useEightBitPalette;
- static bool fullscreen;
- static bool showBoundingRect;
- static bool showFps;
- static bool noTimerUpdate;
- static bool noTickerMorph;
- static bool useButtonBalls;
- static bool adapted;
- static bool verbose;
- static bool pause;
-
- static float animSpeed;
- static float animSpeedButtons;
- static float benchmarkFps;
- static int tickerLetterCount;
- static int fps;
- static int menuCount;
- static float tickerMoveSpeed;
- static float tickerMorphSpeed;
- static QString tickerText;
- static QString rootMenuName;
-
- // fonts
- static QFont contentFont();
- static QFont headingFont();
- static QFont buttonFont();
- static QFont tickerFont();
-
-};
-
-#endif // COLORS_H
-
diff --git a/demos/qtdemo/demoitem.cpp b/demos/qtdemo/demoitem.cpp
deleted file mode 100644
index 90b2f406..00000000
--- a/demos/qtdemo/demoitem.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "demoitem.h"
-#include "menumanager.h"
-#include "guide.h"
-#include "colors.h"
-
-QHash<QString, SharedImage *> DemoItem::sharedImageHash;
-QMatrix DemoItem::matrix;
-
-DemoItem::DemoItem(QGraphicsScene *, QGraphicsItem *parent) : QGraphicsItem(parent)
-{
- this->opacity = 1.0;
- this->locked = false;
- this->prepared = false;
- this->neverVisible = false;
- this->noSubPixeling = false;
- this->currentAnimation = 0;
- this->currGuide = 0;
- this->guideFrame = 0;
- this->sharedImage = new SharedImage();
- ++this->sharedImage->refCount;
-}
-
-DemoItem::~DemoItem()
-{
- if(--this->sharedImage->refCount == 0){
- if (!this->hashKey.isEmpty())
- DemoItem::sharedImageHash.remove(this->hashKey);
- delete this->sharedImage;
- }
-}
-
-void DemoItem::setNeverVisible(bool never)
-{
- Q_UNUSED(never);
-/*
- this->neverVisible = never;
- if (never){
- this->setVisible(false);
- QList<QGraphicsItem *> c = children();
- for (int i=0; i<c.size(); i++){
- DemoItem *d = dynamic_cast<DemoItem *>(c[i]); // Don't use dynamic cast because it needs RTTI support.
- if (d)
- d->setNeverVisible(true);
- else{
- c[i]->setVisible(false);
- }
- }
- }
-*/
-}
-
-void DemoItem::setRecursiveVisible(bool visible){
- if (visible && this->neverVisible){
- this->setVisible(false);
- return;
- }
-
- this->setVisible(visible);
- QList<QGraphicsItem *> c = childItems();
- for (int i=0; i<c.size(); i++){
- // DemoItem *d = dynamic_cast<DemoItem *>(c[i]);
- // if (d)
- // d->setRecursiveVisible(visible);
- // else{
- c[i]->setVisible(visible);
- // }
- }
-}
-
-void DemoItem::useGuide(Guide *guide, float startFrame)
-{
- this->startFrame = startFrame;
- this->guideFrame = startFrame;
- while (this->guideFrame > guide->startLength + guide->length()){
- if (guide->nextGuide == guide->firstGuide)
- break;
-
- guide = guide->nextGuide;
- }
- this->currGuide = guide;
-}
-
-void DemoItem::guideAdvance(float distance)
-{
- this->guideFrame += distance;
- while (this->guideFrame > this->currGuide->startLength + this->currGuide->length()){
- this->currGuide = this->currGuide->nextGuide;
- if (this->currGuide == this->currGuide->firstGuide)
- this->guideFrame -= this->currGuide->lengthAll();
- }
-}
-
-void DemoItem::guideMove(float moveSpeed)
-{
- this->currGuide->guide(this, moveSpeed);
-}
-
-void DemoItem::setPosUsingSheepDog(const QPointF &dest, const QRectF &sceneFence)
-{
- this->setPos(dest);
- if (sceneFence.isNull())
- return;
-
- // I agree. This is not the optimal way of doing it.
- // But don't want for use time on it now....
- float itemWidth = this->boundingRect().width();
- float itemHeight = this->boundingRect().height();
- float fenceRight = sceneFence.x() + sceneFence.width();
- float fenceBottom = sceneFence.y() + sceneFence.height();
-
- if (this->scenePos().x() < sceneFence.x()) this->moveBy(this->mapFromScene(QPointF(sceneFence.x(), 0)).x(), 0);
- if (this->scenePos().x() > fenceRight - itemWidth) this->moveBy(this->mapFromScene(QPointF(fenceRight - itemWidth, 0)).x(), 0);
- if (this->scenePos().y() < sceneFence.y()) this->moveBy(0, this->mapFromScene(QPointF(0, sceneFence.y())).y());
- if (this->scenePos().y() > fenceBottom - itemHeight) this->moveBy(0, this->mapFromScene(QPointF(0, fenceBottom - itemHeight)).y());
-}
-
-void DemoItem::setGuidedPos(const QPointF &pos)
-{
- this->guidedPos = pos;
-}
-
-QPointF DemoItem::getGuidedPos()
-{
- return this->guidedPos;
-}
-
-void DemoItem::switchGuide(Guide *guide)
-{
- this->currGuide = guide;
- this->guideFrame = 0;
-}
-
-bool DemoItem::inTransition()
-{
- if (this->currentAnimation)
- return this->currentAnimation->running();
- else
- return false;
-}
-
-void DemoItem::setMatrix(const QMatrix &matrix)
-{
- DemoItem::matrix = matrix;
-}
-
-void DemoItem::useSharedImage(const QString &hashKey)
-{
- this->hashKey = hashKey;
- if (!sharedImageHash.contains(hashKey))
- sharedImageHash.insert(hashKey, this->sharedImage);
- else {
- if(--this->sharedImage->refCount == 0)
- delete this->sharedImage;
- this->sharedImage = sharedImageHash.value(hashKey);
- ++this->sharedImage->refCount;
- }
-}
-
-bool DemoItem::validateImage()
-{
- if ((this->sharedImage->matrix != DemoItem::matrix && !Colors::noRescale) || !(this->sharedImage->image || this->sharedImage->pixmap)){
- // (Re)create image according to new matrix
- delete this->sharedImage->image;
- this->sharedImage->image = 0;
- delete this->sharedImage->pixmap;
- this->sharedImage->pixmap = 0;
- this->sharedImage->matrix = DemoItem::matrix;
-
- // Let subclass create and draw a new image according to the new matrix
- QImage *image = this->createImage(Colors::noRescale ? QMatrix() : DemoItem::matrix);
- if (image){
- if (Colors::showBoundingRect){
- // draw red transparent rect
- QPainter painter(image);
- painter.fillRect(image->rect(), QColor(255, 0, 0, 50));
- painter.end();
- }
-
- this->sharedImage->unscaledBoundingRect = this->sharedImage->matrix.inverted().mapRect(image->rect());
- if (Colors::usePixmaps){
- if (image->isNull())
- this->sharedImage->pixmap = new QPixmap(1, 1);
- else
- this->sharedImage->pixmap = new QPixmap(image->size());
- this->sharedImage->pixmap->fill(QColor(0, 0, 0, 0));
- QPainter painter(this->sharedImage->pixmap);
- painter.drawImage(0, 0, *image);
- delete image;
- } else {
- this->sharedImage->image = image;
- }
- return true;
- } else
- return false;
- }
- return true;
-}
-
-QRectF DemoItem::boundingRect() const
-{
- const_cast<DemoItem *>(this)->validateImage();
- return this->sharedImage->unscaledBoundingRect;
-}
-
-void DemoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- if (this->validateImage()){
-
- bool wasSmoothPixmapTransform = painter->testRenderHint(QPainter::SmoothPixmapTransform);
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
-
- if (Colors::noRescale){
- // Let the painter scale the image for us.
- // This may degrade both quality and performance
- if (this->sharedImage->image)
- painter->drawImage(this->pos(), *this->sharedImage->image);
- else
- painter->drawPixmap(this->pos(), *this->sharedImage->pixmap);
- }
- else {
- QMatrix m = painter->worldMatrix();
- painter->setWorldMatrix(QMatrix());
- float x = this->noSubPixeling ? qRound(m.dx()) : m.dx();
- float y = this->noSubPixeling ? qRound(m.dy()) : m.dy();
- if (this->sharedImage->image)
- painter->drawImage(QPointF(x, y), *this->sharedImage->image);
- else
- painter->drawPixmap(QPointF(x, y), *this->sharedImage->pixmap);
- }
-
- if (!wasSmoothPixmapTransform) {
- painter->setRenderHint(QPainter::SmoothPixmapTransform, false);
- }
-
- }
-}
diff --git a/demos/qtdemo/demoitem.h b/demos/qtdemo/demoitem.h
deleted file mode 100644
index 22c28bb3..00000000
--- a/demos/qtdemo/demoitem.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DEMO_ITEM_H
-#define DEMO_ITEM_H
-
-#include <QtWidgets>
-
-class DemoItemAnimation;
-class Guide;
-
-class SharedImage
-{
-public:
- SharedImage() : refCount(0), image(0), pixmap(0){}
- ~SharedImage()
- {
- delete image;
- delete pixmap;
- }
-
- int refCount;
- QImage *image;
- QPixmap *pixmap;
- QMatrix matrix;
- QRectF unscaledBoundingRect;
-};
-
-class DemoItem : public QGraphicsItem
-{
-
-public:
- DemoItem(QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
- virtual ~DemoItem();
-
- bool inTransition();
- virtual void animationStarted(int id = 0){ Q_UNUSED(id); };
- virtual void animationStopped(int id = 0){ Q_UNUSED(id); };
- virtual void prepare(){};
- void setRecursiveVisible(bool visible);
- void useSharedImage(const QString &hashKey);
- void setNeverVisible(bool never = true);
- static void setMatrix(const QMatrix &matrix);
- virtual QRectF boundingRect() const; // overridden
- void setPosUsingSheepDog(const QPointF &dest, const QRectF &sceneFence);
-
- qreal opacity;
- bool locked;
- DemoItemAnimation *currentAnimation;
- bool noSubPixeling;
-
- // Used if controlled by a guide:
- void useGuide(Guide *guide, float startFrame = 0);
- void guideAdvance(float distance);
- void guideMove(float moveSpeed);
- void setGuidedPos(const QPointF &position);
- QPointF getGuidedPos();
- float startFrame;
- float guideFrame;
- Guide *currGuide;
-
-protected:
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option = 0, QWidget *widget = 0); // overridden
- virtual QImage *createImage(const QMatrix &) const { return 0; };
- virtual bool collidesWithItem(const QGraphicsItem *, Qt::ItemSelectionMode) const { return false; };
- bool prepared;
-
-private:
- SharedImage *sharedImage;
- QString hashKey;
- bool neverVisible;
- bool validateImage();
-
- // Used if controlled by a guide:
- void switchGuide(Guide *guide);
- friend class Guide;
- QPointF guidedPos;
-
- // The next static hash is shared amongst all demo items, and
- // has the purpose of reusing images to save memory and time
- static QHash<QString, SharedImage *> sharedImageHash;
- static QMatrix matrix;
-};
-
-#endif // DEMO_ITEM_H
-
diff --git a/demos/qtdemo/demoitemanimation.cpp b/demos/qtdemo/demoitemanimation.cpp
deleted file mode 100644
index dd776314..00000000
--- a/demos/qtdemo/demoitemanimation.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "demoitemanimation.h"
-#include "demoitem.h"
-#include "colors.h"
-
-DemoItemAnimation::DemoItemAnimation(DemoItem *item, INOROUT inOrOut)
-{
- this->opacityAt0 = 1.0;
- this->opacityAt1 = 1.0;
- this->startDelay = 0;
- this->inOrOut = inOrOut;
- this->hideOnFinished = false;
- this->forcePlay = false;
- this->timeline = new QTimeLine(5000);
- this->timeline->setFrameRange(0, 2000);
- this->timeline->setUpdateInterval(int(1000.0/Colors::fps));
- this->moveOnPlay = false;
- setTimeLine(this->timeline);
- setItem(item);
-}
-
-DemoItemAnimation::~DemoItemAnimation()
-{
- // Do not delete demoitem. It is not
- // owned by an animation
- delete this->timeline;
-}
-
-void DemoItemAnimation::prepare()
-{
- this->demoItem()->prepare();
-}
-
-void DemoItemAnimation::setStartPos(const QPointF &pos){
- this->startPos = pos;
-}
-
-void DemoItemAnimation::setDuration(int duration)
-{
- duration = int(duration * Colors::animSpeed);
- this->timeline->setDuration(duration);
- this->moveOnPlay = true;
-}
-
-void DemoItemAnimation::setCurrentTime(int ms)
-{
- this->timeline->setCurrentTime(ms);
-}
-
-bool DemoItemAnimation::notOwnerOfItem()
-{
- return this != demoItem()->currentAnimation;
-}
-
-void DemoItemAnimation::play(bool fromStart, bool force)
-{
- this->fromStart = fromStart;
- this->forcePlay = force;
-
- QPointF currPos = this->demoItem()->pos();
-
- // If the item that this animation controls in currently under the
- // control of another animation, stop that animation first
- if (this->demoItem()->currentAnimation)
- this->demoItem()->currentAnimation->timeline->stop();
- this->demoItem()->currentAnimation = this;
- this->timeline->stop();
-
- if (Colors::noAnimations && !this->forcePlay){
- this->timeline->setCurrentTime(1);
- this->demoItem()->setPos(this->posAt(1));
- }
- else{
- if (this->demoItem()->isVisible())
- // If the item is already visible, start the animation from
- // the items current position rather than from start.
- this->setPosAt(0.0, currPos);
- else
- this->setPosAt(0.0, this->startPos);
-
- if (this->fromStart){
- this->timeline->setCurrentTime(0);
- this->demoItem()->setPos(this->posAt(0));
- }
- }
-
- if (this->inOrOut == ANIM_IN)
- this->demoItem()->setRecursiveVisible(true);
-
- if (this->startDelay){
- QTimer::singleShot(this->startDelay, this, SLOT(playWithoutDelay()));
- return;
- }
- else
- this->playWithoutDelay();
-}
-
-void DemoItemAnimation::playWithoutDelay()
-{
- if (this->moveOnPlay && !(Colors::noAnimations && !this->forcePlay))
- this->timeline->start();
- this->demoItem()->animationStarted(this->inOrOut);
-}
-
-void DemoItemAnimation::stop(bool reset)
-{
- this->timeline->stop();
- if (reset)
- this->demoItem()->setPos(this->posAt(0));
- if (this->hideOnFinished && !this->moveOnPlay)
- this->demoItem()->setRecursiveVisible(false);
- this->demoItem()->animationStopped(this->inOrOut);
-}
-
-void DemoItemAnimation::setRepeat(int nr)
-{
- this->timeline->setLoopCount(nr);
-}
-
-void DemoItemAnimation::playReverse()
-{
-}
-
-bool DemoItemAnimation::running()
-{
- return (this->timeLine()->state() == QTimeLine::Running);
-}
-
-bool DemoItemAnimation::runningOrItemLocked()
-{
- return (this->running() || this->demoItem()->locked);
-}
-
-void DemoItemAnimation::lockItem(bool state)
-{
- this->demoItem()->locked = state;
-}
-
-DemoItem *DemoItemAnimation::demoItem()
-{
- return (DemoItem *) this->item();
-}
-
-void DemoItemAnimation::setOpacityAt0(qreal opacity)
-{
- this->opacityAt0 = opacity;
-}
-
-void DemoItemAnimation::setOpacityAt1(qreal opacity)
-{
- this->opacityAt1 = opacity;
-}
-
-void DemoItemAnimation::setOpacity(qreal step)
-{
- DemoItem *demoItem = (DemoItem *) item();
- demoItem->opacity = this->opacityAt0 + step * step * step * (this->opacityAt1 - this->opacityAt0);
-}
-
-void DemoItemAnimation::afterAnimationStep(qreal step)
-{
- if (step == 1.0f){
- if (this->timeline->loopCount() > 0){
- // animation finished.
- if (this->hideOnFinished)
- this->demoItem()->setRecursiveVisible(false);
- this->demoItem()->animationStopped(this->inOrOut);
- }
- } else if (Colors::noAnimations && !this->forcePlay){
- // The animation is not at end, but
- // the animations should not play, so go to end.
- this->setStep(1.0f); // will make this method being called recursive.
- }
-}
-
-
-
-
-
diff --git a/demos/qtdemo/demoitemanimation.h b/demos/qtdemo/demoitemanimation.h
deleted file mode 100644
index e37ac807..00000000
--- a/demos/qtdemo/demoitemanimation.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DEMO_ITEM_ANIMATION_H
-#define DEMO_ITEM_ANIMATION_H
-
-#include <QtCore>
-#include <QtWidgets>
-
-class DemoItem;
-
-class DemoItemAnimation : public QGraphicsItemAnimation
-{
- Q_OBJECT
-
-public:
- enum INOROUT {ANIM_IN, ANIM_OUT, ANIM_UNSPECIFIED};
-
- DemoItemAnimation(DemoItem *item, INOROUT inOrOut = ANIM_UNSPECIFIED);
- virtual ~DemoItemAnimation();
-
- virtual void play(bool fromStart = true, bool force = false);
- virtual void playReverse();
- virtual void stop(bool reset = true);
- virtual void setRepeat(int nr = 0);
-
- void setDuration(int duration);
- void setDuration(float duration){ setDuration(int(duration)); };
- void setOpacityAt0(qreal opacity);
- void setOpacityAt1(qreal opacity);
- void setOpacity(qreal step);
- void setCurrentTime(int ms);
- void setStartPos(const QPointF &pos);
- bool notOwnerOfItem();
-
- bool running();
- bool runningOrItemLocked();
- void lockItem(bool state);
- void prepare();
-
- DemoItem *demoItem();
-
- virtual void afterAnimationStep(qreal step); // overridden
-
- QTimeLine *timeline;
- qreal opacityAt0;
- qreal opacityAt1;
- int startDelay;
- QPointF startPos;
- bool hideOnFinished;
- bool moveOnPlay;
- bool forcePlay;
- bool fromStart;
- INOROUT inOrOut;
-
-private slots:
- virtual void playWithoutDelay();
-};
-
-#endif // DEMO_ITEM_ANIMATION_H
-
-
-
diff --git a/demos/qtdemo/demoscene.cpp b/demos/qtdemo/demoscene.cpp
deleted file mode 100644
index c7550ab6..00000000
--- a/demos/qtdemo/demoscene.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "demoscene.h"
-
-void DemoScene::drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget)
-{
- for (int i=0; i<numItems; ++i) {
- painter->save();
- painter->setMatrix(items[i]->sceneMatrix(), true);
- items[i]->paint(painter, &options[i], widget);
- painter->restore();
- }
-}
-
-
diff --git a/demos/qtdemo/demoscene.h b/demos/qtdemo/demoscene.h
deleted file mode 100644
index bb640eaf..00000000
--- a/demos/qtdemo/demoscene.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAIN_VIEW_H
-#define MAIN_VIEW_H
-
-#include <QtWidgets>
-
-class DemoScene : public QGraphicsScene
-{
-public:
- DemoScene(QObject *parent) : QGraphicsScene(parent){}
-
-protected:
- void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget);
-};
-
-#endif // MAIN_VIEW_H
-
diff --git a/demos/qtdemo/demotextitem.cpp b/demos/qtdemo/demotextitem.cpp
deleted file mode 100644
index 9092cd1d..00000000
--- a/demos/qtdemo/demotextitem.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "demotextitem.h"
-#include "colors.h"
-
-DemoTextItem::DemoTextItem(const QString &text, const QFont &font, const QColor &textColor,
- float textWidth, QGraphicsScene *scene, QGraphicsItem *parent, TYPE type, const QColor &bgColor)
- : DemoItem(scene, parent)
-{
- this->type = type;
- this->text = text;
- this->font = font;
- this->textColor = textColor;
- this->bgColor = bgColor;
- this->textWidth = textWidth;
- this->noSubPixeling = true;
-}
-
-void DemoTextItem::setText(const QString &text)
-{
- this->text = text;
- this->update();
-}
-
-QImage *DemoTextItem::createImage(const QMatrix &matrix) const
-{
- if (this->type == DYNAMIC_TEXT)
- return 0;
-
- float sx = qMin(matrix.m11(), matrix.m22());
- float sy = matrix.m22() < sx ? sx : matrix.m22();
-
- QGraphicsTextItem textItem(0, 0);
- textItem.setHtml(this->text);
- textItem.setTextWidth(this->textWidth);
- textItem.setFont(this->font);
- textItem.setDefaultTextColor(this->textColor);
- textItem.document()->setDocumentMargin(2);
-
- float w = textItem.boundingRect().width();
- float h = textItem.boundingRect().height();
- QImage *image = new QImage(int(w * sx), int(h * sy), QImage::Format_ARGB32_Premultiplied);
- image->fill(QColor(0, 0, 0, 0).rgba());
- QPainter painter(image);
- painter.scale(sx, sy);
- QStyleOptionGraphicsItem style;
- textItem.paint(&painter, &style, 0);
- return image;
-}
-
-
-void DemoTextItem::animationStarted(int)
-{
- this->noSubPixeling = false;
-}
-
-
-void DemoTextItem::animationStopped(int)
-{
- this->noSubPixeling = true;
-}
-
-QRectF DemoTextItem::boundingRect() const
-
-{
- if (this->type == STATIC_TEXT)
- return DemoItem::boundingRect();
- return QRectF(0, 0, 50, 20); // Sorry for using magic number
-}
-
-
-void DemoTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- if (this->type == STATIC_TEXT) {
- DemoItem::paint(painter, option, widget);
- return;
- }
-
- painter->setPen(this->textColor);
- painter->drawText(0, 0, this->text);
-}
diff --git a/demos/qtdemo/demotextitem.h b/demos/qtdemo/demotextitem.h
deleted file mode 100644
index 3b2d3cd2..00000000
--- a/demos/qtdemo/demotextitem.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DEMO_TEXT_ITEM_H
-#define DEMO_TEXT_ITEM_H
-
-#include <QtGui>
-#include "demoitem.h"
-
-class DemoTextItem : public DemoItem
-{
-public:
- enum TYPE {STATIC_TEXT, DYNAMIC_TEXT};
-
- DemoTextItem(const QString &text, const QFont &font, const QColor &textColor,
- float textWidth, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0, TYPE type = STATIC_TEXT, const QColor &bgColor = QColor());
- void setText(const QString &text);
- QRectF boundingRect() const; // overridden
- void animationStarted(int id = 0);
- void animationStopped(int id = 0);
-
-protected:
- virtual QImage *createImage(const QMatrix &matrix) const; // overridden
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option = 0, QWidget *widget = 0); // overridden
-
-private:
- float textWidth;
- QString text;
- QFont font;
- QColor textColor;
- QColor bgColor;
- TYPE type;
-};
-
-#endif // DEMO_TEXT_ITEM_H
-
diff --git a/demos/qtdemo/dockitem.cpp b/demos/qtdemo/dockitem.cpp
deleted file mode 100644
index eb5661cc..00000000
--- a/demos/qtdemo/dockitem.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "dockitem.h"
-#include "colors.h"
-
-DockItem::DockItem(ORIENTATION orien, qreal x, qreal y, qreal width, qreal length, QGraphicsScene *scene, QGraphicsItem *parent)
- : DemoItem(scene, parent)
-{
- this->orientation = orien;
- this->width = width;
- this->length = length;
- this->setPos(x, y);
- this->setZValue(40);
- this->setupPixmap();
-}
-
-void DockItem::setupPixmap()
-{
- this->pixmap = new QPixmap(int(this->boundingRect().width()), int(this->boundingRect().height()));
- this->pixmap->fill(QColor(0, 0, 0, 0));
- QPainter painter(this->pixmap);
- // create brush:
- QColor background = Colors::sceneBg1;
- QLinearGradient brush(0, 0, 0, this->boundingRect().height());
- brush.setSpread(QGradient::PadSpread);
-
- if (this->orientation == DOWN){
- brush.setColorAt(0.0, background);
- brush.setColorAt(0.2, background);
- background.setAlpha(0);
- brush.setColorAt(1.0, background);
- }
- else
- if (this->orientation == UP){
- brush.setColorAt(1.0, background);
- brush.setColorAt(0.8, background);
- background.setAlpha(0);
- brush.setColorAt(0.0, background);
- }
- else
- qWarning("DockItem doesn't support the orientation given!");
-
- painter.fillRect(0, 0, int(this->boundingRect().width()), int(this->boundingRect().height()), brush);
-
-}
-
-DockItem::~DockItem()
-{
- delete this->pixmap;
-}
-
-QRectF DockItem::boundingRect() const
-{
- if (this->orientation == UP || this->orientation == DOWN)
- return QRectF(0, 0, this->length, this->width);
- else
- return QRectF(0, 0, this->width, this->length);
-}
-
-void DockItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- painter->drawPixmap(0, 0, *this->pixmap);
-}
-
-
-
diff --git a/demos/qtdemo/dockitem.h b/demos/qtdemo/dockitem.h
deleted file mode 100644
index 796885d9..00000000
--- a/demos/qtdemo/dockitem.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DOCK_ITEM_H
-#define DOCK_ITEM_H
-
-#include <QtGui>
-#include "demoitem.h"
-
-class DockItem : public DemoItem
-{
-public:
- enum ORIENTATION {UP, DOWN, LEFT, RIGHT};
-
- DockItem(ORIENTATION orien, qreal x, qreal y, qreal width, qreal length, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
- virtual ~DockItem();
-
- virtual QRectF boundingRect() const; // overridden
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); // overridden
-
- qreal length;
- qreal width;
- ORIENTATION orientation;
-
-private:
- void setupPixmap();
- QPixmap *pixmap;
-};
-
-#endif // DOCK_ITEM_H
-
diff --git a/demos/qtdemo/examplecontent.cpp b/demos/qtdemo/examplecontent.cpp
deleted file mode 100644
index 73bb09ab..00000000
--- a/demos/qtdemo/examplecontent.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "examplecontent.h"
-#include "colors.h"
-#include "menumanager.h"
-#include "imageitem.h"
-#include "headingitem.h"
-
-ExampleContent::ExampleContent(const QString &name, QGraphicsScene *scene, QGraphicsItem *parent)
- : DemoItem(scene, parent)
-{
- this->name = name;
- this->heading = 0;
- this->description = 0;
- this->screenshot = 0;
-}
-
-void ExampleContent::prepare()
-{
- if (!this->prepared){
- this->prepared = true;
- this->createContent();
- }
-}
-
-void ExampleContent::animationStopped(int id)
-{
- if (id == DemoItemAnimation::ANIM_OUT){
- // Free up some memory:
- delete this->heading;
- delete this->description;
- delete this->screenshot;
- this->heading = 0;
- this->description = 0;
- this->screenshot = 0;
- this->prepared = false;
- }
-}
-
-QString ExampleContent::loadDescription()
-{
- QByteArray ba = MenuManager::instance()->getHtml(this->name);
- QString errorMsg;
- int errorLine, errorColumn;
-
- QDomDocument exampleDoc;
- if (ba.isEmpty()) {
- qDebug() << "No documentation found for" << name << "Is the documentation built?";
- } else if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) {
- qDebug() << "Error loading documentation for " << name << ": " << errorMsg << errorLine << errorColumn;
- }
-
- QDomNodeList paragraphs = exampleDoc.elementsByTagName("p");
- if (paragraphs.length() < 1 && Colors::verbose)
- qDebug() << "- ExampleContent::loadDescription(): Could not load description:"
- << MenuManager::instance()->info[this->name]["docfile"];
- QString description = Colors::contentColor + QLatin1String("");
- //QLatin1String("Could not load description. Ensure that the documentation for Qt is built."); // QTBUG-12522: If there is no description why show an error to the user when qDebug above communications the issue (if it is indeed an issue at all) when demos are built?
- for (int p = 0; p < int(paragraphs.length()); ++p) {
- description = this->extractTextFromParagraph(paragraphs.item(p));
- if (this->isSummary(description)) {
- break;
- }
- }
- return Colors::contentColor + description;
-}
-
-bool ExampleContent::isSummary(const QString &text)
-{
- return (!text.contains("[") &&
- text.indexOf(QRegExp(QString("(In )?((The|This) )?(%1 )?.*(tutorial|example|demo|application)").arg(this->name),
- Qt::CaseInsensitive)) != -1);
-}
-
-QString ExampleContent::extractTextFromParagraph(const QDomNode &parentNode)
-{
- QString description;
- QDomNode node = parentNode.firstChild();
-
- while (!node.isNull()) {
- QString beginTag;
- QString endTag;
- if (node.isText())
- description += Colors::contentColor + node.nodeValue();
- else if (node.hasChildNodes()) {
- if (node.nodeName() == "b") {
- beginTag = "<b>";
- endTag = "</b>";
- } else if (node.nodeName() == "a") {
- beginTag = Colors::contentColor;
- endTag = "</font>";
- } else if (node.nodeName() == "i") {
- beginTag = "<i>";
- endTag = "</i>";
- } else if (node.nodeName() == "tt") {
- beginTag = "<tt>";
- endTag = "</tt>";
- }
- description += beginTag + this->extractTextFromParagraph(node) + endTag;
- }
- node = node.nextSibling();
- }
-
- return description;
-}
-
-void ExampleContent::createContent()
-{
- // Create the items:
- this->heading = new HeadingItem(this->name, this->scene(), this);
- this->description = new DemoTextItem(this->loadDescription(), Colors::contentFont(),
- Colors::heading, 500, this->scene(), this);
- int imgHeight = 340 - int(this->description->boundingRect().height()) + 50;
- this->screenshot = new ImageItem(QImage::fromData(MenuManager::instance()->getImage(this->name)),
- 550, imgHeight, this->scene(), this);
-
- // Place the items on screen:
- this->heading->setPos(0, 3);
- this->description->setPos(0, this->heading->pos().y() + this->heading->boundingRect().height() + 10);
- this->screenshot->setPos(0, this->description->pos().y() + this->description->boundingRect().height() + 10);
-}
-
-QRectF ExampleContent::boundingRect() const
-{
- return QRectF(0, 0, 500, 100);
-}
-
-
diff --git a/demos/qtdemo/examplecontent.h b/demos/qtdemo/examplecontent.h
deleted file mode 100644
index 2fc12bb2..00000000
--- a/demos/qtdemo/examplecontent.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CONTENT_ITEM_H
-#define CONTENT_ITEM_H
-
-#include <QtGui>
-#include <QtXml>
-#include "demoitem.h"
-
-class HeadingItem;
-class DemoTextItem;
-class ImageItem;
-
-class ExampleContent : public DemoItem
-{
-
-public:
- ExampleContent(const QString &name, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
-
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0){};
- void animationStopped(int id);
- void prepare();
-
-private:
- QString name;
- HeadingItem *heading;
- DemoTextItem *description;
- ImageItem *screenshot;
-
- QString loadDescription();
- QString extractTextFromParagraph(const QDomNode &parentNode);
- bool isSummary(const QString &text);
- void createContent();
-};
-
-#endif // CONTENT_ITEM_H
-
diff --git a/demos/qtdemo/guide.cpp b/demos/qtdemo/guide.cpp
deleted file mode 100644
index f79d0406..00000000
--- a/demos/qtdemo/guide.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <cmath>
-#include "guide.h"
-#include "colors.h"
-
-Guide::Guide(Guide *follows)
-{
- this->scaleX = 1.0;
- this->scaleY = 1.0;
-
- if (follows){
- while (follows->nextGuide != follows->firstGuide) // append to end
- follows = follows->nextGuide;
-
- follows->nextGuide = this;
- this->prevGuide = follows;
- this->firstGuide = follows->firstGuide;
- this->nextGuide = follows->firstGuide;
- this->startLength = int(follows->startLength + follows->length()) + 1;
- }
- else{
- this->prevGuide = this;
- this->firstGuide = this;
- this->nextGuide = this;
- this->startLength = 0;
- }
-}
-
-void Guide::setScale(float scaleX, float scaleY, bool all)
-{
- this->scaleX = scaleX;
- this->scaleY = scaleY;
-
- if (all){
- Guide *next = this->nextGuide;
- while(next != this){
- next->scaleX = scaleX;
- next->scaleY = scaleY;
- next = next->nextGuide;
- }
- }
-}
-
-void Guide::setFence(const QRectF &fence, bool all)
-{
- this->fence = fence;
-
- if (all){
- Guide *next = this->nextGuide;
- while(next != this){
- next->fence = fence;
- next = next->nextGuide;
- }
- }
-}
-
-Guide::~Guide()
-{
- if (this != this->nextGuide && this->nextGuide != this->firstGuide)
- delete this->nextGuide;
-}
-
-float Guide::lengthAll()
-{
- float len = length();
- Guide *next = this->nextGuide;
- while(next != this){
- len += next->length();
- next = next->nextGuide;
- }
- return len;
-}
-
-void Guide::move(DemoItem *item, QPointF &dest, float moveSpeed)
-{
- QLineF walkLine(item->getGuidedPos(), dest);
- if (moveSpeed >= 0 && walkLine.length() > moveSpeed){
- // The item is too far away from it's destination point.
- // So we choose to move it towards it instead.
- float dx = walkLine.dx();
- float dy = walkLine.dy();
-
- if (qAbs(dx) > qAbs(dy)){
- // walk along x-axis
- if (dx != 0){
- float d = moveSpeed * dy / qAbs(dx);
- float s = dx > 0 ? moveSpeed : -moveSpeed;
- dest.setX(item->getGuidedPos().x() + s);
- dest.setY(item->getGuidedPos().y() + d);
- }
- }
- else{
- // walk along y-axis
- if (dy != 0){
- float d = moveSpeed * dx / qAbs(dy);
- float s = dy > 0 ? moveSpeed : -moveSpeed;
- dest.setX(item->getGuidedPos().x() + d);
- dest.setY(item->getGuidedPos().y() + s);
- }
- }
- }
-
- item->setGuidedPos(dest);
-}
diff --git a/demos/qtdemo/guide.h b/demos/qtdemo/guide.h
deleted file mode 100644
index db18faaa..00000000
--- a/demos/qtdemo/guide.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GUIDE_H
-#define GUIDE_H
-
-#include "demoitem.h"
-
-class Guide
-{
-public:
- Guide(Guide *follows = 0);
- virtual ~Guide();
-
- virtual void guide(DemoItem *item, float moveSpeed) = 0;
- void move(DemoItem *item, QPointF &dest, float moveSpeed);
- virtual QPointF startPos(){ return QPointF(0, 0); };
- virtual QPointF endPos(){ return QPointF(0, 0); };
- virtual float length(){ return 1; };
- float lengthAll();
-
- void setScale(float scaleX, float scaleY, bool all = true);
- void setFence(const QRectF &fence, bool all = true);
-
- int startLength;
- Guide *nextGuide;
- Guide *firstGuide;
- Guide *prevGuide;
- float scaleX;
- float scaleY;
- QRectF fence;
-};
-
-#endif // GUIDE_H
-
diff --git a/demos/qtdemo/guidecircle.cpp b/demos/qtdemo/guidecircle.cpp
deleted file mode 100644
index 41fb0f49..00000000
--- a/demos/qtdemo/guidecircle.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "guidecircle.h"
-
-static float PI2 = 2*3.1415f;
-
-GuideCircle::GuideCircle(const QRectF &rect, float startAngle, float span, DIRECTION dir, Guide *follows) : Guide(follows)
-{
- this->radiusX = rect.width() / 2.0;
- this->radiusY = rect.height() / 2.0;
- this->posX = rect.topLeft().x();
- this->posY = rect.topLeft().y();
- this->spanRad = span * PI2 / -360.0;
- if (dir == CCW){
- this->startAngleRad = startAngle * PI2 / -360.0;
- this->endAngleRad = startAngleRad + spanRad;
- this->stepAngleRad = this->spanRad / this->length();
- }
- else{
- this->startAngleRad = spanRad + (startAngle * PI2 / -360.0);
- this->endAngleRad = startAngle * PI2 / -360.0;
- this->stepAngleRad = -this->spanRad / this->length();
- }
-}
-
-float GuideCircle::length()
-{
- return qAbs(this->radiusX * spanRad);
-}
-
-QPointF GuideCircle::startPos()
-{
- return QPointF((posX + radiusX + radiusX * cos(startAngleRad)) * scaleX,
- (posY + radiusY + radiusY * sin(startAngleRad)) * scaleY);
-}
-
-QPointF GuideCircle::endPos()
-{
- return QPointF((posX + radiusX + radiusX * cos(endAngleRad)) * scaleX,
- (posY + radiusY + radiusY * sin(endAngleRad)) * scaleY);
-}
-
-void GuideCircle::guide(DemoItem *item, float moveSpeed)
-{
- float frame = item->guideFrame - this->startLength;
- QPointF end((posX + radiusX + radiusX * cos(startAngleRad + (frame * stepAngleRad))) * scaleX,
- (posY + radiusY + radiusY * sin(startAngleRad + (frame * stepAngleRad))) * scaleY);
- this->move(item, end, moveSpeed);
-}
diff --git a/demos/qtdemo/guidecircle.h b/demos/qtdemo/guidecircle.h
deleted file mode 100644
index c93033ad..00000000
--- a/demos/qtdemo/guidecircle.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GUIDECIRCLE_H
-#define GUIDECIRCLE_H
-
-#include "guide.h"
-#include "demoitem.h"
-
-class GuideCircle : public Guide
-{
-public:
- enum DIRECTION {CW = 1, CCW = -1};
-
- GuideCircle(const QRectF &rect, float startAngle = 0, float span = 360, DIRECTION dir = CCW, Guide *follows = 0);
-
- void guide(DemoItem *item, float moveSpeed); // overridden
- QPointF startPos();
- QPointF endPos();
- float length();
-
-private:
- float posX;
- float posY;
- float radiusX;
- float radiusY;
- float startAngleRad;
- float endAngleRad;
- float spanRad;
- float stepAngleRad;
-};
-
-#endif // GUIDECIRCLE_H
-
diff --git a/demos/qtdemo/guideline.cpp b/demos/qtdemo/guideline.cpp
deleted file mode 100644
index 5fc73f79..00000000
--- a/demos/qtdemo/guideline.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "guideline.h"
-#include <cmath>
-
-GuideLine::GuideLine(const QLineF &line, Guide *follows) : Guide(follows)
-{
- this->line = line;
-}
-
-GuideLine::GuideLine(const QPointF &end, Guide *follows) : Guide(follows)
-{
- if (follows)
- this->line = QLineF(prevGuide->endPos(), end);
- else
- this->line = QLineF(QPointF(0, 0), end);
-}
-
-float GuideLine::length()
-{
- return line.length();
-}
-
-QPointF GuideLine::startPos()
-{
- return QPointF(this->line.p1().x() * scaleX, this->line.p1().y() * scaleY);
-}
-
-QPointF GuideLine::endPos()
-{
- return QPointF(this->line.p2().x() * scaleX, this->line.p2().y() * scaleY);
-}
-
-void GuideLine::guide(DemoItem *item, float moveSpeed)
-{
- float frame = item->guideFrame - this->startLength;
- float endX = (this->line.p1().x() + (frame * this->line.dx() / this->length())) * scaleX;
- float endY = (this->line.p1().y() + (frame * this->line.dy() / this->length())) * scaleY;
- QPointF pos(endX, endY);
- this->move(item, pos, moveSpeed);
-}
-
diff --git a/demos/qtdemo/guideline.h b/demos/qtdemo/guideline.h
deleted file mode 100644
index 64ca017a..00000000
--- a/demos/qtdemo/guideline.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GUIDELINE_H
-#define GUIDELINE_H
-
-#include "guide.h"
-#include "demoitem.h"
-
-class GuideLine : public Guide
-{
-public:
- GuideLine(const QLineF &line, Guide *follows = 0);
- GuideLine(const QPointF &end, Guide *follows = 0);
-
- void guide(DemoItem *item, float moveSpeed); // overridden
- QPointF startPos();
- QPointF endPos();
- float length();
-
-private:
- QLineF line;
-
-};
-
-#endif // GUIDELINE_H
-
diff --git a/demos/qtdemo/headingitem.cpp b/demos/qtdemo/headingitem.cpp
deleted file mode 100644
index 3a73744a..00000000
--- a/demos/qtdemo/headingitem.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "headingitem.h"
-#include "colors.h"
-
-HeadingItem::HeadingItem(const QString &text, QGraphicsScene *scene, QGraphicsItem *parent)
- : DemoItem(scene, parent)
-{
- this->text = text;
- this->noSubPixeling = true;
-}
-
-QImage *HeadingItem::createImage(const QMatrix &matrix) const
-{
- float sx = qMin(matrix.m11(), matrix.m22());
- float sy = matrix.m22() < sx ? sx : matrix.m22();
- QFontMetrics fm(Colors::headingFont());
-
- float w = fm.width(this->text) + 1;
- float h = fm.height();
- float xShadow = 3.0f;
- float yShadow = 3.0f;
-
- QImage *image = new QImage(int((w + xShadow) * sx), int((h + yShadow) * sy), QImage::Format_ARGB32_Premultiplied);
- image->fill(QColor(0, 0, 0, 0).rgba());
- QPainter painter(image);
- painter.setFont(Colors::headingFont());
- painter.scale(sx, sy);
-
- //draw shadow
- QLinearGradient brush_shadow(xShadow, yShadow, w, yShadow);
- brush_shadow.setSpread(QLinearGradient::PadSpread);
- if (Colors::useEightBitPalette)
- brush_shadow.setColorAt(0.0f, QColor(0, 0, 0));
- else
- brush_shadow.setColorAt(0.0f, QColor(0, 0, 0, 100));
- QPen pen_shadow;
- pen_shadow.setBrush(brush_shadow);
- painter.setPen(pen_shadow);
- painter.drawText(int(xShadow), int(yShadow), int(w), int(h), Qt::AlignLeft, this->text);
-
- // draw text
- QLinearGradient brush_text(0, 0, w, w);
- brush_text.setSpread(QLinearGradient::PadSpread);
- brush_text.setColorAt(0.0f, QColor(255, 255, 255));
- brush_text.setColorAt(0.2f, QColor(255, 255, 255));
- brush_text.setColorAt(0.5f, QColor(190, 190, 190));
- QPen pen_text;
- pen_text.setBrush(brush_text);
- painter.setPen(pen_text);
- painter.drawText(0, 0, int(w), int(h), Qt::AlignLeft, this->text);
- return image;
-}
-
-
-void HeadingItem::animationStarted(int)
-{
- this->noSubPixeling = false;
-}
-
-
-void HeadingItem::animationStopped(int)
-{
- this->noSubPixeling = true;
-}
diff --git a/demos/qtdemo/headingitem.h b/demos/qtdemo/headingitem.h
deleted file mode 100644
index 5a07dd75..00000000
--- a/demos/qtdemo/headingitem.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HEADING_ITEM_H
-#define HEADING_ITEM_H
-
-#include <QtGui>
-#include "demoitem.h"
-
-class HeadingItem : public DemoItem
-{
-public:
- HeadingItem(const QString &text, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
- void animationStarted(int id = 0);
- void animationStopped(int id = 0);
-
-protected:
- virtual QImage *createImage(const QMatrix &matrix) const; // overridden
-
-private:
- QString text;
-};
-
-#endif // HEADING_ITEM_H
-
diff --git a/demos/qtdemo/imageitem.cpp b/demos/qtdemo/imageitem.cpp
deleted file mode 100644
index 3a1ed587..00000000
--- a/demos/qtdemo/imageitem.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "imageitem.h"
-#include "colors.h"
-
-ImageItem::ImageItem(const QImage &image, int maxWidth, int maxHeight, QGraphicsScene *scene,
- QGraphicsItem *parent, bool adjustSize, float scale) : DemoItem(scene, parent)
-{
- this->image = image;
- this->maxWidth = maxWidth;
- this->maxHeight = maxHeight;
- this->adjustSize = adjustSize;
- this->scale = scale;
-}
-
-QImage *ImageItem::createImage(const QMatrix &matrix) const
-{
- QImage *original = new QImage(image);
- if (original->isNull()){
- return original; // nothing we can do about it...
- }
-
- QPoint size = matrix.map(QPoint(this->maxWidth, this->maxHeight));
- float w = size.x(); // x, y is the used as width, height
- float h = size.y();
-
- // Optimization: if image is smaller than maximum allowed size, just return the loaded image
- if (original->size().height() <= h && original->size().width() <= w && !this->adjustSize && this->scale == 1)
- return original;
-
- // Calculate what the size of the final image will be:
- w = qMin(w, float(original->size().width()) * this->scale);
- h = qMin(h, float(original->size().height()) * this->scale);
-
- float adjustx = 1.0f;
- float adjusty = 1.0f;
- if (this->adjustSize){
- adjustx = qMin(matrix.m11(), matrix.m22());
- adjusty = matrix.m22() < adjustx ? adjustx : matrix.m22();
- w *= adjustx;
- h *= adjusty;
- }
-
- // Create a new image with correct size, and draw original on it
- QImage *image = new QImage(int(w+2), int(h+2), QImage::Format_ARGB32_Premultiplied);
- image->fill(QColor(0, 0, 0, 0).rgba());
- QPainter painter(image);
- painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
- if (this->adjustSize)
- painter.scale(adjustx, adjusty);
- if (this->scale != 1)
- painter.scale(this->scale, this->scale);
- painter.drawImage(0, 0, *original);
-
- if (!this->adjustSize){
- // Blur out edges
- int blur = 30;
- if (h < original->height()){
- QLinearGradient brush1(0, h - blur, 0, h);
- brush1.setSpread(QGradient::PadSpread);
- brush1.setColorAt(0.0, QColor(0, 0, 0, 0));
- brush1.setColorAt(1.0, Colors::sceneBg1);
- painter.fillRect(0, int(h) - blur, original->width(), int(h), brush1);
- }
- if (w < original->width()){
- QLinearGradient brush2(w - blur, 0, w, 0);
- brush2.setSpread(QGradient::PadSpread);
- brush2.setColorAt(0.0, QColor(0, 0, 0, 0));
- brush2.setColorAt(1.0, Colors::sceneBg1);
- painter.fillRect(int(w) - blur, 0, int(w), original->height(), brush2);
- }
- }
- delete original;
- return image;
-}
diff --git a/demos/qtdemo/imageitem.h b/demos/qtdemo/imageitem.h
deleted file mode 100644
index 30fa535b..00000000
--- a/demos/qtdemo/imageitem.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef IMAGE_ITEM_H
-#define IMAGE_ITEM_H
-
-#include <QtGui>
-#include "demoitem.h"
-
-class ImageItem : public DemoItem
-{
-public:
- ImageItem(const QImage &image, int maxWidth, int maxHeight, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0,
- bool adjustSize = false, float scale = 1.0f);
-
- bool adjustSize;
- float scale;
-protected:
- QImage *createImage(const QMatrix &matrix) const;
-
-private:
- QImage image;
- int maxWidth;
- int maxHeight;
-};
-
-#endif // DOCK_ITEM_H
-
diff --git a/demos/qtdemo/images/demobg.png b/demos/qtdemo/images/demobg.png
deleted file mode 100755
index 3280afaa..00000000
--- a/demos/qtdemo/images/demobg.png
+++ /dev/null
Binary files differ
diff --git a/demos/qtdemo/images/qtlogo_large.png b/demos/qtdemo/images/qtlogo_large.png
deleted file mode 100644
index 186c69c7..00000000
--- a/demos/qtdemo/images/qtlogo_large.png
+++ /dev/null
Binary files differ
diff --git a/demos/qtdemo/images/qtlogo_small.png b/demos/qtdemo/images/qtlogo_small.png
deleted file mode 100644
index 21b17dfa..00000000
--- a/demos/qtdemo/images/qtlogo_small.png
+++ /dev/null
Binary files differ
diff --git a/demos/qtdemo/itemcircleanimation.cpp b/demos/qtdemo/itemcircleanimation.cpp
deleted file mode 100644
index e4e302b1..00000000
--- a/demos/qtdemo/itemcircleanimation.cpp
+++ /dev/null
@@ -1,500 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "itemcircleanimation.h"
-#include "demoitemanimation.h"
-#include "colors.h"
-#include "menumanager.h"
-#include "mainwindow.h"
-#include "menumanager.h"
-
-static QGraphicsScene *sscene;
-
-//////////////////// POST EFFECT STUFF ////////////////////////////////////////
-
-class TickerPostEffect
-{
-public:
- virtual ~TickerPostEffect(){};
- virtual void tick(float){};
- virtual void transform(DemoItem *, QPointF &){};
-};
-
-class PostRotateXY : public TickerPostEffect
-{
-public:
- float currRotX, currRotY;
- float speedx, speedy, curvx, curvy;
-
- PostRotateXY(float speedx, float speedy, float curvx, float curvy)
- : currRotX(0), currRotY(0),
- speedx(speedx), speedy(speedy),
- curvx(curvx), curvy(curvy){};
-
- void tick(float adjust)
- {
- currRotX += speedx * adjust;
- currRotY += speedy * adjust;
- }
-
- void transform(DemoItem *item, QPointF &pos)
- {
- DemoItem *parent = (DemoItem *) item->parentItem();
- QPointF center = parent->boundingRect().center();
- pos.setX(center.x() + (pos.x() - center.x()) * cos(currRotX + pos.x() * curvx));
- pos.setY(center.y() + (pos.y() - center.y()) * cos(currRotY + pos.y() * curvy));
- }
-};
-
-class PostRotateXYTwist : public TickerPostEffect
-{
-public:
- float currRotX, currRotY;
- float speedx, speedy, curvx, curvy;
-
- PostRotateXYTwist(float speedx, float speedy, float curvx, float curvy)
- : currRotX(0), currRotY(0),
- speedx(speedx), speedy(speedy),
- curvx(curvx), curvy(curvy){};
-
- void tick(float adjust)
- {
- currRotX += speedx * adjust;
- currRotY += speedy * adjust;
- }
-
- void transform(DemoItem *item, QPointF &pos)
- {
- DemoItem *parent = (DemoItem *) item->parentItem();
- QPointF center = parent->boundingRect().center();
- pos.setX(center.x() + (pos.x() - center.x()) * cos(currRotX + pos.y() * curvx));
- pos.setY(center.y() + (pos.y() - center.y()) * cos(currRotY + pos.x() * curvy));
- }
-};
-
-//////////////////// TICKER EFFECT STUFF //////////////////////////////////////
-
-class TickerEffect
-{
- TickerPostEffect *postEffect;
-public:
- enum EffectStatus{Normal, Intro, Outro} status;
- LetterList *letters;
- float morphSpeed, moveSpeed;
- float normalMorphSpeed, normalMoveSpeed;
- bool useSheepDog, morphBetweenModels;
-
- TickerEffect(LetterList *letters)
- : postEffect(new TickerPostEffect()), status(Intro), letters(letters),
- morphSpeed(Colors::tickerMorphSpeed), moveSpeed(Colors::tickerMoveSpeed),
- normalMorphSpeed(Colors::tickerMorphSpeed), normalMoveSpeed(Colors::tickerMoveSpeed),
- useSheepDog(true), morphBetweenModels(!Colors::noTickerMorph){}
-
- void setPostEffect(TickerPostEffect *effect)
- {
- delete postEffect;
- postEffect = effect;
- }
-
- virtual ~TickerEffect()
- {
- delete postEffect;
- }
-
- void slowDownAfterIntro(float adjust)
- {
- if (morphBetweenModels){
- if (status == Intro){
- float dec = 0.1 * adjust;
- moveSpeed -= dec;
- if (moveSpeed < Colors::tickerMoveSpeed){
- moveSpeed = normalMoveSpeed;
- morphSpeed = normalMorphSpeed;
- status = Normal;
- }
- }
- }
- }
-
- void moveLetters(float adjust)
- {
- float adaptedMoveSpeed = this->moveSpeed * adjust;
- float adaptedMorphSpeed = this->morphSpeed * adjust;
- postEffect->tick(adjust);
-
- for (int i=0; i<letters->size(); i++){
- LetterItem *letter = letters->at(i);
- letter->guideAdvance(this->morphBetweenModels ? adaptedMoveSpeed : Colors::tickerMoveSpeed);
- letter->guideMove(this->morphBetweenModels ? adaptedMorphSpeed : -1);
-
- QPointF pos = letter->getGuidedPos();
- postEffect->transform(letter, pos);
-
- if (useSheepDog)
- letter->setPosUsingSheepDog(pos, QRectF(0, 0, 800, 600));
- else
- letter->setPos(pos);
- }
- }
-
- virtual void tick(float adjust)
- {
- slowDownAfterIntro(adjust);
- moveLetters(adjust);
- }
-
-};
-
-class EffectWhirlWind : public TickerEffect
-{
-public:
- EffectWhirlWind(LetterList *letters) : TickerEffect(letters)
- {
- moveSpeed = 50;
- for (int i=0; i<this->letters->size(); i++){
- LetterItem *letter = this->letters->at(i);
- letter->setGuidedPos(QPointF(0, 100));
- }
- }
-};
-
-class EffectSnake : public TickerEffect
-{
-public:
- EffectSnake(LetterList *letters) : TickerEffect(letters)
- {
- moveSpeed = 40;
- for (int i=0; i<this->letters->size(); i++){
- LetterItem *letter = this->letters->at(i);
- letter->setGuidedPos(QPointF(0, -250 - (i * 5)));
- }
- }
-};
-
-class EffectScan : public TickerEffect
-{
-public:
- EffectScan(LetterList *letters) : TickerEffect(letters)
- {
- for (int i=0; i<this->letters->size(); i++){
- LetterItem *letter = this->letters->at(i);
- letter->setGuidedPos(QPointF(100, -300));
- }
- }
-};
-
-class EffectRaindrops : public TickerEffect
-{
-public:
- EffectRaindrops(LetterList *letters) : TickerEffect(letters)
- {
- for (int i=0; i<this->letters->size(); i++){
- LetterItem *letter = this->letters->at(i);
- letter->setGuidedPos(QPointF(-100 + rand() % 200, - 200.0f - rand() % 1300));
- }
- }
-};
-
-class EffectLine : public TickerEffect
-{
-public:
- EffectLine(LetterList *letters) : TickerEffect(letters)
- {
- for (int i=0; i<this->letters->size(); i++){
- LetterItem *letter = this->letters->at(i);
- letter->setGuidedPos(QPointF(100, 500.0f + i * 20));
- }
- }
-};
-
-//////////////////// TICKER STUFF /////////////////////////////////////////////
-
-ItemCircleAnimation::ItemCircleAnimation(QGraphicsScene *scene, QGraphicsItem *parent)
- : DemoItem(scene, parent)
-{
- sscene = scene;
- this->letterCount = Colors::tickerLetterCount;
- this->scale = 1;
- this->showCount = -1;
- this->tickOnPaint = false;
- this->paused = false;
- this->doIntroTransitions = true;
- this->setAcceptHoverEvents(true);
- this->setCursor(Qt::OpenHandCursor);
- this->setupGuides();
- this->setupLetters();
- this->useGuideQt();
- this->effect = 0;//new TickerEffect(this->letterList);
-}
-
-ItemCircleAnimation::~ItemCircleAnimation()
-{
- delete this->letterList;
- delete this->qtGuide1;
- delete this->qtGuide2;
- delete this->qtGuide3;
- delete this->effect;
-}
-
-void ItemCircleAnimation::createLetter(char c)
-{
- LetterItem *letter = new LetterItem(c, sscene, this);
- this->letterList->append(letter);
-}
-
-void ItemCircleAnimation::setupLetters()
-{
- this->letterList = new LetterList();
-
- QString s = Colors::tickerText;
- int len = s.length();
- int i = 0;
- for (; i < this->letterCount - len; i += len)
- for (int l=0; l<len; l++)
- createLetter(s[l].toLatin1());
-
- // Fill inn with blanks:
- for (; i < this->letterCount; ++i)
- createLetter(' ');
-}
-
-void ItemCircleAnimation::setupGuides()
-{
- int x = 0;
- int y = 20;
-
- this->qtGuide1 = new GuideCircle(QRectF(x, y, 260, 260), -36, 342);
- this->currGuide = 0;
- new GuideLine(QPointF(x + 240, y + 268), this->qtGuide1);
- new GuideLine(QPointF(x + 265, y + 246), this->qtGuide1);
- new GuideLine(QPointF(x + 158, y + 134), this->qtGuide1);
- new GuideLine(QPointF(x + 184, y + 109), this->qtGuide1);
- new GuideLine(QPointF(x + 160, y + 82), this->qtGuide1);
- new GuideLine(QPointF(x + 77, y + 163), this->qtGuide1); // T-top
- new GuideLine(QPointF(x + 100, y + 190), this->qtGuide1);
- new GuideLine(QPointF(x + 132, y + 159), this->qtGuide1);
- new GuideLine(QPointF(x + 188, y + 211), this->qtGuide1);
- new GuideCircle(QRectF(x + 30, y + 30, 200, 200), -30, 336, GuideCircle::CW, this->qtGuide1);
- new GuideLine(QPointF(x + 238, y + 201), this->qtGuide1);
-
- y = 30;
- this->qtGuide2 = new GuideCircle(QRectF(x + 30, y + 30, 200, 200), 135, 270, GuideCircle::CCW);
- new GuideLine(QPointF(x + 222, y + 38), this->qtGuide2);
- new GuideCircle(QRectF(x, y, 260, 260), 135, 270, GuideCircle::CW, this->qtGuide2);
- new GuideLine(QPointF(x + 59, y + 59), this->qtGuide2);
-
- x = 115;
- y = 10;
- this->qtGuide3 = new GuideLine(QLineF(x, y, x + 30, y));
- new GuideLine(QPointF(x + 30, y + 170), this->qtGuide3);
- new GuideLine(QPointF(x, y + 170), this->qtGuide3);
- new GuideLine(QPointF(x, y), this->qtGuide3);
-
- this->qtGuide1->setFence(QRectF(0, 0, 800, 600));
- this->qtGuide2->setFence(QRectF(0, 0, 800, 600));
- this->qtGuide3->setFence(QRectF(0, 0, 800, 600));
-}
-
-void ItemCircleAnimation::useGuide(Guide *guide, int firstLetter, int lastLetter)
-{
- float padding = guide->lengthAll() / float(lastLetter - firstLetter);
- for (int i=firstLetter; i<lastLetter; i++){
- LetterItem *letter = this->letterList->at(i);
- letter->useGuide(guide, (i - firstLetter) * padding);
- }
-}
-
-void ItemCircleAnimation::useGuideQt()
-{
- if (this->currGuide != this->qtGuide1){
- this->useGuide(qtGuide1, 0, this->letterCount);
- this->currGuide = qtGuide1;
- }
-}
-
-void ItemCircleAnimation::useGuideTt()
-{
- if (this->currGuide != this->qtGuide2){
- int split = int(this->letterCount * 5.0 / 7.0);
- this->useGuide(qtGuide2, 0, split);
- this->useGuide(qtGuide3, split, this->letterCount);
- this->currGuide = qtGuide2;
- }
-}
-
-QRectF ItemCircleAnimation::boundingRect() const
-{
- return QRectF(0, 0, 300, 320);
-}
-
-void ItemCircleAnimation::prepare()
-{
-}
-
-void ItemCircleAnimation::switchToNextEffect()
-{
- ++this->showCount;
- delete this->effect;
-
- switch (this->showCount){
- case 1:
- this->effect = new EffectSnake(this->letterList);
- break;
- case 2:
- this->effect = new EffectLine(this->letterList);
- this->effect->setPostEffect(new PostRotateXYTwist(0.01f, 0.0f, 0.003f, 0.0f));
- break;
- case 3:
- this->effect = new EffectRaindrops(this->letterList);
- this->effect->setPostEffect(new PostRotateXYTwist(0.01f, 0.005f, 0.003f, 0.003f));
- break;
- case 4:
- this->effect = new EffectScan(this->letterList);
- this->effect->normalMoveSpeed = 0;
- this->effect->setPostEffect(new PostRotateXY(0.008f, 0.0f, 0.005f, 0.0f));
- break;
- default:
- this->showCount = 0;
- this->effect = new EffectWhirlWind(this->letterList);
- }
-}
-
-void ItemCircleAnimation::animationStarted(int id)
-{
- if (id == DemoItemAnimation::ANIM_IN){
- if (this->doIntroTransitions){
- // Make all letters dissapear
- for (int i=0; i<this->letterList->size(); i++){
- LetterItem *letter = this->letterList->at(i);
- letter->setPos(1000, 0);
- }
- this->switchToNextEffect();
- this->useGuideQt();
- this->scale = 1;
- // The first time we run, we have a rather large
- // delay to perform benchmark before the ticker shows.
- // But now, since we are showing, use a more appropriate value:
- this->currentAnimation->startDelay = 1500;
- }
- }
- else if (this->effect)
- this->effect->useSheepDog = false;
-
- this->tickTimer = QTime::currentTime();
-}
-
-void ItemCircleAnimation::animationStopped(int)
-{
- // Nothing to do.
-}
-
-void ItemCircleAnimation::swapModel(){
- if (this->currGuide == this->qtGuide2)
- this->useGuideQt();
- else
- this->useGuideTt();
-}
-
-void ItemCircleAnimation::hoverEnterEvent(QGraphicsSceneHoverEvent *)
-{
-// Skip swap here to enhance ticker dragging
-// this->swapModel();
-}
-
-void ItemCircleAnimation::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
-{
- this->swapModel();
-}
-
-void ItemCircleAnimation::setTickerScale(float s)
-{
- this->scale = s;
- qtGuide1->setScale(this->scale, this->scale);
- qtGuide2->setScale(this->scale, this->scale);
- qtGuide3->setScale(this->scale, this->scale);
-}
-
-void ItemCircleAnimation::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- this->mouseMoveLastPosition = event->scenePos();
- if (event->button() == Qt::LeftButton)
- this->setCursor(Qt::ClosedHandCursor);
- else
- this->switchToNextEffect();
-}
-
-void ItemCircleAnimation::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- this->setCursor(Qt::OpenHandCursor);
-}
-
-void ItemCircleAnimation::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
-{
- QPointF newPosition = event->scenePos();
- this->setPosUsingSheepDog(this->pos() + newPosition - this->mouseMoveLastPosition, QRectF(-260, -280, 1350, 1160));
- this->mouseMoveLastPosition = newPosition;
-}
-
-void ItemCircleAnimation::wheelEvent(QGraphicsSceneWheelEvent *event)
-{
- this->effect->moveSpeed = this->effect->moveSpeed + (event->delta() > 0 ? -0.20 : 0.20);
- if (this->effect->moveSpeed < 0)
- this->effect->moveSpeed = 0;
-}
-
-void ItemCircleAnimation::pause(bool on)
-{
- this->paused = on;
- this->tickTimer = QTime::currentTime();
-}
-
-void ItemCircleAnimation::tick()
-{
- if (this->paused || !this->effect)
- return;
-
- float t = this->tickTimer.msecsTo(QTime::currentTime());
- this->tickTimer = QTime::currentTime();
- this->effect->tick(t/10.0f);
-}
-
-void ItemCircleAnimation::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
-{
- if (this->tickOnPaint)
- tick();
-}
-
-
-
-
diff --git a/demos/qtdemo/itemcircleanimation.h b/demos/qtdemo/itemcircleanimation.h
deleted file mode 100644
index 98a129fe..00000000
--- a/demos/qtdemo/itemcircleanimation.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ITEM_CIRCLE_ANIMATION_H
-#define ITEM_CIRCLE_ANIMATION_H
-
-#include <QtCore>
-#include <QObject>
-#include <QtGui>
-#include <QTimeLine>
-#include <QList>
-#include "demoitem.h"
-#include "letteritem.h"
-#include "guideline.h"
-#include "guidecircle.h"
-
-typedef QList<LetterItem *> LetterList;
-class TickerEffect;
-
-class ItemCircleAnimation : public QObject, public DemoItem
-{
-public:
- ItemCircleAnimation(QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
- virtual ~ItemCircleAnimation();
-
- // overridden methods:
- QRectF boundingRect() const;
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
- void wheelEvent(QGraphicsSceneWheelEvent *event);
- void animationStarted(int id = 0);
- void animationStopped(int id = 0);
- void prepare();
- void tick();
- void switchToNextEffect();
- void useGuideQt();
- void useGuideTt();
- void pause(bool on);
-
- bool tickOnPaint;
- bool paused;
- bool doIntroTransitions;
-
-private:
- void setupLetters();
- void createLetter(char c);
- void setupGuides();
- void useGuide(Guide *guide, int firstLetter, int lastLetter);
- void swapModel();
- void setTickerScale(float s);
-
- int showCount;
- float scale;
- QPointF mouseMoveLastPosition;
- int letterCount;
- LetterList *letterList;
- Guide *qtGuide1;
- Guide *qtGuide2;
- Guide *qtGuide3;
- Guide *currGuide;
- TickerEffect *effect;
- QTime tickTimer;
-};
-
-#endif // ITEM_CIRCLE_ANIMATION_H
-
-
-
diff --git a/demos/qtdemo/letteritem.cpp b/demos/qtdemo/letteritem.cpp
deleted file mode 100644
index bf416b96..00000000
--- a/demos/qtdemo/letteritem.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <cmath>
-#include "letteritem.h"
-#include "colors.h"
-
-LetterItem::LetterItem(char letter, QGraphicsScene *scene, QGraphicsItem *parent) : DemoItem(scene, parent), letter(letter)
-{
- useSharedImage(QString(__FILE__) + letter);
-}
-
-LetterItem::~LetterItem()
-{
-}
-
-QImage *LetterItem::createImage(const QMatrix &matrix) const
-{
- QRect scaledRect = matrix.mapRect(QRect(0, 0, 25, 25));
- QImage *image = new QImage(scaledRect.width(), scaledRect.height(), QImage::Format_ARGB32_Premultiplied);
- image->fill(0);
- QPainter painter(image);
- painter.scale(matrix.m11(), matrix.m22());
- painter.setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
- painter.setPen(Qt::NoPen);
- if (Colors::useEightBitPalette){
- painter.setBrush(QColor(102, 175, 54));
- painter.drawEllipse(0, 0, 25, 25);
- painter.setFont(Colors::tickerFont());
- painter.setPen(QColor(255, 255, 255));
- painter.drawText(10, 15, QString(this->letter));
- }
- else {
- QLinearGradient brush(0, 0, 0, 25);
- brush.setSpread(QLinearGradient::PadSpread);
- brush.setColorAt(0.0, QColor(102, 175, 54, 200));
- brush.setColorAt(1.0, QColor(102, 175, 54, 60));
- painter.setBrush(brush);
- painter.drawEllipse(0, 0, 25, 25);
- painter.setFont(Colors::tickerFont());
- painter.setPen(QColor(255, 255, 255, 255));
- painter.drawText(10, 15, QString(this->letter));
- }
- return image;
-}
-
-
diff --git a/demos/qtdemo/letteritem.h b/demos/qtdemo/letteritem.h
deleted file mode 100644
index a0d227f6..00000000
--- a/demos/qtdemo/letteritem.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LETTER_ITEM_H
-#define LETTER_ITEM_H
-
-#include <QtGui>
-#include "demoitem.h"
-
-class LetterItem : public DemoItem
-{
-public:
- LetterItem(char letter, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
- virtual ~LetterItem();
-
-protected:
- QImage *createImage(const QMatrix &matrix) const;
-
-private:
- char letter;
-};
-
-#endif // LETTER_ITEM_H
-
diff --git a/demos/qtdemo/main.cpp b/demos/qtdemo/main.cpp
deleted file mode 100644
index 8f8ab421..00000000
--- a/demos/qtdemo/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include "mainwindow.h"
-#include "menumanager.h"
-#include "colors.h"
-
-static void artisticSleep(int sleepTime)
-{
- QTime time;
- time.restart();
- while (time.elapsed() < sleepTime)
- QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
-}
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(qtdemo);
- QApplication app(argc, argv);
- Colors::parseArgs(argc, argv);
- MainWindow mainWindow;
- MenuManager::instance()->init(&mainWindow);
- mainWindow.setFocus();
-
- if (Colors::fullscreen)
- mainWindow.showFullScreen();
- else {
- mainWindow.enableMask(true);
- mainWindow.show();
- }
-
- artisticSleep(500);
- mainWindow.start();
- return app.exec();
-}
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp
deleted file mode 100644
index 0aee2af6..00000000
--- a/demos/qtdemo/mainwindow.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-#include "menumanager.h"
-#include "colors.h"
-#include "dockitem.h"
-#include "demotextitem.h"
-#include "imageitem.h"
-#include "demoitem.h"
-#include "demoscene.h"
-
-#ifndef QT_NO_OPENGL
- #include <QGLWidget>
-#endif
-//#define QT_NO_OPENGL
-
-MainWindow::MainWindow(QWidget *parent) : QGraphicsView(parent), updateTimer(this)
-{
- this->currentFps = Colors::fps;
- this->loop = false;
- this->fpsMedian = -1;
- this->fpsLabel = 0;
- this->pausedLabel = 0;
- this->doneAdapt = false;
- this->useTimer = false;
- this->updateTimer.setSingleShot(true);
- this->companyLogo = 0;
- this->qtLogo = 0;
- this->setupWidget();
- this->setupScene();
- this->setupSceneItems();
- this->drawBackgroundToPixmap();
-}
-
-MainWindow::~MainWindow()
-{
- delete this->companyLogo;
- delete this->qtLogo;
-}
-
-void MainWindow::setupWidget()
-{
- QRect screenRect = QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen());
- QRect windowRect(0, 0, 800, 600);
- if (screenRect.width() < 800)
- windowRect.setWidth(screenRect.width());
- if (screenRect.height() < 600)
- windowRect.setHeight(screenRect.height());
- windowRect.moveCenter(screenRect.center());
- this->setGeometry(windowRect);
- this->setMinimumSize(80, 60);
- setWindowTitle(tr("Qt Examples and Demos"));
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setFrameStyle(QFrame::NoFrame);
- this->setRenderingSystem();
- connect(&this->updateTimer, SIGNAL(timeout()), this, SLOT(tick()));
-}
-
-void MainWindow::setRenderingSystem()
-{
- QWidget *viewport = 0;
-
-#ifndef QT_NO_OPENGL
- if (Colors::openGlRendering) {
- QGLWidget *glw = new QGLWidget(QGLFormat(QGL::SampleBuffers));
- if (Colors::noScreenSync)
- glw->format().setSwapInterval(0);
- glw->setAutoFillBackground(false);
- viewport = glw;
- setCacheMode(QGraphicsView::CacheNone);
- if (Colors::verbose)
- qDebug() << "- using OpenGL";
- } else // software rendering
-#endif
- {
- // software rendering
- viewport = new QWidget;
- setCacheMode(QGraphicsView::CacheBackground);
- if (Colors::verbose)
- qDebug() << "- using software rendering";
- }
-
- setViewport(viewport);
-}
-
-void MainWindow::start()
-{
- this->switchTimerOnOff(true);
- this->demoStartTime.restart();
- MenuManager::instance()->itemSelected(MenuManager::ROOT, Colors::rootMenuName);
- if (Colors::verbose)
- qDebug("- starting demo");
-}
-
-void MainWindow::enableMask(bool enable)
-{
- if (!enable || Colors::noWindowMask)
- this->clearMask();
- else {
- QPolygon region;
- region.setPoints(9,
- // north side:
- 0, 0,
- 800, 0,
- // east side:
- // 800, 70,
- // 790, 90,
- // 790, 480,
- // 800, 500,
- 800, 600,
- // south side:
- 700, 600,
- 670, 590,
- 130, 590,
- 100, 600,
- 0, 600,
- // west side:
- // 0, 550,
- // 10, 530,
- // 10, 520,
- // 0, 520,
- 0, 0);
- this->setMask(QRegion(region));
- }
-}
-
-void MainWindow::setupScene()
-{
- this->scene = new DemoScene(this);
- this->scene->setSceneRect(0, 0, 800, 600);
- setScene(this->scene);
- this->scene->setItemIndexMethod(QGraphicsScene::NoIndex);
-}
-
-void MainWindow::drawItems(QPainter *painter, int numItems, QGraphicsItem **items, const QStyleOptionGraphicsItem* options)
-{
- QGraphicsView::drawItems(painter, numItems, items, options);
-}
-
-void MainWindow::switchTimerOnOff(bool on)
-{
- bool ticker = MenuManager::instance()->ticker && MenuManager::instance()->ticker->scene();
- if (ticker)
- MenuManager::instance()->ticker->tickOnPaint = !on || Colors::noTimerUpdate;
-
- if (on && !Colors::noTimerUpdate){
- this->useTimer = true;
- this->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
- this->fpsTime = QTime::currentTime();
- this->updateTimer.start(int(1000 / Colors::fps));
- }
- else{
- this->useTimer = false;
- this->updateTimer.stop();
- if (Colors::softwareRendering)
- if (Colors::noTicker)
- this->setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
- else
- this->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
- else
- this->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
- }
-}
-
-bool MainWindow::measureFps()
-{
- // Calculate time diff:
- float t = this->fpsTime.msecsTo(QTime::currentTime());
- if (t == 0)
- t = 0.01f;
- this->currentFps = (1000.0f / t);
- this->fpsHistory += this->currentFps;
- this->fpsTime = QTime::currentTime();
-
- // Calculate median:
- int size = this->fpsHistory.size();
- if (size == 10){
- qSort(this->fpsHistory.begin(), this->fpsHistory.end());
- this->fpsMedian = this->fpsHistory.at(int(size/2));
- if (this->fpsMedian == 0)
- this->fpsMedian = 0.01f;
- this->fpsHistory.clear();
- return true;
- }
- return false;
-}
-
-/**
- Used for adaption in case things are so slow
- that no median yet has been calculated
-*/
-void MainWindow::forceFpsMedianCalculation()
-{
- if (this->fpsMedian != -1)
- return;
-
- int size = this->fpsHistory.size();
- if (size == 0){
- this->fpsMedian = 0.01f;
- return;
- }
-
- qSort(this->fpsHistory.begin(), this->fpsHistory.end());
- this->fpsMedian = this->fpsHistory.at(int(size/2));
- if (this->fpsMedian == 0)
- this->fpsMedian = 0.01f;
-}
-
-void MainWindow::tick()
-{
- bool medianChanged = this->measureFps();
- this->checkAdapt();
-
- if (medianChanged && this->fpsLabel && Colors::showFps)
- this->fpsLabel->setText(QString("FPS: ") + QString::number(int(this->currentFps)));
-
- if (MenuManager::instance()->ticker)
- MenuManager::instance()->ticker->tick();
-
- this->viewport()->update();
- if (this->useTimer)
- this->updateTimer.start(int(1000 / Colors::fps));
-}
-
-void MainWindow::setupSceneItems()
-{
- if (Colors::showFps){
- this->fpsLabel = new DemoTextItem(QString("FPS: --"), Colors::buttonFont(), Qt::white, -1, this->scene, 0, DemoTextItem::DYNAMIC_TEXT);
- this->fpsLabel->setZValue(1000);
- this->fpsLabel->setPos(Colors::stageStartX, 600 - QFontMetricsF(Colors::buttonFont()).height() - 5);
- }
-
- this->mainSceneRoot = new QGraphicsWidget();
- this->scene->addItem(mainSceneRoot);
- this->companyLogo = new ImageItem(QImage(":/images/qtlogo_large.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f);
- this->qtLogo = new ImageItem(QImage(":/images/qtlogo_small.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f);
- this->companyLogo->setZValue(100);
- this->qtLogo->setZValue(100);
- this->pausedLabel = new DemoTextItem(QString("PAUSED"), Colors::buttonFont(), Qt::white, -1, this->scene, 0);
- this->pausedLabel->setZValue(100);
- QFontMetricsF fm(Colors::buttonFont());
- this->pausedLabel->setPos(Colors::stageWidth - fm.width("PAUSED"), 590 - fm.height());
- this->pausedLabel->setRecursiveVisible(false);
-}
-
-void MainWindow::checkAdapt()
-{
- if (this->doneAdapt
- || Colors::noTimerUpdate
- || this->demoStartTime.elapsed() < 2000)
- return;
-
- this->doneAdapt = true;
- this->forceFpsMedianCalculation();
- Colors::benchmarkFps = this->fpsMedian;
- if (Colors::verbose)
- qDebug() << "- benchmark:" << QString::number(Colors::benchmarkFps) << "FPS";
-
- if (Colors::noAdapt)
- return;
-
- if (this->fpsMedian < 30){
- if (MenuManager::instance()->ticker && MenuManager::instance()->ticker->scene()){
- this->scene->removeItem(MenuManager::instance()->ticker);
- Colors::noTimerUpdate = true;
- this->switchTimerOnOff(false);
- if (this->fpsLabel)
- this->fpsLabel->setText(QString("FPS: (") + QString::number(this->fpsMedian) + QString(")"));
- if (Colors::verbose)
- qDebug() << "- benchmark adaption: removed ticker (fps < 30)";
- }
-
- if (this->fpsMedian < 20){
- Colors::noAnimations = true;
- if (Colors::verbose)
- qDebug() << "- benchmark adaption: animations switched off (fps < 20)";
- }
-
- Colors::adapted = true;
- }
-}
-
-int MainWindow::performBenchmark()
-{
-/*
- QTime time;
- time.restart();
- while (time.elapsed() < 2000)
- QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
-*/
- return 0;
-}
-
-void MainWindow::drawBackgroundToPixmap()
-{
- const QRectF r = this->scene->sceneRect();
- this->background = QPixmap(qRound(r.width()), qRound(r.height()));
- this->background.fill(Qt::black);
- QPainter painter(&this->background);
-
- if (false && Colors::useEightBitPalette){
- painter.fillRect(r, Colors::sceneBg1);
- } else {
- QImage bg(":/images/demobg.png");
- painter.drawImage(0, 0, bg);
- }
-}
-
-void MainWindow::drawBackground(QPainter *painter, const QRectF &rect)
-{
- Q_UNUSED(rect);
- painter->drawPixmap(QPoint(0, 0), this->background);
-}
-
-void MainWindow::showEvent(QShowEvent * event)
-{
- Q_UNUSED(event);
- QGraphicsView::showEvent(event);
-}
-
-void MainWindow::toggleFullscreen()
-{
- if (this->isFullScreen()){
- this->enableMask(true);
- this->showNormal();
- if (MenuManager::instance()->ticker)
- MenuManager::instance()->ticker->pause(false);
- }
- else {
- this->enableMask(false);
- this->showFullScreen();
- }
-}
-
-void MainWindow::keyPressEvent(QKeyEvent *event)
-{
- if (event->key() == Qt::Key_Escape){
- this->loop = false;
- QApplication::quit();
- }
- else if (event->key() == Qt::Key_F1){
- QString s("");
- s += "Rendering system: ";
- if (Colors::openGlRendering)
- s += "OpenGL";
- else
- s += "software";
-
- s += "\nAdapt: ";
- s += Colors::noAdapt ? "off" : "on";
- s += "\nAdaption occurred: ";
- s += Colors::adapted ? "yes" : "no";
- s += "\nOpenGL version: ";
- s += Colors::glVersion;
- QWidget w;
- s += "\nColor bit depth: ";
- s += QString::number(w.depth());
- s += "\nWanted FPS: ";
- s += QString::number(Colors::fps);
- s += "\nBenchmarked FPS: ";
- s += Colors::benchmarkFps != -1 ? QString::number(Colors::benchmarkFps) : "not calculated";
- s += "\nAnimations: ";
- s += Colors::noAnimations ? "off" : "on";
- s += "\nBlending: ";
- s += Colors::useEightBitPalette ? "off" : "on";
- s += "\nTicker: ";
- s += Colors::noTicker ? "off" : "on";
- s += "\nPixmaps: ";
- s += Colors::usePixmaps ? "on" : "off";
- s += "\nRescale images on resize: ";
- s += Colors::noRescale ? "off" : "on";
- s += "\nTimer based updates: ";
- s += Colors::noTimerUpdate ? "off" : "on";
- s += "\nSeparate loop: ";
- s += Colors::useLoop ? "yes" : "no";
- s += "\nScreen sync: ";
- s += Colors::noScreenSync ? "no" : "yes";
- QMessageBox::information(0, QString("Current configuration"), s);
- }
- QGraphicsView::keyPressEvent(event);
-}
-
-void MainWindow::focusInEvent(QFocusEvent *)
-{
- if (!Colors::pause)
- return;
-
- if (MenuManager::instance()->ticker)
- MenuManager::instance()->ticker->pause(false);
-
- int code = MenuManager::instance()->currentMenuCode;
- if (code == MenuManager::ROOT || code == MenuManager::MENU1)
- this->switchTimerOnOff(true);
-
- this->pausedLabel->setRecursiveVisible(false);
-}
-
-void MainWindow::focusOutEvent(QFocusEvent *)
-{
- if (!Colors::pause)
- return;
-
- if (MenuManager::instance()->ticker)
- MenuManager::instance()->ticker->pause(true);
-
- int code = MenuManager::instance()->currentMenuCode;
- if (code == MenuManager::ROOT || code == MenuManager::MENU1)
- this->switchTimerOnOff(false);
-
- this->pausedLabel->setRecursiveVisible(true);
-}
-
-void MainWindow::resizeEvent(QResizeEvent *event)
-{
- Q_UNUSED(event);
-
- this->resetMatrix();
- this->scale(event->size().width() / 800.0, event->size().height() / 600.0);
- QGraphicsView::resizeEvent(event);
- DemoItem::setMatrix(this->matrix());
-
- if (this->companyLogo){
- const QRectF r = this->scene->sceneRect();
- QRectF ttb = this->companyLogo->boundingRect();
- this->companyLogo->setPos(int((r.width() - ttb.width()) / 2), 595 - ttb.height());
- QRectF qtb = this->qtLogo->boundingRect();
- this->qtLogo->setPos(802 - qtb.width(), 0);
- }
-
- // Changing size will almost always
- // hurt FPS during the changing. So
- // ignore it.
- this->fpsHistory.clear();
-}
-
-
diff --git a/demos/qtdemo/mainwindow.h b/demos/qtdemo/mainwindow.h
deleted file mode 100644
index 106a78ec..00000000
--- a/demos/qtdemo/mainwindow.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAIN_WINDOW_H
-#define MAIN_WINDOW_H
-
-#include <QtWidgets>
-#include <QPixmap>
-
-class DemoTextItem;
-class ImageItem;
-
-class MainWindow : public QGraphicsView
-{
- Q_OBJECT
-
-public:
- MainWindow(QWidget *parent = 0);
- ~MainWindow();
- void enableMask(bool enable);
- void toggleFullscreen();
- int performBenchmark();
- void switchTimerOnOff(bool on);
- void start();
-
- QGraphicsScene *scene;
- QGraphicsWidget* mainSceneRoot;
-
- bool loop;
-
- // FPS stuff:
- QList<QTime> frameTimeList;
- QList<float> fpsHistory;
- float currentFps;
- float fpsMedian;
- DemoTextItem *fpsLabel;
-
-protected:
- // Overridden methods:
- void showEvent(QShowEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void resizeEvent(QResizeEvent *event);
- void drawBackground(QPainter *painter, const QRectF &rect);
- void drawItems(QPainter *painter, int numItems, QGraphicsItem ** items, const QStyleOptionGraphicsItem* options);
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
-
-private slots:
- void tick();
-
-private:
- void setupWidget();
- void setupSceneItems();
- void drawBackgroundToPixmap();
- void setupScene();
- bool measureFps();
- void forceFpsMedianCalculation();
- void checkAdapt();
- void setRenderingSystem();
-
- QTimer updateTimer;
- QTime demoStartTime;
- QTime fpsTime;
- QPixmap background;
- ImageItem *companyLogo;
- ImageItem *qtLogo;
- bool doneAdapt;
- bool useTimer;
- DemoTextItem *pausedLabel;
-};
-
-#endif // MAIN_WINDOW_H
-
diff --git a/demos/qtdemo/menucontent.cpp b/demos/qtdemo/menucontent.cpp
deleted file mode 100644
index cdffe823..00000000
--- a/demos/qtdemo/menucontent.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "menucontent.h"
-#include "colors.h"
-#include "menumanager.h"
-#include "demotextitem.h"
-#include "headingitem.h"
-
-MenuContentItem::MenuContentItem(const QDomElement &el, QGraphicsScene *scene, QGraphicsItem *parent)
- : DemoItem(scene, parent)
-{
- this->name = el.attribute("name");
- this->heading = 0;
- this->description1 = 0;
- this->description2 = 0;
-
- if (el.tagName() == "demos") {
- qWarning("MenuContentItem: category '%s' no longer supported.", qPrintable(el.tagName()));
- // this->readmePath = QLibraryInfo::location(QLibraryInfo::DemosPath) + "/README";
- }
- this->readmePath = QLibraryInfo::location(QLibraryInfo::ExamplesPath) + "/" + el.attribute("dirname") + "/README";
-}
-
-void MenuContentItem::prepare()
-{
- if (!this->prepared){
- this->prepared= true;
- this->createContent();
- }
-}
-
-void MenuContentItem::animationStopped(int id)
-{
- if (this->name == Colors::rootMenuName)
- return; // Optimization hack.
-
- if (id == DemoItemAnimation::ANIM_OUT){
- // Free up some memory:
- delete this->heading;
- delete this->description1;
- delete this->description2;
- this->heading = 0;
- this->description1 = 0;
- this->description2 = 0;
- this->prepared = false;
- }
-}
-
-QString MenuContentItem::loadDescription(int startPara, int nrPara)
-{
- QString result;
- QFile readme(this->readmePath);
- if (!readme.open(QFile::ReadOnly)){
- if (Colors::verbose)
- qDebug() << "- MenuContentItem::loadDescription: Could not load:" << this->readmePath;
- return "";
- }
-
- QTextStream in(&readme);
- // Skip a certain number of paragraphs:
- while (startPara)
- if (in.readLine().isEmpty()) --startPara;
-
- // Read in the number of wanted paragraphs:
- QString line = in.readLine();
- do {
- result += line + " ";
- line = in.readLine();
- if (line.isEmpty()){
- --nrPara;
- line = "<br><br>" + in.readLine();
- }
- } while (nrPara && !in.atEnd());
-
- return Colors::contentColor + result;
-}
-
-void MenuContentItem::createContent()
-{
- // Create the items:
- this->heading = new HeadingItem(this->name, this->scene(), this);
- QString para1 = this->loadDescription(0, 1);
- if (para1.isEmpty())
- para1 = Colors::contentColor + QLatin1String("Could not load description. Ensure that the documentation for Qt is built.");
- QColor bgcolor = Colors::sceneBg1.darker(200);
- bgcolor.setAlpha(100);
- this->description1 = new DemoTextItem(para1, Colors::contentFont(), Colors::heading, 500, this->scene(), this, DemoTextItem::STATIC_TEXT);
- this->description2 = new DemoTextItem(this->loadDescription(1, 2), Colors::contentFont(), Colors::heading, 250, this->scene(), this, DemoTextItem::STATIC_TEXT);
-
- // Place the items on screen:
- this->heading->setPos(0, 3);
- this->description1->setPos(0, this->heading->pos().y() + this->heading->boundingRect().height() + 10);
- this->description2->setPos(0, this->description1->pos().y() + this->description1->boundingRect().height() + 15);
-}
-
-QRectF MenuContentItem::boundingRect() const
-{
- return QRectF(0, 0, 500, 350);
-}
-
-
diff --git a/demos/qtdemo/menucontent.h b/demos/qtdemo/menucontent.h
deleted file mode 100644
index 6c798089..00000000
--- a/demos/qtdemo/menucontent.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MENU_CONTENT_ITEM_H
-#define MENU_CONTENT_ITEM_H
-
-#include <QtGui>
-#include <QtXml>
-#include "demoitem.h"
-
-class HeadingItem;
-class DemoTextItem;
-
-class MenuContentItem : public DemoItem
-{
-
-public:
- MenuContentItem(const QDomElement &el, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
-
- virtual QRectF boundingRect() const; // overridden
- virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0){}; // overridden
- void animationStopped(int id);
- void prepare();
-
-private:
- QString name;
- QString readmePath;
- HeadingItem *heading;
- DemoTextItem *description1;
- DemoTextItem *description2;
-
- QString loadDescription(int startPara, int nrPara);
- QString extractTextFromParagraph(const QDomNode &parentNode);
-
- void createContent();
-};
-
-#endif // MENU_CONTENT_ITEM_H
-
diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp
deleted file mode 100644
index b8c16937..00000000
--- a/demos/qtdemo/menumanager.cpp
+++ /dev/null
@@ -1,979 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "menumanager.h"
-#include "colors.h"
-#include "menucontent.h"
-#include "examplecontent.h"
-
-#include <QStandardPaths>
-
-#ifndef QT_NO_DECLARATIVE
-#include <QtQuick1>
-#endif
-
-MenuManager *MenuManager::pInstance = 0;
-
-MenuManager * MenuManager::instance()
-{
- if (!MenuManager::pInstance)
- MenuManager::pInstance = new MenuManager();
- return MenuManager::pInstance;
-}
-
-MenuManager::MenuManager()
-{
- this->ticker = 0;
- this->tickerInAnim = 0;
- this->upButton = 0;
- this->downButton = 0;
- this->helpEngine = 0;
- this->score = new Score();
- this->currentMenu = QLatin1String("[no menu visible]");
- this->currentCategory = QLatin1String("[no category visible]");
- this->currentMenuButtons = QLatin1String("[no menu buttons visible]");
- this->currentInfo = QLatin1String("[no info visible]");
- this->currentMenuCode = -1;
- this->readXmlDocument();
- this->initHelpEngine();
-}
-
-MenuManager::~MenuManager()
-{
- delete this->score;
- delete this->contentsDoc;
- delete this->helpEngine;
-}
-
-QByteArray MenuManager::getResource(const QString &name)
-{
- QByteArray ba = this->helpEngine->fileData(name);
- if (Colors::verbose && ba.isEmpty())
- qDebug() << " - WARNING: Could not get " << name;
- return ba;
-}
-
-void MenuManager::readXmlDocument()
-{
- this->contentsDoc = new QDomDocument();
- QString errorStr;
- int errorLine;
- int errorColumn;
-
- QFile file(":/xml/examples.xml");
- bool statusOK = this->contentsDoc->setContent(&file, true, &errorStr, &errorLine, &errorColumn);
- if (!statusOK){
- QMessageBox::critical(0,
- QObject::tr("DOM Parser"),
- QObject::tr("Could not read or find the contents document. Error at line %1, column %2:\n%3")
- .arg(errorLine).arg(errorColumn).arg(errorStr)
- );
- exit(-1);
- }
-}
-
-void MenuManager::initHelpEngine()
-{
- this->helpRootUrl = QString("qthelp://com.trolltech.qt.%1%2%3/qdoc/")
- .arg(QT_VERSION >> 16).arg((QT_VERSION >> 8) & 0xFF)
- .arg(QT_VERSION & 0xFF);
-
- // Store help collection file in cache dir of assistant
- QString cacheDir;
- const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
- if (!paths.isEmpty())
- cacheDir = paths.front() + QLatin1String("/Trolltech/Assistant/"); // ### fixme
- const QString helpDataFile = QString(QLatin1String("qtdemo_%1.qhc")).arg(QLatin1String(QT_VERSION_STR));
-
- QDir dir;
- if (!dir.exists(cacheDir))
- dir.mkpath(cacheDir);
-
- // Create help engine (and new
- // helpDataFile if it does not exist):
- this->helpEngine = new QHelpEngineCore(cacheDir + helpDataFile);
- this->helpEngine->setupData();
-
- QString qtDocRoot = QLibraryInfo::location(QLibraryInfo::DocumentationPath) + QLatin1String("/qch");
- qtDocRoot = QDir(qtDocRoot).absolutePath();
-
- QStringList qchFiles;
- qchFiles << QLatin1String("/qt.qch")
- << QLatin1String("/designer.qch")
- << QLatin1String("/linguist.qch");
-
- QString oldDir = helpEngine->customValue(QLatin1String("docDir"), QString()).toString();
- if (oldDir != qtDocRoot) {
- foreach (const QString &qchFile, qchFiles)
- helpEngine->unregisterDocumentation(QHelpEngineCore::namespaceName(qtDocRoot + qchFile));
- }
-
- // If the data that the engine will work
- // on is not yet registered, do it now:
- foreach (const QString &qchFile, qchFiles)
- helpEngine->registerDocumentation(qtDocRoot + qchFile);
-
- helpEngine->setCustomValue(QLatin1String("docDir"), qtDocRoot);
-}
-
-void MenuManager::itemSelected(int userCode, const QString &menuName)
-{
- switch (userCode){
- case LAUNCH:
- this->launchExample(this->currentInfo);
- break;
- case LAUNCH_QML:
- this->launchQmlExample(this->currentInfo);
- break;
- case DOCUMENTATION:
- this->showDocInAssistant(this->currentInfo);
- break;
- case QUIT:
- this->window->loop = false;
- QCoreApplication::quit();
- break;
- case FULLSCREEN:
- this->window->toggleFullscreen();
- break;
- case ROOT:
- // out:
- this->score->queueMovie(this->currentMenu + " -out", Score::FROM_START, Score::LOCK_ITEMS);
- this->score->queueMovie(this->currentMenuButtons + " -out", Score::FROM_START, Score::LOCK_ITEMS);
- this->score->queueMovie(this->currentInfo + " -out");
- this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
- this->score->queueMovie("back -out", Score::ONLY_IF_VISIBLE);
- if(qmlRoot)
- qmlRoot->setProperty("show", QVariant(false));
- // book-keeping:
- this->currentMenuCode = ROOT;
- this->currentMenu = menuName + " -menu1";
- this->currentMenuButtons = menuName + " -buttons";
- this->currentInfo = menuName + " -info";
- // in:
- this->score->queueMovie("upndown -shake");
- this->score->queueMovie(this->currentMenu, Score::FROM_START, Score::UNLOCK_ITEMS);
- this->score->queueMovie(this->currentMenuButtons, Score::FROM_START, Score::UNLOCK_ITEMS);
- this->score->queueMovie(this->currentInfo);
- if (!Colors::noTicker){
- this->ticker->doIntroTransitions = true;
- this->tickerInAnim->startDelay = 2000;
- this->ticker->useGuideQt();
- this->score->queueMovie("ticker", Score::NEW_ANIMATION_ONLY);
- }
- break;
- case MENU1:
- // out:
- this->score->queueMovie(this->currentMenu + " -out", Score::FROM_START, Score::LOCK_ITEMS);
- this->score->queueMovie(this->currentMenuButtons + " -out", Score::FROM_START, Score::LOCK_ITEMS);
- this->score->queueMovie(this->currentInfo + " -out");
- if(qmlRoot)
- qmlRoot->setProperty("show", QVariant(false));
- // book-keeping:
- this->currentMenuCode = MENU1;
- this->currentCategory = menuName;
- this->currentMenu = menuName + " -menu1";
- this->currentInfo = menuName + " -info";
- // in:
- this->score->queueMovie("upndown -shake");
- this->score->queueMovie("back -in");
- this->score->queueMovie(this->currentMenu, Score::FROM_START, Score::UNLOCK_ITEMS);
- this->score->queueMovie(this->currentInfo);
- if (!Colors::noTicker)
- this->ticker->useGuideTt();
- break;
- case MENU2:
- // out:
- this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY);
- this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
- if(qmlRoot)
- qmlRoot->setProperty("show", QVariant(false));
- // book-keeping:
- this->currentMenuCode = MENU2;
- this->currentInfo = menuName;
- // in / shake:
- this->score->queueMovie("upndown -shake");
- this->score->queueMovie("back -shake");
- this->score->queueMovie(this->currentMenu + " -shake");
- this->score->queueMovie(this->currentInfo, Score::NEW_ANIMATION_ONLY);
- this->score->queueMovie(this->currentInfo + " -buttons", Score::NEW_ANIMATION_ONLY);
- if (!Colors::noTicker){
- this->score->queueMovie("ticker -out", Score::NEW_ANIMATION_ONLY);
- }
- break;
- case UP:{
- QString backMenu = this->info[this->currentMenu]["back"];
- if (!backMenu.isNull()){
- this->score->queueMovie(this->currentMenu + " -top_out", Score::FROM_START, Score::LOCK_ITEMS);
- this->score->queueMovie(backMenu + " -bottom_in", Score::FROM_START, Score::UNLOCK_ITEMS);
- this->currentMenu = backMenu;
- }
- break; }
- case DOWN:{
- QString moreMenu = this->info[this->currentMenu]["more"];
- if (!moreMenu.isNull()){
- this->score->queueMovie(this->currentMenu + " -bottom_out", Score::FROM_START, Score::LOCK_ITEMS);
- this->score->queueMovie(moreMenu + " -top_in", Score::FROM_START, Score::UNLOCK_ITEMS);
- this->currentMenu = moreMenu;
- }
- break; }
- case BACK:{
- if (this->currentMenuCode == MENU2){
- // out:
- this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY);
- this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
- if(qmlRoot)
- qmlRoot->setProperty("show", QVariant(false));
- // book-keeping:
- this->currentMenuCode = MENU1;
- this->currentMenuButtons = this->currentCategory + " -buttons";
- this->currentInfo = this->currentCategory + " -info";
- // in / shake:
- this->score->queueMovie("upndown -shake");
- this->score->queueMovie(this->currentMenu + " -shake");
- this->score->queueMovie(this->currentInfo, Score::NEW_ANIMATION_ONLY);
- this->score->queueMovie(this->currentInfo + " -buttons", Score::NEW_ANIMATION_ONLY);
- if (!Colors::noTicker){
- this->ticker->doIntroTransitions = false;
- this->tickerInAnim->startDelay = 500;
- this->score->queueMovie("ticker", Score::NEW_ANIMATION_ONLY);
- }
- } else if (this->currentMenuCode != ROOT)
- itemSelected(ROOT, Colors::rootMenuName);
- break; }
- }
-
- // update back- and more buttons
- bool noBackMenu = this->info[this->currentMenu]["back"].isNull();
- bool noMoreMenu = this->info[this->currentMenu]["more"].isNull();
- this->upButton->setState(noBackMenu ? TextButton::DISABLED : TextButton::OFF);
- this->downButton->setState(noMoreMenu ? TextButton::DISABLED : TextButton::OFF);
-
- if (this->score->hasQueuedMovies()){
- this->score->playQue();
- // Playing new movies might include
- // loading etc. So ignore the FPS
- // at this point
- this->window->fpsHistory.clear();
- }
-}
-
-void MenuManager::showDocInAssistant(const QString &name)
-{
- QString url = this->resolveDocUrl(name);
- if (Colors::verbose)
- qDebug() << "Sending URL to Assistant:" << url;
-
- // Start assistant if it's not already running:
- if (this->assistantProcess.state() != QProcess::Running){
- QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
-#if !defined(Q_OS_MAC)
- app += QLatin1String("assistant");
-#else
- app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
-#endif
- QStringList args;
- args << QLatin1String("-enableRemoteControl");
- this->assistantProcess.start(app, args);
- if (!this->assistantProcess.waitForStarted()) {
- QMessageBox::critical(0, tr("Qt Demo"), tr("Could not start Qt Assistant.").arg(app));
- return;
- }
- }
-
- // Send command through remote control even if the process
- // was started to activate assistant and bring it to front:
- QTextStream str(&this->assistantProcess);
- str << "SetSource " << url << QLatin1Char('\n') << endl;
-}
-
-void MenuManager::launchExample(const QString &name)
-{
- QString executable = this->resolveExeFile(name);
-#ifdef Q_OS_MAC
- if (Colors::verbose)
- qDebug() << "Launching:" << executable;
- bool success = QDesktopServices::openUrl(QUrl::fromLocalFile(executable));
- if (!success){
- QMessageBox::critical(0, tr("Failed to launch the example"),
- tr("Could not launch the example. Ensure that it has been built and installed."),
- QMessageBox::Cancel);
- }
-#else // Not mac. To not break anything regarding dll's etc, keep it the way it was before:
- QProcess *process = new QProcess(this);
- connect(process, SIGNAL(finished(int)), this, SLOT(exampleFinished()));
- connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(exampleError(QProcess::ProcessError)));
-
-#ifdef Q_OS_WIN
- //make sure it finds the dlls on windows
- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
- env.insert(QLatin1String("PATH"), QLibraryInfo::location(QLibraryInfo::BinariesPath)
- + QLatin1Char(';') + env.value(QLatin1String("Path")));
- process->setProcessEnvironment(env);
-#endif
-
- if (info[name]["changedirectory"] != "false"){
- QString workingDirectory = resolveDataDir(name);
- process->setWorkingDirectory(workingDirectory);
- if (Colors::verbose)
- qDebug() << "Setting working directory:" << workingDirectory;
- }
-
- if (Colors::verbose)
- qDebug() << "Launching:" << executable;
- process->start(executable);
-#endif
-}
-
-void MenuManager::launchQmlExample(const QString &name)
-{
-#ifndef QT_NO_DECLARATIVE
- if(!qmlRoot){
- exampleError(QProcess::UnknownError);
- return;
- }
- //resolveQmlFilename - refactor to separate fn?
- QString dirName = this->info[name]["dirname"];
- QString category = this->info[name]["category"];
- QString fileName = this->info[name]["filename"];
- QDir dir;
- if (category == "demos") {
- qWarning("MenuContentItem: category '%s' no longer supported.", qPrintable(category));
- // dir = QDir(QLibraryInfo::location(QLibraryInfo::DemosPath));
- }
- dir = QDir(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
- QFile file(dir.path() + "/" + dirName + "/" + fileName + "/" + "main.qml");
- if(!file.exists()){
- //try dirname.qml as well
- file.setFileName(dir.path() + "/" + dirName + "/" + fileName + "/" + fileName.split('/').last() + ".qml");
- if(!file.exists()){
- exampleError(QProcess::UnknownError);
- return;
- }
- }
-
- qmlRoot->setProperty("qmlFile", QVariant(""));//unload component
- qmlRoot->setProperty("show", QVariant(true));
- qmlRoot->setProperty("qmlFile", QUrl::fromLocalFile(file.fileName()));
-#else
- exampleError(QProcess::UnknownError);
-#endif
-}
-
-void MenuManager::quitQML()
-{
- if(qmlRoot)
- qmlRoot->setProperty("show", QVariant(false));
-}
-
-void MenuManager::exampleFinished()
-{
-}
-
-void MenuManager::exampleError(QProcess::ProcessError error)
-{
- if (error != QProcess::Crashed)
- QMessageBox::critical(0, tr("Failed to launch the example"),
- tr("Could not launch the example. Ensure that it has been built."),
- QMessageBox::Cancel);
-}
-
-void MenuManager::init(MainWindow *window)
-{
- this->window = window;
-
- // Create div:
- this->createTicker();
- this->createUpnDownButtons();
- this->createBackButton();
-
- // Create first level menu:
- QDomElement rootElement = this->contentsDoc->documentElement();
- this->createRootMenu(rootElement);
-
- // Create second level menus:
- QDomNode level2MenuNode = rootElement.firstChild();
- while (!level2MenuNode.isNull()){
- QDomElement level2MenuElement = level2MenuNode.toElement();
- this->createSubMenu(level2MenuElement);
-
- // create leaf menu and example info:
- QDomNode exampleNode = level2MenuElement.firstChild();
- while (!exampleNode.isNull()){
- QDomElement exampleElement = exampleNode.toElement();
- this->readInfoAboutExample(exampleElement);
- this->createLeafMenu(exampleElement);
- exampleNode = exampleNode.nextSibling();
- }
-
- level2MenuNode = level2MenuNode.nextSibling();
- }
-
- qmlRoot = 0;
-#ifndef QT_NO_DECLARATIVE
- // Create QML Loader
- declarativeEngine = new QDeclarativeEngine(this);
- connect(declarativeEngine, SIGNAL(quit()),
- this, SLOT(quitQML()));
-
- QDeclarativeComponent component(declarativeEngine, QUrl("qrc:qml/qmlShell.qml"), this);
- QDeclarativeItem* qmlRootItem = 0;
- if(component.isReady()){
- qmlRoot = component.create();
- qmlRootItem = qobject_cast<QDeclarativeItem*>(qmlRoot);
- }else{
- qDebug() << component.status() << component.errorString();
- }
-
- if(qmlRootItem){
- qmlRootItem->setHeight(this->window->scene->sceneRect().height());
- qmlRootItem->setWidth(this->window->scene->sceneRect().width());
- qmlRootItem->setZValue(101);//Above other items
- qmlRootItem->setCursor(Qt::ArrowCursor);
- window->scene->addItem(qmlRootItem);
-
- //Note that QML adds key handling to the app.
- window->viewport()->setFocusPolicy(Qt::NoFocus);//Correct keyboard focus handling
- window->setFocusPolicy(Qt::StrongFocus);
- window->scene->setStickyFocus(true);
- window->setFocus();
- }else{
- qDebug() << "Error initializing QML subsystem, Declarative examples will not work";
- }
-#endif
-}
-
-void MenuManager::readInfoAboutExample(const QDomElement &example)
-{
- QString name = example.attribute("name");
- if (this->info.contains(name))
- qWarning() << "__WARNING: MenuManager::readInfoAboutExample: Demo/example with name"
- << name << "appears twice in the xml-file!__";
-
- this->info[name]["filename"] = example.attribute("filename");
- this->info[name]["category"] = example.parentNode().toElement().tagName();
- this->info[name]["dirname"] = example.parentNode().toElement().attribute("dirname");
- this->info[name]["changedirectory"] = example.attribute("changedirectory");
- this->info[name]["image"] = example.attribute("image");
- this->info[name]["qml"] = example.attribute("qml");
-}
-
-QString MenuManager::resolveDataDir(const QString &name)
-{
- QString dirName = this->info[name]["dirname"];
- QString category = this->info[name]["category"];
- QString fileName = this->info[name]["filename"];
-
- QDir dir;
- if (category == "demos") {
- qWarning("MenuManager: category '%s' no longer supported.", qPrintable(category));
- // dir = QDir(QLibraryInfo::location(QLibraryInfo::DemosPath));
- }
- dir = QDir(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
- dir.cd(dirName);
- dir.cd(fileName);
- return dir.absolutePath();
-}
-
-QString MenuManager::resolveExeFile(const QString &name)
-{
- QString dirName = this->info[name]["dirname"];
- QString category = this->info[name]["category"];
- QString fileName = this->info[name]["filename"];
-
- QDir dir;
- if (category == "demos") {
- qWarning("MenuManager: category '%s' no longer supported.", qPrintable(category));
- // dir = QDir(QLibraryInfo::location(QLibraryInfo::DemosPath));
- }
-
- dir = QDir(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
- dir.cd(dirName);
- dir.cd(fileName);
-
- fileName = fileName.split(QLatin1Char('/')).last();
-#ifdef Q_OS_WIN
- fileName += QLatin1String(".exe");
-#endif
- // UNIX, Mac non-framework and Windows installed builds.
- const QFile installedFile(dir.path() + QLatin1Char('/') + fileName);
- if (installedFile.exists())
- return installedFile.fileName();
- // Windows in-source builds
-#if defined(Q_OS_WIN)
- const QFile winR(dir.path() + QLatin1String("/release/") + fileName);
- if (winR.exists())
- return winR.fileName();
- const QFile winD(dir.path() + QLatin1String("/debug/") + fileName);
- if (winD.exists())
- return winD.fileName();
-#elif defined(Q_OS_MAC)
- // Mac frameworks
- const QFile mac(dir.path() + QLatin1Char('/') + fileName + QLatin1String(".app"));
- if (mac.exists())
- return mac.fileName();
-#endif
- if (Colors::verbose)
- qDebug() << "- WARNING: Could not resolve executable:" << dir.path() << fileName;
- return "__executable not found__";
-}
-
-QString MenuManager::resolveDocUrl(const QString &name)
-{
- QString dirName = this->info[name]["dirname"];
- QString category = this->info[name]["category"];
- QString fileName = this->info[name]["filename"];
-
- if (category == "demos")
- return this->helpRootUrl + "demos-" + fileName.replace("/", "-") + ".html";
- else
- return this->helpRootUrl + dirName.replace("/", "-") + "-" + fileName + ".html";
-}
-
-QString MenuManager::resolveImageUrl(const QString &name)
-{
- return this->helpRootUrl + "images/" + name;
-}
-
-QByteArray MenuManager::getHtml(const QString &name)
-{
- return getResource(this->resolveDocUrl(name));
-}
-
-QByteArray MenuManager::getImage(const QString &name)
-{
- QString imageName = this->info[name]["image"];
- QString category = this->info[name]["category"];
- QString fileName = this->info[name]["filename"];
- bool qml = (this->info[name]["qml"] == QLatin1String("true"));
- if(qml)
- fileName = QLatin1String("qml-") + fileName.split('/').last();
-
- if (imageName.isEmpty()){
- if (category == "demos")
- imageName = fileName + "-demo.png";
- else
- imageName = fileName + "-example.png";
- if ((getResource(resolveImageUrl(imageName))).isEmpty())
- imageName = fileName + ".png";
- if ((getResource(resolveImageUrl(imageName))).isEmpty())
- imageName = fileName + "example.png";
- }
- return getResource(resolveImageUrl(imageName));
-}
-
-
-void MenuManager::createRootMenu(const QDomElement &el)
-{
- QString name = el.attribute("name");
- createMenu(el, MENU1);
- createInfo(new MenuContentItem(el, this->window->scene, this->window->mainSceneRoot), name + " -info");
-
- Movie *menuButtonsIn = this->score->insertMovie(name + " -buttons");
- Movie *menuButtonsOut = this->score->insertMovie(name + " -buttons -out");
- createLowLeftButton(QLatin1String("Quit"), QUIT, menuButtonsIn, menuButtonsOut, 0);
- createLowRightButton("Toggle fullscreen", FULLSCREEN, menuButtonsIn, menuButtonsOut, 0);
-}
-
-void MenuManager::createSubMenu(const QDomElement &el)
-{
- QString name = el.attribute("name");
- createMenu(el, MENU2);
- createInfo(new MenuContentItem(el, this->window->scene, this->window->mainSceneRoot), name + " -info");
-}
-
-void MenuManager::createLeafMenu(const QDomElement &el)
-{
- QString name = el.attribute("name");
- createInfo(new ExampleContent(name, this->window->scene, this->window->mainSceneRoot), name);
-
- Movie *infoButtonsIn = this->score->insertMovie(name + " -buttons");
- Movie *infoButtonsOut = this->score->insertMovie(name + " -buttons -out");
- createLowRightLeafButton("Documentation", 600, DOCUMENTATION, infoButtonsIn, infoButtonsOut, 0);
- if (el.attribute("executable") != "false")
- createLowRightLeafButton("Launch", 405, LAUNCH, infoButtonsIn, infoButtonsOut, 0);
- else if(el.attribute("qml") == "true")
- createLowRightLeafButton("Display", 405, LAUNCH_QML, infoButtonsIn, infoButtonsOut, 0);
-}
-
-void MenuManager::createMenu(const QDomElement &category, BUTTON_TYPE type)
-{
- qreal sw = this->window->scene->sceneRect().width();
- int xOffset = 15;
- int yOffset = 10;
- int maxExamples = Colors::menuCount;
- int menuIndex = 1;
- QString name = category.attribute("name");
- QDomNode currentNode = category.firstChild();
- QString currentMenu = name + QLatin1String(" -menu") + QString::number(menuIndex);
-
- while (!currentNode.isNull()){
- Movie *movieIn = this->score->insertMovie(currentMenu);
- Movie *movieOut = this->score->insertMovie(currentMenu + " -out");
- Movie *movieNextTopOut = this->score->insertMovie(currentMenu + " -top_out");
- Movie *movieNextBottomOut = this->score->insertMovie(currentMenu + " -bottom_out");
- Movie *movieNextTopIn = this->score->insertMovie(currentMenu + " -top_in");
- Movie *movieNextBottomIn = this->score->insertMovie(currentMenu + " -bottom_in");
- Movie *movieShake = this->score->insertMovie(currentMenu + " -shake");
-
- int i = 0;
- while (!currentNode.isNull() && i < maxExamples){
- TextButton *item;
-
- // create normal menu button
- QString label = currentNode.toElement().attribute("name");
- item = new TextButton(label, TextButton::LEFT, type, this->window->scene, this->window->mainSceneRoot);
- currentNode = currentNode.nextSibling();
-
-#ifndef QT_OPENGL_SUPPORT
- if (currentNode.toElement().attribute("dirname") == "opengl")
- currentNode = currentNode.nextSibling();
-#endif
-
- item->setRecursiveVisible(false);
- item->setZValue(10);
- qreal ih = item->sceneBoundingRect().height();
- qreal iw = item->sceneBoundingRect().width();
- qreal ihp = ih + 3;
-
- // create in-animation:
- DemoItemAnimation *anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_IN);
- anim->setDuration(float(1000 + (i * 20)) * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(xOffset, -ih));
- anim->setPosAt(0.20, QPointF(xOffset, -ih));
- anim->setPosAt(0.50, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY + (10 * float(i / 4.0f))));
- anim->setPosAt(0.60, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(0.70, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY + (5 * float(i / 4.0f))));
- anim->setPosAt(0.80, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(0.90, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY + (2 * float(i / 4.0f))));
- anim->setPosAt(1.00, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- movieIn->append(anim);
-
- // create out-animation:
- anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_OUT);
- anim->hideOnFinished = true;
- anim->setDuration((700 + (30 * i)) * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(0.60, QPointF(xOffset, 600 - ih - ih));
- anim->setPosAt(0.65, QPointF(xOffset + 20, 600 - ih));
- anim->setPosAt(1.00, QPointF(sw + iw, 600 - ih));
- movieOut->append(anim);
-
- // create shake-animation:
- anim = new DemoItemAnimation(item);
- anim->setDuration(700 * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(0.55, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY - i*2.0));
- anim->setPosAt(0.70, QPointF(xOffset - 10, (i * ihp) + yOffset + Colors::contentStartY - i*1.5));
- anim->setPosAt(0.80, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY - i*1.0));
- anim->setPosAt(0.90, QPointF(xOffset - 2, (i * ihp) + yOffset + Colors::contentStartY - i*0.5));
- anim->setPosAt(1.00, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- movieShake->append(anim);
-
- // create next-menu top-out-animation:
- anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_OUT);
- anim->hideOnFinished = true;
- anim->setDuration((200 + (30 * i)) * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(0.70, QPointF(xOffset, yOffset + Colors::contentStartY));
- anim->setPosAt(1.00, QPointF(-iw, yOffset + Colors::contentStartY));
- movieNextTopOut->append(anim);
-
- // create next-menu bottom-out-animation:
- anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_OUT);
- anim->hideOnFinished = true;
- anim->setDuration((200 + (30 * i)) * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(0.70, QPointF(xOffset, (maxExamples * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(1.00, QPointF(-iw, (maxExamples * ihp) + yOffset + Colors::contentStartY));
- movieNextBottomOut->append(anim);
-
- // create next-menu top-in-animation:
- anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_IN);
- anim->setDuration((700 - (30 * i)) * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(-iw, yOffset + Colors::contentStartY));
- anim->setPosAt(0.30, QPointF(xOffset, yOffset + Colors::contentStartY));
- anim->setPosAt(1.00, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- movieNextTopIn->append(anim);
-
- // create next-menu bottom-in-animation:
- int reverse = maxExamples - i;
- anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_IN);
- anim->setDuration((1000 - (30 * reverse)) * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(-iw, (maxExamples * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(0.30, QPointF(xOffset, (maxExamples * ihp) + yOffset + Colors::contentStartY));
- anim->setPosAt(1.00, QPointF(xOffset, (i * ihp) + yOffset + Colors::contentStartY));
- movieNextBottomIn->append(anim);
-
- i++;
- }
-
- if (!currentNode.isNull() && i == maxExamples){
- // We need another menu, so register for 'more' and 'back' buttons
- ++menuIndex;
- this->info[currentMenu]["more"] = name + QLatin1String(" -menu") + QString::number(menuIndex);
- currentMenu = name + QLatin1String(" -menu") + QString::number(menuIndex);
- this->info[currentMenu]["back"] = name + QLatin1String(" -menu") + QString::number(menuIndex - 1);
- }
- }
-}
-
-
-void MenuManager::createLowLeftButton(const QString &label, BUTTON_TYPE type,
- Movie *movieIn, Movie *movieOut, Movie *movieShake, const QString &menuString)
-{
- TextButton *button = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
- if (!menuString.isNull())
- button->setMenuString(menuString);
- button->setRecursiveVisible(false);
- button->setZValue(10);
-
- qreal iw = button->sceneBoundingRect().width();
- int xOffset = 15;
-
- // create in-animation:
- DemoItemAnimation *buttonIn = new DemoItemAnimation(button, DemoItemAnimation::ANIM_IN);
- buttonIn->setDuration(1800 * Colors::animSpeedButtons);
- buttonIn->setStartPos(QPointF(-iw, Colors::contentStartY + Colors::contentHeight - 35));
- buttonIn->setPosAt(0.5, QPointF(-iw, Colors::contentStartY + Colors::contentHeight - 35));
- buttonIn->setPosAt(0.7, QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 35));
- buttonIn->setPosAt(1.0, QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 26));
- movieIn->append(buttonIn);
-
- // create out-animation:
- DemoItemAnimation *buttonOut = new DemoItemAnimation(button, DemoItemAnimation::ANIM_OUT);
- buttonOut->hideOnFinished = true;
- buttonOut->setDuration(400 * Colors::animSpeedButtons);
- buttonOut->setStartPos(QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 26));
- buttonOut->setPosAt(1.0, QPointF(-iw, Colors::contentStartY + Colors::contentHeight - 26));
- movieOut->append(buttonOut);
-
- if (movieShake){
- DemoItemAnimation *shakeAnim = new DemoItemAnimation(button, DemoItemAnimation::ANIM_UNSPECIFIED);
- shakeAnim->timeline->setCurveShape(QTimeLine::LinearCurve);
- shakeAnim->setDuration(650);
- shakeAnim->setStartPos(buttonIn->posAt(1.0f));
- shakeAnim->setPosAt(0.60, buttonIn->posAt(1.0f));
- shakeAnim->setPosAt(0.70, buttonIn->posAt(1.0f) + QPointF(-3, 0));
- shakeAnim->setPosAt(0.80, buttonIn->posAt(1.0f) + QPointF(2, 0));
- shakeAnim->setPosAt(0.90, buttonIn->posAt(1.0f) + QPointF(-1, 0));
- shakeAnim->setPosAt(1.00, buttonIn->posAt(1.0f));
- movieShake->append(shakeAnim);
- }
-}
-
-void MenuManager::createLowRightButton(const QString &label, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/)
-{
- TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
- item->setRecursiveVisible(false);
- item->setZValue(10);
-
- qreal sw = this->window->scene->sceneRect().width();
- int xOffset = 70;
-
- // create in-animation:
- DemoItemAnimation *anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_IN);
- anim->setDuration(1800 * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(sw, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.5, QPointF(sw, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.7, QPointF(xOffset + 535, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(1.0, QPointF(xOffset + 535, Colors::contentStartY + Colors::contentHeight - 26));
- movieIn->append(anim);
-
- // create out-animation:
- anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_OUT);
- anim->hideOnFinished = true;
- anim->setDuration(400 * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(xOffset + 535, Colors::contentStartY + Colors::contentHeight - 26));
- anim->setPosAt(1.0, QPointF(sw, Colors::contentStartY + Colors::contentHeight - 26));
- movieOut->append(anim);
-}
-
-void MenuManager::createLowRightLeafButton(const QString &label, int xOffset, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/)
-{
- TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
- item->setRecursiveVisible(false);
- item->setZValue(10);
-
- qreal sw = this->window->scene->sceneRect().width();
- qreal sh = this->window->scene->sceneRect().height();
-
- // create in-animation:
- DemoItemAnimation *anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_IN);
- anim->setDuration(1050 * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(sw, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.10, QPointF(sw, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.30, QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.35, QPointF(xOffset + 30, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.40, QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.45, QPointF(xOffset + 5, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(0.50, QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 35));
- anim->setPosAt(1.00, QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 26));
- movieIn->append(anim);
-
- // create out-animation:
- anim = new DemoItemAnimation(item, DemoItemAnimation::ANIM_OUT);
- anim->hideOnFinished = true;
- anim->setDuration(300 * Colors::animSpeedButtons);
- anim->setStartPos(QPointF(xOffset, Colors::contentStartY + Colors::contentHeight - 26));
- anim->setPosAt(1.0, QPointF(xOffset, sh));
- movieOut->append(anim);
-}
-
-void MenuManager::createInfo(DemoItem *item, const QString &name)
-{
- Movie *movie_in = this->score->insertMovie(name);
- Movie *movie_out = this->score->insertMovie(name + " -out");
- item->setZValue(8);
- item->setRecursiveVisible(false);
-
- float xOffset = 230.0f;
- DemoItemAnimation *infoIn = new DemoItemAnimation(item, DemoItemAnimation::ANIM_IN);
- infoIn->timeline->setCurveShape(QTimeLine::LinearCurve);
- infoIn->setDuration(650);
- infoIn->setStartPos(QPointF(this->window->scene->sceneRect().width(), Colors::contentStartY));
- infoIn->setPosAt(0.60, QPointF(xOffset, Colors::contentStartY));
- infoIn->setPosAt(0.70, QPointF(xOffset + 20, Colors::contentStartY));
- infoIn->setPosAt(0.80, QPointF(xOffset, Colors::contentStartY));
- infoIn->setPosAt(0.90, QPointF(xOffset + 7, Colors::contentStartY));
- infoIn->setPosAt(1.00, QPointF(xOffset, Colors::contentStartY));
- movie_in->append(infoIn);
-
- DemoItemAnimation *infoOut = new DemoItemAnimation(item, DemoItemAnimation::ANIM_OUT);
- infoOut->timeline->setCurveShape(QTimeLine::EaseInCurve);
- infoOut->setDuration(300);
- infoOut->hideOnFinished = true;
- infoOut->setStartPos(QPointF(xOffset, Colors::contentStartY));
- infoOut->setPosAt(1.0, QPointF(-600, Colors::contentStartY));
- movie_out->append(infoOut);
-}
-
-void MenuManager::createTicker()
-{
- if (!Colors::noTicker){
- Movie *movie_in = this->score->insertMovie("ticker");
- Movie *movie_out = this->score->insertMovie("ticker -out");
- Movie *movie_activate = this->score->insertMovie("ticker -activate");
- Movie *movie_deactivate = this->score->insertMovie("ticker -deactivate");
-
- this->ticker = new ItemCircleAnimation(this->window->scene, 0);
- this->ticker->setZValue(50);
- this->ticker->hide();
-
- // Move ticker in:
- int qtendpos = 485;
- int qtPosY = 120;
- this->tickerInAnim = new DemoItemAnimation(this->ticker, DemoItemAnimation::ANIM_IN);
- this->tickerInAnim->setDuration(500);
- this->tickerInAnim->setStartPos(QPointF(this->window->scene->sceneRect().width(), Colors::contentStartY + qtPosY));
- this->tickerInAnim->setPosAt(0.60, QPointF(qtendpos, Colors::contentStartY + qtPosY));
- this->tickerInAnim->setPosAt(0.70, QPointF(qtendpos + 30, Colors::contentStartY + qtPosY));
- this->tickerInAnim->setPosAt(0.80, QPointF(qtendpos, Colors::contentStartY + qtPosY));
- this->tickerInAnim->setPosAt(0.90, QPointF(qtendpos + 5, Colors::contentStartY + qtPosY));
- this->tickerInAnim->setPosAt(1.00, QPointF(qtendpos, Colors::contentStartY + qtPosY));
- movie_in->append(this->tickerInAnim);
-
- // Move ticker out:
- DemoItemAnimation *qtOut = new DemoItemAnimation(this->ticker, DemoItemAnimation::ANIM_OUT);
- qtOut->hideOnFinished = true;
- qtOut->setDuration(500);
- qtOut->setStartPos(QPointF(qtendpos, Colors::contentStartY + qtPosY));
- qtOut->setPosAt(1.00, QPointF(this->window->scene->sceneRect().width() + 700, Colors::contentStartY + qtPosY));
- movie_out->append(qtOut);
-
- // Move ticker in on activate:
- DemoItemAnimation *qtActivate = new DemoItemAnimation(this->ticker);
- qtActivate->setDuration(400);
- qtActivate->setStartPos(QPointF(this->window->scene->sceneRect().width(), Colors::contentStartY + qtPosY));
- qtActivate->setPosAt(0.60, QPointF(qtendpos, Colors::contentStartY + qtPosY));
- qtActivate->setPosAt(0.70, QPointF(qtendpos + 30, Colors::contentStartY + qtPosY));
- qtActivate->setPosAt(0.80, QPointF(qtendpos, Colors::contentStartY + qtPosY));
- qtActivate->setPosAt(0.90, QPointF(qtendpos + 5, Colors::contentStartY + qtPosY));
- qtActivate->setPosAt(1.00, QPointF(qtendpos, Colors::contentStartY + qtPosY));
- movie_activate->append(qtActivate);
-
- // Move ticker out on deactivate:
- DemoItemAnimation *qtDeactivate = new DemoItemAnimation(this->ticker);
- qtDeactivate->hideOnFinished = true;
- qtDeactivate->setDuration(400);
- qtDeactivate->setStartPos(QPointF(qtendpos, Colors::contentStartY + qtPosY));
- qtDeactivate->setPosAt(1.00, QPointF(qtendpos, 800));
- movie_deactivate->append(qtDeactivate);
- }
-}
-
-void MenuManager::createUpnDownButtons()
-{
- float xOffset = 15.0f;
- float yOffset = 450.0f;
-
- this->upButton = new TextButton("", TextButton::LEFT, MenuManager::UP, this->window->scene, this->window->mainSceneRoot, TextButton::UP);
- this->upButton->prepare();
- this->upButton->setPos(xOffset, yOffset);
- this->upButton->setState(TextButton::DISABLED);
-
- this->downButton = new TextButton("", TextButton::LEFT, MenuManager::DOWN, this->window->scene, this->window->mainSceneRoot, TextButton::DOWN);
- this->downButton->prepare();
- this->downButton->setPos(xOffset + 10 + this->downButton->sceneBoundingRect().width(), yOffset);
-
- Movie *movieShake = this->score->insertMovie("upndown -shake");
-
- DemoItemAnimation *shakeAnim = new DemoItemAnimation(this->upButton, DemoItemAnimation::ANIM_UNSPECIFIED);
- shakeAnim->timeline->setCurveShape(QTimeLine::LinearCurve);
- shakeAnim->setDuration(650);
- shakeAnim->setStartPos(this->upButton->pos());
- shakeAnim->setPosAt(0.60, this->upButton->pos());
- shakeAnim->setPosAt(0.70, this->upButton->pos() + QPointF(-2, 0));
- shakeAnim->setPosAt(0.80, this->upButton->pos() + QPointF(1, 0));
- shakeAnim->setPosAt(0.90, this->upButton->pos() + QPointF(-1, 0));
- shakeAnim->setPosAt(1.00, this->upButton->pos());
- movieShake->append(shakeAnim);
-
- shakeAnim = new DemoItemAnimation(this->downButton, DemoItemAnimation::ANIM_UNSPECIFIED);
- shakeAnim->timeline->setCurveShape(QTimeLine::LinearCurve);
- shakeAnim->setDuration(650);
- shakeAnim->setStartPos(this->downButton->pos());
- shakeAnim->setPosAt(0.60, this->downButton->pos());
- shakeAnim->setPosAt(0.70, this->downButton->pos() + QPointF(-5, 0));
- shakeAnim->setPosAt(0.80, this->downButton->pos() + QPointF(-3, 0));
- shakeAnim->setPosAt(0.90, this->downButton->pos() + QPointF(-1, 0));
- shakeAnim->setPosAt(1.00, this->downButton->pos());
- movieShake->append(shakeAnim);
-}
-
-void MenuManager::createBackButton()
-{
- Movie *backIn = this->score->insertMovie("back -in");
- Movie *backOut = this->score->insertMovie("back -out");
- Movie *backShake = this->score->insertMovie("back -shake");
- createLowLeftButton(QLatin1String("Back"), ROOT, backIn, backOut, backShake, Colors::rootMenuName);
-}
diff --git a/demos/qtdemo/menumanager.h b/demos/qtdemo/menumanager.h
deleted file mode 100644
index 69deff00..00000000
--- a/demos/qtdemo/menumanager.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MENU_MANAGER_H
-#define MENU_MANAGER_H
-
-#include <QtGui>
-#include <QtXml>
-#include <QtHelp/QHelpEngineCore>
-
-#include "score.h"
-#include "textbutton.h"
-#include "mainwindow.h"
-#include "itemcircleanimation.h"
-
-typedef QHash<QString, QString> StringHash;
-typedef QHash<QString, StringHash> HashHash;
-
-class TextButton;
-class QDeclarativeEngine;
-
-class MenuManager : public QObject
-{
- Q_OBJECT
-
-public:
- enum BUTTON_TYPE {ROOT, MENU1, MENU2, LAUNCH, DOCUMENTATION, QUIT, FULLSCREEN, UP, DOWN, BACK, LAUNCH_QML};
-
- // singleton pattern:
- static MenuManager *instance();
- virtual ~MenuManager();
-
- void init(MainWindow *window);
- void itemSelected(int userCode, const QString &menuName = "");
-
- QByteArray getHtml(const QString &name);
- QByteArray getImage(const QString &name);
- QString resolveExeFile(const QString &name);
- QString resolveDocUrl(const QString &name);
- QString resolveImageUrl(const QString &name);
- QString resolveDataDir(const QString &name);
-
- HashHash info;
- ItemCircleAnimation *ticker;
- MainWindow *window;
- Score *score;
- int currentMenuCode;
-
- QObject *qmlRoot;
-#ifndef QT_NO_DECLARATIVE
- QDeclarativeEngine* declarativeEngine;
-#endif
-
-private slots:
- void exampleFinished();
- void exampleError(QProcess::ProcessError error);
-
- void quitQML();
-
-private:
- // singleton pattern:
- MenuManager();
- static MenuManager *pInstance;
-
- QByteArray getResource(const QString &name);
-
- void readXmlDocument();
- void initHelpEngine();
- void getDocumentationDir();
- void readInfoAboutExample(const QDomElement &example);
- void showDocInAssistant(const QString &docFile);
- void launchExample(const QString &uniqueName);
- void launchQmlExample(const QString &uniqueName);
-
- void createMenu(const QDomElement &category, BUTTON_TYPE type);
- void createLowLeftButton(const QString &label, BUTTON_TYPE type,
- Movie *movieIn, Movie *movieOut, Movie *movieShake, const QString &menuString = QString());
- void createLowRightButton(const QString &label, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie *movieShake);
- void createLowRightLeafButton(const QString &label, int pos, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/);
- void createRootMenu(const QDomElement &el);
- void createSubMenu(const QDomElement &el);
- void createLeafMenu(const QDomElement &el);
- void createInfo(DemoItem *item, const QString &name);
- void createTicker();
- void createUpnDownButtons();
- void createBackButton();
-
- QDomDocument *contentsDoc;
- QProcess assistantProcess;
- QString currentMenu;
- QString currentCategory;
- QString currentMenuButtons;
- QString currentInfo;
- QString helpRootUrl;
- DemoItemAnimation *tickerInAnim;
- QDir docDir;
- QDir imgDir;
- QHelpEngineCore *helpEngine;
-
- TextButton *upButton;
- TextButton *downButton;
-
-};
-
-#endif // MENU_MANAGER_H
-
diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml
deleted file mode 100644
index 950614ed..00000000
--- a/demos/qtdemo/qmlShell.qml
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Item {
- id: main
- //height and width set by program to fill window
- //below properties are sometimes set from C++
- property url qmlFile: ''
- property bool show: false
-
- Item{ id:embeddedViewer
- width: parent.width
- height: parent.height
- opacity: 0;
- z: 10
- Loader{
- id: loader
- z: 10
- focus: true //Automatic FocusScope
- clip: true
- source: qmlFile
- anchors.centerIn: parent
- onStatusChanged:{
- if(status == Loader.Null) {
- loader.focus = false;//fixes QTBUG11411, probably because the focusScope needs to gain focus to focus the right child
- }else if(status == Loader.Ready) {
- if(loader.item.width > 640)
- loader.item.width = 640;
- if(loader.item.height > 480)
- loader.item.height = 480;
- }}
-
- }
- Rectangle{ id: frame
- z: 9
- anchors.fill: loader.status == Loader.Ready ? loader : errorTxt
- anchors.margins: -8
- radius: 4
- smooth: true
- border.color: "#88aaaaaa"
- gradient: Gradient{
- GradientStop{ position: 0.0; color: "#14FFFFFF" }
- GradientStop{ position: 1.0; color: "#5AFFFFFF" }
- }
- MouseArea{
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
- onClicked: loader.focus=true;/* and don't propagate to the 'exit' area*/
- }
-
- Rectangle{ id: innerFrame
- anchors.margins: 7
- anchors.bottomMargin: 8
- anchors.rightMargin: 8
- color: "black"
- border.color: "#44000000"
- anchors.fill:parent
- }
-
- }
- Rectangle{ id: closeButton
- width: 24
- height: 24
- z: 11
- border.color: "#aaaaaaaa"
- gradient: Gradient{
- GradientStop{ position: 0.0; color: "#34FFFFFF" }
- GradientStop{ position: 1.0; color: "#7AFFFFFF" }
- }
- anchors.left: frame.right
- anchors.bottom: frame.top
- anchors.margins: -(2*width/3)
- Text{
- text: 'X'
- font.bold: true
- color: "white"
- font.pixelSize: 12
- anchors.centerIn: parent
- }
- MouseArea{
- anchors.fill: parent
- onClicked: main.show = false;
- }
- }
-
- Text{
- id: errorTxt
- z: 10
- anchors.centerIn: parent
- color: 'white'
- smooth: true
- visible: loader.status == Loader.Error
- textFormat: Text.RichText
- //Note that if loader is Error, it is because the file was found but there was an error creating the component
- //This means either we have a bug in our demos, or the required modules (which ship with Qt) did not deploy correctly
- text: "The example has failed to load.<br />If you installed all Qt's C++ and QML modules then this is a bug!<br />"
- + 'Report it at <a href="http://bugreports.qt-project.org">http://bugreports.qt-project.org</a>';
- onLinkActivated: Qt.openUrlExternally(link);
- }
- }
- Rectangle{ id: blackout //Maybe use a colorize effect instead?
- z: 8
- anchors.fill: parent
- color: "#000000"
- opacity: 0
- }
- MouseArea{
- z: 8
- enabled: main.show
- hoverEnabled: main.show //To steal focus from the buttons
- acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
- anchors.fill: parent
- }
-
- states: [
- State {
- name: "show"
- when: show == true
- PropertyChanges {
- target: embeddedViewer
- opacity: 1
- }
- PropertyChanges {
- target: blackout
- opacity: 0.5
- }
- }
- ]
- transitions: [//Should not be too long, because the component has already started running
- Transition { from: ''; to: "show"; reversible: true
- ParallelAnimation{
- NumberAnimation{ properties: "opacity"; easing.type: Easing.InQuad; duration: 500}
- PropertyAction { target: loader; property: "focus"; value: true}//Might be needed to ensure the focus stays with us
- }
- }
- ]
-}
diff --git a/demos/qtdemo/qtdemo.icns b/demos/qtdemo/qtdemo.icns
deleted file mode 100644
index def5f0e1..00000000
--- a/demos/qtdemo/qtdemo.icns
+++ /dev/null
Binary files differ
diff --git a/demos/qtdemo/qtdemo.ico b/demos/qtdemo/qtdemo.ico
deleted file mode 100644
index 016c77f0..00000000
--- a/demos/qtdemo/qtdemo.ico
+++ /dev/null
Binary files differ
diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro
deleted file mode 100644
index 7dfe949a..00000000
--- a/demos/qtdemo/qtdemo.pro
+++ /dev/null
@@ -1,74 +0,0 @@
-CONFIG += help x11inc
-
-QT += widgets xml network
-
-qtHaveModule(opengl) {
- DEFINES += QT_OPENGL_SUPPORT
- QT += opengl
-}
-
-qtHaveModule(quick1) {
- QT += quick1
-} else {
- DEFINES *= QT_NO_DECLARATIVE
-}
-
-RESOURCES = qtdemo.qrc
-HEADERS = mainwindow.h \
- demoscene.h \
- demoitem.h \
- score.h \
- demoitemanimation.h \
- itemcircleanimation.h \
- demotextitem.h \
- headingitem.h \
- dockitem.h \
- scanitem.h \
- letteritem.h \
- examplecontent.h \
- menucontent.h \
- guide.h \
- guideline.h \
- guidecircle.h \
- menumanager.h \
- colors.h \
- textbutton.h \
- imageitem.h
-SOURCES = main.cpp \
- demoscene.cpp \
- mainwindow.cpp \
- demoitem.cpp \
- score.cpp \
- demoitemanimation.cpp \
- itemcircleanimation.cpp \
- demotextitem.cpp \
- headingitem.cpp \
- dockitem.cpp \
- scanitem.cpp \
- letteritem.cpp \
- examplecontent.cpp \
- menucontent.cpp \
- guide.cpp \
- guideline.cpp \
- guidecircle.cpp \
- menumanager.cpp \
- colors.cpp \
- textbutton.cpp \
- imageitem.cpp
-
-win32:RC_FILE = qtdemo.rc
-mac {
-ICON = qtdemo.icns
-QMAKE_INFO_PLIST = Info_mac.plist
-}
-
-# install
-sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES qtdemo.pro images xml *.ico *.icns *.rc *.plist
-sources.path = $$[QT_INSTALL_DEMOS]/qtdoc/qtdemo
-
-INSTALLS += sources
-
-OTHER_FILES += \
- qmlShell.qml
-
-load(qt_app)
diff --git a/demos/qtdemo/qtdemo.qrc b/demos/qtdemo/qtdemo.qrc
deleted file mode 100644
index b6da367e..00000000
--- a/demos/qtdemo/qtdemo.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>xml/examples.xml</file>
- <file>images/qtlogo_small.png</file>
- <file>images/qtlogo_large.png</file>
- <file>images/demobg.png</file>
- </qresource>
- <qresource prefix="/qml" lang="qml">
- <file>qmlShell.qml</file>
- </qresource>
-</RCC>
diff --git a/demos/qtdemo/qtdemo.rc b/demos/qtdemo/qtdemo.rc
deleted file mode 100644
index c1b294a4..00000000
--- a/demos/qtdemo/qtdemo.rc
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "winver.h"
-
-IDI_ICON1 ICON DISCARDABLE "qtdemo.ico"
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,0
- PRODUCTVERSION 1,0,0,0
- FILEFLAGS 0x0L
- FILEFLAGSMASK 0x3fL
- FILEOS 0x00040004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "CompanyName", "Digia Plc and/or its subsidiary(-ies)"
- VALUE "FileDescription", "Qt Examples and Demos"
- VALUE "FileVersion", "1.0.0.0"
- VALUE "LegalCopyright", "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies)."
- VALUE "InternalName", "qtdemo"
- VALUE "OriginalFilename", "qtdemo.exe"
- VALUE "ProductName", "Qt Examples and Demos"
- VALUE "ProductVersion", "1.0.0.0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
diff --git a/demos/qtdemo/scanitem.cpp b/demos/qtdemo/scanitem.cpp
deleted file mode 100644
index 38994f29..00000000
--- a/demos/qtdemo/scanitem.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "scanitem.h"
-#include "colors.h"
-
-#define ITEM_WIDTH 16
-#define ITEM_HEIGHT 16
-
-ScanItem::ScanItem(QGraphicsScene *scene, QGraphicsItem *parent)
- : DemoItem(scene, parent)
-{
- useSharedImage(QString(__FILE__));
-}
-
-ScanItem::~ScanItem()
-{
-}
-
-QImage *ScanItem::createImage(const QMatrix &matrix) const
-{
- QRect scaledRect = matrix.mapRect(QRect(0, 0, ITEM_WIDTH, ITEM_HEIGHT));
- QImage *image = new QImage(scaledRect.width(), scaledRect.height(), QImage::Format_ARGB32_Premultiplied);
- image->fill(QColor(0, 0, 0, 0).rgba());
- QPainter painter(image);
- painter.setRenderHint(QPainter::Antialiasing);
-
- if (Colors::useEightBitPalette){
- painter.setPen(QPen(QColor(100, 100, 100), 2));
- painter.setBrush(QColor(206, 246, 117));
- painter.drawEllipse(1, 1, scaledRect.width()-2, scaledRect.height()-2);
- }
- else {
- painter.setPen(QPen(QColor(0, 0, 0, 15), 1));
-// painter.setBrush(QColor(206, 246, 117, 150));
- painter.setBrush(QColor(0, 0, 0, 15));
- painter.drawEllipse(1, 1, scaledRect.width()-2, scaledRect.height()-2);
- }
- return image;
-}
-
-
diff --git a/demos/qtdemo/scanitem.h b/demos/qtdemo/scanitem.h
deleted file mode 100644
index acb1398e..00000000
--- a/demos/qtdemo/scanitem.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SCAN_ITEM_H
-#define SCAN_ITEM_H
-
-#include <QtGui>
-#include "demoitem.h"
-
-class ScanItem : public DemoItem
-{
-public:
- ScanItem(QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
- virtual ~ScanItem();
-
-protected:
- QImage *createImage(const QMatrix &matrix) const;
-
-};
-
-#endif // SCAN_ITEM_H
-
diff --git a/demos/qtdemo/score.cpp b/demos/qtdemo/score.cpp
deleted file mode 100644
index 0ff464dd..00000000
--- a/demos/qtdemo/score.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "score.h"
-#include "colors.h"
-#include "demoitem.h"
-
-Score::Score()
-{
-}
-
-Score::~Score()
-{
- // NB! Deleting all movies.
- qDeleteAll(this->index);
-}
-
-void Score::prepare(Movie *movie, RUN_MODE runMode, LOCK_MODE lockMode)
-{
- if (lockMode == LOCK_ITEMS){
- for (int i=0; i<movie->size(); ++i){
- if (runMode == ONLY_IF_VISIBLE && !movie->at(i)->demoItem()->isVisible())
- continue;
- movie->at(i)->lockItem(true);
- movie->at(i)->prepare();
- }
- }
- else if (lockMode == UNLOCK_ITEMS){
- for (int i=0; i<movie->size(); ++i){
- if (runMode == ONLY_IF_VISIBLE && !movie->at(i)->demoItem()->isVisible())
- continue;
- movie->at(i)->lockItem(false);
- movie->at(i)->prepare();
- }
- }
- else {
- for (int i=0; i<movie->size(); ++i){
- if (runMode == ONLY_IF_VISIBLE && !movie->at(i)->demoItem()->isVisible())
- continue;
- movie->at(i)->prepare();
- }
- }
-}
-
-void Score::play(Movie *movie, RUN_MODE runMode)
-{
- if (runMode == NEW_ANIMATION_ONLY){
- for (int i=0; i<movie->size(); ++i)
- if (movie->at(i)->notOwnerOfItem())
- movie->at(i)->play(true);
- }
- else if (runMode == ONLY_IF_VISIBLE){
- for (int i=0; i<movie->size(); ++i)
- if (movie->at(i)->demoItem()->isVisible())
- movie->at(i)->play(runMode == FROM_START);
- }
- else {
- for (int i=0; i<movie->size(); ++i)
- movie->at(i)->play(runMode == FROM_START);
- }
-}
-
-void Score::playMovie(const QString &indexName, RUN_MODE runMode, LOCK_MODE lockMode)
-{
- MovieIndex::iterator movieIterator = this->index.find(indexName);
- if (movieIterator == this->index.end())
- return;
-
- Movie *movie = *movieIterator;
- this->prepare(movie, runMode, lockMode);
- this->play(movie, runMode);
-}
-
-void Score::queueMovie(const QString &indexName, RUN_MODE runMode, LOCK_MODE lockMode)
-{
- MovieIndex::iterator movieIterator = this->index.find(indexName);
- if (movieIterator == this->index.end()){
- if (Colors::verbose)
- qDebug() << "Queuing movie:" << indexName << "(does not exist)";
- return;
- }
-
- Movie *movie = *movieIterator;
- this->prepare(movie, runMode, lockMode);
- this->playList.append(PlayListMember(movie, int(runMode)));
- if (Colors::verbose)
- qDebug() << "Queuing movie:" << indexName;
-}
-
-void Score::playQue()
-{
- int movieCount = this->playList.size();
- for (int i=0; i<movieCount; i++)
- this->play(this->playList.at(i).movie, RUN_MODE(this->playList.at(i).runMode));
- this->playList.clear();
- if (Colors::verbose)
- qDebug() << "********* Playing que *********";
-}
-
-void Score::insertMovie(const QString &indexName, Movie *movie)
-{
- this->index.insert(indexName, movie);
-}
-
-Movie *Score::insertMovie(const QString &indexName)
-{
- Movie *movie = new Movie();
- insertMovie(indexName, movie);
- return movie;
-}
-
diff --git a/demos/qtdemo/score.h b/demos/qtdemo/score.h
deleted file mode 100644
index 0ccd1760..00000000
--- a/demos/qtdemo/score.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SCORE_H
-#define SCORE_H
-
-#include <QList>
-#include <QHash>
-#include "demoitemanimation.h"
-
-typedef QList<DemoItemAnimation *> Movie;
-typedef QHash<QString, Movie*> MovieIndex;
-
-class PlayListMember
-{
-public:
- PlayListMember(Movie *movie, int runMode) : movie(movie), runMode(runMode){};
- Movie *movie;
- int runMode;
-};
-typedef QList<PlayListMember> PlayList;
-
-class Score
-{
-public:
- enum LOCK_MODE {LOCK_ITEMS, UNLOCK_ITEMS, SKIP_LOCK};
- enum RUN_MODE {FROM_CURRENT, FROM_START, NEW_ANIMATION_ONLY, ONLY_IF_VISIBLE};
-
- Score();
- virtual ~Score();
-
- void playMovie(const QString &indexName, RUN_MODE runMode = FROM_START, LOCK_MODE lockMode = SKIP_LOCK);
- void insertMovie(const QString &indexName, Movie *movie);
- Movie *insertMovie(const QString &indexName);
- void queueMovie(const QString &indexName, RUN_MODE runMode = FROM_START, LOCK_MODE lockMode = SKIP_LOCK);
- void playQue();
- bool hasQueuedMovies(){ return this->playList.size() > 0; };
-
- MovieIndex index;
- PlayList playList;
-
-private:
- void prepare(Movie *movie, RUN_MODE runMode, LOCK_MODE lockMode);
- void play(Movie *movie, RUN_MODE runMode);
-};
-
-#endif // SCORE_H
-
diff --git a/demos/qtdemo/textbutton.cpp b/demos/qtdemo/textbutton.cpp
deleted file mode 100644
index 690a1277..00000000
--- a/demos/qtdemo/textbutton.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "textbutton.h"
-#include "demoitemanimation.h"
-#include "demotextitem.h"
-#include "colors.h"
-#include "menumanager.h"
-
-#define BUTTON_WIDTH 180
-#define BUTTON_HEIGHT 19
-
-class ButtonBackground : public DemoItem
-{
-public:
- TextButton::BUTTONTYPE type;
- bool highlighted;
- bool pressed;
- QSize logicalSize;
-
- ButtonBackground(TextButton::BUTTONTYPE type, bool highlighted, bool pressed, QSize logicalSize,
- QGraphicsScene *scene, QGraphicsItem *parent) : DemoItem(scene, parent)
- {
- this->type = type;
- this->highlighted = highlighted;
- this->pressed = pressed;
- this->logicalSize = logicalSize;
- useSharedImage(QString(__FILE__) + static_cast<int>(type) + highlighted + pressed);
- }
-
-protected:
- QImage *createImage(const QMatrix &matrix) const
- {
- if (type == TextButton::SIDEBAR || type == TextButton::PANEL)
- return createRoundButtonBackground(matrix);
- else
- return createArrowBackground(matrix);
- }
-
- QImage *createRoundButtonBackground(const QMatrix &matrix) const
- {
- QRect scaledRect;
- scaledRect = matrix.mapRect(QRect(0, 0, this->logicalSize.width(), this->logicalSize.height()));
-
- QImage *image = new QImage(scaledRect.width(), scaledRect.height(), QImage::Format_ARGB32_Premultiplied);
- image->fill(QColor(0, 0, 0, 0).rgba());
- QPainter painter(image);
- painter.setRenderHint(QPainter::SmoothPixmapTransform);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.setPen(Qt::NoPen);
-
- if (Colors::useEightBitPalette){
- painter.setPen(QColor(120, 120, 120));
- if (this->pressed)
- painter.setBrush(QColor(60, 60, 60));
- else if (this->highlighted)
- painter.setBrush(QColor(100, 100, 100));
- else
- painter.setBrush(QColor(80, 80, 80));
- }
- else {
- QLinearGradient outlinebrush(0, 0, 0, scaledRect.height());
- QLinearGradient brush(0, 0, 0, scaledRect.height());
-
- brush.setSpread(QLinearGradient::PadSpread);
- QColor highlight(255, 255, 255, 70);
- QColor shadow(0, 0, 0, 70);
- QColor sunken(220, 220, 220, 30);
- QColor normal1(255, 255, 245, 60);
- QColor normal2(255, 255, 235, 10);
-
- if (this->type == TextButton::PANEL){
- normal1 = QColor(200, 170, 160, 50);
- normal2 = QColor(50, 10, 0, 50);
- }
-
- if (pressed) {
- outlinebrush.setColorAt(0.0f, shadow);
- outlinebrush.setColorAt(1.0f, highlight);
- brush.setColorAt(0.0f, sunken);
- painter.setPen(Qt::NoPen);
- } else {
- outlinebrush.setColorAt(1.0f, shadow);
- outlinebrush.setColorAt(0.0f, highlight);
- brush.setColorAt(0.0f, normal1);
- if (!this->highlighted)
- brush.setColorAt(1.0f, normal2);
- painter.setPen(QPen(outlinebrush, 1));
- }
- painter.setBrush(brush);
- }
-
- if (this->type == TextButton::PANEL)
- painter.drawRect(0, 0, scaledRect.width(), scaledRect.height());
- else
- painter.drawRoundedRect(0, 0, scaledRect.width(), scaledRect.height(), 10, 90, Qt::RelativeSize);
- return image;
- }
-
- QImage *createArrowBackground(const QMatrix &matrix) const
- {
- QRect scaledRect;
- scaledRect = matrix.mapRect(QRect(0, 0, this->logicalSize.width(), this->logicalSize.height()));
-
- QImage *image = new QImage(scaledRect.width(), scaledRect.height(), QImage::Format_ARGB32_Premultiplied);
- image->fill(QColor(0, 0, 0, 0).rgba());
- QPainter painter(image);
- painter.setRenderHint(QPainter::SmoothPixmapTransform);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.setPen(Qt::NoPen);
-
- if (Colors::useEightBitPalette){
- painter.setPen(QColor(120, 120, 120));
- if (this->pressed)
- painter.setBrush(QColor(60, 60, 60));
- else if (this->highlighted)
- painter.setBrush(QColor(100, 100, 100));
- else
- painter.setBrush(QColor(80, 80, 80));
- }
- else {
- QLinearGradient outlinebrush(0, 0, 0, scaledRect.height());
- QLinearGradient brush(0, 0, 0, scaledRect.height());
-
- brush.setSpread(QLinearGradient::PadSpread);
- QColor highlight(255, 255, 255, 70);
- QColor shadow(0, 0, 0, 70);
- QColor sunken(220, 220, 220, 30);
- QColor normal1 = QColor(200, 170, 160, 50);
- QColor normal2 = QColor(50, 10, 0, 50);
-
- if (pressed) {
- outlinebrush.setColorAt(0.0f, shadow);
- outlinebrush.setColorAt(1.0f, highlight);
- brush.setColorAt(0.0f, sunken);
- painter.setPen(Qt::NoPen);
- } else {
- outlinebrush.setColorAt(1.0f, shadow);
- outlinebrush.setColorAt(0.0f, highlight);
- brush.setColorAt(0.0f, normal1);
- if (!this->highlighted)
- brush.setColorAt(1.0f, normal2);
- painter.setPen(QPen(outlinebrush, 1));
- }
- painter.setBrush(brush);
- }
-
- painter.drawRect(0, 0, scaledRect.width(), scaledRect.height());
-
- float xOff = scaledRect.width() / 2;
- float yOff = scaledRect.height() / 2;
- float sizex = 3.0f * matrix.m11();
- float sizey = 1.5f * matrix.m22();
- if (this->type == TextButton::UP)
- sizey *= -1;
- QPainterPath path;
- path.moveTo(xOff, yOff + (5 * sizey));
- path.lineTo(xOff - (4 * sizex), yOff - (3 * sizey));
- path.lineTo(xOff + (4 * sizex), yOff - (3 * sizey));
- path.lineTo(xOff, yOff + (5 * sizey));
- painter.drawPath(path);
-
- return image;
- }
-
-};
-
-TextButton::TextButton(const QString &text, ALIGNMENT align, int userCode,
- QGraphicsScene *scene, QGraphicsItem *parent, BUTTONTYPE type)
- : DemoItem(scene, parent)
-{
- this->menuString = text;
- this->buttonLabel = text;
- this->alignment = align;
- this->buttonType = type;
- this->userCode = userCode;
- this->bgOn = 0;
- this->bgOff = 0;
- this->bgHighlight = 0;
- this->bgDisabled = 0;
- this->state = OFF;
-
- this->setAcceptHoverEvents(true);
- this->setCursor(Qt::PointingHandCursor);
-
- // Calculate button size:
- const int w = 180;
- const int h = 19;
- if (type == SIDEBAR || type == PANEL)
- this->logicalSize = QSize(w, h);
- else
- this->logicalSize = QSize(int((w / 2.0f) - 5), int(h * 1.5f));
-}
-
-void TextButton::setMenuString(const QString &menu)
-{
- this->menuString = menu;
-}
-
-void TextButton::prepare()
-{
- if (!this->prepared){
- this->prepared = true;
- this->setupHoverText();
- this->setupScanItem();
- this->setupButtonBg();
- }
-}
-
-TextButton::~TextButton()
-{
- if (this->prepared){
- if (Colors::useButtonBalls)
- delete this->scanAnim;
- }
-}
-
-QRectF TextButton::boundingRect() const
-{
- return QRectF(0, 0, this->logicalSize.width(), this->logicalSize.height());
-};
-
-void TextButton::setupHoverText()
-{
- if (this->buttonLabel.isEmpty())
- return;
-
- DemoTextItem *textItem = new DemoTextItem(this->buttonLabel, Colors::buttonFont(), Colors::buttonText, -1, this->scene(), this);
- textItem->setZValue(zValue() + 2);
- textItem->setPos(16, 0);
-}
-
-void TextButton::setupScanItem()
-{
- if (Colors::useButtonBalls){
- ScanItem *scanItem = new ScanItem(0, this);
- scanItem->setZValue(zValue() + 1);
-
- this->scanAnim = new DemoItemAnimation(scanItem);
- this->scanAnim->timeline->setLoopCount(1);
-
- float x = 1;
- float y = 1.5f;
- float stop = BUTTON_WIDTH - scanItem->boundingRect().width() - x;
- if (this->alignment == LEFT){
- this->scanAnim->setDuration(2500);
- this->scanAnim->setPosAt(0.0, QPointF(x, y));
- this->scanAnim->setPosAt(0.5, QPointF(x, y));
- this->scanAnim->setPosAt(0.7, QPointF(stop, y));
- this->scanAnim->setPosAt(1.0, QPointF(x, y));
- scanItem->setPos(QPointF(x, y));
- }
- else {
- this->scanAnim->setPosAt(0.0, QPointF(stop, y));
- this->scanAnim->setPosAt(0.5, QPointF(x, y));
- this->scanAnim->setPosAt(1.0, QPointF(stop, y));
- scanItem->setPos(QPointF(stop, y));
- }
- }
-}
-
-void TextButton::setState(STATE state)
-{
- this->state = state;
- this->bgOn->setRecursiveVisible(state == ON);
- this->bgOff->setRecursiveVisible(state == OFF);
- this->bgHighlight->setRecursiveVisible(state == HIGHLIGHT);
- this->bgDisabled->setRecursiveVisible(state == DISABLED);
- this->setCursor(state == DISABLED ? Qt::ArrowCursor : Qt::PointingHandCursor);
-
-}
-
-void TextButton::setupButtonBg()
-{
- this->bgOn = new ButtonBackground(this->buttonType, true, true, this->logicalSize, this->scene(), this);
- this->bgOff = new ButtonBackground(this->buttonType, false, false, this->logicalSize, this->scene(), this);
- this->bgHighlight = new ButtonBackground(this->buttonType, true, false, this->logicalSize, this->scene(), this);
- this->bgDisabled = new ButtonBackground(this->buttonType, true, true, this->logicalSize, this->scene(), this);
- this->setState(OFF);
-}
-
-void TextButton::hoverEnterEvent(QGraphicsSceneHoverEvent *)
-{
- if (this->locked || this->state == DISABLED)
- return;
-
- if (this->state == OFF){
- this->setState(HIGHLIGHT);
-
- if (Colors::noAnimations && Colors::useButtonBalls){
- // wait a bit in the beginning
- // to enhance the effect. Have to this here
- // so that the adaption can be dynamic
- this->scanAnim->setDuration(1000);
- this->scanAnim->setPosAt(0.2, this->scanAnim->posAt(0));
- }
-
- if (MenuManager::instance()->window->fpsMedian > 10
- || Colors::noAdapt
- || Colors::noTimerUpdate){
- if (Colors::useButtonBalls)
- this->scanAnim->play(true, true);
- }
- }
-}
-
-void TextButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- Q_UNUSED(event);
- if (this->state == DISABLED)
- return;
-
- this->setState(OFF);
-
- if (Colors::noAnimations && Colors::useButtonBalls)
- this->scanAnim->stop();
-}
-
-void TextButton::mousePressEvent(QGraphicsSceneMouseEvent *)
-{
- if (this->state == DISABLED)
- return;
-
- if (this->state == HIGHLIGHT || this->state == OFF)
- this->setState(ON);
-}
-
-void TextButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- if (this->state == ON){
- this->setState(OFF);
- if (!this->locked && this->boundingRect().contains(event->pos())){
- MenuManager::instance()->itemSelected(this->userCode, this->menuString);
- }
- }
-}
-
-void TextButton::animationStarted(int)
-{
- if (this->state == DISABLED)
- return;
- this->setState(OFF);
-}
-
-
-
diff --git a/demos/qtdemo/textbutton.h b/demos/qtdemo/textbutton.h
deleted file mode 100644
index 09ae9f5a..00000000
--- a/demos/qtdemo/textbutton.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TEXT_BUTTON_H
-#define TEXT_BUTTON_H
-
-#include <QtGui>
-#include "demoitem.h"
-#include "demotextitem.h"
-#include "scanitem.h"
-
-class DemoItemAnimation;
-class ButtonBackground;
-
-class TextButton : public DemoItem
-{
-public:
- enum ALIGNMENT {LEFT, RIGHT};
- enum BUTTONTYPE {SIDEBAR, PANEL, UP, DOWN};
- enum STATE {ON, OFF, HIGHLIGHT, DISABLED};
-
- TextButton(const QString &text, ALIGNMENT align = LEFT, int userCode = 0,
- QGraphicsScene *scene = 0, QGraphicsItem *parent = 0, BUTTONTYPE color = SIDEBAR);
- virtual ~TextButton();
-
- // overridden methods:
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0){};
- virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
- virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-
- void animationStarted(int id = 0);
- void prepare();
- void setState(STATE state);
- void setMenuString(const QString &menu);
- void setDisabled(bool disabled);
-
-private:
- void setupButtonBg();
- void setupScanItem();
- void setupHoverText();
-
- DemoItemAnimation *scanAnim;
- ButtonBackground *bgOn;
- ButtonBackground *bgOff;
- ButtonBackground *bgHighlight;
- ButtonBackground *bgDisabled;
-
- BUTTONTYPE buttonType;
- ALIGNMENT alignment;
- QString buttonLabel;
- QString menuString;
- int userCode;
- QSize logicalSize;
-
- STATE state;
-};
-
-#endif // TEXT_BUTTON_H
-
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
deleted file mode 100644
index dadfb52c..00000000
--- a/demos/qtdemo/xml/examples.xml
+++ /dev/null
@@ -1,280 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<categories name="Qt Examples and Demos">
- <demos dirname="." docname="demos" name="Demonstrations">
- <example filename="declarative/samegame" name="SameGame" executable="false" qml="true"/>
- <example filename="declarative/flickr" name="Flickr Client" executable="false" qml="true"/>
- <example filename="affine" name="Affine Transformations" />
- <example filename="composition" name="Composition Modes" />
- <example filename="gradients" name="Gradients" />
- <example filename="pathstroke" name="Path Stroking" />
- <example filename="textedit" name="Text Edit" />
- <example filename="chip" name="40000 Chips" />
- <example filename="embeddeddialogs" name="Embedded Dialogs" />
- <example filename="interview" name="Interview" />
- <example filename="declarative/rssnews" name="Rss Client" executable="false" qml="true"/>
- <example filename="declarative/twitter" name="Twitter Client" executable="false" qml="true"/>
- <example filename="browser" name="Browser" />
- <example filename="qmediaplayer" name="Media Player" />
- <example filename="boxes" name="Boxes" />
- <example filename="sub-attaq" name="Sub-attaq" />
- <example filename="spectrum" name="Spectrum Analyzer" />
- <example filename="declarative/minehunt" name="Minehunt"/>
- <example filename="deform" name="Vector Deformation" />
- <example filename="books" name="Books" />
- <example filename="mainwindow" name="Main Window" />
- <example filename="spreadsheet" name="Spreadsheet" />
- <example filename="sqlbrowser" name="SQL Browser" />
- <example filename="arthurplugin" name="Arthur Plugin" executable="false" />
- </demos>
- <category dirname="animation" name="Animation Framework">
- <example filename="animatedtiles" name="Animated Tiles" />
- <example filename="appchooser" name="Appchooser" />
- <example filename="easing" name="Easing Curves" />
- <example filename="moveblocks" name="Moving Blocks" />
- <example filename="states" name="States" />
- <example filename="stickman" name="Stickman" />
- </category>
- <category dirname="qtconcurrent" name="Concurrent Programming">
- <example filename="map" name="Map" executable="false" />
- <example filename="progressdialog" name="Progress Dialog" />
- <example filename="runfunction" name="Run Function" executable="false"/>
- <example filename="wordcount" name="Word Count" executable="false" />
- </category>
- <category dirname="declarative/toys" name="Qt Declarative Examples">
- <example filename="dynamicscene" name="Dynamic Scene" executable="false" qml="true" />
- <example filename="tic-tac-toe" name="Tic Tac Toe" executable="false" qml="true" />
- <example filename="clocks" name="Clocks" executable="false" qml="true" />
- <example filename="corkboards" name="Corkboards" executable="false" qml="true" />
- <example filename="tvtennis" name="TV Tennis" executable="false" qml="true" />
- </category>
- <category dirname="designer" name="Qt Designer">
- <example filename="calculatorbuilder" name="Calculator Builder" />
- <example filename="calculatorform" name="Calculator Form" />
- <example filename="containerextension" name="Container Extension" executable="false"/>
- <example filename="customwidgetplugin" name="Custom Widget Plugin" executable="false" />
- <example filename="taskmenuextension" name="Task Menu Extension" executable="false" />
- <example filename="worldtimeclockbuilder" name="World Time Clock Builder" />
- <example filename="worldtimeclockplugin" name="World Time Clock Plugin" executable="false"/>
- </category>
- <category dirname="desktop" name="Desktop">
- <example filename="systray" name="System Tray" image="systemtray-example.png"/>
- <example filename="screenshot" name="Screenshot" />
- </category>
- <category dirname="dialogs" name="Dialogs">
- <example filename="configdialog" name="Configuration Dialog" />
- <example filename="extension" name="Extension Dialog" />
- <example filename="findfiles" name="Find Files Dialog" />
- <example filename="standarddialogs" name="Standard Dialogs" />
- <example filename="tabdialog" name="Tab Dialog" />
- <example filename="trivialwizard" name="Trivial Wizard" image="trivialwizard-example-introduction.png"/>
- <example filename="licensewizard" name="License Wizard" />
- <example filename="classwizard" name="Class Wizard" />
- </category>
- <category dirname="draganddrop" name="Drag and Drop">
- <example filename="draggableicons" name="Draggable Icons" />
- <example filename="draggabletext" name="Draggable Text" />
- <example filename="dropsite" name="Drop Site" />
- <example filename="fridgemagnets" name="Fridge Magnets" />
- <example filename="puzzle" name="Puzzle" image="draganddroppuzzle-example.png"/>
- </category>
- <category dirname="graphicsview" name="Graphics View">
- <example filename="elasticnodes" name="Elastic Nodes" />
- <example filename="collidingmice" name="Colliding Mice" />
- <example filename="diagramscene" name="Diagram Scene" />
- <example filename="dragdroprobot" name="Drag and Drop Robot" />
- <example filename="portedcanvas" name="Ported Canvas" />
- <example filename="portedasteroids" name="Ported Asteroids" />
- <example filename="padnavigator" name="Pad Navigator Example" />
- </category>
- <category dirname="ipc" name="IPC">
- <example filename="sharedmemory" name="Shared Memory" image="sharedmemory-example_1.png"/>
- <example filename="localfortuneclient" name="Local Fortune Client" image="localfortuneclient-example.png"/>
- <example filename="localfortuneserver" name="Local Fortune Server" image="localfortuneserver-example.png"/>
- </category>
- <category dirname="itemviews" name="Item Views">
- <example filename="addressbook" name="Address Book" />
- <example filename="basicsortfiltermodel" name="Basic Sort/Filter Model" />
- <example filename="chart" name="Chart" />
- <example filename="customsortfiltermodel" name="Custom Sort/Filter Model" />
- <example filename="coloreditorfactory" name="Color Editor Factory" image="coloreditorfactoryimage.png"/>
- <example filename="combowidgetmapper" name="Combo Widget Mapper" />
- <example filename="dirview" name="Directory View" />
- <example filename="fetchmore" name="Fetch More" />
- <example filename="frozencolumn" name="Frozen Column" />
- <example filename="pixelator" name="Pixelator" />
- <example filename="puzzle" name="Puzzle " image="itemviewspuzzle-example.png"/>
- <example filename="simpledommodel" name="Simple DOM Model" />
- <example filename="simpletreemodel" name="Simple Tree Model" />
- <example filename="simplewidgetmapper" name="Simple Widget Mapper" />
- <example filename="spinboxdelegate" name="Spin Box Delegate" />
- <example filename="stardelegate" name="Star Delegate" />
- </category>
- <category dirname="layouts" name="Layouts">
- <example filename="basiclayouts" name="Basic Layouts" />
- <example filename="borderlayout" name="Border Layout" />
- <example filename="dynamiclayouts" name="Dynamic Layouts" />
- <example filename="flowlayout" name="Flow Layout" />
- </category>
- <category dirname="linguist" name="Qt Linguist">
- <example filename="arrowpad" name="Arrow Pad" image="linguist-arrowpad_en.png"/>
- <example filename="hellotr" name="Hello World" image="linguist-hellotr_en.png"/>
- <example filename="trollprint" name="Troll Print" image="linguist-trollprint_10_en.png"/>
- </category>
- <category dirname="mainwindows" name="Main Windows">
- <example filename="application" name="Application" />
- <example filename="dockwidgets" name="Dock Widgets" />
- <example filename="mdi" name="MDI" />
- <example filename="sdi" name="SDI" />
- <example filename="menus" name="Menus" />
- <example filename="recentfiles" name="Recent Files" />
- </category>
- <category dirname="declarative/ui-components" name="QML UI Components">
- <example filename="dialcontrol" name="Dial" executable="false" qml="true" />
- <example filename="flipable" name="Flipable" executable="false" qml="true" />
- <example filename="progressbar" name="Progress bar" executable="false" qml="true" />
- <example filename="scrollbar" name="Scroll bar" executable="false" qml="true" />
- <example filename="searchbox" name="Search box" executable="false" qml="true" />
- <example filename="slideswitch" name="Slide switch" executable="false" qml="true" />
- <example filename="spinner" name="Spinner" executable="false" qml="true" />
- <example filename="tabwidget" name="Tab widget" executable="false" qml="true" />
- </category>
- <category dirname="network" name="Networking">
- <example filename="blockingfortuneclient" name="Blocking Fortune Client" />
- <example filename="broadcastreceiver" name="Broadcast Receiver" />
- <example filename="broadcastsender" name="Broadcast Sender" />
- <example filename="network-chat" name="Network Chat Client" />
- <example filename="fortuneclient" name="Fortune Client" />
- <example filename="fortuneserver" name="Fortune Server" />
- <example filename="qftp" changedirectory="false" name="FTP Client" />
- <example filename="http" changedirectory="false" name="HTTP Client" />
- <example filename="loopback" name="Loopback" />
- <example filename="threadedfortuneserver" name="Threaded Fort. Server" />
- <example filename="torrent" name="Torrent Client" />
- <example filename="securesocketclient" name="Secure Socket Client" />
- <example filename="googlesuggest" name="Google Suggest" />
- </category>
- <category dirname="opengl" name="OpenGL">
- <example filename="2dpainting" name="2D Painting" />
- <example filename="framebufferobject" name="Framebuffer Object" />
- <example filename="framebufferobject2" name="Framebuffer Object 2" />
- <example filename="grabber" name="Grabber" />
- <example filename="hellogl" name="Hello GL" />
- <example filename="overpainting" name="Overpainting" />
- <example filename="pbuffers" name="Pixel Buffers" />
- <example filename="pbuffers2" name="Pixel Buffers 2" />
- <example filename="samplebuffers" name="Sample Buffers" />
- <example filename="textures" name="Textures" />
- </category>
- <category dirname="painting" name="Painting">
- <example filename="basicdrawing" name="Basic Drawing" />
- <example filename="concentriccircles" name="Concentric Circles" />
- <example filename="fontsampler" name="Font Sampler" />
- <example filename="imagecomposition" name="Image Composition" />
- <example filename="painterpaths" name="Painter Paths" />
- <example filename="svggenerator" name="SVG Generator" />
- <example filename="svgviewer" name="SVG Viewer" />
- <example filename="transformations" name="Transformations" />
- </category>
- <category dirname="multimedia" name="Multimedia">
- <example filename="audiodevices" name="Audio Devices" />
- <example filename="audiooutput" name="Audio Output" />
- <example filename="audioinput" name="Audio Input" />
- </category>
- <category dirname="richtext" name="Rich Text">
- <example filename="calendar" name="Calendar" />
- <example filename="orderform" name="Order Form" />
- <example filename="syntaxhighlighter" name="Syntax Highlighter" />
- <example filename="textobject" name="Text Object" />
- </category>
- <category dirname="script" name="QtScript">
- <example filename="calculator" name="Calculator" />
- <example filename="context2d" name="Context2D" />
- <example filename="defaultprototypes" name="Default Prototypes" />
- <example filename="helloscript" name="Hello Script" image="t1.png"/>
- <example filename="qstetrix" name="QSTetrix" image="tetrix-example.png" />
- </category>
- <category dirname="sql" name="SQL">
- <example filename="cachedtable" name="Cached Table" />
- <example filename="drilldown" name="Drill Down" />
- <example filename="querymodel" name="Query Model" />
- <example filename="relationaltablemodel" name="Relational Table Model" />
- <example filename="tablemodel" name="Table Model" />
- <example filename="masterdetail" name="Music Archive" />
- <example filename="sqlwidgetmapper" name="SQL Widget Mapper" />
- </category>
- <category dirname="statemachine" name="State Machine">
- <example filename="eventtransitions" name="Event Transitions" />
- <example filename="rogue" name="Rogue" />
- <example filename="trafficlight" name="Traffic Light" />
- <example filename="twowaybutton" name="Two-way Button" />
- </category>
- <category dirname="threads" name="Threading">
- <example filename="mandelbrot" name="Mandelbrot" />
- </category>
- <category dirname="tools" name="Tools">
- <example filename="codecs" name="Codecs" />
- <example filename="completer" name="Completer" />
- <example filename="customcompleter" name="Custom Completer" />
- <example filename="i18n" name="Internationalization" />
- <example filename="inputpanel" name="Input Panel" />
- <example filename="plugandpaint" name="Plug and Paint" />
- <example filename="regexp" name="Regular Expressions" />
- <example filename="settingseditor" name="Settings Editor" />
- <example filename="treemodelcompleter" name="Tree Model Completer" />
- <example filename="undoframework" name="Undo Framework"/>
- </category>
- <category dirname="tutorials/addressbook" name="Address Book Tutorial">
- <example filename="part1" name="Part 1" image="addressbook-tutorial-part1-screenshot.png" />
- <example filename="part2" name="Part 2" image="addressbook-tutorial-part2-add-contact.png" />
- <example filename="part3" name="Part 3" image="addressbook-tutorial-part3-screenshot.png" />
- <example filename="part4" name="Part 4" image="addressbook-tutorial-screenshot.png" />
- <example filename="part5" name="Part 5" image="addressbook-tutorial-part5-screenshot.png" />
- <example filename="part6" name="Part 6" image="addressbook-tutorial-part6-screenshot.png" />
- <example filename="part7" name="Part 7" image="addressbook-tutorial-part7-screenshot.png" />
- </category>
- <category dirname="widgets" name="Widgets">
- <example filename="analogclock" name="Analog Clock" />
- <example filename="calculator" name="Calculator " />
- <example filename="calendarwidget" name="Calendar Widget" />
- <example filename="charactermap" name="Character Map" />
- <example filename="codeeditor" name="Code Editor" />
- <example filename="digitalclock" name="Digital Clock" />
- <example filename="groupbox" name="Group Box" />
- <example filename="icons" name="Icons" />
- <example filename="imageviewer" name="Image Viewer" />
- <example filename="lineedits" name="Line Edits" />
- <example filename="movie" name="Movie Player" />
- <example filename="scribble" name="Scribble" />
- <example filename="shapedclock" name="Shaped Clock" />
- <example filename="sliders" name="Sliders" />
- <example filename="spinboxes" name="Spin Boxes" />
- <example filename="styles" name="Styles" image="styles-enabledwood.png"/>
- <example filename="stylesheet" name="Style Sheet" image="stylesheet-coffee-plastique.png"/>
- <example filename="tablet" name="Tablet" />
- <example filename="tetrix" name="Tetrix " />
- <example filename="tooltips" name="Tool Tips" />
- <example filename="wiggly" name="Wiggly" />
- <example filename="windowflags" name="Window Flags" />
- </category>
- <category dirname="webkit" name="WebKit">
- <example filename="formextractor" name="Form Extractor" />
- <example filename="previewer" name="HTML Previewer" />
- <example filename="fancybrowser" name="Fancy Browser" />
- <example filename="googlechat" name="Google Chat" />
- <example filename="simplewebplugin" name="Simple Web Plugin" />
- <example filename="webplugin" name="Web Plugin" />
- <example filename="webftpclient" name="Web FTP Client" />
- </category>
- <category dirname="xml" name="XML">
- <example filename="saxbookmarks" name="SAX Bookmarks" />
- <example filename="dombookmarks" name="DOM Bookmarks" />
- <example filename="rsslisting" name="RSS-Listing" />
- <example filename="streambookmarks" name="QXmlStream Bookmarks" image="xmlstreamexample-screenshot.png"/>
- </category>
- <category dirname="xmlpatterns" name="XML Patterns">
- <example filename="recipes" name="Recipes" />
- <example filename="qobjectxmlmodel" name="QObjectXmlModel" />
- <example filename="filetree" name="File Tree" />
- <example filename="schema" name="XML Schema Validation" />
- </category>
-</categories>
diff --git a/doc/src/diagrams/qtdemo-example.png b/doc/src/diagrams/qtdemo-example.png
deleted file mode 100644
index 8a399d67..00000000
--- a/doc/src/diagrams/qtdemo-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/diagrams/qtdemo.png b/doc/src/diagrams/qtdemo.png
deleted file mode 100644
index 2db5399d..00000000
--- a/doc/src/diagrams/qtdemo.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/examples/qtdemo.qdoc b/doc/src/examples/qtdemo.qdoc
deleted file mode 100644
index 6cb90b41..00000000
--- a/doc/src/examples/qtdemo.qdoc
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/*!
- \page qtdemo.html
- \title Examples Launcher
- \ingroup qttools
- \keyword qtdemo
-
- The Examples Launcher (\c qtdemo) allows the user to browse the
- examples and demonstrations included with Qt, access the documentation
- associated with each of them, and launch them as separate applications.
-
- \image qtdemo.png
-
- \list
- \li On Windows, click the Start button, open the \e Programs submenu, open
- the \e{Qt 4} submenu, and click \e{Examples and Demos}.
- \li On Unix or Linux, you may find a \c qtdemo icon on the desktop background or
- in the desktop start menu under the \e Programming or \e Development
- submenus. You can launch this application from this icon. Alternatively, you can
- enter \c qtdemo in a terminal window.
- \li On OS X, navigate to the \c /Developer/Applications/Qt directory in the
- Finder and double click on the \c qtdemo.app icon.
- \endlist
-*/
diff --git a/doc/src/images/qtdemo-small.png b/doc/src/images/qtdemo-small.png
deleted file mode 100644
index d987ffa0..00000000
--- a/doc/src/images/qtdemo-small.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/qtdemo.png b/doc/src/images/qtdemo.png
deleted file mode 100644
index e7267a91..00000000
--- a/doc/src/images/qtdemo.png
+++ /dev/null
Binary files differ
diff --git a/qtdoc.pro b/qtdoc.pro
index cba304ea..d0012442 100644
--- a/qtdoc.pro
+++ b/qtdoc.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = doc # demos
+SUBDIRS = doc