summaryrefslogtreecommitdiffstats
path: root/demos/qtdemo
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-06-25 13:49:53 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-06-25 13:49:53 (GMT)
commitdb8f05e257019694f5e8076845626008f2adc3dd (patch)
tree05d3959403cf15ac5f702091439e028af01f343b /demos/qtdemo
parent8aafaa65a1d16f8b982279f5aceedf1e281ddb5a (diff)
parent796a5a2c7d8c91a46ac761dde18b7da2ec6c177b (diff)
downloadQt-db8f05e257019694f5e8076845626008f2adc3dd.zip
Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.gz
Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.bz2
Merge commit 'qt/master-stable' into 4.6-stable
Bring Qt 4.6 into the Qt-S60 repo. Conflicts: configure.exe mkspecs/features/qttest_p4.prf qmake/generators/makefile.cpp src/corelib/io/qdir.cpp src/corelib/io/qprocess.h src/corelib/kernel/qcoreevent.h src/corelib/kernel/qobject.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/corelib/thread/qthread_p.h src/corelib/tools/qvector.h src/gui/dialogs/qdialog.cpp src/gui/dialogs/qfiledialog.cpp src/gui/dialogs/qfiledialog_p.h src/gui/dialogs/qmessagebox.cpp src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsview.cpp src/gui/image/qpixmapcache.cpp src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication_p.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget_p.h src/gui/painting/qdrawhelper.cpp src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qmenubar.cpp src/network/socket/qlocalserver.cpp src/testlib/qtestcase.cpp src/testlib/testlib.pro tests/auto/qimagereader/tst_qimagereader.cpp tests/auto/qitemdelegate/tst_qitemdelegate.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qpixmap/qpixmap.pro
Diffstat (limited to 'demos/qtdemo')
-rw-r--r--demos/qtdemo/colors.cpp33
-rw-r--r--demos/qtdemo/colors.h4
-rw-r--r--demos/qtdemo/mainwindow.cpp25
-rw-r--r--demos/qtdemo/qtdemo.pro4
-rw-r--r--demos/qtdemo/xml/examples.xml15
5 files changed, 37 insertions, 44 deletions
diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp
index 883b0fb..eaef058 100644
--- a/demos/qtdemo/colors.cpp
+++ b/demos/qtdemo/colors.cpp
@@ -72,10 +72,8 @@ int Colors::contentHeight = 510;
// Properties:
bool Colors::openGlRendering = false;
-bool Colors::direct3dRendering = false;
bool Colors::softwareRendering = false;
-bool Colors::openGlAwailable = true;
-bool Colors::direct3dAwailable = true;
+bool Colors::openGlAvailable = true;
bool Colors::xRenderPresent = true;
bool Colors::noTicker = false;
@@ -206,8 +204,6 @@ void Colors::parseArgs(int argc, char *argv[])
QString s(argv[i]);
if (s == "-opengl")
Colors::openGlRendering = true;
- else if (s == "-direct3d")
- Colors::direct3dRendering = true;
else if (s == "-software")
Colors::softwareRendering = true;
else if (s == "-no-opengl") // support old style
@@ -270,7 +266,7 @@ void Colors::parseArgs(int argc, char *argv[])
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] [-direct3d] [-software] [-fullscreen] [-ticker[0|1]] ")
+ 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] "
@@ -290,7 +286,6 @@ void Colors::parseArgs(int argc, char *argv[])
void Colors::setLowSettings()
{
Colors::openGlRendering = false;
- Colors::direct3dRendering = false;
Colors::softwareRendering = true;
Colors::noTicker = true;
Colors::noTimerUpdate = true;
@@ -325,19 +320,15 @@ void Colors::detectSystemResources()
qDebug() << "- OpenGL not supported by current build of Qt";
#endif
{
- Colors::openGlAwailable = false;
+ Colors::openGlAvailable = false;
if (Colors::verbose)
qDebug("- OpenGL not recommended on this system");
}
-#if defined(Q_WS_WIN)
- Colors::direct3dAwailable = false; // for now.
-#endif
-
#if defined(Q_WS_X11)
// check if X render is present:
QPixmap tmp(1, 1);
- if (!tmp.x11PictureHandle()){
+ if (!tmp.x11PictureHandle() && tmp.paintEngine()->type() == QPaintEngine::X11){
Colors::xRenderPresent = false;
if (Colors::verbose)
qDebug("- X render not present");
@@ -369,21 +360,9 @@ void Colors::postConfigure()
}
}
-#if !defined(Q_WS_WIN)
- if (Colors::direct3dRendering){
- Colors::direct3dRendering = false;
- qDebug() << "- WARNING: Direct3D specified, but not supported on this platform";
- }
-#endif
-
- if (!Colors::openGlRendering && !Colors::direct3dRendering && !Colors::softwareRendering){
+ if (!Colors::openGlRendering && !Colors::softwareRendering){
// The user has not decided rendering system. So we do it instead:
-#if defined(Q_WS_WIN)
- if (Colors::direct3dAwailable)
- Colors::direct3dRendering = true;
- else
-#endif
- if (Colors::openGlAwailable)
+ if (Colors::openGlAvailable)
Colors::openGlRendering = true;
else
Colors::softwareRendering = true;
diff --git a/demos/qtdemo/colors.h b/demos/qtdemo/colors.h
index 58865c6..31eb93b 100644
--- a/demos/qtdemo/colors.h
+++ b/demos/qtdemo/colors.h
@@ -81,11 +81,9 @@ public:
static int contentHeight;
// properties:
+ static bool openGlAvailable;
static bool openGlRendering;
- static bool direct3dRendering;
static bool softwareRendering;
- static bool openGlAwailable;
- static bool direct3dAwailable;
static bool xRenderPresent;
static bool noAdapt;
static bool noTicker;
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp
index 16ca95f..6207607 100644
--- a/demos/qtdemo/mainwindow.cpp
+++ b/demos/qtdemo/mainwindow.cpp
@@ -100,14 +100,8 @@ void MainWindow::setRenderingSystem()
{
QWidget *viewport = 0;
- if (Colors::direct3dRendering){
- viewport->setAttribute(Qt::WA_MSWindowsUseDirect3D);
- setCacheMode(QGraphicsView::CacheNone);
- if (Colors::verbose)
- qDebug() << "- using Direct3D";
- }
#ifndef QT_NO_OPENGL
- else if (Colors::openGlRendering){
+ if (Colors::openGlRendering) {
QGLWidget *glw = new QGLWidget(QGLFormat(QGL::SampleBuffers));
if (Colors::noScreenSync)
glw->format().setSwapInterval(0);
@@ -116,9 +110,10 @@ void MainWindow::setRenderingSystem()
setCacheMode(QGraphicsView::CacheNone);
if (Colors::verbose)
qDebug() << "- using OpenGL";
- }
+ } else // software rendering
#endif
- else{ // software rendering
+ {
+ // software rendering
viewport = new QWidget;
setCacheMode(QGraphicsView::CacheBackground);
if (Colors::verbose)
@@ -190,6 +185,7 @@ void MainWindow::switchTimerOnOff(bool on)
if (on && !Colors::noTimerUpdate){
this->useTimer = true;
+ this->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
this->fpsTime = QTime::currentTime();
this->updateTimer.start(int(1000 / Colors::fps));
}
@@ -261,6 +257,7 @@ void MainWindow::tick()
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->tick();
+ this->viewport()->update();
if (this->useTimer)
this->updateTimer.start(int(1000 / Colors::fps));
}
@@ -384,8 +381,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
s += "Rendering system: ";
if (Colors::openGlRendering)
s += "OpenGL";
- else if (Colors::direct3dRendering)
- s += "Direct3D";
else
s += "software";
@@ -430,7 +425,9 @@ void MainWindow::focusInEvent(QFocusEvent *)
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->pause(false);
- this->switchTimerOnOff(true);
+ int code = MenuManager::instance()->currentMenuCode;
+ if (code == MenuManager::ROOT || code == MenuManager::MENU1)
+ this->switchTimerOnOff(true);
this->pausedLabel->setRecursiveVisible(false);
}
@@ -443,7 +440,9 @@ void MainWindow::focusOutEvent(QFocusEvent *)
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->pause(true);
- this->switchTimerOnOff(false);
+ int code = MenuManager::instance()->currentMenuCode;
+ if (code == MenuManager::ROOT || code == MenuManager::MENU1)
+ this->switchTimerOnOff(false);
this->pausedLabel->setRecursiveVisible(true);
}
diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro
index 18eac80..6d3cf7d 100644
--- a/demos/qtdemo/qtdemo.pro
+++ b/demos/qtdemo/qtdemo.pro
@@ -1,6 +1,8 @@
CONFIG += assistant help x11inc
TARGET = qtdemo
-DESTDIR = $$QT_BUILD_TREE/bin
+DEMO_DESTDIR = $$QT_BUILD_TREE
+isEmpty(DEMO_DESTDIR):DEMO_DESTDIR=../..
+DESTDIR = $$DEMO_DESTDIR/bin
OBJECTS_DIR = .obj
MOC_DIR = .moc
INSTALLS += target sources
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 96a3e80..2560848 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -19,6 +19,15 @@
<example filename="mediaplayer" name="Media Player" />
<example filename="boxes" name="Boxes" />
</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="UI States" />
+ <example filename="stickman" name="Stickman" />
+ <example filename="sub-attaq" name="Sub-attaq" />
+ </category>
<category dirname="qtconcurrent" name="Concurrent Programming">
<example filename="map" name="Map" executable="false" />
<example filename="progressdialog" name="Progress Dialog" />
@@ -167,6 +176,12 @@
<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="tankgame" name="Tank Game" />
+ <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>