aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Schröder <holger.schroeder.ext@basyskom.de>2010-09-21 14:18:59 +0200
committerTomas Junnonen <tomas.junnonen@nokia.com>2010-09-27 13:11:46 +0300
commit2ff22b3ec5af327424c2911d8815dae301c96efb (patch)
treef2f99e459f8ed2cbc04f5c822b1670284a03d83e
parent6ae245e04af6d7df352c963b76c46d2daa8f01b9 (diff)
Changes: remove plain qt style in libmeegotouch
RevBy: Tomas Junnonen, Berthold Krevert Details: the plain qt style can now be found at: http://meego.gitorious.org/meegotouch/meegotouch-qt-style The reason for the split of the plain qt style from libmeegotouch is the following problem: The style should display the content picker instead of the normal qt file dialog in qt applications. The libcontentmanager does implement the content picker. And libcontentmanager links against libmeegotouch. So we would have an impossible cyclic dependency when we would try to link against the libcontentmanager from the plain qt style in libmeegotouch. So we had to split the plain qt style form the rest of the libmeegotouch and put it into its own repo at the URL above. Now the plain qt style can link against both libmeegotouch and libcontentmanager.
-rw-r--r--README.specfile5
-rwxr-xr-xconfigure23
-rw-r--r--debian/.gitignore2
-rw-r--r--debian/control31
-rw-r--r--debian/meegotouch-demos-plainqt.install3
-rw-r--r--debian/meegotouch-qt-style.install1
-rwxr-xr-xdebian/rules7
-rw-r--r--demos/demos.pro6
-rw-r--r--demos/qtstyledialogs/.gitignore3
-rw-r--r--demos/qtstyledialogs/com.nokia.qtstyledialogs.service.in3
-rw-r--r--demos/qtstyledialogs/main.cpp33
-rw-r--r--demos/qtstyledialogs/mainwindow.cpp174
-rw-r--r--demos/qtstyledialogs/mainwindow.h54
-rw-r--r--demos/qtstyledialogs/mainwindow.ui251
-rw-r--r--demos/qtstyledialogs/qtstyledialogs-windows-style.desktop7
-rw-r--r--demos/qtstyledialogs/qtstyledialogs.desktop7
-rw-r--r--demos/qtstyledialogs/qtstyledialogs.pro54
-rw-r--r--demos/qtstyleexample/.gitignore4
-rw-r--r--demos/qtstyleexample/com.nokia.qtstyleexample.service.in3
-rw-r--r--demos/qtstyleexample/images/Widgets-Gallery-Graphics.svg48
-rw-r--r--demos/qtstyleexample/images/icon-m-message-send-receive.svg25
-rw-r--r--demos/qtstyleexample/images/icon-m-save.svg25
-rw-r--r--demos/qtstyleexample/main.cpp44
-rw-r--r--demos/qtstyleexample/mainwindow.cpp61
-rw-r--r--demos/qtstyleexample/mainwindow.h41
-rw-r--r--demos/qtstyleexample/mainwindow.ui1459
-rw-r--r--demos/qtstyleexample/qtstyleexample-windows-style.desktop7
-rw-r--r--demos/qtstyleexample/qtstyleexample.desktop7
-rw-r--r--demos/qtstyleexample/qtstyleexample.pro55
-rw-r--r--demos/qtstyleexample/res.qrc6
-rw-r--r--demos/qtstyleexample/style/qtstyleexample.conf0
-rw-r--r--demos/qtstyleexample/style/qtstyleexample.css0
-rw-r--r--demos/qtstylekinetic/.gitignore3
-rw-r--r--demos/qtstylekinetic/com.nokia.qtstylekinetic.service.in3
-rw-r--r--demos/qtstylekinetic/main.cpp33
-rw-r--r--demos/qtstylekinetic/mainwindow.cpp49
-rw-r--r--demos/qtstylekinetic/mainwindow.h35
-rw-r--r--demos/qtstylekinetic/mainwindow.ui334
-rw-r--r--demos/qtstylekinetic/qtstylekinetic.pro54
-rw-r--r--demos/qtstyleorientation/.gitignore3
-rw-r--r--demos/qtstyleorientation/com.nokia.qtstyleorientation.service.in3
-rw-r--r--demos/qtstyleorientation/main.cpp40
-rw-r--r--demos/qtstyleorientation/mainwindow.cpp72
-rw-r--r--demos/qtstyleorientation/mainwindow.h39
-rw-r--r--demos/qtstyleorientation/meegotouch-wallpaper-landscape.jpgbin405946 -> 0 bytes
-rw-r--r--demos/qtstyleorientation/meegotouch-wallpaper-portrait.jpgbin296218 -> 0 bytes
-rw-r--r--demos/qtstyleorientation/qtstyleorientation.desktop7
-rw-r--r--demos/qtstyleorientation/qtstyleorientation.pro39
-rw-r--r--demos/qtstyleorientation/res.qrc6
-rw-r--r--libmeegotouch.spec37
-rw-r--r--mkspecs/features/meegotouch_translations.prf3
-rw-r--r--plainqt/icons/Icon-back.pngbin814 -> 0 bytes
-rw-r--r--plainqt/icons/Icon-close.pngbin1194 -> 0 bytes
-rw-r--r--plainqt/icons/Icon-home.pngbin691 -> 0 bytes
-rw-r--r--plainqt/plainqt.pro8
-rw-r--r--plainqt/style/.gitignore1
-rw-r--r--plainqt/style/bg2.pngbin128007 -> 0 bytes
-rw-r--r--plainqt/style/qtmaemo6clicklabel.cpp79
-rw-r--r--plainqt/style/qtmaemo6clicklabel.h53
-rw-r--r--plainqt/style/qtmaemo6comboboxpopup.cpp119
-rw-r--r--plainqt/style/qtmaemo6comboboxpopup.h57
-rw-r--r--plainqt/style/qtmaemo6dialogproxy.cpp152
-rw-r--r--plainqt/style/qtmaemo6dialogproxy.h82
-rw-r--r--plainqt/style/qtmaemo6dialogtitle.cpp99
-rw-r--r--plainqt/style/qtmaemo6dialogtitle.h70
-rw-r--r--plainqt/style/qtmaemo6kineticscrolling.cpp373
-rw-r--r--plainqt/style/qtmaemo6kineticscrolling.h188
-rw-r--r--plainqt/style/qtmaemo6menu.cpp85
-rw-r--r--plainqt/style/qtmaemo6menu.h44
-rw-r--r--plainqt/style/qtmaemo6menuproxy.cpp210
-rw-r--r--plainqt/style/qtmaemo6menuproxy.h60
-rw-r--r--plainqt/style/qtmaemo6scrollbareventfilter.cpp401
-rw-r--r--plainqt/style/qtmaemo6scrollbareventfilter.h178
-rw-r--r--plainqt/style/qtmaemo6sliderpopup.cpp126
-rw-r--r--plainqt/style/qtmaemo6sliderpopup.h63
-rwxr-xr-xplainqt/style/qtmaemo6style.cpp3064
-rw-r--r--plainqt/style/qtmaemo6style.h281
-rw-r--r--plainqt/style/qtmaemo6style_p.h413
-rw-r--r--plainqt/style/qtmaemo6styleeventfilter.cpp228
-rw-r--r--plainqt/style/qtmaemo6styleeventfilter.h43
-rw-r--r--plainqt/style/qtmaemo6styleplugin.cpp46
-rw-r--r--plainqt/style/qtmaemo6styleplugin.h37
-rw-r--r--plainqt/style/qtmaemo6submenu.cpp70
-rw-r--r--plainqt/style/qtmaemo6submenu.h47
-rw-r--r--plainqt/style/qtmaemo6teststyle.cpp155
-rw-r--r--plainqt/style/qtmaemo6teststyle.h83
-rw-r--r--plainqt/style/qtmaemo6teststyle_p.h46
-rw-r--r--plainqt/style/qtmaemo6titlebar.cpp242
-rw-r--r--plainqt/style/qtmaemo6titlebar.h131
-rw-r--r--plainqt/style/qtmaemo6window.cpp245
-rw-r--r--plainqt/style/qtmaemo6window.h147
-rw-r--r--plainqt/style/qtmaemo6windowdecoration.cpp271
-rw-r--r--plainqt/style/qtmaemo6windowdecoration.h105
-rw-r--r--plainqt/style/qtmeegofilepicker.cpp243
-rw-r--r--plainqt/style/qtmeegofilepicker.h76
-rw-r--r--plainqt/style/sensorial_bg_3.pngbin224077 -> 0 bytes
-rw-r--r--plainqt/style/style.pri50
-rw-r--r--plainqt/style/style.pro63
-rw-r--r--plainqt/style/style.qrc10
-rw-r--r--projects.pro10
-rw-r--r--src/translations/translations.pro2
-rw-r--r--tests/tests.pro5
-rw-r--r--tests/ut_qtmaemo6style/.gitignore1
-rw-r--r--tests/ut_qtmaemo6style/ut_qtmaemo6style.cpp157
-rw-r--r--tests/ut_qtmaemo6style/ut_qtmaemo6style.h55
-rw-r--r--tests/ut_qtmaemo6style/ut_qtmaemo6style.pro32
106 files changed, 8 insertions, 12007 deletions
diff --git a/README.specfile b/README.specfile
index 5be7c4b0..92477925 100644
--- a/README.specfile
+++ b/README.specfile
@@ -164,10 +164,6 @@ packages:
"libmeegotouch" has "requires" dependencies set up on all of them so it is
sufficient to install libmeegotouch.rpm to get all the modularized libs.
-- libmeegotouchqtstyle": The "plain Qt style", the Qt plug-in that adds the
- Meego Touch look and feel for "plain Qt" applications (applications that
- don't link against libmeegotouch).
-
- libmeegotouch-bin: Some binaries required by applications using libmeegotouch
such as the theme daemon and the service mapper.
@@ -185,7 +181,6 @@ packages:
- meegotouch-demos-widgetsgallery: Widget gallery demo
- meegotouch-demos-widgetsgallery-tests
- - meegotouch-demos-qtstyle
- meegotouch-demos-animatedlayout
- meegotouch-demos-appletinstallationsource
- meegotouch-demos-applicationextension
diff --git a/configure b/configure
index 7d0912e9..6ed09ab8 100755
--- a/configure
+++ b/configure
@@ -60,7 +60,6 @@ CFG_DEV=no
CFG_MINIMAL=no
CFG_BUILD_TESTS=no
CFG_BUILD_BENCHMARKS=no
-CFG_BUILD_PLAINQT=yes
CFG_BUILD_EXAMPLES=no
M_DEFAULT_BUILD_PARTS="libs demos"
@@ -222,7 +221,6 @@ while [ "$#" -gt 0 ]; do
CFG_BUILD_TESTS="yes"
CFG_BUILD_EXAMPLES="yes"
CFG_BUILD_BENCHMARKS="yes"
- CFG_BUILD_PLAINQT="yes"
;;
minimal)
CFG_MINIMAL="yes"
@@ -236,11 +234,6 @@ while [ "$#" -gt 0 ]; do
benchmarks)
CFG_BUILD_BENCHMARKS="yes"
;;
- plainqt)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_BUILD_PLAINQT="$VAL"
- fi
- ;;
maemo5)
IS_MAEMO5="yes"
;;
@@ -343,14 +336,6 @@ else
fi
fi
-if [ "$CFG_BUILD_PLAINQT" = "yes" ]; then
- CFG_BUILD_PARTS="$CFG_BUILD_PARTS plainqt"
-else
- if echo $CFG_BUILD_PARTS | grep plainqt >/dev/null 2>&1; then
- CFG_BUILD_PLAINQT="yes"
- fi
-fi
-
if [ "$CFG_BUILD_EXAMPLES" = "yes" ]; then
CFG_BUILD_PARTS="$CFG_BUILD_PARTS examples"
else
@@ -489,11 +474,11 @@ Configure options:
Additional options:
-make <part> ....... Add part to the list of parts to be built at make time
- (*libs *demos plainqt tests benchmarks)
+ (*libs *demos tests benchmarks)
-nomake <part> ..... Exclude part from the list of parts to be built
-dev ............... Compile and link with default developer options.
- This enables the benchmarks, tests and plainqt parts.
+ This enables the benchmarks and tests parts.
-tests ............. Build the tests.
-benchmarks ........ Build the benchmarks.
@@ -510,9 +495,6 @@ Additional options:
-no-icu ............ Do not compile with ICU support.
+ -icu ............... Compile with ICU support.
- -no-plainqt......... Do not build the Plain Qt style plugin.
- + -plainqt ........... Build the Plain Qt style plugin.
-
EOF
exit 0
@@ -823,7 +805,6 @@ echo "Debug ............... $CFG_DEBUG"
echo
echo "Benchmarks .......... $CFG_BUILD_BENCHMARKS"
-echo "Plain Qt support .... $CFG_BUILD_PLAINQT"
echo "Tests ............... $CFG_BUILD_TESTS"
echo "Examples ............ $CFG_BUILD_EXAMPLES"
diff --git a/debian/.gitignore b/debian/.gitignore
index ee5a0cd8..3a4046f8 100644
--- a/debian/.gitignore
+++ b/debian/.gitignore
@@ -45,8 +45,6 @@ meegotouch-demos-appletinstallationsource
meegotouch-demos-appletinstallationsource-dbg
meegotouch-dev-tools
meegotouch-dev-tools-dbg
-meegotouch-demos-plainqt-dbg
-meegotouch-demos-plainqt
meegotouch-im-context
meegotouch-qt-style
meegotouch-qt-style-dbg
diff --git a/debian/control b/debian/control
index 157c61b4..3647d70a 100644
--- a/debian/control
+++ b/debian/control
@@ -97,7 +97,7 @@ Description: meegotouch-dev-tools debug package
Package: meegotouch-demos
Section: devel
Architecture: any
-Depends: meegotouch-demos-widgetsgallery, meegotouch-demos-plainqt
+Depends: meegotouch-demos-widgetsgallery
Description: Demo applications for MeeGo Touch
Collection of demo applications for MeeGo Touch
@@ -175,22 +175,6 @@ Architecture: any
Depends: ${shlibs:Depends}, meegotestrunner, meegotouch-demos-widgetsgallery (= ${Source-Version})
Description: Demo application for MeeGo Touch
-Package: meegotouch-demos-plainqt
-Section: devel
-Architecture: any
-Depends: ${shlibs:Depends}
-Conflicts: dui-demos-plainqt
-Replaces: dui-demos-plainqt
-Description: Demo applications showing the capabilities of the plain qt style.
-
-Package: meegotouch-demos-plainqt-dbg
-Section: devel
-Architecture: any
-Depends: meegotouch-demos-plainqt (= ${Source-Version})
-Conflicts: dui-demos-plainqt-dbg
-Replaces: dui-demos-plainqt-dbg
-Description: debug symbols of the plain qt examples
-
Package: meegotouch-demos-appletinstallationsource
Section: devel
Architecture: any
@@ -243,19 +227,6 @@ Depends: libmeegotouch-benchmarks (= ${Source-Version})
Description: libmeegotouch-benchmarks debug package
libmeegotouch-benchmarks debug symbols.
-Package: meegotouch-qt-style
-Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, libmeegotouchcore0 (= ${Source-Version})
-Description: MeeGo Touch Qt style for plain Qt applications
- MeeGo Touch Qt style plugin
-
-Package: meegotouch-qt-style-dbg
-Architecture: any
-Section: devel
-Depends: meegotouch-qt-style (= ${Source-Version})
-Description: meegotouch-qt-style debug package
- meegotouch-qt-style debug symbols.
-
Package: libmeegotouch-doc
Section: doc
Architecture: all
diff --git a/debian/meegotouch-demos-plainqt.install b/debian/meegotouch-demos-plainqt.install
deleted file mode 100644
index 22206526..00000000
--- a/debian/meegotouch-demos-plainqt.install
+++ /dev/null
@@ -1,3 +0,0 @@
-usr/bin/qtstyle*
-usr/share/applications/qtstyle*.desktop
-usr/share/dbus-1/services/com.nokia.qtstyle*
diff --git a/debian/meegotouch-qt-style.install b/debian/meegotouch-qt-style.install
deleted file mode 100644
index 691ace4d..00000000
--- a/debian/meegotouch-qt-style.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/qt4/plugins/styles/libmeegotouchqtstyleplugin.so* \ No newline at end of file
diff --git a/debian/rules b/debian/rules
index 0081da0f..72a87c43 100755
--- a/debian/rules
+++ b/debian/rules
@@ -59,11 +59,6 @@ ifeq (,$(findstring notestability,$(DEB_BUILD_OPTIONS)))
OPTIONS += -testable
endif
-#disable plain qt by setting DEB_BUILD_OPTION=noplainqt,...
-ifneq (,$(findstring noplainqt,$(DEB_BUILD_OPTIONS)))
- OPTIONS += -no-plainqt
-endif
-
# Perform a minimal build by setting DEB_BUILD_OPTION=minimal,...
ifeq (,$(findstring minimal,$(DEB_BUILD_OPTIONS)))
OPTIONS += -make "tests benchmarks examples"
@@ -150,12 +145,10 @@ binary-arch: build install
dh_strip -p libmeegotouch-bin --dbg-package=libmeegotouch-bin
dh_strip -p meegotouch-dev-tools --dbg-package=meegotouch-dev-tools
dh_strip -p meegotouch-demos-widgetsgallery --dbg-package=meegotouch-demos-widgetsgallery
- dh_strip -p meegotouch-demos-plainqt --dbg-package=meegotouch-demos-plainqt
dh_strip -p meegotouch-demos-appletinstallationsource --dbg-package=meegotouch-demos-appletinstallationsource
dh_strip -p meegotouch-demos-applicationextension --dbg-package=meegotouch-demos-applicationextension
dh_strip -p libmeegotouch-tests --dbg-package=libmeegotouch-tests
dh_strip -p libmeegotouch-benchmarks --dbg-package=libmeegotouch-benchmarks
- dh_strip -p meegotouch-qt-style --dbg-package=meegotouch-qt-style
dh_compress
dh_fixperms
dh_makeshlibs
diff --git a/demos/demos.pro b/demos/demos.pro
index 2a56d7d7..a5133fb6 100644
--- a/demos/demos.pro
+++ b/demos/demos.pro
@@ -9,11 +9,7 @@ SUBDIRS = \
!contains(M_BUILD_FEATURES, minimal) {
SUBDIRS += \
animatedlayout \
- animatedlayout/translations \
- qtstyleexample \
- qtstyledialogs \
- qtstylekinetic \
- qtstyleorientation
+ animatedlayout/translations
}
# we do not have compiled QtDBusd4
diff --git a/demos/qtstyledialogs/.gitignore b/demos/qtstyledialogs/.gitignore
deleted file mode 100644
index 97435977..00000000
--- a/demos/qtstyledialogs/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-com.nokia.qtstyledialogs.service
-qtstyledialogs
-ui_mainwindow.h
diff --git a/demos/qtstyledialogs/com.nokia.qtstyledialogs.service.in b/demos/qtstyledialogs/com.nokia.qtstyledialogs.service.in
deleted file mode 100644
index 26a0deb4..00000000
--- a/demos/qtstyledialogs/com.nokia.qtstyledialogs.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=com.nokia.qtstyledialogs
-Exec=@M_INSTALL_BIN@/qtstyledialogs -style iqs
diff --git a/demos/qtstyledialogs/main.cpp b/demos/qtstyledialogs/main.cpp
deleted file mode 100644
index cef840be..00000000
--- a/demos/qtstyledialogs/main.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-
-#include "mainwindow.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- MainWindow mw;
- mw.show();
-
- return app.exec();
-}
-
diff --git a/demos/qtstyledialogs/mainwindow.cpp b/demos/qtstyledialogs/mainwindow.cpp
deleted file mode 100644
index 73e25d90..00000000
--- a/demos/qtstyledialogs/mainwindow.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-
-#include <QPushButton>
-#include <QColorDialog>
-#include <QErrorMessage>
-#include <QFileDialog>
-#include <QFontDialog>
-#include <QInputDialog>
-#include <QMessageBox>
-#include <QPageSetupDialog>
-#include <QPrintPreviewDialog>
-#include <QProgressDialog>
-#include <QWizard>
-
-MainWindow::MainWindow() : QMainWindow(NULL)
-{
- setupUi(this);
-
- connect(normalNmDialogButton, SIGNAL(clicked()), SLOT(showNormalNmDialog()));
- connect(fullScreenNmDialogButton, SIGNAL(clicked()), SLOT(showFullScreenNmDialog()));
- connect(hugeNmDialogButton, SIGNAL(clicked()), SLOT(showHugeNmDialog()));
-
- connect(normalMDialogButton, SIGNAL(clicked()), SLOT(showNormalMDialog()));
- connect(fullScreenMDialogButton, SIGNAL(clicked()), SLOT(showFullScreenMDialog()));
- connect(HugeMDialogButton, SIGNAL(clicked()), SLOT(showHugeMDialog()));
-
-
- connect(colorDialogButton, SIGNAL(clicked()), SLOT(showColorDialog()));
- connect(errorMessageButton, SIGNAL(clicked()), SLOT(showErrorMessage()));
- connect(fileDialogButton, SIGNAL(clicked()), SLOT(showFileDialog()));
- connect(fontDialogButton, SIGNAL(clicked()), SLOT(showFontDialog()));
- connect(inputDialogButton, SIGNAL(clicked()), SLOT(showInputDialog()));
- connect(messageBoxButton, SIGNAL(clicked()), SLOT(showMessageBox()));
- connect(pageSetupDialogButton, SIGNAL(clicked()), SLOT(showPageSetupDialog()));
- connect(printPreviewDialogButton, SIGNAL(clicked()), SLOT(showPrintPreviewDialog()));
- connect(progressDialogButton, SIGNAL(clicked()), SLOT(showProgressDialog()));
- connect(wizardButton, SIGNAL(clicked()), SLOT(showWizard()));
-}
-
-MainWindow::~MainWindow()
-{
-
-}
-
-void MainWindow::showColorDialog()
-{
- QColor testColor = QColorDialog::getColor(Qt::red,
- this, "Color Dialog",
- QColorDialog::ShowAlphaChannel);
-}
-
-void MainWindow::showErrorMessage()
-{
- QErrorMessage dialog(this);
- dialog.showMessage("Errare humanum est, sed in errare perseverare diabolicum.");
- dialog.exec();
-}
-
-void MainWindow::showFileDialog()
-{
- QString testFileName = QFileDialog::getOpenFileName(this,
- "Please choose a file name for testing",
- "/");
-}
-
-void MainWindow::showFontDialog()
-{
- bool ok = false;
- QFont testFont = QFontDialog::getFont(&ok, QFont("Times", 12),
- this,
- "Please choose a font for testing.");
-}
-
-void MainWindow::showInputDialog()
-{
- QString testText = QInputDialog::getText(this,
- "Please enter a string for testing.",
- "This is a test");
-}
-
-void MainWindow::showMessageBox()
-{
- QMessageBox::warning(this,
- "Don't Panic! This is a test!",
- "Error 422001: I'm sorry, M. I'm afraid I can't do that!");
-}
-
-void MainWindow::showPageSetupDialog()
-{
- QPageSetupDialog dialog(this);
- dialog.exec();
-}
-
-void MainWindow::showPrintPreviewDialog()
-{
- QPrintPreviewDialog dialog(this);
- dialog.exec();
-}
-
-void MainWindow::showProgressDialog()
-{
- QProgressDialog dialog(this);
- dialog.exec();
-}
-
-void MainWindow::showWizard()
-{
- QWizard dialog(this);
- dialog.exec();
-}
-
-void MainWindow::showNormalNmDialog()
-{
- QDialog dialog(this);
- dialog.setModal(false);
- dialog.exec();
-}
-
-void MainWindow::showFullScreenNmDialog()
-{
- QDialog dialog(this);
- dialog.showFullScreen();
- dialog.setModal(false);
- dialog.exec();
-}
-
-void MainWindow::showHugeNmDialog()
-{
- QDialog dialog(this);
- dialog.setFixedWidth(2048);
- dialog.setFixedHeight(2048);
- dialog.setModal(false);
- dialog.exec();
-}
-
-void MainWindow::showNormalMDialog()
-{
- QDialog dialog(this);
- dialog.exec();
-}
-
-void MainWindow::showFullScreenMDialog()
-{
- QDialog dialog(this);
- dialog.showFullScreen();
- dialog.exec();
-}
-
-void MainWindow::showHugeMDialog()
-{
- QDialog dialog(this);
- dialog.setFixedWidth(2048);
- dialog.setFixedHeight(2048);
- dialog.exec();
-}
diff --git a/demos/qtstyledialogs/mainwindow.h b/demos/qtstyledialogs/mainwindow.h
deleted file mode 100644
index 0fbd3ffe..00000000
--- a/demos/qtstyledialogs/mainwindow.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-#include "ui_mainwindow.h"
-
-class MainWindow : public QMainWindow, Ui::MainWindow
-{
- Q_OBJECT
-public:
- MainWindow();
- ~MainWindow();
-public slots:
- void showNormalNmDialog();
- void showFullScreenNmDialog();
- void showHugeNmDialog();
-
- void showNormalMDialog();
- void showFullScreenMDialog();
- void showHugeMDialog();
-
- void showColorDialog();
- void showErrorMessage();
- void showFileDialog();
- void showFontDialog();
- void showInputDialog();
- void showMessageBox();
- void showPageSetupDialog();
- void showPrintPreviewDialog();
- void showProgressDialog();
- void showWizard();
-};
-
-#endif
diff --git a/demos/qtstyledialogs/mainwindow.ui b/demos/qtstyledialogs/mainwindow.ui
deleted file mode 100644
index 8c19bb52..00000000
--- a/demos/qtstyledialogs/mainwindow.ui
+++ /dev/null
@@ -1,251 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>527</width>
- <height>415</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Qt Style Dialog Test</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Dialog window modes:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="normalNmDialogButton">
- <property name="text">
- <string>Normal non-modal Dialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="fullScreenNmDialogButton">
- <property name="text">
- <string>Fullscreen non-modal Dialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="hugeNmDialogButton">
- <property name="text">
- <string>Huge non-modal Dialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="normalMDialogButton">
- <property name="text">
- <string>Normal modal Dialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="fullScreenMDialogButton">
- <property name="text">
- <string>Fullscreen modal Dialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="HugeMDialogButton">
- <property name="text">
- <string>Huge modal Dialog</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Standard Qt Dialogs:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="colorDialogButton">
- <property name="text">
- <string>QColorDialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="errorMessageButton">
- <property name="text">
- <string>QErrorMessage</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="fileDialogButton">
- <property name="text">
- <string>QFileDialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="fontDialogButton">
- <property name="text">
- <string>QFontDialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="inputDialogButton">
- <property name="text">
- <string>QInputDialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="messageBoxButton">
- <property name="text">
- <string>QMessageBox</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pageSetupDialogButton">
- <property name="text">
- <string>QPageSetupDialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="printPreviewDialogButton">
- <property name="text">
- <string>QPrintPreviewDialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="progressDialogButton">
- <property name="text">
- <string>QProgressDialog</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="wizardButton">
- <property name="text">
- <string>QWizard</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_6">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- <action name="actionNew">
- <property name="text">
- <string>New</string>
- </property>
- </action>
- <action name="actionQuit">
- <property name="text">
- <string>Quit</string>
- </property>
- </action>
- <action name="actionOpen">
- <property name="icon">
- <iconset>
- <normaloff>:/images/images/icon-m-save.svg</normaloff>:/images/images/icon-m-save.svg</iconset>
- </property>
- <property name="text">
- <string>Open...</string>
- </property>
- </action>
- <action name="actionOrder">
- <property name="icon">
- <iconset>
- <normaloff>:/images/images/icon-m-message-send-receive.svg</normaloff>:/images/images/icon-m-message-send-receive.svg</iconset>
- </property>
- <property name="text">
- <string>order</string>
- </property>
- </action>
- <action name="actionAction_1">
- <property name="text">
- <string>Action 1</string>
- </property>
- </action>
- <action name="actionAction_2">
- <property name="text">
- <string>Action 2</string>
- </property>
- </action>
- <action name="actionAction_3">
- <property name="text">
- <string>Action 3</string>
- </property>
- </action>
- <action name="actionAction_4">
- <property name="text">
- <string>Action 4</string>
- </property>
- </action>
- </widget>
- <resources>
- <include location="res.qrc"/>
- </resources>
- <connections/>
-</ui>
diff --git a/demos/qtstyledialogs/qtstyledialogs-windows-style.desktop b/demos/qtstyledialogs/qtstyledialogs-windows-style.desktop
deleted file mode 100644
index 4eb8902f..00000000
--- a/demos/qtstyledialogs/qtstyledialogs-windows-style.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=QtStyle Dialogs Example (Windows style)
-Icon=icon-l-video
-Exec=qtstyledialogs -style windows
-X-Maemo-Service=com.nokia.qtstyledialogs
-OnlyShowIn=X-MeeGo;
diff --git a/demos/qtstyledialogs/qtstyledialogs.desktop b/demos/qtstyledialogs/qtstyledialogs.desktop
deleted file mode 100644
index 2805ce10..00000000
--- a/demos/qtstyledialogs/qtstyledialogs.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=QtStyle Dialogs Example
-Icon=icon-l-video
-Exec=qtstyledialogs -style iqs
-X-Maemo-Service=com.nokia.qtstyledialogs
-OnlyShowIn=X-MeeGo;
diff --git a/demos/qtstyledialogs/qtstyledialogs.pro b/demos/qtstyledialogs/qtstyledialogs.pro
deleted file mode 100644
index 3b07e1ca..00000000
--- a/demos/qtstyledialogs/qtstyledialogs.pro
+++ /dev/null
@@ -1,54 +0,0 @@
-MROOT = ../..
-include($$MROOT/mkspecs/common.pri)
-TEMPLATE = app
-TARGET = qtstyledialogs
-target.path = $$M_INSTALL_BIN
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp \
- mainwindow.cpp
-HEADERS += mainwindow.h
-FORMS += mainwindow.ui
-
-# UI style definition
-style_sheet.path = $$M_THEME_DIR/../qtstyledialogs/themes/style
-style_sheet.files = style/qtstyledialogs.css
-view_configuration.path = $$M_THEME_DIR/../qtstyledialogs/themes
-view_configuration.files = style/qtstyledialogs.conf
-style_images.path = $$M_THEME_DIR/../qtstyledialogs/themes/images
-style_images.files = images/*.png \
- images/*.jpg
-style_svg.path = $$M_THEME_DIR/../qtstyledialogs/themes/svg
-style_svg.files = images/*.svg
-
-desktop_entry.path = $$M_INSTALL_DATA/applications
-desktop_entry.files = \
- qtstyledialogs.desktop \
- qtstyledialogs-windows-style.desktop
-
-myname = com.nokia.qtstyledialogs
-
-services.CONFIG += no_check_exist
-services.target = $${myname}.service
-services.commands = cat $$IN_PWD/$${myname}.service.in \
- | sed -e "s:@M_INSTALL_BIN@:$${M_INSTALL_BIN}:g" \
- > $${myname}.service
-services.files = $$OUT_PWD/$${myname}.service
-services.path = $$M_DBUS_SERVICES_DIR
-
-
-DEFINES += IMAGES_DIR=\"\\\"$$style_images.path/\\\"\"
-
-# Install instructions
-INSTALLS += target \
- style_sheet \
- style_images \
- style_svg \
- desktop_entry \
-
-!win32:!macx {
- INSTALLS += services
-}
-
diff --git a/demos/qtstyleexample/.gitignore b/demos/qtstyleexample/.gitignore
deleted file mode 100644
index b93835f2..00000000
--- a/demos/qtstyleexample/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-qtstyleexample
-ui_mainwindow.h
-qrc_res.cpp
-com.nokia.qtstyleexample.service
diff --git a/demos/qtstyleexample/com.nokia.qtstyleexample.service.in b/demos/qtstyleexample/com.nokia.qtstyleexample.service.in
deleted file mode 100644
index 62aab1da..00000000
--- a/demos/qtstyleexample/com.nokia.qtstyleexample.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=com.nokia.qtstyleexample
-Exec=@M_INSTALL_BIN@/qtstyleexample -style iqs
diff --git a/demos/qtstyleexample/images/Widgets-Gallery-Graphics.svg b/demos/qtstyleexample/images/Widgets-Gallery-Graphics.svg
deleted file mode 100644
index 42364fdd..00000000
--- a/demos/qtstyleexample/images/Widgets-Gallery-Graphics.svg
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="level1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="688px" height="264px" viewBox="0 0 688 264" enable-background="new 0 0 688 264" xml:space="preserve">
-<g id="Widgets-Gallery-Button-Background">
- <g opacity="0.03">
- <g>
- <g>
- <path fill="#FFFFFF" d="M159.835,139.873c0,4.4,3.6,8,8,8h398c4.4,0,8-3.6,8-8v-72c0-4.4-3.6-8-8-8h-398c-4.4,0-8,3.6-8,8
- V139.873z"/>
- </g>
- <defs>
- <filter id="Adobe_OpacityMaskFilter" filterUnits="userSpaceOnUse" x="159.835" y="59.873" width="414" height="88">
-
- <feColorMatrix type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0" color-interpolation-filters="sRGB" result="source"/>
- </filter>
- </defs>
- </g>
- </g>
- <g opacity="0.15">
- <g>
- <g>
- <defs>
- <path id="SVGID_2_" d="M565.835,60.873c3.86,0,7,3.141,7,7v72c0,3.859-3.14,7-7,7h-398c-3.86,0-7-3.141-7-7v-72
- c0-3.859,3.14-7,7-7H565.835 M565.835,59.873h-398c-4.399,0-8,3.6-8,8v72c0,4.4,3.601,8,8,8h398c4.399,0,8-3.6,8-8v-72
- C573.835,63.473,570.234,59.873,565.835,59.873L565.835,59.873z"/>
- </defs>
- <clipPath id="SVGID_3_">
- <use xlink:href="#SVGID_2_" overflow="visible"/>
- </clipPath>
- <linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="366.8354" y1="147.873" x2="366.8354" y2="59.8735">
- <stop offset="0" style="stop-color:#FFFFFF"/>
- <stop offset="0.0859" style="stop-color:#F7F7F7"/>
- <stop offset="0.2181" style="stop-color:#E2E2E2"/>
- <stop offset="0.3803" style="stop-color:#BEBEBE"/>
- <stop offset="0.566" style="stop-color:#8D8D8D"/>
- <stop offset="0.7717" style="stop-color:#4E4E4E"/>
- <stop offset="0.9913" style="stop-color:#030303"/>
- <stop offset="1" style="stop-color:#000000"/>
- </linearGradient>
- <path clip-path="url(#SVGID_3_)" fill="url(#SVGID_4_)" d="M159.835,67.873c0-4.4,3.601-8,8-8h398c4.399,0,8,3.6,8,8v72
- c0,4.4-3.601,8-8,8h-398c-4.399,0-8-3.6-8-8V67.873z"/>
- </g>
- </g>
- </g>
-</g>
-</svg>
diff --git a/demos/qtstyleexample/images/icon-m-message-send-receive.svg b/demos/qtstyleexample/images/icon-m-message-send-receive.svg
deleted file mode 100644
index 9508865d..00000000
--- a/demos/qtstyleexample/images/icon-m-message-send-receive.svg
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="icon-m-message-send-receive-layer"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px"
- viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
-<symbol id="background_x5F_64" viewBox="-31.999 -32 63.999 64">
- <polygon style="fill:none;" points="32,-32 -32,-32 -32,32 32,32 "/>
-</symbol>
-<g id="icon-m-message-send-receive_1_">
-
- <use xlink:href="#background_x5F_64" width="63.999" height="64" id="background_x5F_64_157_" x="-31.999" y="-32" transform="matrix(1 0 0 -1 32 32)" style="overflow:visible;"/>
- <g>
- <path style="fill:#000000;" d="M40.979,13.527v-0.252c0-3.078-2.504-5.613-5.527-5.613H5.543C2.498,7.662,0,10.197,0,13.275v0.252
- l20.492,9.107L40.979,13.527z M44.486,17.51c-5.715,0-10.84,2.461-14.408,6.357l-8.977,3.98l-0.609,0.262l-0.619-0.262L0,19.033
- v12.428c0,3.107,2.498,5.623,5.543,5.623h19.434c0.078,10.641,8.779,19.256,19.51,19.256C55.256,56.34,64,47.648,64,36.938
- C64,26.211,55.256,17.51,44.486,17.51z M26.619,37.217l0.059-0.053h4.965c-0.004-0.092-0.014-0.172-0.014-0.264
- c0.002-7.156,5.803-12.959,12.963-12.963c2.635,0,5.08,0.793,7.125,2.143l-3.068,3.07c-1.213-0.637-2.592-1.004-4.057-1.006
- c-4.838,0.008-8.748,3.918-8.758,8.756c0,0.09,0.02,0.174,0.021,0.264h6.469l0.057,0.053L34.5,44.52L26.619,37.217z
- M57.535,37.164c-0.143,7.035-5.873,12.693-12.943,12.697c-2.258-0.002-4.379-0.582-6.227-1.596l3.172-3.172
- c0.953,0.354,1.979,0.559,3.055,0.561c4.746-0.008,8.592-3.777,8.74-8.49h-5.83l-0.057-0.055l7.881-7.301l7.881,7.301
- l-0.057,0.055H57.535z"/>
- </g>
-</g>
-</svg>
diff --git a/demos/qtstyleexample/images/icon-m-save.svg b/demos/qtstyleexample/images/icon-m-save.svg
deleted file mode 100644
index 4e7e124e..00000000
--- a/demos/qtstyleexample/images/icon-m-save.svg
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="icon-m-save-layer" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
- y="0px" width="64px" height="64px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
-<symbol id="background_x5F_64" viewBox="-31.999 -32 63.999 64">
- <polygon style="fill:none;" points="32,-32 -32,-32 -32,32 32,32 "/>
-</symbol>
-<g id="icon-m-save_1_">
-
- <use xlink:href="#background_x5F_64" width="63.999" height="64" id="background_x5F_64_421_" x="-31.999" y="-32" transform="matrix(1 0 0 -1 31.9995 32)" style="overflow:visible;"/>
- <g>
- <g>
- <g>
- <rect x="21.945" y="33.199" style="fill:#231F20;" width="20.02" height="4"/>
- <rect x="22.074" y="42.582" style="fill:#231F20;" width="12" height="4"/>
- <path style="fill:#231F20;" d="M56.168,5.895h-9.775v13.008c0,0.551-0.449,1-1,1H18.609c-0.549,0-1-0.449-1-1V5.895H7.833
- c-1.1,0-2,0.9-2,2v48.334c0,1.1,0.9,2,2,2h48.334c1.1,0,2-0.9,2-2V7.895C58.168,6.795,57.268,5.895,56.168,5.895z M48.623,50.1
- c0,1.1-0.898,2-2,2H17.378c-1.1,0-2-0.9-2-2v-20.66c0-1.1,0.9-2,2-2h29.245c1.102,0,2,0.9,2,2V50.1z"/>
- </g>
- </g>
- <path style="fill:#231F20;" d="M31.808,5.771v7.965c0,0.551,0.449,1,1,1h6.45c0.551,0,1-0.449,1-1V5.771H31.808z"/>
- </g>
-</g>
-</svg>
diff --git a/demos/qtstyleexample/main.cpp b/demos/qtstyleexample/main.cpp
deleted file mode 100644
index 8d902584..00000000
--- a/demos/qtstyleexample/main.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QDebug>
-#include <QStyle>
-
-#include "mainwindow.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-// app.setProperty( "NoMStyle", true );
-// app.setProperty( "NoMNavigationBar", true );
- qCritical() << app.arguments();
- if(app.arguments().contains("-oc")) {
- bool enabled = QMetaObject::invokeMethod(app.style(), "setOrientationChangeEnabled", Q_ARG(bool, true));
- qCritical() << "Orientation change enabled:" << enabled;
- }
-
- MainWindow mw;
- mw.show();
-
- qCritical() << "Starting eventloop";
- return app.exec();
-}
-
diff --git a/demos/qtstyleexample/mainwindow.cpp b/demos/qtstyleexample/mainwindow.cpp
deleted file mode 100644
index 2324d427..00000000
--- a/demos/qtstyleexample/mainwindow.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-
-#include <QMenu>
-#include <QFileDialog>
-#include <QDebug>
-
-MainWindow::MainWindow() : QMainWindow(NULL)
-{
- setupUi(this);
- QMenu *menu(menuBar()->addMenu("Long menu"));
-
- for (int i = 0; i < 200; ++i) {
- menu->addAction(QString("Entry %1").arg(i));
- comboBox->addItem(QString("%1 cm").arg(i * 2));
- }
- connect(actionOpen, SIGNAL(triggered()), this, SLOT(fileOpen()));
- if(!connect(style(), SIGNAL(orientationChanged(int)), this, SLOT(setStatusBarText())))
- qCritical() << "Couldn't connect statusbar";
-
- statusBarLabel = new QLabel();
- statusBar()->addWidget(statusBarLabel);
-
- statusBarLabel->setText("I am the status bar");
-}
-
-MainWindow::~MainWindow()
-{
-
-}
-
-void MainWindow::fileOpen()
-{
- QString s = QFileDialog::getOpenFileName();
-}
-
-void MainWindow::setStatusBarText() {
- int retVal;
- if(QMetaObject::invokeMethod(qApp->style(), "orientation", Q_ARG(int*, &retVal)))
- statusBarLabel->setText(QString("Orientation %1°").arg(retVal));
- else
- statusBarLabel->setText("Couldn't retrive orientation");
-}
diff --git a/demos/qtstyleexample/mainwindow.h b/demos/qtstyleexample/mainwindow.h
deleted file mode 100644
index 763e512e..00000000
--- a/demos/qtstyleexample/mainwindow.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-#include "ui_mainwindow.h"
-
-class MainWindow : public QMainWindow, Ui::MainWindow
-{
- Q_OBJECT
-public:
- MainWindow();
- ~MainWindow();
-
-protected slots:
- void fileOpen();
- void setStatusBarText();
-private:
- QLabel* statusBarLabel;
-};
-
-#endif
diff --git a/demos/qtstyleexample/mainwindow.ui b/demos/qtstyleexample/mainwindow.ui
deleted file mode 100644
index 54e06652..00000000
--- a/demos/qtstyleexample/mainwindow.ui
+++ /dev/null
@@ -1,1459 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>584</width>
- <height>437</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Pizza Order</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>1</number>
- </property>
- <widget class="QWidget" name="Pizza">
- <attribute name="title">
- <string>Pizza</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="7" column="0" colspan="2">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>311</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="5" column="1">
- <widget class="QLineEdit" name="lineEdit"/>
- </item>
- <item row="4" column="1">
- <widget class="QSpinBox" name="spinBox"/>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Size</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QCheckBox" name="checkBox">
- <property name="text">
- <string>Extra cheese</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" rowspan="6">
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Type</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="radioButton">
- <property name="text">
- <string>Margarita</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButton_2">
- <property name="text">
- <string>Salami</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButton_3">
- <property name="text">
- <string>Frutti di mare</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="comboBox">
- <item>
- <property name="text">
- <string>28cm</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QPushButton" name="pushButton">
- <property name="text">
- <string>PushButton</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="comboBox_2">
- <property name="editable">
- <bool>true</bool>
- </property>
- <item>
- <property name="text">
- <string>Small</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Medium</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Large</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Extra Large</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="Buttons">
- <attribute name="title">
- <string>Buttons</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>PushButtons</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QPushButton" name="pushButton_2">
- <property name="text">
- <string>PushButton</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_3">
- <property name="text">
- <string>ToggleButton</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCommandLinkButton" name="commandLinkButton">
- <property name="text">
- <string>CommandLinkButton</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QGroupBox" name="groupBox_5">
- <property name="title">
- <string>ToolButtons</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <widget class="QToolButton" name="toolButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>ToolButton text beside</string>
- </property>
- <property name="icon">
- <iconset resource="res.qrc">
- <normaloff>:/images/images/icon-m-message-send-receive.svg</normaloff>:/images/images/icon-m-message-send-receive.svg</iconset>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="toolButton_4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>ToolButton text below</string>
- </property>
- <property name="icon">
- <iconset resource="res.qrc">
- <normaloff>:/images/images/icon-m-message-send-receive.svg</normaloff>:/images/images/icon-m-message-send-receive.svg</iconset>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextUnderIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="toolButton_2">
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res.qrc">
- <normaloff>:/images/images/icon-m-message-send-receive.svg</normaloff>:/images/images/icon-m-message-send-receive.svg</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="toolButton_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>ToolButton text only</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextOnly</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="SpecialButtons">
- <attribute name="title">
- <string>Special Buttons</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0">
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>CheckBoxes</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QCheckBox" name="checkBox_2">
- <property name="text">
- <string>Chocolate</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="checkBox_3">
- <property name="text">
- <string>Coffee</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>RadioButtons</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QRadioButton" name="radioButton_4">
- <property name="text">
- <string>Vanilla</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButton_5">
- <property name="text">
- <string>Strawberry</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButton_6">
- <property name="text">
- <string>Lime</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>QDialogButtonBox:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>PushButtons:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_12">
- <property name="text">
- <string>OK</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_11">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="1">
- <spacer name="verticalSpacer_5">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>224</width>
- <height>133</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>ScrollBars</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <item>
- <widget class="QGroupBox" name="groupBox_6">
- <property name="title">
- <string>ScrollArea</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>466</width>
- <height>166</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_9">
- <item>
- <widget class="QPushButton" name="pushButton_4">
- <property name="text">
- <string>Gingerbread</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_7">
- <property name="text">
- <string>Christmas Cookie</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_5">
- <property name="text">
- <string>Stollen</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_10">
- <property name="text">
- <string>Nut Macrons</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_6">
- <property name="text">
- <string>Star Anise</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_9">
- <property name="text">
- <string>Chocolate Hearts</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_7">
- <property name="title">
- <string>Stand-alone ScrollBars</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_6">
- <item row="0" column="0">
- <widget class="QScrollBar" name="horizontalScrollBar">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="Slider">
- <attribute name="title">
- <string>Slider</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QSlider" name="horizontalSlider">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSlider" name="horizontalSlider_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksBelow</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QSlider" name="verticalSlider">
- <property name="value">
- <number>99</number>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>103</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="1">
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>103</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1">
- <widget class="QSlider" name="verticalSlider_2">
- <property name="value">
- <number>99</number>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksBothSides</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="Seite">
- <property name="cursor">
- <cursorShape>ArrowCursor</cursorShape>
- </property>
- <attribute name="title">
- <string>ListWidget</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <widget class="QTabWidget" name="tabWidget_6">
- <property name="currentIndex">
- <number>2</number>
- </property>
- <widget class="QWidget" name="SingleColListView">
- <attribute name="title">
- <string>ListView</string>
- </attribute>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QListWidget" name="listWidget">
- <property name="viewMode">
- <enum>QListView::ListMode</enum>
- </property>
- <item>
- <property name="text">
- <string>Sun</string>
- </property>
- <property name="icon">
- <iconset>
- <normalon>:/images/images/icon-m-save.svg</normalon>
- </iconset>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Mercury</string>
- </property>
- <property name="icon">
- <iconset>
- <normalon>:/images/images/icon-m-save.svg</normalon>
- </iconset>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Venus</string>
- </property>
- <property name="icon">
- <iconset>
- <normalon>:/images/images/icon-m-message-send-receive.svg</normalon>
- </iconset>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Earth</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Mars</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Ceres</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Vesta</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Pallas</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hygiea</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Jupiter</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Saturn</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Uranus</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Neptune</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Orcus</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Pluto</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Ixion</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Huya</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Varuna</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Haumea</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Quaoar</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Makemake</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Eris</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Sedna</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_8">
- <attribute name="title">
- <string>TableView</string>
- </attribute>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QTableWidget" name="tableWidget">
- <row>
- <property name="text">
- <string>New Row</string>
- </property>
- </row>
- <row>
- <property name="text">
- <string>New Row</string>
- </property>
- </row>
- <row>
- <property name="text">
- <string>New Row</string>
- </property>
- </row>
- <column>
- <property name="text">
- <string>Subject</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Sender</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Date</string>
- </property>
- </column>
- <item row="0" column="0">
- <property name="text">
- <string>QtMaemo6Style</string>
- </property>
- </item>
- <item row="0" column="1">
- <property name="text">
- <string>John Doe</string>
- </property>
- </item>
- <item row="0" column="2">
- <property name="text">
- <string>2010-01-31</string>
- </property>
- </item>
- <item row="1" column="0">
- <property name="text">
- <string>Re: QtMaemo6Style</string>
- </property>
- </item>
- <item row="1" column="1">
- <property name="text">
- <string>Max Mustermann</string>
- </property>
- </item>
- <item row="1" column="2">
- <property name="text">
- <string>2010-02-02</string>
- </property>
- </item>
- <item row="2" column="0">
- <property name="text">
- <string>Re: Re: QtMaemo6 Style</string>
- </property>
- </item>
- <item row="2" column="1">
- <property name="text">
- <string>John Doe</string>
- </property>
- </item>
- <item row="2" column="2">
- <property name="text">
- <string>2010-02-03</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_7">
- <attribute name="title">
- <string>TreeView</string>
- </attribute>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <widget class="QTreeWidget" name="treeWidget">
- <column>
- <property name="text">
- <string>Name</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Size</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Date</string>
- </property>
- </column>
- <item>
- <property name="text">
- <string>/</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="text">
- <string>2010-01-01</string>
- </property>
- <item>
- <property name="text">
- <string>home</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="text">
- <string>2010-01-01</string>
- </property>
- <item>
- <property name="text">
- <string>user</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="text">
- <string>2010-01-01</string>
- </property>
- <item>
- <property name="text">
- <string>file</string>
- </property>
- <property name="text">
- <string>568 Byte</string>
- </property>
- <property name="text">
- <string>2010-01-01</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>file2</string>
- </property>
- <property name="text">
- <string>168 Byte</string>
- </property>
- <property name="text">
- <string>2010-01-03</string>
- </property>
- </item>
- </item>
- </item>
- <item>
- <property name="text">
- <string>bin</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="text">
- <string>2010-01-01</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>etc</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="text">
- <string>2010-01-01</string>
- </property>
- </item>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2">
- <attribute name="title">
- <string>Tabs</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_7">
- <item row="0" column="0">
- <widget class="QTabWidget" name="tabWidget_2">
- <property name="tabPosition">
- <enum>QTabWidget::North</enum>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab_3">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- </widget>
- <widget class="QWidget" name="tab_4">
- <attribute name="icon">
- <iconset>
- <normalon>:/images/images/icon-m-save.svg</normalon>
- </iconset>
- </attribute>
- <attribute name="title">
- <string>Tab 2</string>
- </attribute>
- </widget>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QTabWidget" name="tabWidget_3">
- <property name="tabPosition">
- <enum>QTabWidget::South</enum>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>1</number>
- </property>
- <widget class="QWidget" name="tab_5">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- </widget>
- <widget class="QWidget" name="tab_6">
- <attribute name="icon">
- <iconset>
- <normalon>:/images/images/icon-m-save.svg</normalon>
- </iconset>
- </attribute>
- <attribute name="title">
- <string>Tab 2</string>
- </attribute>
- </widget>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QTabWidget" name="tabWidget_4">
- <property name="tabPosition">
- <enum>QTabWidget::West</enum>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab_11">
- <attribute name="icon">
- <iconset>
- <normalon>:/images/images/icon-m-save.svg</normalon>
- </iconset>
- </attribute>
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- </widget>
- <widget class="QWidget" name="tab_12">
- <attribute name="title">
- <string>Tab 2</string>
- </attribute>
- </widget>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QTabWidget" name="tabWidget_5">
- <property name="tabPosition">
- <enum>QTabWidget::East</enum>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>1</number>
- </property>
- <widget class="QWidget" name="tab_15">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- </widget>
- <widget class="QWidget" name="tab_16">
- <attribute name="icon">
- <iconset>
- <normalon>:/images/images/icon-m-save.svg</normalon>
- </iconset>
- </attribute>
- <attribute name="title">
- <string>Tab 2</string>
- </attribute>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_17">
- <attribute name="title">
- <string>ProgressBar</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_11">
- <item>
- <widget class="QGroupBox" name="groupBox_9">
- <property name="title">
- <string>ProgressBar</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_10">
- <item>
- <widget class="QProgressBar" name="progressBar">
- <property name="value">
- <number>24</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="horizontalSlider_3">
- <property name="minimum">
- <number>0</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="value">
- <number>24</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_8">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>177</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer_6">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0">
- <widget class="QGroupBox" name="groupBox_8">
- <property name="title">
- <string>GroupBox</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <widget class="QPushButton" name="pushButton_8">
- <property name="text">
- <string>PushButton</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer_6">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0">
- <widget class="QGroupBox" name="groupBox_8">
- <property name="title">
- <string>GroupBox</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <widget class="QPushButton" name="pushButton_8">
- <property name="text">
- <string>PushButton</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>584</width>
- <height>20</height>
- </rect>
- </property>
- <widget class="QMenu" name="menuFile">
- <property name="title">
- <string>File</string>
- </property>
- <addaction name="actionNew"/>
- <addaction name="actionOpen"/>
- <addaction name="separator"/>
- <addaction name="actionQuit"/>
- </widget>
- <widget class="QMenu" name="menuEdit">
- <property name="title">
- <string>Edit</string>
- </property>
- <widget class="QMenu" name="menuSettings">
- <property name="title">
- <string>Settings</string>
- </property>
- <addaction name="actionSetting_1"/>
- <addaction name="actionSetting_2"/>
- <addaction name="actionSetting_3"/>
- </widget>
- <addaction name="actionCut"/>
- <addaction name="actionCopy"/>
- <addaction name="actionPaste"/>
- <addaction name="menuSettings"/>
- </widget>
- <widget class="QMenu" name="menuAction">
- <property name="title">
- <string>Action</string>
- </property>
- </widget>
- <addaction name="menuFile"/>
- <addaction name="menuEdit"/>
- <addaction name="menuAction"/>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- <widget class="QToolBar" name="toolBar">
- <property name="windowTitle">
- <string>toolBar</string>
- </property>
- <attribute name="toolBarArea">
- <enum>LeftToolBarArea</enum>
- </attribute>
- <attribute name="toolBarBreak">
- <bool>false</bool>
- </attribute>
- <addaction name="actionOrder"/>
- <addaction name="actionOpen"/>
- <addaction name="actionAction_1"/>
- <addaction name="actionAction_2"/>
- <addaction name="actionAction_3"/>
- <addaction name="actionAction_4"/>
- </widget>
- <action name="actionNew">
- <property name="text">
- <string>New</string>
- </property>
- </action>
- <action name="actionQuit">
- <property name="text">
- <string>Quit</string>
- </property>
- </action>
- <action name="actionOpen">
- <property name="icon">
- <iconset resource="res.qrc">
- <normaloff>:/images/images/icon-m-save.svg</normaloff>:/images/images/icon-m-save.svg</iconset>
- </property>
- <property name="text">
- <string>Open...</string>
- </property>
- </action>
- <action name="actionOrder">
- <property name="icon">
- <iconset resource="res.qrc">
- <normaloff>:/images/images/icon-m-message-send-receive.svg</normaloff>:/images/images/icon-m-message-send-receive.svg</iconset>
- </property>
- <property name="text">
- <string>order</string>
- </property>
- </action>
- <action name="actionAction_1">
- <property name="text">
- <string>Action 1</string>
- </property>
- </action>
- <action name="actionAction_2">
- <property name="text">
- <string>Action 2</string>
- </property>
- </action>
- <action name="actionAction_3">
- <property name="text">
- <string>Action 3</string>
- </property>
- </action>
- <action name="actionAction_4">
- <property name="text">
- <string>Action 4</string>
- </property>
- </action>
- <action name="actionCut">
- <property name="text">
- <string>Cut</string>
- </property>
- </action>
- <action name="actionCopy">
- <property name="text">
- <string>Copy</string>
- </property>
- </action>
- <action name="actionPaste">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Paste</string>
- </property>
- </action>
- <action name="actionSetting_1">
- <property name="text">
- <string>Setting 1</string>
- </property>
- </action>
- <action name="actionSetting_2">
- <property name="text">
- <string>Setting 2</string>
- </property>
- </action>
- <action name="actionSetting_3">
- <property name="text">
- <string>Setting 3</string>
- </property>
- </action>
- </widget>
- <resources>
- <include location="res.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>horizontalSlider_3</sender>
- <signal>valueChanged(int)</signal>
- <receiver>progressBar</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>164</x>
- <y>114</y>
- </hint>
- <hint type="destinationlabel">
- <x>164</x>
- <y>87</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>horizontalSlider</sender>
- <signal>valueChanged(int)</signal>
- <receiver>horizontalSlider_2</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>93</x>
- <y>66</y>
- </hint>
- <hint type="destinationlabel">
- <x>364</x>
- <y>68</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>horizontalSlider_2</sender>
- <signal>valueChanged(int)</signal>
- <receiver>horizontalSlider</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>375</x>
- <y>69</y>
- </hint>
- <hint type="destinationlabel">
- <x>258</x>
- <y>73</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>verticalSlider</sender>
- <signal>valueChanged(int)</signal>
- <receiver>verticalSlider_2</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>93</x>
- <y>116</y>
- </hint>
- <hint type="destinationlabel">
- <x>351</x>
- <y>122</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>verticalSlider_2</sender>
- <signal>valueChanged(int)</signal>
- <receiver>verticalSlider</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>338</x>
- <y>171</y>
- </hint>
- <hint type="destinationlabel">
- <x>89</x>
- <y>162</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>toolButton</sender>
- <signal>clicked(bool)</signal>
- <receiver>toolButton_4</receiver>
- <slot>setChecked(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>508</x>
- <y>92</y>
- </hint>
- <hint type="destinationlabel">
- <x>514</x>
- <y>119</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>toolButton</sender>
- <signal>clicked()</signal>
- <receiver>toolButton_3</receiver>
- <slot>toggle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>443</x>
- <y>96</y>
- </hint>
- <hint type="destinationlabel">
- <x>459</x>
- <y>198</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/demos/qtstyleexample/qtstyleexample-windows-style.desktop b/demos/qtstyleexample/qtstyleexample-windows-style.desktop
deleted file mode 100644
index fb219ad3..00000000
--- a/demos/qtstyleexample/qtstyleexample-windows-style.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=QtStyle Example (Windows style)
-Icon=icon-l-video
-Exec=qtstyleexample -style windows
-X-Maemo-Service=com.nokia.qtstyleexample
-OnlyShowIn=X-MeeGo;
diff --git a/demos/qtstyleexample/qtstyleexample.desktop b/demos/qtstyleexample/qtstyleexample.desktop
deleted file mode 100644
index cd173123..00000000
--- a/demos/qtstyleexample/qtstyleexample.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=QtStyle Example
-Icon=icon-l-video
-Exec=qtstyleexample -style iqs
-X-Maemo-Service=com.nokia.qtstyleexample
-OnlyShowIn=X-MeeGo;
diff --git a/demos/qtstyleexample/qtstyleexample.pro b/demos/qtstyleexample/qtstyleexample.pro
deleted file mode 100644
index 2dae8f2a..00000000
--- a/demos/qtstyleexample/qtstyleexample.pro
+++ /dev/null
@@ -1,55 +0,0 @@
-MROOT = ../..
-include($$MROOT/mkspecs/common.pri)
-TEMPLATE = app
-TARGET = qtstyleexample
-target.path = $$M_INSTALL_BIN
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp \
- mainwindow.cpp
-HEADERS += mainwindow.h
-FORMS += mainwindow.ui
-
-# UI style definition
-style_sheet.path = $$M_THEME_DIR/../qtstyleexample/themes/style
-style_sheet.files = style/qtstyleexample.css
-view_configuration.path = $$M_THEME_DIR/../qtstyleexample/themes
-view_configuration.files = style/qtstyleexample.conf
-style_images.path = $$M_THEME_DIR/../qtstyleexample/themes/images
-style_images.files = images/*.png \
- images/*.jpg
-style_svg.path = $$M_THEME_DIR/../qtstyleexample/themes/svg
-style_svg.files = images/*.svg
-
-desktop_entry.path = $$M_INSTALL_DATA/applications
-desktop_entry.files = \
- qtstyleexample.desktop \
- qtstyleexample-windows-style.desktop
-
-myname = com.nokia.qtstyleexample
-
-services.CONFIG += no_check_exist
-services.target = $${myname}.service
-services.commands = cat $$IN_PWD/$${myname}.service.in \
- | sed -e "s:@M_INSTALL_BIN@:$${M_INSTALL_BIN}:g" \
- > $${myname}.service
-services.files = $$OUT_PWD/$${myname}.service
-services.path = $$M_DBUS_SERVICES_DIR
-
-
-DEFINES += IMAGES_DIR=\"\\\"$$style_images.path/\\\"\"
-
-# Install instructions
-INSTALLS += target \
- style_sheet \
- style_images \
- style_svg \
- desktop_entry
-
-!win32:!macx {
- INSTALLS += services
-}
-
-RESOURCES += res.qrc
diff --git a/demos/qtstyleexample/res.qrc b/demos/qtstyleexample/res.qrc
deleted file mode 100644
index 467d23bb..00000000
--- a/demos/qtstyleexample/res.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/images">
- <file>images/icon-m-message-send-receive.svg</file>
- <file>images/icon-m-save.svg</file>
- </qresource>
-</RCC>
diff --git a/demos/qtstyleexample/style/qtstyleexample.conf b/demos/qtstyleexample/style/qtstyleexample.conf
deleted file mode 100644
index e69de29b..00000000
--- a/demos/qtstyleexample/style/qtstyleexample.conf
+++ /dev/null
diff --git a/demos/qtstyleexample/style/qtstyleexample.css b/demos/qtstyleexample/style/qtstyleexample.css
deleted file mode 100644
index e69de29b..00000000
--- a/demos/qtstyleexample/style/qtstyleexample.css
+++ /dev/null
diff --git a/demos/qtstylekinetic/.gitignore b/demos/qtstylekinetic/.gitignore
deleted file mode 100644
index 2d032aee..00000000
--- a/demos/qtstylekinetic/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-ui_mainwindow.h
-com.nokia.qtstylekinetic.service
-qtstylekinetic
diff --git a/demos/qtstylekinetic/com.nokia.qtstylekinetic.service.in b/demos/qtstylekinetic/com.nokia.qtstylekinetic.service.in
deleted file mode 100644
index d363f3dc..00000000
--- a/demos/qtstylekinetic/com.nokia.qtstylekinetic.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=com.nokia.qtstylekinetic
-Exec=@M_INSTALL_BIN@/qtstylekinetic
diff --git a/demos/qtstylekinetic/main.cpp b/demos/qtstylekinetic/main.cpp
deleted file mode 100644
index cef840be..00000000
--- a/demos/qtstylekinetic/main.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-
-#include "mainwindow.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- MainWindow mw;
- mw.show();
-
- return app.exec();
-}
-
diff --git a/demos/qtstylekinetic/mainwindow.cpp b/demos/qtstylekinetic/mainwindow.cpp
deleted file mode 100644
index 5fb89efa..00000000
--- a/demos/qtstylekinetic/mainwindow.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-
-#include <QPushButton>
-#include <QTableWidgetItem>
-#include <QDebug>
-
-MainWindow::MainWindow() : QMainWindow(NULL)
-{
- setupUi(this);
-
- QWidget* w = new QWidget();
- w->setLayout(new QVBoxLayout);
- for(int i = 0; i < 100; ++i)
- w->layout()->addWidget(new QPushButton(QString("Button %1").arg(i)));
- scrollArea->setWidget(w);
-
- for(int i = 0; i < 100; ++i)
- new QListWidgetItem(QString("Item %1").arg(i), listWidget);
-
- for(int row = 0; row < 100; ++row)
- for(int col = 0; col < 100; ++col) {
- QTableWidgetItem* item = new QTableWidgetItem(QString("%1").arg(row*col));
- tableWidget->setItem(row, col, item);
- }
-}
-
-MainWindow::~MainWindow()
-{
-
-}
diff --git a/demos/qtstylekinetic/mainwindow.h b/demos/qtstylekinetic/mainwindow.h
deleted file mode 100644
index eb47af7b..00000000
--- a/demos/qtstylekinetic/mainwindow.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-#include "ui_mainwindow.h"
-
-class MainWindow : public QMainWindow, Ui::MainWindow
-{
- Q_OBJECT
-public:
- MainWindow();
- ~MainWindow();
-};
-
-#endif
diff --git a/demos/qtstylekinetic/mainwindow.ui b/demos/qtstylekinetic/mainwindow.ui
deleted file mode 100644
index 7ee198ad..00000000
--- a/demos/qtstylekinetic/mainwindow.ui
+++ /dev/null
@@ -1,334 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>527</width>
- <height>427</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Qt Style Kinetic Test</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>ScrollArea</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>495</width>
- <height>353</height>
- </rect>
- </property>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2">
- <attribute name="title">
- <string>ListView</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QListWidget" name="listWidget"/>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_3">
- <attribute name="title">
- <string>TableView</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QTableWidget" name="tableWidget">
- <property name="rowCount">
- <number>100</number>
- </property>
- <property name="columnCount">
- <number>100</number>
- </property>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <row/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- <column/>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- <action name="actionNew">
- <property name="text">
- <string>New</string>
- </property>
- </action>
- <action name="actionQuit">
- <property name="text">
- <string>Quit</string>
- </property>
- </action>
- <action name="actionOpen">
- <property name="icon">
- <iconset>
- <normaloff>:/images/images/icon-m-save.svg</normaloff>:/images/images/icon-m-save.svg</iconset>
- </property>
- <property name="text">
- <string>Open...</string>
- </property>
- </action>
- <action name="actionOrder">
- <property name="icon">
- <iconset>
- <normaloff>:/images/images/icon-m-message-send-receive.svg</normaloff>:/images/images/icon-m-message-send-receive.svg</iconset>
- </property>
- <property name="text">
- <string>order</string>
- </property>
- </action>
- <action name="actionAction_1">
- <property name="text">
- <string>Action 1</string>
- </property>
- </action>
- <action name="actionAction_2">
- <property name="text">
- <string>Action 2</string>
- </property>
- </action>
- <action name="actionAction_3">
- <property name="text">
- <string>Action 3</string>
- </property>
- </action>
- <action name="actionAction_4">
- <property name="text">
- <string>Action 4</string>
- </property>
- </action>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/demos/qtstylekinetic/qtstylekinetic.pro b/demos/qtstylekinetic/qtstylekinetic.pro
deleted file mode 100644
index a12b6049..00000000
--- a/demos/qtstylekinetic/qtstylekinetic.pro
+++ /dev/null
@@ -1,54 +0,0 @@
-MROOT = ../..
-include($$MROOT/mkspecs/common.pri)
-TEMPLATE = app
-TARGET = qtstylekinetic
-target.path = $$M_INSTALL_BIN
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp \
- mainwindow.cpp
-HEADERS += mainwindow.h
-FORMS += mainwindow.ui
-
-# UI style definition
-style_sheet.path = $$M_THEME_DIR/../qtstylekinetic/themes/style
-style_sheet.files = style/qtstylekinetic.css
-view_configuration.path = $$M_THEME_DIR/../qtstylekinetic/themes
-view_configuration.files = style/qtstylekinetic.conf
-style_images.path = $$M_THEME_DIR/../qtstylekinetic/themes/images
-style_images.files = images/*.png \
- images/*.jpg
-style_svg.path = $$M_THEME_DIR/../qtstylekinetic/themes/svg
-style_svg.files = images/*.svg
-
-desktop_entry.path = $$M_INSTALL_DATA/applications
-desktop_entry.files = \
- qtstylekinetic.desktop \
- qtstylekinetic-windows-style.desktop
-
-myname = com.nokia.qtstylekinetic
-
-services.CONFIG += no_check_exist
-services.target = $${myname}.service
-services.commands = cat $$IN_PWD/$${myname}.service.in \
- | sed -e "s:@M_INSTALL_BIN@:$${M_INSTALL_BIN}:g" \
- > $${myname}.service
-services.files = $$OUT_PWD/$${myname}.service
-services.path = $$M_DBUS_SERVICES_DIR
-
-
-DEFINES += IMAGES_DIR=\"\\\"$$style_images.path/\\\"\"
-
-# Install instructions
-INSTALLS += target \
- style_sheet \
- style_images \
- style_svg \
- desktop_entry \
-
-!win32:!macx {
- INSTALLS += services
-}
-
diff --git a/demos/qtstyleorientation/.gitignore b/demos/qtstyleorientation/.gitignore
deleted file mode 100644
index 97968259..00000000
--- a/demos/qtstyleorientation/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-qtstyleorientation
-qrc_res.cpp
-com.nokia.qtstyleorientation.service
diff --git a/demos/qtstyleorientation/com.nokia.qtstyleorientation.service.in b/demos/qtstyleorientation/com.nokia.qtstyleorientation.service.in
deleted file mode 100644
index 527b7b74..00000000
--- a/demos/qtstyleorientation/com.nokia.qtstyleorientation.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=com.nokia.qtstyleorientation
-Exec=@M_INSTALL_BIN@/qtstyleorientation
diff --git a/demos/qtstyleorientation/main.cpp b/demos/qtstyleorientation/main.cpp
deleted file mode 100644
index 7b5deb98..00000000
--- a/demos/qtstyleorientation/main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QDebug>
-#include <QStyle>
-
-#include "mainwindow.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- qCritical() << app.arguments();
- bool enabled = QMetaObject::invokeMethod(app.style(), "setOrientationChangeEnabled", Q_ARG(bool, true));
- qCritical() << "Orientation change enabled:" << enabled;
-
- MainWindow mw;
- mw.show();
-
- return app.exec();
-}
-
diff --git a/demos/qtstyleorientation/mainwindow.cpp b/demos/qtstyleorientation/mainwindow.cpp
deleted file mode 100644
index 62b5f8e7..00000000
--- a/demos/qtstyleorientation/mainwindow.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-
-#include <QMenu>
-#include <QFileDialog>
-#include <QDebug>
-#include <QStyle>
-
-MainWindow::MainWindow() : QLabel(NULL)
-{
- setWindowTitle("Orientation Change Demo");
-
- if(!connect(style(), SIGNAL(orientationChanged(int)), this, SLOT(rotateImage(int))))
- qCritical() << "Could not connect to orientationChanged signal of the Qt Meegotouch style. Maybe you are not running with the Maemo6 style?";
- m_landscapeImage.load(":/images/meegotouch-wallpaper-landscape.jpg");
- m_portraitImage.load(":/images/meegotouch-wallpaper-portrait.jpg");
-
- int orientation = 0;
- QMetaObject::invokeMethod(style(), "orientation", Q_RETURN_ARG(int, orientation));
- rotateImage(orientation);
-}
-
-MainWindow::~MainWindow()
-{
-
-}
-
-void MainWindow::rotateImage(int orientationAngle) {
- QTransform t;
- t.rotate(orientationAngle);
-
- QPixmap pixmap;
-
- switch(orientationAngle) {
- case 0:
- setAlignment(Qt::AlignTop);
- pixmap = m_landscapeImage;
- break;
- case 90:
- setAlignment(Qt::AlignRight);
- pixmap = m_portraitImage;
- break;
- case 180:
- setAlignment(Qt::AlignBottom);
- pixmap = m_landscapeImage;
- break;
- case 270:
- setAlignment(Qt::AlignLeft);
- pixmap = m_portraitImage;
- break;
- }
-
- setPixmap(pixmap.transformed(t));
-}
diff --git a/demos/qtstyleorientation/mainwindow.h b/demos/qtstyleorientation/mainwindow.h
deleted file mode 100644
index a38927d4..00000000
--- a/demos/qtstyleorientation/mainwindow.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QLabel>
-#include <QPixmap>
-
-class MainWindow : public QLabel
-{
- Q_OBJECT
-public:
- MainWindow();
- ~MainWindow();
-protected slots:
- void rotateImage(int);
-protected:
- QPixmap m_landscapeImage;
- QPixmap m_portraitImage;
-};
-
-#endif
diff --git a/demos/qtstyleorientation/meegotouch-wallpaper-landscape.jpg b/demos/qtstyleorientation/meegotouch-wallpaper-landscape.jpg
deleted file mode 100644
index e1cbce32..00000000
--- a/demos/qtstyleorientation/meegotouch-wallpaper-landscape.jpg
+++ /dev/null
Binary files differ
diff --git a/demos/qtstyleorientation/meegotouch-wallpaper-portrait.jpg b/demos/qtstyleorientation/meegotouch-wallpaper-portrait.jpg
deleted file mode 100644
index ee8526e4..00000000
--- a/demos/qtstyleorientation/meegotouch-wallpaper-portrait.jpg
+++ /dev/null
Binary files differ
diff --git a/demos/qtstyleorientation/qtstyleorientation.desktop b/demos/qtstyleorientation/qtstyleorientation.desktop
deleted file mode 100644
index 242b7aa3..00000000
--- a/demos/qtstyleorientation/qtstyleorientation.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=QtStyle Orientation
-Icon=icon-l-video
-Exec=qtstyleorientation
-X-Maemo-Service=com.nokia.qtstyleorientation
-OnlyShowIn=X-MeeGo;
diff --git a/demos/qtstyleorientation/qtstyleorientation.pro b/demos/qtstyleorientation/qtstyleorientation.pro
deleted file mode 100644
index e9b04906..00000000
--- a/demos/qtstyleorientation/qtstyleorientation.pro
+++ /dev/null
@@ -1,39 +0,0 @@
-MROOT = ../..
-include($$MROOT/mkspecs/common.pri)
-TEMPLATE = app
-TARGET = qtstyleorientation
-target.path = $$M_INSTALL_BIN
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp \
- mainwindow.cpp
-HEADERS += mainwindow.h
-
-desktop_entry.path = $$M_INSTALL_DATA/applications
-desktop_entry.files = \
- qtstyleorientation.desktop
-
-myname = com.nokia.qtstyleorientation
-
-services.CONFIG += no_check_exist
-services.target = $${myname}.service
-services.commands = cat $$IN_PWD/$${myname}.service.in \
- | sed -e "s:@M_INSTALL_BIN@:$${M_INSTALL_BIN}:g" \
- > $${myname}.service
-services.files = $$OUT_PWD/$${myname}.service
-services.path = $$M_DBUS_SERVICES_DIR
-
-
-DEFINES += IMAGES_DIR=\"\\\"$$style_images.path/\\\"\"
-
-# Install instructions
-INSTALLS += target \
- desktop_entry
-
-!win32:!macx {
- INSTALLS += services
-}
-
-RESOURCES += res.qrc
diff --git a/demos/qtstyleorientation/res.qrc b/demos/qtstyleorientation/res.qrc
deleted file mode 100644
index 47ca0c1b..00000000
--- a/demos/qtstyleorientation/res.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/images">
- <file>meegotouch-wallpaper-landscape.jpg</file>
- <file>meegotouch-wallpaper-portrait.jpg</file>
- </qresource>
-</RCC>
diff --git a/libmeegotouch.spec b/libmeegotouch.spec
index 9dd536fe..0a5e7b89 100644
--- a/libmeegotouch.spec
+++ b/libmeegotouch.spec
@@ -63,7 +63,6 @@ Requires: libmeegotouchextensions0 >= %{version}
Requires: libmeegotouchsettings0 >= %{version}
Requires: libmeegotouchviews0 >= %{version}
Requires: libmeegotouch-bin >= %{version}
-Requires: meegotouch-qt-style >= %{version}
#
@@ -114,14 +113,6 @@ Requires: libmeegotouchviews0 >= %{version}
Meego Touch framework binary files
-%package -n meegotouch-qt-style
-Summary: Meego Touch plain Qt style
-Requires: libmeegotouchcore0 >= %{version}
-Requires: libmeegotouchviews0 >= %{version}
-%description -n meegotouch-qt-style
-Meego Touch Qt style for applications that do not link against libmeegotouch
-
-
#
# Development subpackages
#
@@ -135,7 +126,6 @@ Requires: libmeegotouchcore0 >= %{version}
Requires: libmeegotouchextensions0 >= %{version}
Requires: libmeegotouchsettings0 >= %{version}
Requires: libmeegotouchviews0 >= %{version}
-Requires: meegotouch-qt-style >= %{version}
%description -n libmeegotouch-devel
Development files for Meego Touch
@@ -162,7 +152,6 @@ Meego Touch API documentation
%package -n meegotouch-demos
Summary: Meego Touch demo applications
Requires: meegotouch-demos-widgetsgallery
-Requires: meegotouch-demos-qt-style
Requires: meegotouch-demos-animatedlayout
%description -n meegotouch-demos
Collection of demo applications for Meego Touch
@@ -182,15 +171,6 @@ Requires: meegotouch-demos-widgetsgallery
Meego Touch demo application tests
-%package -n meegotouch-demos-qt-style
-Summary: Meego Touch plain Qt applications demos
-Requires: meegotouch-qt-style
-%description -n meegotouch-demos-qt-style
-Demo applications that show how plain Qt applications
-(applications that do not link against libmeegotouch) are supported
-in the Meego Touch framework
-
-
%package -n meegotouch-demos-animatedlayout
Summary: Meego Touch animated layout demo
Requires: meegotouch-demos-animatedlayout-l10n
@@ -403,7 +383,7 @@ Meego Touch animated layout Japanese translations
%build
export PATH=$PATH:%{_libdir}/qt4/bin
unset LD_AS_NEEDED
-./configure -prefix /usr -release -plainqt -tests -benchmarks
+./configure -prefix /usr -release -tests -benchmarks
make %{?_smp_mflags}
@@ -517,11 +497,6 @@ fi
%{_libdir}/libmeegotouchviews.so.0*
-%files -n meegotouch-qt-style
-%defattr(-,root,root)
-%{_libdir}/qt4/plugins/styles/libmeegotouchqtstyleplugin.so
-
-
%files -n libmeegotouch-bin
%defattr(-,root,root)
%dir %{_libdir}/meegotouch
@@ -580,16 +555,6 @@ fi
%{_libdir}/libmeegotouch-benchmarks/*
-%files -n meegotouch-demos-qt-style
-%defattr(-,root,root)
-%dir /usr/share/qtstyleexample
-%dir /usr/share/qtstyleexample/themes
-/usr/bin/qtstyle*
-/usr/share/applications/qtstyle*
-/usr/share/dbus-1/services/com.nokia.qtstyle*
-/usr/share/qtstyleexample/themes/*
-
-
%files -n meegotouch-demos-animatedlayout
%defattr(-,root,root)
%dir /usr/share/animatedlayout
diff --git a/mkspecs/features/meegotouch_translations.prf b/mkspecs/features/meegotouch_translations.prf
index 72b4cb80..560f9188 100644
--- a/mkspecs/features/meegotouch_translations.prf
+++ b/mkspecs/features/meegotouch_translations.prf
@@ -43,8 +43,7 @@
# widgetsgallery/translations \
# animatedlayout \
# animatedlayout/translations \
-# launcher \
-# qtstyleexample
+# launcher
#
# get around lack of sleep on Windows:
diff --git a/plainqt/icons/Icon-back.png b/plainqt/icons/Icon-back.png
deleted file mode 100644
index 61930d1e..00000000
--- a/plainqt/icons/Icon-back.png
+++ /dev/null
Binary files differ
diff --git a/plainqt/icons/Icon-close.png b/plainqt/icons/Icon-close.png
deleted file mode 100644
index d80badae..00000000
--- a/plainqt/icons/Icon-close.png
+++ /dev/null
Binary files differ
diff --git a/plainqt/icons/Icon-home.png b/plainqt/icons/Icon-home.png
deleted file mode 100644
index 66b647d7..00000000
--- a/plainqt/icons/Icon-home.png
+++ /dev/null
Binary files differ
diff --git a/plainqt/plainqt.pro b/plainqt/plainqt.pro
deleted file mode 100644
index 9d312b7b..00000000
--- a/plainqt/plainqt.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = style
-
-QMAKE_EXTRA_TARGETS += check
-check.commands = $$system(true)
-
-QMAKE_EXTRA_TARGETS += check-xml
-check-xml.commands = $$system(true)
diff --git a/plainqt/style/.gitignore b/plainqt/style/.gitignore
deleted file mode 100644
index c4f6bed6..00000000
--- a/plainqt/style/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-qrc_style.cpp
diff --git a/plainqt/style/bg2.png b/plainqt/style/bg2.png
deleted file mode 100644
index c4d6b9dd..00000000
--- a/plainqt/style/bg2.png
+++ /dev/null
Binary files differ
diff --git a/plainqt/style/qtmaemo6clicklabel.cpp b/plainqt/style/qtmaemo6clicklabel.cpp
deleted file mode 100644
index ddbdd27c..00000000
--- a/plainqt/style/qtmaemo6clicklabel.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <qtmaemo6clicklabel.h>
-
-#include <QPainter>
-#include <QPixmap>
-
-#include <qtmaemo6style.h>
-
-QtMaemo6ClickLabel::QtMaemo6ClickLabel(QWidget *parent)
- : QLabel(parent)
- , m_orientationAngle(M::Angle0)
-{
- setMargin(0);
- setIndent(0);
- setContentsMargins(0,0,0,0);
-}
-
-QSize QtMaemo6ClickLabel::minimumSizeHint () const {
- return getSize(QLabel::minimumSizeHint());
-}
-
-QSize QtMaemo6ClickLabel::sizeHint () const {
- return getSize(QLabel::sizeHint());
-}
-
-QSize QtMaemo6ClickLabel::getSize(const QSize origSize) const {
- if(m_orientationAngle == M::Angle0 || m_orientationAngle == M::Angle180)
- return origSize;
- else
- return QSize(origSize.height(), origSize.width());
-}
-
-void QtMaemo6ClickLabel::setOrientation(M::OrientationAngle angle) {
- m_orientationAngle = angle;
- updateGeometry();
-}
-
-void QtMaemo6ClickLabel::paintEvent(QPaintEvent *ev) {
- Q_UNUSED(ev);
-
- QPainter p(this);
- QRect bRect = rect();
-
- QTransform t;
- QPoint center = bRect.center();
- t.translate(center.x(), center.y());
- t.rotate(m_orientationAngle);
- t.translate(-center.x(), -center.y());
-
- bRect = t.mapRect(bRect);
- p.setTransform(t);
- p.fillRect(bRect, Qt::transparent);
- style()->drawItemText(&p, bRect, Qt::AlignLeft | Qt::AlignVCenter, palette(), true, text(), QPalette::Foreground);
- if(pixmap())
- style()->drawItemPixmap(&p, bRect, Qt::AlignCenter, *pixmap());
-}
-
-void QtMaemo6ClickLabel::mousePressEvent(QMouseEvent *ev) {
- Q_UNUSED(ev);
- emit clicked();
-}
diff --git a/plainqt/style/qtmaemo6clicklabel.h b/plainqt/style/qtmaemo6clicklabel.h
deleted file mode 100644
index 40cae33b..00000000
--- a/plainqt/style/qtmaemo6clicklabel.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6CLICKLABEL_H
-#define QTMAEMO6CLICKLABEL_H
-
-#include <QLabel>
-#include <mnamespace.h>
-
-
-/*!
- * this class extends QLabel to behave more like a button
- */
-class QtMaemo6ClickLabel : public QLabel
-{
- Q_OBJECT
-public:
- explicit QtMaemo6ClickLabel(QWidget *parent);
-
- virtual QSize minimumSizeHint () const;
- virtual QSize sizeHint () const;
-protected:
- /*! \reimp */
- void paintEvent(QPaintEvent *ev);
- void mousePressEvent(QMouseEvent *ev);
- /*! \reimp_end */
-private:
- QSize getSize(const QSize origSize) const;
-public Q_SLOTS:
- void setOrientation(M::OrientationAngle);
-Q_SIGNALS:
- void clicked();
-protected:
- M::OrientationAngle m_orientationAngle;
-};
-
-#endif // QTMAEMO6CLICKLABEL_H
diff --git a/plainqt/style/qtmaemo6comboboxpopup.cpp b/plainqt/style/qtmaemo6comboboxpopup.cpp
deleted file mode 100644
index dc8a5a9b..00000000
--- a/plainqt/style/qtmaemo6comboboxpopup.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6comboboxpopup.h"
-#include "qtmaemo6windowdecoration.h"
-#include "qtmaemo6style_p.h"
-
-#include <QComboBox>
-#include <QListView>
-#include <QLineEdit>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QCompleter>
-#include <QPushButton>
-
-//krazy:excludeall=qclasses
-
-QtMaemo6ComboBoxPopup::QtMaemo6ComboBoxPopup(QComboBox *comboBox, QWidget *parent)
- : QWidget(parent),
- m_comboBox(comboBox),
- m_listView(NULL),
- m_lineEdit(NULL)
-{
- setObjectName("Qt_Maemo6_ComboBox");
-
- m_listView = new QListView();
-
- if(comboBox) {
- m_listView->setModel(comboBox->model());
- // show selected item in view
- if (comboBox->currentIndex() >= 0) {
- QModelIndex selected = m_listView->model()->index(comboBox->currentIndex(), 0, QModelIndex());
- if (selected.isValid())
- m_listView->setCurrentIndex(selected);
- }
- }
-
- if(m_comboBox->isEditable()) {
- //m_lineEdit = m_comboBox->lineEdit();
- m_lineEdit = new QLineEdit();
- if(m_comboBox->completer()) {
- m_lineEdit->setCompleter(m_comboBox->completer());
- m_lineEdit->setText(m_comboBox->lineEdit()->text());
- m_comboBox->completer()->setWidget(m_comboBox);
- }
- connect(m_lineEdit, SIGNAL(returnPressed()), this, SLOT(closePopup()));
- }
-
- QVBoxLayout* vLayout = new QVBoxLayout(this);
-
- if(m_lineEdit) {
- QHBoxLayout* hLayout = new QHBoxLayout();
- hLayout->setMargin(0);
- hLayout->setSpacing(8);
- QPushButton* button = new QPushButton(qtTrId("qtn_comm_command_done"));
- hLayout->addWidget(m_lineEdit);
- hLayout->addWidget(button);
-
- vLayout->addLayout(hLayout);
-
- connect(button, SIGNAL(clicked()), this, SLOT(closePopup()));
- }
- vLayout->addWidget(m_listView);
-
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
- connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SLOT(selectItem(QModelIndex)));
-}
-
-QtMaemo6ComboBoxPopup::~QtMaemo6ComboBoxPopup()
-{
-
-}
-
-void QtMaemo6ComboBoxPopup::showEvent(QShowEvent *e) {
- Q_UNUSED(e);
- if(m_lineEdit) {
- m_lineEdit->setFocus();
- m_lineEdit->selectAll();
- }
-}
-
-void QtMaemo6ComboBoxPopup::resizeEvent(QResizeEvent *e) {
- QWidget::resizeEvent(e);
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(style()))
- s->setPaletteBackground(this);
-}
-
-void QtMaemo6ComboBoxPopup::selectItem(const QModelIndex & index)
-{
- m_comboBox->setCurrentIndex(index.row());
- close();
-}
-
-void QtMaemo6ComboBoxPopup::closePopup() {
- if(m_comboBox->completer()->completionCount() > 0)
- // If there is a valid completion use this
- m_comboBox->lineEdit()->setText( m_comboBox->completer()->currentCompletion() );
- else
- // if there's no completion
- m_comboBox->lineEdit()->setText(m_lineEdit->text());
- close();
-}
diff --git a/plainqt/style/qtmaemo6comboboxpopup.h b/plainqt/style/qtmaemo6comboboxpopup.h
deleted file mode 100644
index d476253e..00000000
--- a/plainqt/style/qtmaemo6comboboxpopup.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6COMBOBOXPOPUP_H
-#define QTMAEMO6COMBOBOXPOPUP_H
-
-#include "qtmaemo6window.h"
-
-//krazy:excludeall=qclasses
-
-#include <QWidget>
-
-class QModelIndex;
-class QListView;
-class QComboBox;
-class QLineEdit;
-
-/*!
- * This class shows replaces combo box popups
- */
-class QtMaemo6ComboBoxPopup : public QWidget
-{
- Q_OBJECT
-public:
- explicit QtMaemo6ComboBoxPopup(QComboBox *comboBox, QWidget *parent);
- virtual ~QtMaemo6ComboBoxPopup();
-protected Q_SLOTS:
- void selectItem(const QModelIndex &);
- void closePopup();
-protected:
- /*! \reimp */
- virtual void showEvent(QShowEvent *e);
- virtual void resizeEvent(QResizeEvent *);
- /*! \reimp_end */
-private:
- QComboBox* m_comboBox;
- QListView* m_listView;
- QLineEdit* m_lineEdit;
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6dialogproxy.cpp b/plainqt/style/qtmaemo6dialogproxy.cpp
deleted file mode 100644
index 1b6f8236..00000000
--- a/plainqt/style/qtmaemo6dialogproxy.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6dialogproxy.h"
-
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QWidget>
-#include <QEvent>
-#include <QApplication>
-#include <QCloseEvent>
-#include <QDialog>
-
-#include "qtmaemo6dialogtitle.h"
-#include "qtmaemo6style_p.h"
-
-QtMaemo6DialogProxy::QtMaemo6DialogProxy(QWidget *mw, QWidget *parent)
- : QtMaemo6Window(mw, parent)
-{
- setObjectName("Qt_Maemo6_DialogProxy");
- setAttribute(Qt::WA_TranslucentBackground);
-
- QPalette palette;
- palette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 192)));
- setPalette(palette);
-
- //m_dialogTitle = new QtMaemo6DialogTitle(NULL);
-
- m_dialogWidget = new QWidget(NULL);
- m_dialogWidget->setObjectName("dialog_widget");
- m_dialogTitle = new QtMaemo6DialogTitle(m_dialogWidget);
-
- QVBoxLayout* dialogLayout = new QVBoxLayout(m_dialogWidget);
- dialogLayout->setSpacing(0);
- dialogLayout->setMargin(0);
- dialogLayout->addWidget(m_dialogTitle);
- dialogLayout->addWidget(centralWidget());
-
- QSpacerItem *leftSideSpacer = new QSpacerItem(9, 0);
- QSpacerItem *rightSideSpacer = new QSpacerItem(9, 0);
- QSpacerItem *topSpacer = new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
-
- m_windowLayout->addItem(topSpacer, 0, 0, 1, 3);
- m_windowLayout->addItem(leftSideSpacer, 1, 0, 2, 1);
- m_windowLayout->addWidget(m_dialogWidget, 1, 1, 1, 1);
- //m_windowLayout->addWidget(m_dialogTitle, 1, 1, 1, 1);
- //m_windowLayout->addWidget(centralWidget(), 2, 1, 1, 1);
- m_windowLayout->addItem(rightSideSpacer, 1, 2, 2, 1);
-
- //only works if mw is a QDialog, otherwise the connect simply fails
- connect(m_dialogTitle, SIGNAL(closeRequest()), mw, SLOT(reject()));
-
- mw->installEventFilter(this);
-}
-
-QtMaemo6DialogProxy::~QtMaemo6DialogProxy()
-{
-}
-
-void QtMaemo6DialogProxy::setTitle(const QString &text)
-{
- m_dialogTitle->setTitle(text);
-}
-
-void QtMaemo6DialogProxy::setPixmap(const QPixmap &icon)
-{
- m_dialogTitle->setPixmap(icon);
-}
-
-void QtMaemo6DialogProxy::ensureWidgetVisible(QWidget* widget, QRect visibleArea) {
- if(visibleArea.isValid()) {
- //that is the real visible area of the viewport, the navigation bar is excluded here
- QRect realVisibleRect = visibleArea.intersected(
- QRect(m_dialogWidget->mapToGlobal(QPoint(0,0)), m_dialogWidget->size() ));
-
- QRect globalWidgetRect = QRect(
- widget->mapToGlobal(QPoint(0,0)),
- widget->size()
- );
-
- QPoint widgetGlobalPosition = widget->mapToGlobal(QPoint(0,0));
-
- //the widget is not fully covered by the visible Area
- if(globalWidgetRect.intersected(realVisibleRect) != globalWidgetRect) {
- QPoint originalViewportPos = m_dialogWidget->mapToGlobal(QPoint(0,0));
- m_originalWidgetPos.widget = m_dialogWidget;
- m_originalWidgetPos.position = m_dialogWidget->pos();
-
- int newYPos = realVisibleRect.top() + ((realVisibleRect.height() - widget->height()) / 2);
-
- //centered in visibleArea
- m_dialogWidget->move(m_dialogWidget->pos().x(), newYPos);
- }
- } else {
- if(m_originalWidgetPos.widget) {
- m_originalWidgetPos.widget->move(m_originalWidgetPos.position);
- m_originalWidgetPos.widget = 0;
- }
- }
-}
-
-void QtMaemo6DialogProxy::resizeEvent(QResizeEvent *) {
- if(centralWidget()) {
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(centralWidget()->style()))
- s->setPaletteBackground(centralWidget());
- }
-}
-
-void QtMaemo6DialogProxy::mousePressEvent(QMouseEvent *event)
-{
- //close dialog if some click occurs outside the dialogs window
- if(!m_dialogWidget->geometry().contains(event->pos()))
- close();
-}
-
-
-bool QtMaemo6DialogProxy::eventFilter(QObject *obj, QEvent *event) {
- //in dialog case, also close the decoration on hide event, because the
- //dialogs are only hidden, not closed by default
- if(obj == widget() && event->type() == QEvent::Hide) {
- close();
- }
-
- if(event->type() == QEvent::Resize) {
- //don't show dialog bigger than needed
- // it's a little tricky because everything is inside a scrollarea
- if(QScrollArea* scrollArea = qobject_cast<QScrollArea*>(centralWidget())) {
- int left, top, right, bottom;
- QWidget* w = scrollArea->widget();
- w->getContentsMargins(&left, &top, &right, & bottom);
- int scrollAreaContentHeight = w->height() + top + bottom;
- scrollArea->setMaximumHeight(scrollAreaContentHeight);
- }
- }
- return QtMaemo6Window::eventFilter(obj, event);
-}
diff --git a/plainqt/style/qtmaemo6dialogproxy.h b/plainqt/style/qtmaemo6dialogproxy.h
deleted file mode 100644
index 3f9120d3..00000000
--- a/plainqt/style/qtmaemo6dialogproxy.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6DIALOGPROXY_H
-#define QTMAEMO6DIALOGPROXY_H
-
-#include <QGraphicsView>
-#include <QWidget>
-#include <QScrollArea>
-#include <QPointer>
-#include "qtmaemo6window.h"
-
-class QtMaemo6DialogTitle;
-
-/*!
- * This class emulates the windowdecoration, for dialogs. It draws the the
- * titlebar and cares for the composition modes.
- */
-class QtMaemo6DialogProxy : public QtMaemo6Window
-{
- Q_OBJECT
-public:
- explicit QtMaemo6DialogProxy(QWidget *mw, QWidget *parent);
- ~QtMaemo6DialogProxy();
-
- /*!
- * sets the title of the dialog
- */
- void setTitle(const QString &text);
-
- /*!
- * sets the icon shown in the dialog's titlebar
- */
- void setPixmap(const QPixmap &icon);
-
- void ensureWidgetVisible(QWidget* widget, QRect visibleArea);
-protected:
- QtMaemo6DialogProxy() {};
- void init();
-
- /*! \reimp */
- //bool eventFilter(QObject* watched, QEvent* ev);
- //void closeEvent(QCloseEvent* event);
- virtual void resizeEvent(QResizeEvent *);
- virtual void mousePressEvent(QMouseEvent *event);
- bool eventFilter(QObject *obj, QEvent *event);
- /*! \reimp_end */
-
-private:
- QtMaemo6DialogTitle *m_dialogTitle;
-
- //this contains the visible part of the dialog (titlebar + content)
- QWidget* m_dialogWidget;
-
- struct WidgetPos {
- WidgetPos() : widget(NULL) {};
- WidgetPos(QWidget* w, QPoint p) : widget(w), position(p) {};
- WidgetPos(const WidgetPos& other) { widget = other.widget; position = other.position; }
- QWidget* widget;
- QPoint position;
- };
- WidgetPos m_originalWidgetPos;
-
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6dialogtitle.cpp b/plainqt/style/qtmaemo6dialogtitle.cpp
deleted file mode 100644
index 7d1ff63b..00000000
--- a/plainqt/style/qtmaemo6dialogtitle.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6dialogtitle.h"
-#include "qtmaemo6style_p.h"
-
-#include <QToolButton>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QStyleOption>
-#include <QPainter>
-#include <mescapebuttonpanelstyle.h>
-#include <mlabelstyle.h>
-#include <MTheme>
-
-
-QtMaemo6DialogTitle::QtMaemo6DialogTitle(QWidget *parent) : QWidget(parent)
-{
- setObjectName(QString("Qt_Maemo6_DialogTitle"));
-
- QStyleOption option;
- option.initFrom(this);
-
- const MLabelStyle *titleBarStyle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(option.state,
- "MLabelStyle", "MDialogTitleLabel"));
-
- m_titleLabel = new QLabel(this);
- if ( titleBarStyle ) {
- m_titleLabel->setFont(titleBarStyle->font());
-
- QPalette pal(palette());
- pal.setColor(foregroundRole(), titleBarStyle->color());
- setPalette(pal);
- }
-
- m_closeButton = new QtMaemo6ClickLabel(this);
- m_closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
- m_closeButton->setMargin(8);
- m_closeButton->setObjectName( QString( "Qt_Maemo6_Dialog_CloseButton" ) );
-
- //currently meegotouch uses the same close button icon for dialogs as used in navigation bar
- const MEscapeButtonPanelStyle *escapeButtonStyle =
- static_cast<const MEscapeButtonPanelStyle *>(QtMaemo6StylePrivate::mStyle(option.state,
- "MEscapeButtonPanelStyle", ""));
- if(escapeButtonStyle) {
- m_closeButton->setPixmap(*MTheme::pixmapCopy(escapeButtonStyle->closeButtonIconId()));
- }
- connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(closeRequest()));
-
- m_titleBarLayout = new QHBoxLayout(this);
- m_titleBarLayout->setMargin(0);
- m_titleBarLayout->setSpacing(0);
- m_titleBarLayout->addWidget(m_titleLabel);
- m_titleBarLayout->addWidget(m_closeButton);
-
-}
-
-QtMaemo6DialogTitle::~QtMaemo6DialogTitle()
-{
-
-}
-
-void QtMaemo6DialogTitle::resizeEvent(QResizeEvent *) {
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(style()))
- s->setPaletteBackground(this, "MDialogStyle", "MDialogTitleBar");
-}
-
-void QtMaemo6DialogTitle::setTitle(const QString &title)
-{
- m_titleLabel->setText(title);
- m_titleLabel->setAlignment(Qt::AlignHCenter);
-}
-
-QString QtMaemo6DialogTitle::title() const
-{
- return m_titleLabel->text();
-}
-
-void QtMaemo6DialogTitle::setPixmap(const QPixmap &icon)
-{
- m_closeButton->setPixmap(icon);
-}
diff --git a/plainqt/style/qtmaemo6dialogtitle.h b/plainqt/style/qtmaemo6dialogtitle.h
deleted file mode 100644
index e8115520..00000000
--- a/plainqt/style/qtmaemo6dialogtitle.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6DIALOGTITLE_H
-#define QTMAEMO6DIALOGTITLE_H
-
-#include "qtmaemo6clicklabel.h"
-#include <QHBoxLayout>
-
-
-/*!
- * This class emulates the title bar of a dialog
- */
-class QtMaemo6DialogTitle : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY(QString title READ title WRITE setTitle)
-public:
- explicit QtMaemo6DialogTitle(QWidget *parent);
- virtual ~QtMaemo6DialogTitle();
-
- /*!
- * returns the dialog's title
- */
- QString title() const;
-
-public Q_SLOTS:
- /*!
- * sets the title of the dialog
- */
- void setTitle(const QString &title);
-
- /*!
- * sets the icon shown in the title bar
- */
- void setPixmap(const QPixmap &icon);
-
-Q_SIGNALS:
- /*!
- * this signal is emitted, if the title bar's close button was clicked
- */
- void closeRequest();
-
-protected:
- /*! \reimp */
- void resizeEvent(QResizeEvent *);
- /*! \reimp_end */
-private:
- QtMaemo6ClickLabel *m_closeButton;
- QLabel *m_titleLabel;
- QHBoxLayout *m_titleBarLayout;
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6kineticscrolling.cpp b/plainqt/style/qtmaemo6kineticscrolling.cpp
deleted file mode 100644
index 8ae44a4d..00000000
--- a/plainqt/style/qtmaemo6kineticscrolling.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6kineticscrolling.h"
-
-#include <QAbstractItemView>
-#include <QScrollArea>
-#include <QApplication>
-#include <QList>
-#include <QMouseEvent>
-#include <QEvent>
-#include <QScrollBar>
-
-void QtMaemo6KineticScrolling::KineticData::setState(State state) {
- m_state = state;
-}
-
-QtMaemo6KineticScrolling::QtMaemo6KineticScrolling(QObject *parent)
- : QObject(parent),
- m_scrollStartDelay(85),
- m_scrollStartOffset(5),
- m_deaccelerationInterval(20),
- m_deaccelerationStrength(2),
- m_maxKineticScrollSpeed(64),
- m_layoutDirection(Qt::LeftToRight)
-{
-}
-
-QtMaemo6KineticScrolling::~QtMaemo6KineticScrolling()
-{
-}
-
-void QtMaemo6KineticScrolling::enableOn(QAbstractScrollArea *scrollArea)
-{
- QWidget *viewport = scrollArea->viewport();
- viewport->installEventFilter(this);
-
- scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- scrollArea->installEventFilter(this);
-
- m_kineticData.remove(viewport);
- m_kineticData[viewport] = new KineticData;
- m_kineticData[viewport]->scrollArea = scrollArea;
- m_kineticData[viewport]->setState(KineticData::Waiting);
-
- if(QAbstractItemView* itemView = qobject_cast<QAbstractItemView*>(scrollArea)) {
- //FIXME: public API usage... scrollPerItem prevents the kinetic from working
- // properly
- itemView->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
- itemView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- }
- return;
-}
-
-static QPoint scrollOffset(QAbstractScrollArea *scrollArea, bool rightToLeft)
-{
- if(rightToLeft)
- return QPoint(scrollArea->horizontalScrollBar()->maximum() - scrollArea->horizontalScrollBar()->value(),
- scrollArea->verticalScrollBar()->value());
- else
- return QPoint(scrollArea->horizontalScrollBar()->value(),
- scrollArea->verticalScrollBar()->value());
-}
-
-static int scrollRange(QScrollBar* scrollBar)
-{
- return scrollBar->maximum() - scrollBar->minimum();
-}
-
-static bool setScrollOffset(QAbstractScrollArea *scrollArea, const QPoint &p, Qt::LayoutDirection direction)
-{
- bool ret = true;
- bool hasHorizontalScrolling = scrollRange(scrollArea->horizontalScrollBar()) > 0;
- bool hasVerticalScrolling = scrollRange(scrollArea->verticalScrollBar()) > 0;
-
- bool xOffsetInRange = p.x() >= scrollArea->horizontalScrollBar()->minimum()
- && p.x() <= scrollArea->horizontalScrollBar()->maximum();
- bool yOffsetInRange = p.y() >= scrollArea->verticalScrollBar()->minimum()
- && p.y() <= scrollArea->verticalScrollBar()->maximum();
-
- if(hasHorizontalScrolling && !xOffsetInRange)
- ret = false;
- if(hasVerticalScrolling && !yOffsetInRange)
- ret = false;
-
- //...but scroll at least to the end of the scrollbar anyway
- QPoint realScroll = p;
- if(realScroll.x() < scrollArea->horizontalScrollBar()->minimum())
- realScroll.setX(scrollArea->horizontalScrollBar()->minimum());
- if(realScroll.x() > scrollArea->horizontalScrollBar()->maximum())
- realScroll.setX(scrollArea->horizontalScrollBar()->maximum());
- if(realScroll.y() < scrollArea->verticalScrollBar()->minimum())
- realScroll.setY(scrollArea->verticalScrollBar()->minimum());
- if(realScroll.y() > scrollArea->verticalScrollBar()->maximum())
- realScroll.setY(scrollArea->verticalScrollBar()->maximum());
-
- if(direction == Qt::RightToLeft)
- scrollArea->horizontalScrollBar()->setValue(scrollArea->horizontalScrollBar()->maximum() - p.x());
- else
- scrollArea->horizontalScrollBar()->setValue(p.x());
-
- scrollArea->verticalScrollBar()->setValue(p.y());
-
- return ret;
-}
-
-static QPoint deaccelerate(const QPoint &speed, int a, int max)
-{
- int x = qBound(-max, speed.x(), max);
- int y = qBound(-max, speed.y(), max);
- if(x > 0)
- x = qMax(0, x - a);
- else
- x = qMin(0, x + a);
-
- if(y > 0)
- y = qMax(0, y - a);
- else
- y = qMin(0, y + a);
-
- return QPoint(x, y);
-}
-
-bool QtMaemo6KineticScrolling::eventFilter(QObject *object, QEvent *event)
-{
- if (!object->isWidgetType())
- return false;
-
- QEvent::Type type = event->type();
- if (type != QEvent::MouseButtonPress &&
- type != QEvent::MouseButtonRelease &&
- type != QEvent::MouseMove &&
- type != QEvent::Show)
- return false;
-
- QWidget *viewport = qobject_cast<QWidget*>(object);
- //if object is not the viewport itself, search if one of the parents is the viewport
- if(!qobject_cast<QAbstractScrollArea*>(viewport->parentWidget())) {
- QWidget* parentViewPort = viewport->parentWidget();
- QAbstractScrollArea* scrollArea = NULL;
- while ( parentViewPort ) {
- if((scrollArea = qobject_cast<QAbstractScrollArea*>(parentViewPort))){
- viewport = scrollArea->viewport();
- break;
- } else
- parentViewPort = parentViewPort->parentWidget();
- }
- }
- KineticData *data = m_kineticData.value(viewport);
-
- if(viewport && data && type == QEvent::Show) {
- //we have the viewport here
- if(data) {
- installEventFilter(viewport->children());
- }
- }
-
- //skip if the event is on ignoreList
- if (!viewport || !data || data->ignored.removeAll(event))
- return false;
-
- QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event);
- if (!mouseEvent || mouseEvent->modifiers() != Qt::NoModifier)
- return false;
-
- bool consumed = false;
-
- switch (data->state()) {
- case KineticData::Waiting:
- if (mouseEvent->type() == QEvent::MouseButtonPress)
- if (mouseEvent->buttons() == Qt::LeftButton) {
- consumed = true;
- data->setState(KineticData::Pressed);
- data->pressPos = QCursor::pos();
- data->pressedWidget = qobject_cast<QWidget*>(object);
- data->offset = scrollOffset(data->scrollArea, m_layoutDirection);
- if (!m_ticker.isActive())
- m_ticker.start(m_scrollStartDelay, this);
- }
- break;
-
- case KineticData::Pressed:
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->setState(KineticData::Waiting);
-
- QMouseEvent *event1 = new QMouseEvent(QEvent::MouseButtonPress,
- data->pressedWidget->mapFromGlobal(data->pressPos),
- Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- QMouseEvent *event2 = new QMouseEvent(*mouseEvent);
-
- data->ignored << event1;
- data->ignored << event2;
- QApplication::postEvent(data->pressedWidget, event1);
- QApplication::postEvent(data->pressedWidget, event2);
- }
- if (mouseEvent->type() == QEvent::MouseMove) {
- consumed = true;
- QPoint offset = QCursor::pos() - data->pressPos;
- if(offset.manhattanLength() > m_scrollStartOffset) {
- data->setState(KineticData::Panning);
- data->dragPos = QCursor::pos();
- if(m_ticker.isActive())
- m_ticker.stop();
- }
- }
- break;
-
- case KineticData::Panning:
- if (mouseEvent->type() == QEvent::MouseMove) {
- consumed = true;
- QPoint delta = QCursor::pos() - data->pressPos;
- //it occurs, that the last move event before release is a (0,0)
- // move. In this case keep the last speed setting.
- QPoint speed = QCursor::pos() - data->dragPos;
- if(speed != QPoint(0,0))
- data->speed = speed;
- data->dragPos = QCursor::pos();
- setScrollOffset(data->scrollArea, data->offset - delta, m_layoutDirection);
- }
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->setState(KineticData::KineticScroll);
- if (!m_ticker.isActive())
- m_ticker.start(m_deaccelerationInterval, this);
- }
- break;
-
- case KineticData::KineticScroll:
- if (mouseEvent->type() == QEvent::MouseButtonPress) {
- consumed = true;
- data->setState(KineticData::Stop);
- if (!m_ticker.isActive())
- m_ticker.start(m_scrollStartDelay, this);
- }
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->setState(KineticData::Waiting);
- data->speed = QPoint(0, 0);
- }
- break;
-
- case KineticData::Stop:
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->setState(KineticData::Waiting);
- }
- if (mouseEvent->type() == QEvent::MouseMove) {
- consumed = true;
- data->setState(KineticData::Panning);
- data->dragPos = QCursor::pos();
- if (!m_ticker.isActive())
- m_ticker.start(m_deaccelerationInterval, this);
- }
- break;
-
- default:
- break;
- }
-
- return consumed;
-}
-
-void QtMaemo6KineticScrolling::timerEvent(QTimerEvent *event)
-{
- QHashIterator<QWidget*, KineticData*> item(m_kineticData);
- while (item.hasNext()) {
- item.next();
- KineticData *data = item.value();
- if( data->state() == KineticData::Pressed) {
- m_ticker.stop();
- QMouseEvent *newPressEvent = new QMouseEvent(QEvent::MouseButtonPress,
- data->pressedWidget->mapFromGlobal(data->pressPos),
- Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- data->ignored << newPressEvent;
- data->setState(KineticData::Waiting);
- QApplication::postEvent(data->pressedWidget, newPressEvent);
- }
- if (data->state() == KineticData::KineticScroll) {
- data->speed = deaccelerate(data->speed, m_deaccelerationStrength, m_maxKineticScrollSpeed);
- QPoint p = scrollOffset(data->scrollArea, m_layoutDirection);
- bool scrollOffsetSet = setScrollOffset(data->scrollArea, p - data->speed, m_layoutDirection);
-
- if(!scrollOffsetSet && data->speed.manhattanLength() > 0) {
- data->viewportOrigPos = data->scrollArea->viewport()->pos();
- data->setState(KineticData::Bounce);
- } else if(data->speed.manhattanLength() == 0) {
- data->setState(KineticData::Waiting);
- m_ticker.stop();
- }
- }
- if(data->state() == KineticData::Bounce) {
- QPoint speed = data->speed;
- //only bounce on axis that have a valid scrollrange
- if(scrollRange(data->scrollArea->horizontalScrollBar()) == 0)
- speed.setX(0);
- if(scrollRange(data->scrollArea->verticalScrollBar()) == 0)
- speed.setY(0);
- data->scrollArea->viewport()->move(data->scrollArea->viewport()->pos() + speed);
-
- //deaccelerate here by halveing the speed in each step, but care for the speed to stay bigger than 0
- int deaccelerationStrength = qMax(qAbs(data->speed.x()), qAbs(data->speed.y())) / 2;
- if( deaccelerationStrength == 0)
- deaccelerationStrength = 1;
-
- data->speed = deaccelerate(data->speed, deaccelerationStrength, m_maxKineticScrollSpeed);
- if(data->speed == QPoint(0,0)) {
- data->setState(KineticData::BounceBack);
- }
- }
- if (data->state() == KineticData::BounceBack) {
- QPoint pos = data->scrollArea->viewport()->pos();
- //bounce back to original position, this is required if e.g. headers are enabled
- pos -= data->viewportOrigPos;
- QPoint bounceStep;
-
- //limit the last bounceStep to, to bounce back to original position
- int stepX = 10;
- if(qAbs(pos.x()) - stepX < 0)
- stepX = qAbs(pos.x());
- int stepY = 10;
- if(qAbs(pos.y()) - stepY < 0)
- stepY = qAbs(pos.y());
-
- //invert the step if bouncing positions are negative
- if(pos.x() < 0)
- stepX = -stepX;
- if(pos.y() < 0)
- stepY = -stepY;
-
- bounceStep = QPoint(stepX, stepY);
-
- data->scrollArea->viewport()->move(data->scrollArea->viewport()->pos() - bounceStep);
- if(bounceStep.manhattanLength() == 0) {
- data->setState(KineticData::Waiting);
- m_ticker.stop();
- }
- }
- if (data->state() == KineticData::Stop) {
- data->setState(KineticData::Waiting);
- data->speed = QPoint(0,0);
- m_ticker.stop();
- }
- }
- QObject::timerEvent(event);
-}
-
-void QtMaemo6KineticScrolling::installEventFilter(QObjectList list) {
- foreach(QObject* obj, list) {
- QWidget* w = qobject_cast<QWidget*>(obj);
- if(w) {
- w->installEventFilter(this);
- installEventFilter(w->children());
- }
- }
-}
diff --git a/plainqt/style/qtmaemo6kineticscrolling.h b/plainqt/style/qtmaemo6kineticscrolling.h
deleted file mode 100644
index fbb08a7e..00000000
--- a/plainqt/style/qtmaemo6kineticscrolling.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6KINETICSCROLLING_H
-#define QTMAEMO6KINETICSCROLLING_H
-
-#include <QObject>
-#include <QBasicTimer>
-#include <QHash>
-#include <QPoint>
-
-class QWidget;
-class QAbstractScrollArea;
-
-class QtMaemo6KineticScrolling: public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int scrollStartDelay READ scrollStartDelay WRITE setScrollStartDelay);
- Q_PROPERTY(int scrollStartOffset READ scrollStartOffset WRITE setScrollStartOffset);
- Q_PROPERTY(int deaccelerationInterval READ deaccelerationInterval WRITE setDeaccelerationInterval);
- Q_PROPERTY(int deaccelerationStrength READ deaccelerationStrength WRITE setDeaccelerationStrength);
- Q_PROPERTY(int maxKineticScrollSpeed READ maxKineticScrollSpeed WRITE setMaxKineticScrollSpeed);
-public:
- QtMaemo6KineticScrolling(QObject *parent = 0);
- ~QtMaemo6KineticScrolling();
-
- /*!
- * Enables the kinetic scrolling on the given scrollarea.
- */
- void enableOn(QAbstractScrollArea *scrollArea);
-
- /*! \reimp */
- bool eventFilter(QObject *object, QEvent *event);
- /*! \reimp_end */
-
- /*!
- * \brief Returns the current scroll delay in milliseconds.
- * After a press event a move must been made within this time
- * before the scrolling starts. If there is no move within this time
- * the mouse press event is forwarded to the widget under the mouse.
- * Default is 50ms.
- * \see scrollStartOffset
- */
- int scrollStartDelay() const {
- return m_scrollStartDelay;
- };
-
- /*!
- * \brief Sets the scroll delay in milliseconds.
- * \see scrollStartDelay()
- */
- void setScrollStartDelay(int delay) {
- m_scrollStartDelay = delay;
- };
-
- /*!
- * \brief Rturns the current scroll offset in milliseconds.
- * After a press event a move must been made with at least this manhattan
- * length before the scrolling starts. If there is no move within this length
- * the mouse press event is forwarded to the widget under the mouse.
- * Default is 5.
- * \see scrollStartDelay()
- */
- int scrollStartOffset() const {
- return m_scrollStartOffset;
- };
-
- /*!
- * \brief Sets the scroll offset in milliseconds.
- * \see scrollStartOffset()
- */
- void setScrollStartOffset(int offset) {
- m_scrollStartDelay = offset;
- };
-
- /*!
- * \brief Returns the current interval in milliseconds the deacceleration methode is called.
- * After a press event a move must been made with at least this manhattan
- * length before the scrolling starts. If there is no move within this length
- * the mouse press event is forwarded to the widget under the mouse.
- * Default is 20ms.
- */
- int deaccelerationInterval() const {
- return m_deaccelerationInterval;
- };
-
- /*!
- * \brief Sets the deaccelaration interval in milliseconds.
- * \see deaccelerationInterval()
- */
- void setDeaccelerationInterval(int interval) {
- m_deaccelerationInterval = interval;
- };
-
- /*!
- * \brief Returns the current deaccelaration strength.
- * this is the value of speed in pixels the kinetic scrolling will be decreased
- * every deaccelaration interval.
- * Default is 1.
- */
- int deaccelerationStrength() const {
- return m_deaccelerationStrength;
- };
-
- /*!
- * \brief Sets the deaccelaration strength.
- * \see deaccelerationStrength()
- */
- void setDeaccelerationStrength(int strength) {
- m_deaccelerationStrength = strength;
- };
-
- /*!
- * \brief Returns the max value of the kinetic scrolling speed in pixels per interval.
- * Default is 64.
- */
- int maxKineticScrollSpeed() const {
- return m_maxKineticScrollSpeed;
- };
- /*!
- * \brief Sets the maximum speed of kinetic scrolling in pixels per interval.
- * \see maxKineticScrollSpeed()
- */
- void setMaxKineticScrollSpeed(int speed) {
- m_maxKineticScrollSpeed = speed;
- };
-
- /*!
- * \brief If application has direction right to left, set this.
- */
- void setRightToLeft(bool rightToLeft) {
- if(rightToLeft)
- m_layoutDirection = Qt::RightToLeft;
- else
- m_layoutDirection = Qt::LeftToRight;
- }
-
-protected:
- void timerEvent(QTimerEvent *event);
- void installEventFilter(QObjectList list);
-
-private:
- class KineticData {
- public:
- typedef enum { Waiting, Pressed, Panning, KineticScroll, Bounce, BounceBack, Stop } State;
- void setState(State state);
- State state() const { return m_state; };
- QAbstractScrollArea *scrollArea;
- QWidget* pressedWidget;
- QPoint pressPos;
- QPoint offset;
- QPoint dragPos;
- QPoint speed;
- QPoint viewportOrigPos;
- QList<QEvent*> ignored;
- protected:
- State m_state;
- };
-
- QHash<QWidget*, KineticData*> m_kineticData;
- QBasicTimer m_ticker;
-
- int m_scrollStartDelay;
- int m_scrollStartOffset;
- int m_deaccelerationInterval;
- int m_deaccelerationStrength;
- int m_maxKineticScrollSpeed;
-
- Qt::LayoutDirection m_layoutDirection;
-};
-
-#endif // QTMAEMO6KINETICSCROLLING_H
diff --git a/plainqt/style/qtmaemo6menu.cpp b/plainqt/style/qtmaemo6menu.cpp
deleted file mode 100644
index 215e5c9d..00000000
--- a/plainqt/style/qtmaemo6menu.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6menu.h"
-#include "qtmaemo6submenu.h"
-#include "qtmaemo6windowdecoration.h"
-#include "qtmaemo6style_p.h"
-
-#include <QPainter>
-#include <QStyleOption>
-#include <QGridLayout>
-#include <QToolButton>
-
-QtMaemo6Menu::QtMaemo6Menu(QMenuBar *mb, QWidget *parent) : QWidget(parent)
-{
- setObjectName("Qt_Maemo6_Menu");
-
- QGridLayout *gridLayout = new QGridLayout(this);
-
- for (int i = 0; i < mb->actions().count(); ++i) {
- QAction *action = mb->actions().at(i);
- QToolButton *button = new QToolButton();
- button->setDefaultAction(action);
- if (action->menu())
- connect(button, SIGNAL(clicked()), this, SLOT(showSubMenu()));
- else
- connect(button, SIGNAL(clicked()), this, SLOT(executeAction()));
- button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- gridLayout->addWidget(button, i / 2, i % 2);
- }
-
-}
-
-QtMaemo6Menu::~QtMaemo6Menu()
-{
-
-}
-
-void QtMaemo6Menu::showSubMenu()
-{
- if (QToolButton *button = qobject_cast<QToolButton *>(sender())) {
- if (QMenu *menu = button->defaultAction()->menu()) {
- //show menu
- QtMaemo6SubMenu *subMenu = new QtMaemo6SubMenu(menu, NULL);
- QtMaemo6WindowDecoration *decoration = new QtMaemo6WindowDecoration(subMenu, NULL);
- decoration->showFastMaximized();
- //these both must be done after the show, because the status- and
- // menubar is added on show event
- decoration->setStatusBar(NULL);
- decoration->setMenuBar(NULL);
- close();
- }
- }
-}
-
-void QtMaemo6Menu::executeAction()
-{
- if (QToolButton *button = qobject_cast<QToolButton *>(sender())) {
- button->defaultAction()->activate(QAction::Trigger);
- close();
- }
-}
-
-void QtMaemo6Menu::resizeEvent(QResizeEvent *e) {
- QWidget::resizeEvent(e);
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(style()))
- s->setPaletteBackground(this, "MApplicationMenuStyle");
-}
-
diff --git a/plainqt/style/qtmaemo6menu.h b/plainqt/style/qtmaemo6menu.h
deleted file mode 100644
index 735d8ce7..00000000
--- a/plainqt/style/qtmaemo6menu.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6MENU_H
-#define QTMAEMO6MENU_H
-
-#include <QWidget>
-#include <QMenuBar>
-
-/*!
- * This class emulates the title bar of a dialog
- */
-class QtMaemo6Menu : public QWidget
-{
- Q_OBJECT
-public:
- explicit QtMaemo6Menu(QMenuBar *mb, QWidget *parent);
- virtual ~QtMaemo6Menu();
-protected Q_SLOTS:
- void showSubMenu();
- void executeAction();
-protected:
- /*! \reimp */
- void resizeEvent(QResizeEvent *);
- /*! \reimp_end */
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6menuproxy.cpp b/plainqt/style/qtmaemo6menuproxy.cpp
deleted file mode 100644
index 9876eed2..00000000
--- a/plainqt/style/qtmaemo6menuproxy.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6menuproxy.h"
-#include "qtmaemo6menu.h"
-#include "qtmaemo6style_p.h"
-
-#include <QGridLayout>
-#include <QWidget>
-#include <QEvent>
-#include <QCloseEvent>
-#include <QStyleOption>
-#include <QPushButton>
-#include <QPaintEvent>
-#include <QPainter>
-#include <QPropertyAnimation>
-#include <QParallelAnimationGroup>
-
-#include <mapplicationmenustyle.h>
-#include <mwidgetfadeanimationstyle.h>
-#include <MDebug>
-
-/* unforunately this is required to force widgets drawing it's background, even
- if there are widget attributes are set, that suppress the drawing!
-*/
-class DrawBackgroundEventFilter : public QObject {
-protected:
- bool eventFilter(QObject* obj, QEvent* e) {
- if(QPaintEvent* pe = dynamic_cast<QPaintEvent*>(e)) {
- if(QWidget* w = qobject_cast<QWidget*>(obj)) {
- mDebug("PlainQt Style") << "EventFilter:" << w->objectName() << w->geometry() << pe->rect();
-
- Q_UNUSED(pe);
- QPainter p(w);
- p.setPen(Qt::NoPen);
- p.setBrush(w->palette().window());
- p.drawRect(pe->rect());
- }
- }
- return QObject::eventFilter(obj, e);
- };
-};
-
-QtMaemo6MenuProxy::QtMaemo6MenuProxy(QMenuBar *mb, QWidget *parent)
- : QtMaemo6Window(NULL, parent),
- m_menuBar(mb)
-{
- setObjectName("Qt_Maemo6_MenuProxy");
-
- //must be set, to activate the compositing
- setAttribute(Qt::WA_TranslucentBackground);
- QPalette palette;
- palette.setBrush(QPalette::Window, Qt::transparent);
- setPalette(palette);
-
- m_appArea = new QWidget();
- m_appArea->setObjectName("appArea");
- m_appArea->installEventFilter(new DrawBackgroundEventFilter());
-
- m_appArea->setAttribute(Qt::WA_TranslucentBackground);
- palette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 192)));
- m_appArea->setPalette(palette);
-
- QGridLayout* gridLayout = new QGridLayout(m_appArea);
- gridLayout->setMargin(0);
- gridLayout->setSpacing(0);
-
- m_menu = new QtMaemo6Menu(mb, NULL);
- m_menu->setAttribute(Qt::WA_TranslucentBackground, false);
- palette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 0)));
- m_menu->setPalette(palette);
- setCentralWidget(m_menu);
-
- QStyleOption option;
- option.initFrom(mb);
-
- const MApplicationMenuStyle *style =
- static_cast<const MApplicationMenuStyle *>(
- QtMaemo6StylePrivate::mStyle(option.state, "MApplicationMenuStyle"));
-
- QSpacerItem *topSpacer = new QSpacerItem(1, style->paddingTop());
- QSpacerItem *rightSpacer = new QSpacerItem(style->paddingRight(), 1);
- QSpacerItem *bottomSpacer = new QSpacerItem(1, style->paddingBottom());
- QSpacerItem *leftSpacer = new QSpacerItem(style->paddingLeft(), 1);
-
- gridLayout->addItem(leftSpacer, 0, 0, 1, 1);
- gridLayout->addWidget(centralWidget(), 0, 1, 1, 1);
- gridLayout->addItem(rightSpacer, 0, 2, 1, 1);
- gridLayout->addItem(bottomSpacer, 1, 0, 1, 3);
-
- m_windowLayout->addItem(topSpacer, 0, 0, 1, 1);
- m_windowLayout->addWidget(m_appArea, 1, 0, 1, 1);
-}
-
-QtMaemo6MenuProxy::~QtMaemo6MenuProxy()
-{
- //delete manually, because it is removed from the scroll area bevore deleting
- delete m_menu;
-}
-
-void QtMaemo6MenuProxy::resizeEvent(QResizeEvent *) {
- if(widget()) {
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(widget()->style())) {
- QStyleOption option;
- option.initFrom(widget());
-
- const MApplicationMenuStyle *style =
- static_cast<const MApplicationMenuStyle *>(
- QtMaemo6StylePrivate::mStyle(option.state, "MApplicationMenuStyle"));
- // draw widget background
- s->setPaletteBackground(widget(), style->canvasImage());
- }
- }
-}
-
-void QtMaemo6MenuProxy::mousePressEvent(QMouseEvent *event)
-{
- hideWindow(); //this also closes the window, after hide animation is done.
- Q_UNUSED(event);
-}
-
-void QtMaemo6MenuProxy::showEvent(QShowEvent *event) {
- Q_UNUSED(event);
-
- const MWidgetFadeAnimationStyle *fadeInStyle =
- static_cast<const MWidgetFadeAnimationStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MWidgetFadeAnimationStyle", "In"));
-
- layout()->activate();
- QRect finalGeometry = QRect(m_menu->geometry().topLeft(), m_menu->sizeHint());
- mDebug("PlainQt Style") << m_menu->geometry();
- QRect startGeometry = finalGeometry;
- startGeometry.moveTo(finalGeometry.x(), finalGeometry.y() - finalGeometry.height());
- m_menu->setGeometry(startGeometry);
-
- QParallelAnimationGroup* animationGroup = new QParallelAnimationGroup();
- QPropertyAnimation *widgetFadeIn = new QPropertyAnimation(animationGroup);
- widgetFadeIn->setTargetObject(m_menu);
- widgetFadeIn->setPropertyName("geometry");
- widgetFadeIn->setDuration(fadeInStyle->duration());
- widgetFadeIn->setEasingCurve(fadeInStyle->easingCurve());
- widgetFadeIn->setStartValue(startGeometry);
- widgetFadeIn->setEndValue(finalGeometry);
-
- QPalette finalPalette = m_appArea->palette();
- QPalette startPalette = finalPalette;
- startPalette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 0)));
-
- QPropertyAnimation *backgroundFadeIn = new QPropertyAnimation(animationGroup);
- backgroundFadeIn->setTargetObject(m_appArea);
- backgroundFadeIn->setPropertyName("palette");
- backgroundFadeIn->setDuration(fadeInStyle->duration());
- backgroundFadeIn->setEasingCurve(fadeInStyle->easingCurve());
- backgroundFadeIn->setStartValue(startPalette);
- backgroundFadeIn->setEndValue(finalPalette);
-
- animationGroup->start(QAbstractAnimation::DeleteWhenStopped);
-
- QtMaemo6Window::showEvent(event);
-}
-
-void QtMaemo6MenuProxy::hideWindow() {
- const MWidgetFadeAnimationStyle *fadeOutStyle =
- static_cast<const MWidgetFadeAnimationStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MWidgetFadeAnimationStyle", "Out"));
-
- QRect startGeometry = m_menu->geometry();
- QRect finalGeometry = startGeometry;
- finalGeometry.moveTo(finalGeometry.x(), finalGeometry.y() - finalGeometry.height());
-
- QParallelAnimationGroup* animationGroup = new QParallelAnimationGroup();
- QPropertyAnimation *widgetFadeOut = new QPropertyAnimation(animationGroup);
- widgetFadeOut->setTargetObject(m_menu);
- widgetFadeOut->setPropertyName("geometry");
- widgetFadeOut->setDuration(fadeOutStyle->duration());
- widgetFadeOut->setEasingCurve(fadeOutStyle->easingCurve());
- widgetFadeOut->setStartValue(startGeometry);
- widgetFadeOut->setEndValue(finalGeometry);
-
- QPalette startPalette = m_appArea->palette();
- QPalette finalPalette = startPalette;
- startPalette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 0)));
-
- QPropertyAnimation *backgroundFadeOut = new QPropertyAnimation(animationGroup);
- backgroundFadeOut->setTargetObject(m_appArea);
- backgroundFadeOut->setPropertyName("palette");
- backgroundFadeOut->setDuration(fadeOutStyle->duration());
- backgroundFadeOut->setEasingCurve(fadeOutStyle->easingCurve());
- backgroundFadeOut->setStartValue(startPalette);
- backgroundFadeOut->setEndValue(finalPalette);
-
- connect(animationGroup, SIGNAL(finished()), this, SLOT(close()));
- animationGroup->start(QAbstractAnimation::DeleteWhenStopped);
-}
diff --git a/plainqt/style/qtmaemo6menuproxy.h b/plainqt/style/qtmaemo6menuproxy.h
deleted file mode 100644
index 24858992..00000000
--- a/plainqt/style/qtmaemo6menuproxy.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6MENUPROXY_H
-#define QTMAEMO6MENUPROXY_H
-
-#include <QWidget>
-
-#include "qtmaemo6window.h"
-
-class QtMaemo6Menu;
-class QDialog;
-class QMenuBar;
-
-/*!
- * This class emulates the windowdecoration, for dialogs. It draws the the
- * titlebar and cares for the composition modes.
- */
-class QtMaemo6MenuProxy : public QtMaemo6Window
-{
- Q_OBJECT
-public:
- explicit QtMaemo6MenuProxy(QMenuBar *menu, QWidget *parent);
- ~QtMaemo6MenuProxy();
-
-protected:
- QtMaemo6MenuProxy() {};
- void hideWindow();
-
- //not needed for menus
- void ensureWidgetVisible(QWidget* widget, QRect visibleArea) { Q_UNUSED(widget); Q_UNUSED(visibleArea); }
-
- /*! \reimp */
- virtual void resizeEvent(QResizeEvent *);
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void showEvent(QShowEvent *event);
- /*! \reimp_end */
-protected:
- QMenuBar *m_menuBar;
- QtMaemo6Menu *m_menu;
- QWidget* m_appArea;
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6scrollbareventfilter.cpp b/plainqt/style/qtmaemo6scrollbareventfilter.cpp
deleted file mode 100644
index fba493f6..00000000
--- a/plainqt/style/qtmaemo6scrollbareventfilter.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6scrollbareventfilter.h"
-#include "qtmaemo6style_p.h"
-#include "qtmaemo6windowdecoration.h"
-
-#include <QWidget>
-#include <QAbstractScrollArea>
-#include <QScrollBar>
-#include <QApplication>
-#include <QSequentialAnimationGroup>
-#include <QPropertyAnimation>
-#include <QPaintEvent>
-
-#include <MDebug>
-#include <mapplicationpagestyle.h>
-#include <mpositionindicatorstyle.h>
-#include <mwidgetstyle.h>
-#include <MScalableImage>
-
-#include <mwidgetfadeanimationstyle.h>
-
-#ifdef SHOW_SCROLLING_THUMBNAIL
-AbstractScrollAreaThumbView::AbstractScrollAreaThumbView(QWidget *parent /* = NULL*/)
- : QLabel(parent)
-{
- setVisible(false);
-}
-
-void AbstractScrollAreaThumbView::paintEvent(QPaintEvent *event)
-{
- if (pixmap()) {
-
- QPixmap pix = *pixmap();
-
- QPainter pixPainter(&pix);
-
- QPainterPath grayedOutRegion;
- grayedOutRegion.setFillRule(Qt::OddEvenFill);
- grayedOutRegion.addRect(QRect(QPoint(0, 0), pixmap()->size()));
- grayedOutRegion.addRect(m_visibleRect);
-
- pixPainter.setPen(Qt::NoPen);
- pixPainter.setBrush(QBrush(QColor(255, 255, 255, 128)));
- pixPainter.drawPath(grayedOutRegion);
-
- pixPainter.setPen(QPen(Qt::black, 1.0));
- pixPainter.setBrush(Qt::NoBrush);
- pixPainter.drawRect(m_visibleRect);
- pixPainter.end();
-
- pix = setPixmapOpacity(pix, m_opacity);
-
- QPainter painter(this);
- painter.drawPixmap(event->rect(), pix);
- }
-}
-#endif //SHOW_SCROLLING_THUMBNAIL
-
-QtMaemo6ScrollBarEventFilter::QtMaemo6ScrollBarEventFilter(QObject *parent) :
- QObject(parent),
-#ifdef SHOW_SCROLLING_THUMBNAIL
- m_scrollAreaThumbnailMaxSize(200),
- m_scrollAreaThumbnailOffset(20),
- m_scrollAreaThumbnailBorder(3),
- m_showScrollAreaThumbnailFactor(0.2),
-#endif //SHOW_SCROLLING_THUMBNAIL
- m_scrollBarsAlwaysVisible(false)
-{}
-
-QtMaemo6ScrollBarEventFilter::~QtMaemo6ScrollBarEventFilter()
-{
-}
-
-void QtMaemo6ScrollBarEventFilter::enableOn(QObject *o)
-{
- o->installEventFilter(this);
-
- if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(o)) {
-#ifdef SHOW_SCROLLING_THUMBNAIL
- if (qobject_cast<QtMaemo6WindowDecoration *>(abstractScrollArea->parent())) {
- AbstractScrollAreaThumbView *scrollAreaThumbView = new AbstractScrollAreaThumbView(abstractScrollArea);
- scrollAreaThumbView->setObjectName(SCROLLAREATHUMBVIEW);
- scrollAreaThumbView->setOpacity(0);
- }
-#endif //SHOW_SCROLLING_THUMBNAIL
- //FIXME: find a more proper solution without manipulating the widget's properties
- // turn the scrollbars off for ScrollArea, they are handled manually by the style
- abstractScrollArea->horizontalScrollBar()->setVisible(false);
- abstractScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
- abstractScrollArea->verticalScrollBar()->setVisible(false);
- abstractScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- }
- if (QScrollBar *scrollBar = qobject_cast<QScrollBar *>(o)) {
- //FIXME: using the signals from scrollbar is not the best solution, because
- // they maybe disconnected by the user
- connect(scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarValueChanged()));
- }
-}
-
-bool QtMaemo6ScrollBarEventFilter::eventFilter(QObject *obj, QEvent *event)
-{
- switch (event->type()) {
- /* this is the implementation for showing the scrollbars without using the signals
- from the scrollbars
- this piece of code is kept intentionally, because it may be useful when not using
- the signals from the scrollbar to recognize that scrolling is in progress
- case QEvent::Move: {
- if(!scrollBarsAlwaysVisible()) {
- QMoveEvent* moveEvent = static_cast<QMoveEvent*>(event);
- if(QWidget* widget = qobject_cast<QWidget*>(obj)) {
- QWidget* viewport = widget->parentWidget();
- QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>(viewport->parent());
- if(scrollArea) {
- generateScrollAreaThumb(scrollArea);
- fadeInOutAnimation(scrollArea->findChild<QLabel*>(SCROLLAREATHUMBVIEW), "opacity");
- if(scrollArea->horizontalScrollBar() && moveEvent->oldPos().x() != moveEvent->pos().x()) {
- fadeInOutAnimation(scrollArea->horizontalScrollBar(), WIDGET_OPACITY);
- }
- if(scrollArea->verticalScrollBar() && moveEvent->oldPos().y() != moveEvent->pos().y()) {
- fadeInOutAnimation(scrollArea->verticalScrollBar(), WIDGET_OPACITY);
- }
- }
- }
- }
- }
- break;
- */
- case QEvent::Resize: {
- if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(obj)) {
- if (QScrollBar *scrollBar = scrollArea->horizontalScrollBar()) {
- //Moved the scrollBar init stuff into resizeEvent because
- // in QStyle::polish are no sizes set, so there can't be made
- // a decision about the need to show a scrollbar
- scrollBar->setAttribute(Qt::WA_OpaquePaintEvent, false);
- scrollBar->setParent(scrollArea);
- setScrollBarVisibility(scrollBar);
-
- scrollBar->setGeometry(QRect(scrollArea->contentsRect().left(),
- scrollArea->contentsRect().bottom() - scrollBar->sizeHint().height(),
- scrollArea->contentsRect().width(),
- scrollBar->sizeHint().height()));
- }
- if (QScrollBar *scrollBar = scrollArea->verticalScrollBar()) {
- //Moved the scrollBar init stuff into resizeEvent beacause
- // in QStyle::polish are no sizes set, so there can't be made
- // a decision about the need to show a scrollbar
- scrollBar->setAttribute(Qt::WA_OpaquePaintEvent, false);
- scrollBar->setParent(scrollArea);
- setScrollBarVisibility(scrollBar);
-
- if (qApp->isRightToLeft()) {
- scrollBar->setGeometry(QRect(scrollArea->contentsRect().left(),
- scrollArea->contentsRect().top(),
- scrollBar->sizeHint().width(),
- scrollArea->contentsRect().height()));
- } else {
- scrollBar->setGeometry(QRect(scrollArea->contentsRect().right() - scrollBar->sizeHint().width(),
- scrollArea->contentsRect().top(),
- scrollBar->sizeHint().width(),
- scrollArea->contentsRect().height()));
- }
- }
-#ifdef SHOW_SCROLLING_THUMBNAIL
- if (QLabel *scrollAreaThumbView = scrollArea->findChild<QLabel *>(SCROLLAREATHUMBVIEW)) {
- setScrollAreaThumbGeometry(scrollAreaThumbView);
- }
-#endif //SHOW_SCROLLING_THUMBNAIL
- }
- }
- break;
- default:
- break;
- }
- return QObject::eventFilter(obj, event);
-}
-
-void QtMaemo6ScrollBarEventFilter::setScrollBarVisibility(QScrollBar *scrollBar)
-{
- if (!scrollBarsAlwaysVisible()) {
- scrollBar->setProperty(WIDGET_OPACITY, 0.0);
- } else {
- //set the scrollBar only visible if there is something to scroll
- bool isValidScrollRange = scrollBar->minimum() < scrollBar->maximum();
- scrollBar->setVisible(isValidScrollRange);
- }
-}
-
-
-void QtMaemo6ScrollBarEventFilter::generateScrollAreaThumb(QAbstractScrollArea *scrollArea,
- bool forceUpdate /* = false*/)
-{
-#ifndef SHOW_SCROLLING_THUMBNAIL
- //surpress unused warning while this is inactive
- Q_UNUSED(scrollArea);
- Q_UNUSED(forceUpdate);
-#else
- if (AbstractScrollAreaThumbView *scrollAreaThumbView =
- scrollArea->findChild<AbstractScrollAreaThumbView *>(SCROLLAREATHUMBVIEW)) {
- if (scrollAreaThumbView) {
- QWidget *vp = scrollArea->viewport();
-
- double scaleFactor;
- double longSide = qMax(vp->childrenRect().width(), vp->childrenRect().height());
-
- if (0.0 != longSide) {
- scaleFactor = m_scrollAreaThumbnailMaxSize / longSide;
-
- if (!scrollAreaThumbView->pixmap() || forceUpdate) {
- mDebug("PlainQt Style") << "generating Pixmap";
-
- QPixmap pixmap(vp->childrenRect().size() * scaleFactor + QSize(m_scrollAreaThumbnailBorder * 2, m_scrollAreaThumbnailBorder * 2));
- pixmap.fill(Qt::white);
- QPainter p(&pixmap);
-
- const MApplicationPageStyle *style =
- static_cast<const MApplicationPageStyle *>(
- QtMaemo6StylePrivate::mStyle(QStyle::State_Active, "MApplicationPageStyle", ""));
-
- p.drawPixmap(pixmap.rect(), *style->backgroundImage()->pixmap());
-
- //Drawing the border
- p.setPen(QPen(Qt::black, 1.0));
- p.drawRect(QRect(QPoint(0, 0), pixmap.size() - QSize(1, 1)));
-
- p.translate(3, 3);
- p.scale(scaleFactor, scaleFactor);
- vp->render(&p, QPoint(), vp->childrenRect());
-
- scrollAreaThumbView->setPixmap(pixmap);
- }
-
- QRect visibleRect = QRect(-vp->childrenRect().topLeft(), vp->rect().size());
-
- //scale visibleRect manually to fit the thumbnailview
- scrollAreaThumbView->setVisibleRect(
- QRect(visibleRect.topLeft() * scaleFactor, visibleRect.size() * scaleFactor - QSize(1, 1)).translated(3, 3));
-
- setScrollAreaThumbGeometry(scrollAreaThumbView);
- }
- }
- }
-#endif //SHOW_SCROLLING_THUMBNAIL
-}
-
-void QtMaemo6ScrollBarEventFilter::cleanUpTimerMap()
-{
- if (QAbstractAnimation *animation = qobject_cast<QAbstractAnimation *>(sender())) {
- //the event comes from the fadeOut-animation, so we need to get the group
- if ((animation = qobject_cast<QAbstractAnimation *>(animation->parent()))) {
- foreach(const QWidget * w, m_pendingAnimations.keys()) {
- if (m_pendingAnimations.value(w) == animation) {
- delete m_pendingAnimations.take(w);
- }
- }
- }
- }
-}
-
-void QtMaemo6ScrollBarEventFilter::setScrollAreaThumbGeometry(QLabel *label)
-{
-#ifndef SHOW_SCROLLING_THUMBNAIL
- Q_UNUSED(label);
-#else
- if (label->pixmap()) {
- if (qApp->isRightToLeft()) {
- label->setGeometry(m_scrollAreaThumbnailOffset, m_scrollAreaThumbnailOffset,
- label->pixmap()->width(), label->pixmap()->height());
- } else {
- label->setGeometry(label->parentWidget()->width() - (label->pixmap()->width() + m_scrollAreaThumbnailOffset),
- m_scrollAreaThumbnailOffset, label->pixmap()->width(), label->pixmap()->height());
- }
- }
-#endif //SHOW_SCROLLING_THUMBNAIL
-}
-
-void QtMaemo6ScrollBarEventFilter::scrollBarValueChanged()
-{
-
- if (QScrollBar *scrollBar = qobject_cast<QScrollBar *>(sender())) {
- if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(scrollBar->parent())) {
- int scrollBarRange = scrollBar->maximum() - scrollBar->minimum();
-
-#ifndef SHOW_SCROLLING_THUMBNAIL
- Q_UNUSED(scrollArea);
-#else
- double factor = 0;
-
- if (scrollBar->orientation() == Qt::Horizontal)
- factor = scrollBarRange / (double)scrollArea->viewport()->childrenRect().size().width();
- else
- factor = scrollBarRange / (double)scrollArea->viewport()->childrenRect().size().height();
-
- //only show the scrollArea thumbnail if the contents have enough amount of scrolling
- if (factor > m_showScrollAreaThumbnailFactor) {
- //if a new animation is started force generating a new thumbnail
- bool forceThumbnailUpdate = !m_pendingAnimations.contains(scrollBar);
- generateScrollAreaThumb(scrollArea, forceThumbnailUpdate);
-
- fadeInOutAnimation(scrollArea->findChild<QLabel *>(SCROLLAREATHUMBVIEW), "opacity");
- }
-#endif //SHOW_SCROLLING_THUMBNAIL
- //only show the scrollBar if it has a valid range
- if (scrollBarRange)
- fadeInOutAnimation(scrollBar, WIDGET_OPACITY);
- }
- }
-}
-
-void QtMaemo6ScrollBarEventFilter::fadeInOutAnimation(QWidget *w, const char *property)
-{
- if (!w || !property)
- return;
-
- if (m_pendingAnimations.contains(w)) {
- //if the animation is already running
- QSequentialAnimationGroup *sag = m_pendingAnimations.value(w);
- if (sag->animationAt(FadeIn)->state() == QAbstractAnimation::Running ||
- sag->animationAt(Show)->state() == QAbstractAnimation::Running ||
- sag->animationAt(FadeOut)->state() == QAbstractAnimation::Running) {
- //if the scrollbar is fully visible, restart the show animation.
- if (sag->animationAt(Show)->state() == QAbstractAnimation::Running) {
- sag->animationAt(Show)->stop();
- sag->animationAt(Show)->start();
- }
- }
- } else {
- const MPositionIndicatorStyle *style =
- static_cast<const MPositionIndicatorStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MPositionIndicatorStyle"));
-
- const MWidgetFadeAnimationStyle *fadeInStyle =
- static_cast<const MWidgetFadeAnimationStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MWidgetFadeAnimationStyle", "In"));
-
- const MWidgetFadeAnimationStyle *fadeOutStyle =
- static_cast<const MWidgetFadeAnimationStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MWidgetFadeAnimationStyle", "Out"));
-
- QSequentialAnimationGroup *animationGroup = new QSequentialAnimationGroup();
- QPropertyAnimation *fadeIn = new QPropertyAnimation(animationGroup);
- fadeIn->setTargetObject(w);
- fadeIn->setPropertyName(property);
- fadeIn->setDuration(fadeInStyle->duration());
- fadeIn->setEasingCurve(fadeInStyle->easingCurve());
- fadeIn->setStartValue(0.0);
- fadeIn->setEndValue(1.0);
-
- QPropertyAnimation *fadeOut = new QPropertyAnimation(animationGroup);
- fadeOut->setTargetObject(w);
- fadeOut->setPropertyName(property);
- fadeOut->setDuration(fadeOutStyle->duration());
- fadeOut->setEasingCurve(fadeOutStyle->easingCurve());
- fadeOut->setStartValue(1.0);
- fadeOut->setEndValue(0.0);
-
- animationGroup->insertAnimation(FadeIn, fadeIn);
- animationGroup->insertPause(Show, style->hideTimeout());
- animationGroup->insertAnimation(FadeOut, fadeOut);
-
- connect(animationGroup->animationAt(FadeIn), SIGNAL(finished()), animationGroup->animationAt(Show), SLOT(start()));
- connect(animationGroup->animationAt(Show), SIGNAL(finished()), animationGroup->animationAt(FadeOut), SLOT(start()));
-
- //hide must be called before cleanup, because otherwise the widget is deleted before hiding
- connect(animationGroup->animationAt(FadeOut), SIGNAL(finished()), w, SLOT(hide()));
- connect(animationGroup->animationAt(FadeOut), SIGNAL(finished()), this, SLOT(cleanUpTimerMap()));
-
- connect(fadeIn, SIGNAL(valueChanged(QVariant)), w, SLOT(update()));
- connect(fadeOut, SIGNAL(valueChanged(QVariant)), w, SLOT(update()));
-
- w->show();
- m_pendingAnimations.insert(w, animationGroup);
-
- //do NOT use the animationGroup's start method.
- // if the animation reached the pause animation (show state),
- // the pause animation is restarted every time a scrolling activity
- // occurs. So the pause animation only reaches it's end, if there is
- // no scrolling activity.
- // resetting the animation within the running animation group didn't
- // work!
- fadeIn->start();
- }
-}
diff --git a/plainqt/style/qtmaemo6scrollbareventfilter.h b/plainqt/style/qtmaemo6scrollbareventfilter.h
deleted file mode 100644
index 01873531..00000000
--- a/plainqt/style/qtmaemo6scrollbareventfilter.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6SCROLLBAREVENTFILTER_H
-#define QTMAEMO6SCROLLBAREVENTFILTER_H
-
-#include <QObject>
-#include <QMap>
-#include <QLabel>
-
-class QWidget;
-class QScrollBar;
-class QAbstractScrollArea;
-class QSequentialAnimationGroup;
-
-#define SCROLLAREATHUMBVIEW "scrollAreaThumbView"
-#define WIDGET_OPACITY "widgetOpacity"
-
-#ifdef SHOW_SCROLLING_THUMBNAIL
-/*!
- * this class shows a thumbnail of any other widget placed within an
- * scrollarea. It marks the currently visible part in the scrollarea's
- * viewport on the thumbnail
- */
-class AbstractScrollAreaThumbView : public QLabel
-{
- Q_OBJECT
-public:
- Q_PROPERTY(double opacity READ opacity WRITE setOpacity);
- Q_PROPERTY(QRect visibleRect READ visibleRect WRITE setVisibleRect);
-
- AbstractScrollAreaThumbView(QWidget *parent = NULL);
-
- /*!
- * returns the opacity for the widget
- */
- double opacity() const {
- return m_opacity;
- };
- /*!
- * sets the opacity of the widget
- * this is used for fade in and fade out effects
- */
- void setOpacity(double o) {
- m_opacity = o;
- };
-
- /*!
- * returns the rect that describes the visible part of the widget
- */
- QRect visibleRect() const {
- return m_visibleRect;
- };
-
- /*!
- * sets the current visible rect of the widget
- */
- void setVisibleRect(QRect rect) {
- m_visibleRect = rect;
- };
-protected:
- /*! \reimp */
- virtual void paintEvent(QPaintEvent *event);
- /*! \reimp_end */
-protected:
- QRect m_visibleRect;
- double m_opacity;
-};
-#endif //SHOW_SCROLLING_THUMBNAIL
-
-/*!
- * this class handles visibility of scrollbars.
- * it also cares for the fade effects
- */
-class QtMaemo6ScrollBarEventFilter : public QObject
-{
- Q_OBJECT
-public:
- explicit QtMaemo6ScrollBarEventFilter(QObject *parent);
- ~QtMaemo6ScrollBarEventFilter();
-
- /*!
- * enables the effects on the given scrollbars
- */
- void enableOn(QObject *o);
-
- bool scrollBarsAlwaysVisible() const {
- return m_scrollBarsAlwaysVisible;
- };
- void setScrollBarsAlwaysVisible(bool b) {
- m_scrollBarsAlwaysVisible = b;
- };
-protected:
-
- /*!
- * This filter filters some events that are needed for correct scrollbar handling
- * case QEvent:Move:
- * This event is filtered from the widget contained in scrollareas viewport.
- * It is used for showing and hiding the scrollbars when scrolling is active.
- * case QEvent::Resize:
- * This event is filtered from the scrollArea. It's used to manually adjust the
- * scrollbars.
- */
- bool eventFilter(QObject *obj, QEvent *event);
-
- /*!
- * this updates the visibility of the scrollbar, depending of global settings
- * and the scrollrange of the scrollbar
- */
- void setScrollBarVisibility(QScrollBar *scrollBar);
-
- /*!
- * Generates the fade in and fade out animation, for QWidget w
- * and starts it
- * \param w the widget which sould be animated
- * \param property the property used to animate the widgets opacity
- */
- void fadeInOutAnimation(QWidget *w, const char *property);
-protected Q_SLOTS:
- /*!
- * removes scrollbars from the animations list if the animation is completed
- */
- void cleanUpTimerMap();
-
- /*!
- * this slot is called, if a scrollbars value changed
- */
- void scrollBarValueChanged();
-
- /*!
- * places the scrolling preview thumb
- */
- void setScrollAreaThumbGeometry(QLabel *label);
-
- /*!
- * Generates a thumbnail pixmap of the whole scrollarea contents
- * and sets the pixmap to the thumbnail label of the scrollarea
- * and starts it
- * \param scrollArea the scrollArea the thumbnail should be generated for
- * \param forceUpdate forces to redraw the cached pixmap
- */
- void generateScrollAreaThumb(QAbstractScrollArea *scrollArea, bool forceUpdate = false);
-protected:
-#ifdef SHOW_SCROLLING_THUMBNAIL
- const int m_scrollAreaThumbnailMaxSize;
- const int m_scrollAreaThumbnailOffset;
- const int m_scrollAreaThumbnailBorder;
- const double m_showScrollAreaThumbnailFactor;
-#endif //SHOW_SCROLLING_THUMBNAIL
-
- enum AnimationState {
- FadeIn = 0,
- Show = 1,
- FadeOut = 2
- };
-
- QMap<const QWidget *, QSequentialAnimationGroup *> m_pendingAnimations;
- bool m_scrollBarsAlwaysVisible;
-};
-
-
-#endif //QTMAEMO6SCROLLBAREVENTFILTER_H
diff --git a/plainqt/style/qtmaemo6sliderpopup.cpp b/plainqt/style/qtmaemo6sliderpopup.cpp
deleted file mode 100644
index 8d8efbe0..00000000
--- a/plainqt/style/qtmaemo6sliderpopup.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6sliderpopup.h"
-#include "qtmaemo6style_p.h"
-#include <QApplication>
-#include <QStyle>
-#include <QSizePolicy>
-#include <QPainter>
-#include <QStyleOption>
-#include <QPaintEvent>
-
-
-#include <mlabelstyle.h>
-
-QtMaemo6SliderPopUp::QtMaemo6SliderPopUp()
- : m_slider(0)
-{
- setObjectName("Qt_Maemo6_SliderPopUp");
-}
-
-void QtMaemo6SliderPopUp::enableOn(QSlider* slider) {
-
- QWidget* topLevelWidget = slider;
-
- while(topLevelWidget->parentWidget())
- topLevelWidget = topLevelWidget->parentWidget();
-
- setParent(topLevelWidget);
- setVisible(false);
- setAlignment(Qt::AlignCenter);
-
- disconnect();
- m_slider = slider;
- connect(slider, SIGNAL(sliderPressed()), this, SLOT(show()));
- connect(slider, SIGNAL(sliderReleased()), this, SLOT(hide()));
- connect(slider, SIGNAL(valueChanged(int)), this, SLOT(updatePosition()));
-}
-
-void QtMaemo6SliderPopUp::showEvent(QShowEvent *e) {
- updatePosition();
- QLabel::showEvent(e);
-}
-
-void QtMaemo6SliderPopUp::resizeEvent(QResizeEvent *e) {
- QLabel::resizeEvent(e);
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(style())) {
- s->setPaletteBackground(this, "MSliderStyle", "MSliderHandleLabel");
- }
-
-}
-
-void QtMaemo6SliderPopUp::paintEvent(QPaintEvent *e) {
- QLabel::paintEvent(e);
-}
-
-void QtMaemo6SliderPopUp::updatePosition() {
- if(m_slider) {
- //have to use the style option to determine groove length, because
- // groove length may differ from widget size
- QStyleOptionSlider opt;
- opt.initFrom(m_slider);
-
- int maxSliderLength = style()->pixelMetric(QStyle::PM_SliderLength, &opt, m_slider);
- int span = (m_slider->orientation() == Qt::Horizontal)
- ? opt.rect.width() - maxSliderLength
- : opt.rect.height() - maxSliderLength;
-
- int sliderPos = QStyle::sliderPositionFromValue(m_slider->minimum(), m_slider->maximum(), m_slider->value(), span);
- setText(QString("%1").arg(m_slider->value()));
- resize(styledSizeHint());
-
- QPoint global;
- if(qApp->isLeftToRight())
- global = m_slider->mapToGlobal(m_slider->rect().topLeft());
- else
- global = m_slider->mapToGlobal(m_slider->rect().topRight());
- QPoint offset = parentWidget()->mapFromGlobal(global);
-
- //add the difference between widget width and groove width and the label
- // size to the offset and move the label
- if(m_slider->orientation() == Qt::Horizontal) {
- if(qApp->isLeftToRight()) {
- offset.setX(offset.x() + ((m_slider->width() - span) / 2) - styledSizeHint().width() / 2);
- move(offset.x() + sliderPos, offset.y() - height());
- } else {
- offset.setX(offset.x() - ((m_slider->width() - span) / 2) - styledSizeHint().width() / 2);
- move(offset.x() - sliderPos, offset.y() - height());
- }
- } else {
- offset.setY(offset.y() + ((m_slider->height() - span) / 2) - styledSizeHint().height() / 2);
- move(offset.x() + m_slider->width(), offset.y() + span - sliderPos);
- }
- }
-}
-
-QSize QtMaemo6SliderPopUp::styledSizeHint() {
- QStyleOption opt;
- opt.initFrom(this);
-
- const MLabelStyle *style =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(opt.state,
- "MSliderStyle",
- "MSliderHandleLabel"));
- //int left, top, right, bottom;
- //style->backgroundImage()->borders(&left, &right, &top, &bottom);
- //return sizeHint() + QSize(left + right, top + bottom);
- return sizeHint() + QSize(style->paddingLeft() + style->paddingRight(),
- style->paddingTop() + style->paddingBottom());
-}
diff --git a/plainqt/style/qtmaemo6sliderpopup.h b/plainqt/style/qtmaemo6sliderpopup.h
deleted file mode 100644
index 427d1c22..00000000
--- a/plainqt/style/qtmaemo6sliderpopup.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6SLIDERPOPUP_H
-#define QTMAEMO6SLIDERPOPUP_H
-
-#include <QLabel>
-
-class QSlider;
-
-/*!
- * This class adds a popup to a QSlider, that shows the value of the slider while
- * the slider handle is pressed or moved.
- * The popup is added to toplevel widget the slider belongs to. It's positioned
- * within this top level widget freely depending on the slider's position.
- */
-class QtMaemo6SliderPopUp : public QLabel {
- Q_OBJECT
-public:
- QtMaemo6SliderPopUp();
-
- /*!
- * \brief append the popup to a QSlider
- * \param slider the QSlider the popup should be shown on
- */
- void enableOn(QSlider* slider);
-public Q_SLOTS:
- /*!
- * \brief updates the popups position if the slider is moved
- */
- void updatePosition();
-protected:
- /*! \reimp */
- virtual void showEvent(QShowEvent *);
- virtual void resizeEvent(QResizeEvent *);
- virtual void paintEvent(QPaintEvent *);
- /*! \reimp_end */
-
- /*!
- * \brief returns the size of the popup including the borders
- */
- QSize styledSizeHint();
-protected:
- QSlider* m_slider;
-};
-
-#endif //QTMAEMO6SLIDERPOPUP_H
diff --git a/plainqt/style/qtmaemo6style.cpp b/plainqt/style/qtmaemo6style.cpp
deleted file mode 100755
index f01f8542..00000000
--- a/plainqt/style/qtmaemo6style.cpp
+++ /dev/null
@@ -1,3064 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-
-#include "qtmaemo6style.h"
-#include "qtmaemo6style_p.h"
-
-#include <QAbstractButton>
-#include <QCheckBox>
-#include <QLabel>
-#include <QListWidget>
-#include <QTextEdit>
-#include <QPainter>
-#include <QProgressBar>
-#include <QStyleOptionButton>
-#include <QApplication>
-#include <QDialogButtonBox>
-#include <QFile>
-#include <QInputContext>
-#include <QInputContextFactory>
-#include <QPoint>
-#include <QToolBar>
-#include <QMainWindow>
-#include <QDialog>
-#include <QScrollArea>
-#include <QScrollBar>
-#include <QTimer>
-#include <QMoveEvent>
-#include <QSequentialAnimationGroup>
-#include <QPixmapCache>
-#include <QPropertyAnimation>
-#include <QPauseAnimation>
-#include <QPushButton>
-#include <QLabel>
-#include <QMenu>
-#include <QAbstractItemView>
-#include <QStatusBar>
-#include <QMenuBar>
-#include <QComboBox>
-#include <QDesktopWidget>
-#include <QLineEdit>
-#include <QTime>
-#include <QHeaderView>
-
-#include <MComponentData>
-#include <MDebug>
-#include <MFeedback>
-#include <MTheme>
-#include <MScalableImage>
-#include <MLabel>
-#include <MImageWidget>
-#include <MApplicationWindow>
-#include <MInputMethodState>
-#include <mbuttonstyle.h>
-#include <mapplicationpagestyle.h>
-#include <mpositionindicatorstyle.h>
-#include <mprogressindicatorstyle.h>
-#include <mpannablewidgetstyle.h>
-#include <mwidgetstyle.h>
-#include <mdialogstyle.h>
-#include <mbuttoniconstyle.h>
-#include <mlistitemstyle.h>
-#include <mcheckboxstyle.h>
-#include <mcontainerstyle.h>
-#include <mcomboboxstyle.h>
-#include <mlabelstyle.h>
-#include <mimagewidgetstyle.h>
-#include <mnavigationbarstyle.h>
-#include <mseparatorstyle.h>
-#include <msliderstyle.h>
-#include <mtexteditstyle.h>
-#include <mcontentitemstyle.h>
-#include <mapplicationmenustyle.h>
-#include <mfeedback.h>
-//#include <mwidgetfadeinanimationstyle.h>
-//#include <mwidgetfadeoutanimationstyle.h>
-#include <mdeviceprofile.h>
-#include <morientationtracker.h>
-#include <mcombobox.h>
-
-#include "qtmaemo6titlebar.h"
-#include "qtmaemo6dialogtitle.h"
-#include "qtmaemo6windowdecoration.h"
-#include "qtmaemo6dialogproxy.h"
-#include "qtmaemo6menu.h"
-#include "qtmaemo6kineticscrolling.h"
-#include "qtmaemo6sliderpopup.h"
-//krazy:excludeall=qclasses
-
-//#include "mcontainerheader_p.h"
-
-#ifdef HAVE_NATIVE_FILEDIALOG
-#include "qtmeegofilepicker.h"
-#endif
-
-#define WIDGET_OPACITY "widgetOpacity"
-#define SCROLLAREATHUMBVIEW "scrollAreaThumbView"
-
-//#define MOVE_ACTIONS_FROM_TOOLBAR_TO_TITLEBAR
-//#define M_LOG_POLISH
-
-
-QPixmap setPixmapOpacity(const QPixmap &pixmap, double opacity)
-{
- //opacity == 1 makes no transparency, so let the pixmap unchanged
- if (opacity >= 1.0)
- return pixmap;
-
- QPixmap transparentPixmap(pixmap.size());
- transparentPixmap.fill(Qt::transparent);
-
- //if the opacity is 0, just return a fully transparent pixmap
- if (opacity >= 0.0) {
- QPainter painter(&transparentPixmap);
- painter.setCompositionMode(QPainter::CompositionMode_Source);
- painter.drawPixmap(0, 0, pixmap);
-
- painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
- painter.fillRect(transparentPixmap.rect(), QColor(0, 0, 0, 255 * opacity));
- painter.end();
- }
- return transparentPixmap;
-}
-
-QtMaemo6StylePrivate::QtMaemo6StylePrivate()
- : m_actionsInTitleBarCount(5),
- m_componentData(0),
-#ifdef HAVE_CONTEXTSUBSCRIBER
- m_orientation("Screen.TopEdge"),
-#endif //HAVE_CONTEXTSUBSCRIBER
- m_isMInitialized(false),
- m_isMApplication(false),
- m_isOrientationChangeEnabled(false),
- m_scrollBarEventFilter(0),
- m_windowEventFilter(0),
- m_menuBar(0),
- m_kinetic(0)
-{
- m_excludeClasses.append("QShapedPixmapWidget");
- m_excludeClasses.append("QTipLabel");
-}
-
-QtMaemo6StylePrivate::~QtMaemo6StylePrivate()
-{
- if (!m_isMApplication) {
- delete m_componentData;
- }
-}
-
-void QtMaemo6StylePrivate::initM()
-{
- mDebug("PlainQt Style") << "Qt Maemo 6 Style init";
- Q_Q(QtMaemo6Style);
-
- m_isMInitialized = true;
-
- m_windowEventFilter = new QtMaemo6StyleEventFilter(q);
- m_scrollBarEventFilter = new QtMaemo6ScrollBarEventFilter(q);
- m_scrollBarEventFilter->setScrollBarsAlwaysVisible(false);
- m_kinetic = new QtMaemo6KineticScrolling(q);
-
- if (MComponentData::instance() != 0) {
- m_componentData = MComponentData::instance();
- m_isMApplication = true;
- } else {
- QStringList args = qApp->arguments();
-
- int argc = 1;
- char *argv[ 1 ];
- argv[ 0 ] = 0;
-
- if (! args.isEmpty()) {
- //FIXME: using QString would be nicer
- argv[ 0 ] = strndup(args[ 0 ].toLocal8Bit().constData(), 42);
-
- mDebug("PlainQt Style") << "appName:" << argv[ 0 ];
- }
- m_componentData = new MComponentData(argc, argv);
- }
-
- const MLabelStyle *style =
- static_cast<const MLabelStyle *>(mStyle(QStyle::State_Active,
- "MLabelStyle"));
- qApp->setFont(style->font());
- qApp->setGlobalStrut(QSize(0, 0));
-
- bool inputConnect = QObject::connect(MInputMethodState::instance(), SIGNAL(inputMethodAreaChanged(QRect)), q, SLOT(ensureFocusedWidgetVisible(QRect)));
- if(!inputConnect)
- mDebug("PlainQt Style") << "Virtual keyboard notification connection failed";
-
- QObject::connect(MTheme::instance(), SIGNAL(pixmapRequestsFinished()), q, SLOT(updateDirtyWidgets()));
-
- //Force VKB to landscape orientation
- MInputMethodState::instance()->setActiveWindowOrientationAngle(M::Angle0);
-}
-
-const MStyle *QtMaemo6StylePrivate::mStyle(QStyle::State state,
- const QString &styleClass,
- const QString &styleObject,
- const QString &type,
- const bool hasFocus,
- const MWidgetController *parent
- )
-{
- // Set mode
- QString mode = modeFromState(state);
-
- // a line edit is selected in respect of its focus
- if ((styleClass == "MTextEditStyle") && hasFocus)
- mode = "selected";
-
- const MStyle* style = MTheme::style(styleClass.toLocal8Bit().constData(),
- styleObject.toLocal8Bit().constData(),
- mode, type, M::Landscape, parent);
- if(!style) {
- qCritical() << "Can not load MStyle" << styleClass << styleObject << type;
- }
- return style;
-}
-
-QString QtMaemo6StylePrivate::modeFromState(QStyle::State state)
-{
- // Used for debugging the QStyle::State vs. mode behavior:
- // printStateFlags(state);
-
- // At moment, libmeegotouch uses the following modes:
- // "" (empty string) -- used as default
- // "pressed" -- used whenever a widget is pressed
- // "selected" -- used by checkable elements (for example checkboxes)
- // vertical", "horizontal" -- used by MSeparatorStyle
- QString mode = "";
-
- if (state & QStyle::State_Enabled) {
-
- if(state & QStyle::State_Sunken)
- mode = "pressed";
- else if(state & QStyle::State_On)
- mode = "selected";
- else if(state & QStyle::State_Selected)
- mode = "selected";
- else if(state & QStyle::State_Raised)
- mode = "";
-
- }
-
- return mode;
-}
-
-void QtMaemo6StylePrivate::printStateFlags(QStyle::State state)
-{
-
- if (state & QStyle::State_None)
- mDebug("PlainQt Style") << "QStyle::State_None";
-
- if (state & QStyle::State_Active)
- mDebug("PlainQt Style") << "QStyle::State_Active";
-
- if (state & QStyle::State_AutoRaise)
- mDebug("PlainQt Style") << "QStyle::State_AutoRaise";
-
- if (state & QStyle::State_Children)
- mDebug("PlainQt Style") << "QStyle::State_Children";
-
- if (state & QStyle::State_DownArrow)
- mDebug("PlainQt Style") << "QStyle::State_DownArrow";
-
- if (state & QStyle::State_Editing)
- mDebug("PlainQt Style") << "QStyle::State_Editing";
-
- if (state & QStyle::State_Enabled)
- mDebug("PlainQt Style") << "QStyle::State_Enabled";
-
-// if (state & QStyle::State_HasEditFocus)
-// mDebug("PlainQt Style") << "QStyle::State_HasEditFocus";
-
- if (state & QStyle::State_Horizontal)
- mDebug("PlainQt Style") << "QStyle::State_Horizontal";
-
- if (state & QStyle::State_KeyboardFocusChange)
- mDebug("PlainQt Style") << "QStyle::State_KeyboardFocusChange";
-
- if (state & QStyle::State_MouseOver)
- mDebug("PlainQt Style") << "QStyle::State_MouseOver";
-
- if (state & QStyle::State_NoChange)
- mDebug("PlainQt Style") << "QStyle::State_NoChange";
-
- if (state & QStyle::State_Off)
- mDebug("PlainQt Style") << "QStyle::State_Off";
-
- if (state & QStyle::State_On)
- mDebug("PlainQt Style") << "QStyle::State_On";
-
- if (state & QStyle::State_Raised)
- mDebug("PlainQt Style") << "QStyle::State_Raised";
-
- if (state & QStyle::State_ReadOnly)
- mDebug("PlainQt Style") << "QStyle::State_ReadOnly";
-
- if (state & QStyle::State_Selected)
- mDebug("PlainQt Style") << "QStyle::State_Selected";
-
- if (state & QStyle::State_Item)
- mDebug("PlainQt Style") << "QStyle::State_Item";
-
- if (state & QStyle::State_Open)
- mDebug("PlainQt Style") << "QStyle::State_Open";
-
- if (state & QStyle::State_Sibling)
- mDebug("PlainQt Style") << "QStyle::State_Sibling";
-
- if (state & QStyle::State_Sunken)
- mDebug("PlainQt Style") << "QStyle::State_Sunken";
-
- if (state & QStyle::State_UpArrow)
- mDebug("PlainQt Style") << "QStyle::State_UpArrow";
-
- if (state & QStyle::State_Mini)
- mDebug("PlainQt Style") << "QStyle::State_Mini";
-
- if (state & QStyle::State_Small)
- mDebug("PlainQt Style") << "QStyle::State_Small";
-
-}
-
-bool QtMaemo6Style::setPaletteBackground(QWidget *widget,
- QString styleObject,
- QString styleClass) const
-{
- bool ret = false;
-
- if (NULL != widget) {
-
- //ensure the layout was activated, so the widget already has correct size
- if(widget->parentWidget())
- if(widget->parentWidget()->layout())
- widget->parentWidget()->layout()->activate();
-
- if(widget->size().isValid()) {
- widget->setAutoFillBackground(true);
-
- QStyleOption widgetOption;
- widgetOption.initFrom(widget);
-
- QPixmap backgroundPixmap(widget->size());
- backgroundPixmap.fill(Qt::transparent);
- QPainter painter(&backgroundPixmap);
-
- //by default use the MApplicationPageStyle background
- QString _styleObject("MApplicationPageStyle");
- if(!styleObject.isEmpty())
- _styleObject = styleObject;
-
- const MWidgetStyle *style =
- static_cast<const MWidgetStyle*>(
- QtMaemo6StylePrivate::mStyle(widgetOption.state, _styleObject, styleClass));
- if(style) {
- ret = drawBackground(&painter, &widgetOption, backgroundPixmap.rect(), style, widget);
-
- if(ret) {
- QPalette palette = widget->palette();
- palette.setBrush(widget->backgroundRole(), QBrush(backgroundPixmap));
- widget->setPalette(palette);
- }
- }
- }
- }
- return ret;
-}
-
-bool QtMaemo6Style::setPaletteBackground(QWidget* widget,
- const MScalableImage* image) const
-{
- bool ret = false;
- if(widget && image) {
- Q_D(const QtMaemo6Style);
- //this is needed to force the widget to draw its palette background
- // autmatically before each paint event
- widget->setAutoFillBackground(true);
-
- QStyleOption widgetOption;
- widgetOption.initFrom(widget);
-
- QPixmap backgroundPixmap(widget->size());
- backgroundPixmap.fill(Qt::transparent);
- QPainter painter(&backgroundPixmap);
-
- ret = d->drawScalableImage(&painter, &widgetOption, backgroundPixmap.rect(),
- image, NULL, widget);
- if(ret) {
- QPalette palette = widget->palette();
- palette.setBrush(widget->backgroundRole(), QBrush(backgroundPixmap));
- widget->setPalette(palette);
- }
- }
- return ret;
-}
-
-bool QtMaemo6Style::drawBackground(QPainter *p,
- const QStyleOption *option,
- const QRect &rect,
- const MWidgetStyle *style,
- const QWidget* w /* = 0*/) const
-{
- Q_D(const QtMaemo6Style);
- bool ret = false;
- if (style) {
- if(style->backgroundImage()) {
- ret = d->drawScalableImage(p, option, rect, style->backgroundImage(), style, w);
- } else if(style->backgroundColor().isValid()) {
- p->fillRect(rect, QBrush(style->backgroundColor()));
- }
- }
- return ret;
-}
-
-bool QtMaemo6StylePrivate::drawScalableImage(QPainter *p,
- const QStyleOption *option,
- const QRect &rect,
- const MScalableImage *scalableImage,
- const MWidgetStyle *style,
- const QWidget* widget,
- const QString &purpose,
- bool enableCache) const
-{
- qreal effectiveOpacity = p->opacity();
- if(style)
- p->setOpacity(style->backgroundOpacity() * effectiveOpacity);
- if (!scalableImage) {
- qWarning() << "Image nocht valid *********************";
- }
- if (scalableImage && rect.isValid()) {
- if (MTheme::hasPendingRequests()) {
- //cache widgets that need an update, after the images are loaded
- QWidget* usedWidget = const_cast<QWidget*>(widget);
-
- //if no widget is provieded, use the painter's device, if painted onto a widget
- if(!usedWidget) {
- usedWidget = dynamic_cast<QWidget*>(p->device());
- }
- if(usedWidget) {
- if(!m_dirtyWidgets.contains(usedWidget)) {
- MScalableImage* imageForBackground = 0;
- if(widget)
- imageForBackground = const_cast<MScalableImage*>(scalableImage);
- m_dirtyWidgets.insert(usedWidget, imageForBackground);
- }
- }
- return false;
- }
-
- // Per Widget background image cache implementation
- QPixmap backgroundPixmap(rect.size());
-
- QPaintDevice *device = p->device();
- QWidget *cachedWidget = dynamic_cast<QWidget *>(device);
-
- QString mode;
- if (cachedWidget) {
- mode = QtMaemo6StylePrivate::modeFromState(option->state);
- }
-
- quintptr pWidget = reinterpret_cast<quintptr>(device);
- quintptr pImage = reinterpret_cast<quintptr>(scalableImage);
-
- QString cacheKey = QString("%1_%2_%3_%4_%5x%6").arg(pWidget)
- .arg(pImage)
- .arg(mode)
- .arg(purpose)
- .arg(rect.width())
- .arg(rect.height());
-
- if ((!enableCache || !QPixmapCache::find(cacheKey, backgroundPixmap)) && rect.isValid()) {
- backgroundPixmap.fill(Qt::transparent);
- QPainter pixmapPainter(&backgroundPixmap);
- scalableImage->draw(0, 0, rect.width(), rect.height(), &pixmapPainter);
- QPixmapCache::insert(cacheKey, backgroundPixmap);
- }
-
- p->drawPixmap(rect, backgroundPixmap);
- } else if (style && style->backgroundColor().isValid()) {
- p->fillRect(rect, QBrush(style->backgroundColor()));
- }
- p->setOpacity(effectiveOpacity);
-
- return true;
-}
-
-void QtMaemo6StylePrivate::drawSliderBaseBackground(QPainter *p,
- const QStyleOption *option,
- const QRect &rect,
- const MSliderStyle *style,
- int maxSliderLength)
-{
- Q_UNUSED(maxSliderLength);
-
- p->save();
- if (style) {
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- // draw Background
- qreal effectiveOpacity = p->opacity();
- p->setOpacity(style->backgroundOpacity() * effectiveOpacity);
-
- bool isHorizontal = slider->orientation == Qt::Horizontal;
-
- int span = ( isHorizontal )
- ? slider->rect.width() - maxSliderLength
- : slider->rect.height() - maxSliderLength;
- int sliderPosition = QStyle::sliderPositionFromValue(slider->minimum,
- slider->maximum,
- slider->sliderValue,
- span,
- slider->upsideDown);
- //adjust the slider position to the absolute position within the widget
- // instead of position on the groove
- if(isHorizontal)
- sliderPosition = ((rect.width() - span) / 2) + sliderPosition;
- else
- sliderPosition = ((rect.height() - span) / 2) + sliderPosition;
-
- const MScalableImage *baseImage = (isHorizontal)
- ? style->backgroundBaseImage()
- : style->backgroundVerticalBaseImage();
-
- const MScalableImage *elapsedImage = (isHorizontal)
- ? style->backgroundElapsedImage()
- : style->backgroundVerticalElapsedImage();
-
- if(qApp->isRightToLeft()) {
- const MScalableImage* tempImage = baseImage;
- baseImage = elapsedImage;
- elapsedImage = tempImage;
- }
-
- if (baseImage) {
- // Per Widget background image cache implementation
- QPixmap backgroundPixmap(rect.size());
-
- QPaintDevice *device = p->device();
- QWidget *cachedWidget = dynamic_cast<QWidget *>(device);
-
- QString mode;
- if (cachedWidget) {
- mode = QtMaemo6StylePrivate::modeFromState(option->state);
- }
-
- quintptr pWidget = reinterpret_cast<quintptr>(device);
-
- QString cacheKey = QString("%1_%2_%3x%4_%5").arg(pWidget)
- .arg(mode)
- .arg(rect.width())
- .arg(rect.height())
- .arg(slider->sliderValue);
-
- if (!QPixmapCache::find(cacheKey, backgroundPixmap)) {
- backgroundPixmap.fill(Qt::transparent);
- QPainter pixmapPainter;
- pixmapPainter.begin(&backgroundPixmap);
- if(isHorizontal) {
- if(sliderPosition > 0)
- elapsedImage->draw(0, 0, sliderPosition, rect.height(), &pixmapPainter);
- baseImage->draw(sliderPosition, 0, rect.width() - sliderPosition, rect.height(), &pixmapPainter);
- } else {
- if(sliderPosition > 0)
- elapsedImage->draw(0, 0, rect.width(), sliderPosition, &pixmapPainter);
- baseImage->draw(0, sliderPosition, rect.width(), rect.height() - sliderPosition, &pixmapPainter);
- }
- pixmapPainter.end();
- QPixmapCache::insert(cacheKey, backgroundPixmap);
- }
- p->drawPixmap(rect, backgroundPixmap);
- } else if (style->backgroundColor().isValid()) {
- p->fillRect(rect, QBrush(style->backgroundColor()));
- }
-
- p->setOpacity(effectiveOpacity);
- }
- }
- p->restore();
-}
-
-void QtMaemo6StylePrivate::drawBasicButton(QPainter *painter,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const MButtonStyle *style) const
-{
- drawBasicButton(painter, text, icon, rect, option, style, style->font(), style->iconSize());
-}
-
-void QtMaemo6StylePrivate::drawBasicButton(QPainter *p,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const QString &styleClass,
- const QString &styleObject /* = QString()*/) const
-{
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(option->state,
- styleClass.toLocal8Bit().constData(),
- styleObject));
- drawBasicButton(p, text, icon, rect, option, style, style->font(), style->iconSize());
-
-}
-
-void QtMaemo6StylePrivate::drawToggleButton(QPainter *p,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const QString &styleClass,
- const QString &styleObject /* = QString()*/) const
-{
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(option->state,
- styleClass.toLocal8Bit().constData(),
- styleObject,
- "toggle"));
- drawBasicButton(p, text, icon, rect, option, style, style->font(), style->iconSize());
-}
-
-void QtMaemo6StylePrivate::drawCheckBox(QPainter *p,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option) const
-{
- const MCheckboxStyle *style =
- static_cast<const MCheckboxStyle *>(QtMaemo6StylePrivate::mStyle(option->state,
- "MCheckboxStyle"));
- if(style) {
- drawBasicButton(p, text, icon, rect, option, style, style->font(), style->iconSize());
- if(option->state & QStyle::State_On
- && option->state & QStyle::State_Enabled
- && style->checkmarkImage()) {
- QSizeF pos = (rect.size() / 2) - (style->checkmarkImage()->size() / 2);
- p->drawPixmap(pos.width() + rect.x(), pos.height() + rect.y(), *style->checkmarkImage());
- }
- } else {
- qCritical() << "Could not load MCheckboxStyle for QCheckBox";
- }
-}
-
-void QtMaemo6StylePrivate::drawBasicButton(QPainter *p,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const MButtonStyle *style,
- const QFont &font,
- const QSize &iconSize) const
-{
- Q_Q(const QtMaemo6Style);
- if (style) {
-
- //margins aren't part of the button
- QRect buttonRect = rect.adjusted(style->marginLeft(), style->marginTop(), -style->marginRight(), -style->marginBottom());
- q->drawBackground(p, option, buttonRect, style);
-
- buttonRect.adjust(style->paddingLeft(), style->paddingTop(), -style->paddingRight(), -style->paddingBottom());
- QSize usedIconSize = iconSize.isValid() ? iconSize : style->iconSize();
-
- if (!icon.isNull()) {
-
- //scale icon if necessary (ToDo: investigate if m scales or cuts)
- if (usedIconSize.width() > buttonRect.width()
- || usedIconSize.height() > buttonRect.height()) {
- usedIconSize.scale(buttonRect.size(), Qt::KeepAspectRatio);
- }
-
- if (text.isEmpty()) {
- drawButtonIcon(style, p, buttonRect, icon, usedIconSize, /*centerAlways=*/true);
- } else {
-
- QRect textAndIconRect = getTextAndIconRect(style, text, icon, font, usedIconSize);
- textAndIconRect.moveTo(
- buttonRect.left() + (buttonRect.width() - textAndIconRect.width()) / 2,
- buttonRect.top() + (buttonRect.height() - textAndIconRect.height()) / 2);
- drawButtonIcon(style, p, textAndIconRect, icon, usedIconSize);
-
- buttonRect.translate(usedIconSize.width(), 0);
- drawButtonText(style, p, buttonRect, text, style->horizontalTextAlign() | style->verticalTextAlign(), font);
-
- //merge the alignment of icon and text
- // if the button is aligned horizontaly to the text, text must be drawn with inverted
- // icon's horizontal align and horizontal align of the text
-// if (hasVerticalAlignment(style->iconAlign())) {
-// drawButtonText(style, p, buttonRect, text,
-// invertAlignment(verticalAlignment(style->iconAlign())) | style->horizontalTextAlign(), font);
-// } else if (hasHorizontalAlignment(style->iconAlign())) {
-// drawButtonText(style, p, buttonRect, text,
-// invertAlignment(horizontalAlignment(style->iconAlign())) | style->verticalTextAlign(), font);
-// } else {
-// mDebug("PlainQt Style") << "Button has no text align";
-// }
- }
- } else { //Text only
- drawButtonText(style, p, buttonRect, text, style->horizontalTextAlign() | style->verticalTextAlign(), font);
- }
- }
-}
-
-void QtMaemo6StylePrivate::drawComboBoxButton(QPainter *p,
- const MComboBoxStyle *cbStyle,
- const MListItemStyle *liStyle,
- const QString &currentText,
- const QRect &rect,
- const QStyleOption *option,
- const Qt::LayoutDirection layoutDirection) const
-{
-
- Q_Q(const QtMaemo6Style);
- if (!cbStyle || !liStyle)
- return;
-
- q->drawBackground(p, option, rect, liStyle);
-
- int paddingLeft, paddingTop, paddingRight, paddingBottom;
- paddingFromStyle(liStyle, &paddingLeft, &paddingTop, &paddingRight, &paddingBottom);
-
- //draw indicator Image
- QPixmap indicator;
- QString indicatorImageName = cbStyle->indicatorImage();
- QString cacheKey = QString("%1_%2_%3_%4_%5x%6").arg(reinterpret_cast<quintptr>(p->device()))
- .arg(indicatorImageName)
- .arg(option ? QtMaemo6StylePrivate::modeFromState(option->state) : "noMode")
- .arg("ind")
- .arg(rect.width())
- .arg(rect.height());
-
- if (!QPixmapCache::find(cacheKey, indicator) && rect.isValid()) {
-
- QPixmap *pm = MTheme::pixmapCopy(cbStyle->indicatorImage());
- if (pm) {
-
- indicator = *pm;
-
- if (indicator.size().width() > rect.width()
- || indicator.size().height() > rect.height()) {
- indicator = indicator.scaled(rect.size(), Qt::KeepAspectRatio);
- }
-
- QPixmapCache::insert(cacheKey, indicator);
-
- }
-
- }
-
- // there are no padding values for the indicator, so the spacing has to be hardcoded
- // maybe there is a better way?
- QRect usedIndicatorRect;
- if (layoutDirection == Qt::LeftToRight)
- usedIndicatorRect = rect.adjusted(0, 0, -paddingRight, 0);
- else
- usedIndicatorRect = rect.adjusted(paddingRight, 0, 0, 0);
-
- q->drawItemPixmap(p, usedIndicatorRect, Qt::AlignVCenter | Qt::AlignRight, indicator);
-
- //drawText
- if (!currentText.isEmpty()) {
-
- QColor textColor;
- QFont textFont;
-
- const MLabelStyle *labelStyle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(
- QStyle::State_Enabled, "MLabelStyle", cbStyle->subTitleObjectName()));
-
- if (labelStyle) {
- textColor = labelStyle->color();
- textFont = labelStyle->font();
- } else {
- textColor = qApp->palette().text().color();
- textFont = qApp->font();
- }
-
- int realPaddingRight = indicator.size().isValid() ? paddingRight+indicator.size().width() : paddingRight;
- QRect textRect;
- if (layoutDirection == Qt::LeftToRight)
- textRect = rect.adjusted(paddingLeft, 0, -realPaddingRight, 0);
- else
- textRect = rect.adjusted(realPaddingRight, 0, -paddingLeft, 0);
-
- p->setPen(textColor);
- p->setFont(textFont);
- p->drawText(textRect, Qt::AlignVCenter | Qt::AlignLeft, currentText);
-
- }
-
-}
-
-void QtMaemo6StylePrivate::drawButtonText(const MButtonStyle *style,
- QPainter *painter,
- const QRectF &textRect,
- const QString &text,
- Qt::Alignment align,
- const QFont &font) const
-{
- if (text.isEmpty() || !style)
- return;
-
- // update text area by margin
- int marginLeft = style->textMarginLeft();
- int marginRight = style->textMarginRight();
- int marginTop = style->textMarginTop();
- int marginBottom = style->textMarginBottom();
-
- QRectF rect;
- rect.setX(textRect.x() + marginLeft);
- rect.setY(textRect.y() + marginTop);
- rect.setWidth(textRect.width() - marginLeft - marginRight);
- rect.setHeight(textRect.height() - marginTop - marginBottom);
-
- int alignment = align | Qt::TextHideMnemonic;
-
- painter->setFont(font);
- painter->setPen(style->textColor());
- painter->drawText(rect, alignment, text);
-}
-
-void QtMaemo6StylePrivate::drawButtonText(const MButtonStyle *style,
- QPainter *painter,
- const QRectF &textRect,
- const QString &text,
- Qt::Alignment align) const
-{
- drawButtonText(style, painter, textRect, text, align, style->font());
-}
-
-void QtMaemo6StylePrivate::drawButtonIcon(const MButtonStyle *style,
- QPainter *painter,
- const QRect &contentsRect,
- const QIcon &icon,
- const QSize &iconSize, /* = QSize()*/
- const bool centerAlways) const
-{
- if(style) {
- Q_Q(const QtMaemo6Style);
- QSize usedIconSize = iconSize.isValid() ? iconSize : style->iconSize();
-
- if (centerAlways) {
- q->drawItemPixmap(painter, contentsRect, Qt::AlignHCenter | Qt::AlignVCenter, icon.pixmap(usedIconSize));
- } else {
-
- //If alignment is only horizontal oder vertical, center in the other direction
- Qt::Alignment usedAlign = style->iconAlign();
- if (!hasHorizontalAlignment(usedAlign))
- usedAlign |= Qt::AlignHCenter;
- if (!hasVerticalAlignment(usedAlign))
- usedAlign |= Qt::AlignVCenter;
-
- // int paddingLeft, paddingTop, paddingRight, paddingBottom;
- // paddingFromStyle(style, &paddingLeft, &paddingTop, &paddingRight, &paddingBottom);
- //
- // QRect ctRect = contentsRect.translated(paddingLeft, paddingTop);
- // ctRect.setWidth(ctRect.width() - (paddingLeft + paddingRight));
- // ctRect.setHeight(ctRect.height() - (paddingTop + paddingBottom));
- q->drawItemPixmap(painter, contentsRect,usedAlign, icon.pixmap(usedIconSize));
- }
- }
-}
-
-QRect QtMaemo6StylePrivate::getTextAndIconRect(const MButtonStyle *style,
- const QString &text,
- const QIcon &icon /* = QIcon()*/,
- const QFont &font /* = QFont()*/,
- const QSize &iconSize /* = QSize()*/) const
-{
- QRect textAndIconRect;
- QRect textRect = textBoundingRect(text, font);
- if (!text.isEmpty()) {
- textRect.setWidth(textRect.width() + style->textMarginLeft() + style->textMarginRight());
- textRect.setHeight(textRect.height() + style->textMarginTop() + style->textMarginBottom());
- }
- QSize usedIconSize = iconSize.isValid() ? iconSize : style->iconSize();
-
- if (hasHorizontalAlignment(style->iconAlign())) {
- if (!icon.isNull()) {
- QRect iconRect = QRect(QPoint(0, 0), usedIconSize);
- //TODO: currently the textMarginLeft is used as space between icon and text
- textAndIconRect = iconRect | textRect.translated(iconRect.width(), 0);
- //if the alignment is left -> calc with textMarginLeft
- //if the alignment is right -> calc with textMarginRight
- } else {
- textAndIconRect = textRect;
- }
- } else {
- if (!icon.isNull()) {
- QRect iconRect = QRect(QPoint(0, 0), usedIconSize);
- //TODO: currently the textMarginLeft is used as space between icon and text
- textAndIconRect = iconRect | textRect.translated(0, iconRect.height());
- //if the alignment is top -> calc with textMarginTop
- //if the alignment is bottom -> calc with textMarginBottom
- } else {
- textAndIconRect = textRect;
- }
- }
-
-// int paddingLeft, paddingTop, paddingRight, paddingBottom;
-// paddingFromStyle(style, &paddingLeft, &paddingTop, &paddingRight, &paddingBottom);
-//
-// //add margins to the final rect
-// textAndIconRect = QRect(textAndIconRect.x(), textAndIconRect.y(),
-// textAndIconRect.width() + paddingLeft + paddingRight,
-// textAndIconRect.height() + paddingTop + paddingBottom);
-
- return textAndIconRect;
-}
-
-QRect QtMaemo6StylePrivate::textBoundingRect(const QString &text, const QFont &font) const
-{
- QRect rect = QFontMetrics(font).boundingRect(text);
- return QRect(QPoint(0, 0), QSize(rect.x() + rect.width(), rect.height()));
-}
-
-void QtMaemo6StylePrivate::paddingFromStyle(const MWidgetStyle *style,
- int *left,
- int *top,
- int *right,
- int *bottom) const
-{
- if(style && style->backgroundImage()) {
- style->backgroundImage()->borders(left, right, top, bottom);
- if (left && style->paddingLeft() > *left)
- *left = style->paddingLeft();
- if (top && style->paddingTop() > *top)
- *top = style->paddingTop();
- if (right && style->paddingRight() > *right)
- *right = style->paddingRight();
- if (bottom && style->paddingBottom() > *bottom)
- *bottom = style->paddingBottom();
- } else {
- //if style is invalid or has no backgroundimage, return default padding 0
- *left = *top = *right = *bottom = 0;
- }
-}
-
-QSize QtMaemo6StylePrivate::heuristicSizeFromStyle(const MWidgetStyle *style) const
-{
- QSize os;
- if (style) {
- os = style->preferredSize();
- }
- return os;
-}
-
-
-QRect QtMaemo6StylePrivate::scrollBarSliderRect(const QStyleOptionComplex *option,
- const QWidget *widget /* = 0*/) const
-{
- Q_Q(const QtMaemo6Style);
- if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int sliderMaxLength = (scrollBar->orientation == Qt::Horizontal) ?
- scrollBar->rect.width() : scrollBar->rect.height();
- int sliderMinLength = q->proxy()->pixelMetric(QStyle::PM_ScrollBarSliderMin, scrollBar, widget);
- int sliderLength;
-
- // calculate slider length
- if (scrollBar->maximum != scrollBar->minimum) {
- uint valueRange = scrollBar->maximum - scrollBar->minimum;
- sliderLength = (scrollBar->pageStep * sliderMaxLength) / (valueRange + scrollBar->pageStep);
-
- if (sliderLength < sliderMinLength || valueRange > INT_MAX / 2)
- sliderLength = sliderMinLength;
- if (sliderLength > sliderMaxLength)
- sliderLength = sliderMaxLength;
- } else {
- sliderLength = sliderMaxLength;
- }
-
- int sliderStart = q->sliderPositionFromValue(scrollBar->minimum,
- scrollBar->maximum,
- scrollBar->sliderPosition,
- sliderMaxLength - sliderLength,
- scrollBar->upsideDown);
-
- QRect scrollBarRect = scrollBar->rect;
- QRect rect;
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(sliderStart, 0, sliderLength, scrollBarRect.height());
- } else {
- rect.setRect(0, sliderStart, scrollBarRect.width(), sliderLength);
- }
-
- return q->visualRect(scrollBar->direction, scrollBarRect, rect);
- }
- return QRect();
-}
-
-QPixmap QtMaemo6StylePrivate::borderCroppedPixmap(const MScalableImage* image,
- QSize size,
- int borders,
- int borderLines) const
-{
- QPixmap finalPix;
- quintptr pImage = reinterpret_cast<quintptr>(image);
- QString cacheKey = QString("%1_%2_%3_%4_%5").arg(pImage).arg(size.width()).arg(size.height()).arg(borders).arg(borderLines);
- if(QPixmapCache::find(cacheKey, finalPix))
- return finalPix;
-
- int usedLeftBorder, usedTopBorder, usedRightBorder, usedBottomBorder;
- image->borders(&usedLeftBorder, &usedTopBorder, &usedRightBorder, &usedBottomBorder);
-
- if(!(borders & topBorder))
- usedTopBorder = 0;
- if(!(borders & rightBorder))
- usedRightBorder = 0;
- if(!(borders & bottomBorder))
- usedBottomBorder = 0;
- if(!(borders & leftBorder))
- usedLeftBorder = 0;
-
- QSize tempPixmapSize = size;
-
- QPixmap pix(tempPixmapSize + QSize(usedLeftBorder + usedRightBorder, usedTopBorder + usedBottomBorder));
- pix.fill(Qt::transparent);
- QPainter pixPainter(&pix);
- image->draw(QRect(QPoint(0,0), pix.size()), &pixPainter);
-
- //take the border color from the outermost top centered pixel
- QColor borderColor = pix.copy(QRect(pix.size().width() / 2, 0, 1, 1)).toImage().pixel(0,0);
-
- //cut away borders
- finalPix = pix.copy(QRect(QPoint(usedLeftBorder,usedTopBorder), size));
-
- //draw the closing lines
- QPainter finalPainter(&finalPix);
- finalPainter.setPen(QPen(borderColor, 2));
- if(borderLines & leftBorder)
- finalPainter.drawLine(QPoint(1, 0), QPoint(1, finalPix.height()));
- if(borderLines & topBorder)
- finalPainter.drawLine(QPoint(0, 1), QPoint(finalPix.width(), 1));
- if(borderLines & rightBorder)
- finalPainter.drawLine(QPoint(finalPix.width()-1, 0), QPoint(finalPix.width()-1, finalPix.height()));
- if(borderLines & bottomBorder)
- finalPainter.drawLine(QPoint(0, finalPix.height()-1), QPoint(finalPix.width(), finalPix.height()-1));
-
- QPixmapCache::insert(cacheKey, finalPix);
- return finalPix;
-}
-
-Qt::Alignment QtMaemo6StylePrivate::invertAlignment(Qt::Alignment align) const
-{
- Qt::Alignment retAlign;
- //invert horizontal alignment
- if (align.testFlag(Qt::AlignLeft))
- retAlign = Qt::AlignRight;
- else if (align.testFlag(Qt::AlignRight))
- retAlign = Qt::AlignLeft;
- else if (align.testFlag(Qt::AlignHCenter))
- retAlign = Qt::AlignHCenter;
-
- //invert vertical alignment
- if (align.testFlag(Qt::AlignTop))
- retAlign |= Qt::AlignBottom;
- else if (align.testFlag(Qt::AlignBottom))
- retAlign = Qt::AlignTop;
- else if (align.testFlag(Qt::AlignVCenter))
- retAlign = Qt::AlignVCenter;
-
- return retAlign;
-}
-
-bool QtMaemo6StylePrivate::hasMWindowParent(const QWidget* w) const {
- QWidget* parent = w->parentWidget();
- while(qobject_cast<MWindow*>(parent))
- parent = parent->parentWidget();
- return parent != NULL;
-}
-
-QtMaemo6Style::QtMaemo6Style()
- : QtMaemo6TestStyle(*new QtMaemo6StylePrivate)
-{
- init();
-}
-
-QtMaemo6Style::~QtMaemo6Style()
-{
-
-}
-
-void QtMaemo6Style::init()
-{
-// QPixmapCache::setCacheLimit( 1000 );
-}
-
-int QtMaemo6Style::kineticScrollStartDelay() const {
- Q_D(const QtMaemo6Style);
- return d->m_kinetic->scrollStartDelay();
-}
-
-void QtMaemo6Style::setKineticScrollStartDelay(int delay) {
- Q_D(QtMaemo6Style);
- d->m_kinetic->setScrollStartDelay(delay);
-}
-
-int QtMaemo6Style::kineticScrollStartOffset() const {
- Q_D(const QtMaemo6Style);
- return d->m_kinetic->scrollStartOffset();
-}
-
-void QtMaemo6Style::setKineticScrollStartOffset(int offset) {
- Q_D(QtMaemo6Style);
- d->m_kinetic->setScrollStartOffset(offset);
-}
-
-int QtMaemo6Style::kineticDeaccelerationInterval() const {
- Q_D(const QtMaemo6Style);
- return d->m_kinetic->deaccelerationInterval();
-}
-
-void QtMaemo6Style::setKineticDeaccelerationInterval(int interval) {
- Q_D(QtMaemo6Style);
- d->m_kinetic->setDeaccelerationInterval(interval);
-}
-
-int QtMaemo6Style::kineticDeaccelerationStrength() const {
- Q_D(const QtMaemo6Style);
- return d->m_kinetic->deaccelerationStrength();
-}
-
-void QtMaemo6Style::setKineticDeaccelerationStrength(int strength) {
- Q_D(QtMaemo6Style);
- d->m_kinetic->setDeaccelerationStrength(strength);
-}
-
-int QtMaemo6Style::kineticMaxKineticScrollSpeed() const {
- Q_D(const QtMaemo6Style);
- return d->m_kinetic->maxKineticScrollSpeed();
-}
-
-void QtMaemo6Style::setKineticMaxKineticScrollSpeed(int speed) {
- Q_D(QtMaemo6Style);
- d->m_kinetic->setMaxKineticScrollSpeed(speed);
-}
-
-bool QtMaemo6Style::isStyled( const QWidget * widget ) const {
- return ! ( ( widget &&
- widget->dynamicPropertyNames().contains(M::NoMStyle) ) ||
- qApp->dynamicPropertyNames().contains(M::NoMStyle) );
-}
-
-bool QtMaemo6Style::isOrientationChangeEnabled() const {
- Q_D(const QtMaemo6Style);
- return d->m_isOrientationChangeEnabled;
-}
-
-void QtMaemo6Style::setOrientationChangeEnabled(bool b) {
- Q_D(QtMaemo6Style);
- d->m_isOrientationChangeEnabled = b;
-
- //only subscribe if it is really needed
-#ifdef HAVE_CONTEXTSUBSCRIBER
- if(b) {
- mDebug("PlainQt Style") << "Subscribing for Screen.TopEdge";
- d->m_orientation.waitForSubscription();
- disconnect(&d->m_orientation);
- if(!connect(&d->m_orientation, SIGNAL(valueChanged()), this, SLOT(doOrientationChange())))
- mDebug("PlainQt Style") << "Can't connect to orientation Change signal";
- }
-#endif //HAVE_CONTEXTSUBSCRIBER
-}
-
-M::OrientationAngle QtMaemo6Style::orientation() {
- M::OrientationAngle angle;
- QString edge;
-#ifdef HAVE_CONTEXTSUBSCRIBER
- Q_D(QtMaemo6Style);
- edge = d->m_orientation.value().toString();
-#endif //HAVE_CONTEXTSUBSCRIBER
-
- if (edge == "top") {
- angle = M::Angle0;
- } else if (edge == "left") {
- angle = M::Angle270;
- } else if (edge == "right") {
- angle = M::Angle90;
- //Rotation 180� should be disabled
- //} else if (edge == "bottom") {
- // angle = M::Angle180;
- } else {
- angle = M::Angle0;
- }
- return angle;
-}
-
-void QtMaemo6Style::orientation(int* o) {
- *o = static_cast<int>(orientation());
-}
-
-void QtMaemo6Style::polish(QApplication *app)
-{
- if(!isStyled()) {
- QPlastiqueStyle::polish(app);
- }
- else {
- QtMaemo6TestStyle::polish(app);
- }
-}
-
-void QtMaemo6Style::polish(QWidget *widget)
-{
- Q_D(QtMaemo6Style);
-
- if(qobject_cast<QDesktopWidget*>(widget))
- return;
-
- //Qt internal class, skip this
- if(d->m_excludeClasses.contains(widget->metaObject()->className()))
- return;
-
- if( !isStyled( widget ) ) {
- return;
- }
-
- if(qobject_cast<MWindow*>(widget)) {
- return;
- }
-
- /*
- //skip the scrollbar container widgets of QAbstractScrollAreas
- if( (widget->objectName().contains("qt_scrollarea_hcontainer")
- || widget->objectName().contains("qt_scrollarea_vcontainer")
- || widget->objectName().contains("qt_scrollarea_viewport"))
- && qobject_cast<MWindow*>(widget->parentWidget()))
- return;
- */
-
- //skip the viewports, they are done by the scrollarea
- if( QAbstractScrollArea* sa = qobject_cast<QAbstractScrollArea*>(widget->parentWidget())) {
- if(sa->viewport() == widget) //it's the viewport
- return;
- }
-
-#ifdef M_LOG_POLISH
- QString filename = QString("/tmp/mstyle_%1.log").arg( QCoreApplication::applicationFilePath().section('/', -1 ) );
-
- QFile file( filename );
- if (file.open(QIODevice::Append | QIODevice::Text)) {
- QTextStream out(&file);
- out << filename << " polish: " << (int)(widget) << " " << widget->metaObject()->className()
- << ' ' << widget->objectName() << "\n";
- file.close();
- }
- else {
- mDebug("PlainQt Style") << "unable to open" << filename;
- }
-#endif
-
- // Lazy initialization of the MFramework.
- // This is needed to guarantee that actual MApplications will work as well.
- if (!d->m_isMInitialized) {
- d->initM();
- }
-
- //Ensure that the widget draws its background transparent
- if (!qobject_cast<QtMaemo6WindowDecoration *>(widget)
- && !qobject_cast<QMenu *>(widget)
- && !qobject_cast<QtMaemo6DialogProxy *>(widget)) {
- if(!widget->testAttribute(Qt::WA_TranslucentBackground)) {
- //FIXME: public API usage
- QPalette pal = widget->palette();
- pal.setBrush(QPalette::Window, Qt::transparent);
- widget->setPalette(pal);
- }
- }
-
- if (QtMaemo6TitleBar *titleBar = qobject_cast<QtMaemo6TitleBar *>(widget)) {
- // apply properties of the navigation bar style
- const MNavigationBarStyle *style =
- static_cast<const MNavigationBarStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MNavigationBarStyle"));
- /*
- const MLabelStyle *menuStyle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_None,
- "MLabelStyle", "NavigationBarMenuButtonLabel"));
- Q_UNUSED( menuStyle );
- */
- if(style) {
- titleBar->setItemSpacing( style->itemSpacing() );
- titleBar->setFixedHeight( style->minimumSize().height() );
- }
- }
-
-
-#ifdef MOVE_ACTIONS_FROM_TOOLBAR_TO_TITLEBAR
- if (QtMaemo6TitleBar *titleBar = qobject_cast<QtMaemo6TitleBar *>(widget)) {
- foreach(QAction * action, d->m_toolBarActions) {
- titleBar->addAction(action);
- }
- }
-
- QToolBar *toolBar = qobject_cast<QToolBar *>(widget);
- if (toolBar && qobject_cast<QMainWindow *>(widget->parent())) {
- foreach(QAction * action, toolBar->actions()) {
- if (d->m_toolBarActions.count() < d->m_actionsInTitleBarCount) {
- d->m_toolBarActions.append(action);
- toolBar->removeAction(action);
- } else
- break;
- }
- if (toolBar->actions().isEmpty()) {
- QMainWindow *mw = qobject_cast<QMainWindow *>(widget->parent());
- mw->removeToolBar(toolBar);
- }
- }
-#endif
-
- if (qobject_cast<QScrollBar *>(widget)) {
- //skip the scrollbars if they are inside an MWindow
- if(d->hasMWindowParent(widget))
- return;
- //FIXME: public API usage
- widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
- d->m_scrollBarEventFilter->enableOn(widget);
- }
-
- if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(widget)) {
- d->m_kinetic->enableOn(abstractScrollArea);
- d->m_kinetic->setRightToLeft(qApp->isRightToLeft());
- d->m_scrollBarEventFilter->enableOn(abstractScrollArea);
-
- //must use inherits() because it's an private Qt class
- if (!abstractScrollArea->inherits("QComboBoxListView")) {
- //don't do this for QComboBoxListView, because it uses the QItemDelegate
- //which not uses the style
- QPalette pal = abstractScrollArea->viewport()->palette();
- pal.setBrush(QPalette::Base, Qt::transparent);
- abstractScrollArea->viewport()->setPalette(pal);
- } else {
- //this must be set for ComboBox DropDowns, don't know why!
- QPalette pal = abstractScrollArea->viewport()->palette();
- pal.setBrush(QPalette::Base, Qt::white);
- abstractScrollArea->viewport()->setPalette(pal);
- }
- }
-
- if (QStatusBar *statusBar = qobject_cast<QStatusBar *>(widget)) {
- //only use statusbars directly from MainWindow
- if (qobject_cast<QMainWindow *>(statusBar->parent())) {
- //FIXME: add handling here for not showing empty statusbars
- d->m_statusBar = statusBar;
- }
- //FIXME: Public API usage
- //FIXME: Figure out why this triggers a crash with Qt 4.7
-// statusBar->setSizeGripEnabled(false);
- }
-
- if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(widget)) {
- //Only take the menubar from the main window
- //TODO: this doesn't work for applications that use shared menuBars, like eg. some
- // mac applications do.
- if (menuBar->parent()) {
- if (qobject_cast<QMainWindow *>(menuBar->parent())) {
- d->m_menuBar = menuBar;
- //do not remove the menuBar from the mainWindow, it may be changed
- //by the user
- }
- }
- }
-
- if (QtMaemo6WindowDecoration *decoration = qobject_cast<QtMaemo6WindowDecoration *>(widget)) {
- if (d->m_statusBar)
- decoration->setStatusBar(d->m_statusBar);
- if (d->m_menuBar)
- decoration->setMenuBar(d->m_menuBar);
- }
-
- if(QComboBox* comboBox = qobject_cast<QComboBox*>(widget)) {
- if(comboBox->isEditable()) {
- comboBox->lineEdit()->setVisible(false);
- }
- }
- if(QHeaderView* hView = qobject_cast<QHeaderView*>(widget)) {
- hView->viewport()->setBackgroundRole(QPalette::Window);
- }
-
- if(QSlider* slider = qobject_cast<QSlider*>(widget)) {
- QtMaemo6SliderPopUp* sliderPopup = new QtMaemo6SliderPopUp();
- sliderPopup->enableOn(slider);
- const MLabelStyle *labelTitle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MLabelStyle", "MSliderHandleLabel"));
- QPalette pal = sliderPopup->palette();
- pal.setColor(QPalette::WindowText, labelTitle->color());
- sliderPopup->setPalette(pal);
- }
- if(QLineEdit* le = qobject_cast<QLineEdit*>(widget)) {
- const MTextEditStyle *styleActive =
- static_cast<const MTextEditStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
- "MTextEditStyle"));
- const MTextEditStyle *styleInactive =
- static_cast<const MTextEditStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_None,
- "MTextEditStyle"));
- if(styleActive && styleInactive) {
- QPalette pal = le->palette();
- pal.setColor(QPalette::Inactive, QPalette::Foreground, styleInactive->textColor());
- pal.setColor(QPalette::Active, QPalette::Foreground, styleActive->textColor());
- le->setPalette(pal);
- }
- }
- widget->installEventFilter(d->m_windowEventFilter);
-}
-
-void QtMaemo6Style::drawPrimitive(PrimitiveElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget) const
-{
- if( !isStyled( widget ) ) {
- QPlastiqueStyle::drawPrimitive(element, option, painter, widget);
- return;
- }
-
- // Handle rare case where this method is invoked before the polish is invoked
- Q_D(const QtMaemo6Style);
- if (!d->m_isMInitialized) {
- mDebug("PlainQt Style") << Q_FUNC_INFO << "entered before initialization of MComponentData";
- return;
- }
-
- switch (element) {
- case PE_Widget: {
- if (qobject_cast<const QtMaemo6Menu *>(widget)) {
- const MApplicationMenuStyle *style =
- static_cast<const MApplicationMenuStyle *>(
- QtMaemo6StylePrivate::mStyle(option->state, "MApplicationMenuStyle"));
- // draw widget background
- d->drawScalableImage(painter, option, widget->rect(), style->canvasImage(), style, widget, "canvas-image");
- }
- }
- break;
-
- case PE_PanelLineEdit: {
- // don't draw the line edit, if it is part of a spinbox or a combobox
- if (widget && (qobject_cast<QAbstractSpinBox *>(widget->parent()) || qobject_cast<QComboBox*>(widget->parent()))) {
- mDebug("PlainQt Style") << "### skipping LineEdit";
- break;
- }
-
- if (widget) {
- if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- const MTextEditStyle *style =
- static_cast<const MTextEditStyle *>(QtMaemo6StylePrivate::mStyle(panel->state,
- "MTextEditStyle", "", "", widget->hasFocus()));
- if(style) {
- drawBackground(painter, option, panel->rect, style, widget);
- } else {
- qCritical() << "Could not load MTextEditStyle for QLineEdit";
- }
- }
- }
- }
- break;
- case PE_PanelItemViewItem: { //draw the background of ItemViewItems
- if (const QStyleOptionViewItemV4 *item = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- const MContentItemStyle *style =
- static_cast<const MContentItemStyle *>(QtMaemo6StylePrivate::mStyle(item->state,
- "MContentItemStyle"));
- const QAbstractItemModel *model = item->index.model();
-
- //it's a simple Listview
- if (model->columnCount() == 1) {
- if (model->rowCount() == 1) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageSingle(), style);
- } else if (item->index.row() == 0) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageSinglecolumnTop(), style);
- } else if (item->index.row() == model->rowCount() - 1) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageSinglecolumnBottom(), style);
- } else {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageSinglecolumnCenter(), style);
- }
- } else {
- //TODO: Add implementation for tableviews here
- QtMaemo6TestStyle::drawPrimitive(element, option, painter, widget);
- if (model->rowCount() == 1) {
- if (item->index.column() == 0) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageSinglerowLeft(), style);
- } else if (item->index.column() == model->columnCount() - 1) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageSinglerowRight(), style);
- } else {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageSinglerowCenter(), style);
- }
- } else if (item->index.row() == 0) {
- if (item->index.column() == 0) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageTopLeft(), style);
- } else if (item->index.column() == model->columnCount() - 1) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageTopRight(), style);
- } else {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageTop(), style);
- }
- } else if (item->index.row() == model->rowCount() - 1) {
- if (item->index.column() == 0) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageBottomLeft(), style);
- } else if (item->index.column() == model->columnCount() - 1) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageBottomRight(), style);
- } else {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageBottom(), style);
- }
- } else {
- if (item->index.column() == 0) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageLeft(), style);
- } else if (item->index.column() == model->columnCount() - 1) {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageRight(), style);
- } else {
- d->drawScalableImage(painter, option, item->rect, style->backgroundImageCenter(), style);
- }
- }
- }
-
- }
- }
- break;
- case PE_IndicatorBranch: {
- QtMaemo6TestStyle::drawPrimitive(element, option, painter, widget);
- if (option->state.testFlag(QStyle::State_Children)) {
- QToolButton button;
- QStyleOptionToolButton buttonOption;
- buttonOption.initFrom(&button);
- buttonOption.rect = option->rect;
- if (option->state.testFlag(QStyle::State_Open)) {
- buttonOption.text = '-';
- } else {
- buttonOption.text = '+';
- }
-
- QSize size = sizeFromContents(QStyle::CT_ToolButton, &buttonOption, QSize(), &button);
-
- QRect buttonRect = QRect(option->rect.left() + (option->rect.width() - size.width()) / 2,
- option->rect.top() + (option->rect.height() - size.height()) / 2,
- size.width(), size.height());
- buttonOption.rect = buttonRect;
-
- drawComplexControl(QStyle::CC_ToolButton, &buttonOption, painter, &button);
- }
- }
- break;
- case PE_Frame: {
- //don't draw the frame for item views, this is done by the items themselfs
- if (qobject_cast<const QAbstractItemView *>(widget)) {
- } else
- QtMaemo6TestStyle::drawPrimitive(element, option, painter, widget);
- }
- break;
- case PE_FrameFocusRect: {
- //The focus rect of selected items in AbstractItemViews
- //don't draw anything here
- }
- default: {
- QtMaemo6TestStyle::drawPrimitive(element, option, painter, widget);
- }
- break;
- }
-
-}
-
-void QtMaemo6Style::drawControl(ControlElement element,
- const QStyleOption *opt,
- QPainter *p,
- const QWidget *widget) const
-{
- if( !isStyled( widget ) ) {
- QPlastiqueStyle::drawControl(element, opt, p, widget);
- return;
- }
-
- // Handle rare case where this method is invoked before the polish is invoked
- Q_D(const QtMaemo6Style);
- if (!d->m_isMInitialized) {
- mDebug("PlainQt Style") << Q_FUNC_INFO << "entered before initialization of MComponentData";
- return;
- }
-
- switch (element) {
-
- case CE_ComboBoxLabel: {
- mDebug("PlainQt Style") << "### Combobox line edit";
- }
- break;
-
- case CE_PushButton: {
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
-
- QStyleOptionButton subopt = *btn;
- subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
-
- const QAbstractButton *buttonWidget = qobject_cast<const QAbstractButton * >(widget);
- if (buttonWidget && buttonWidget->isCheckable())
- d->drawToggleButton(p, subopt.text, subopt.icon, subopt.rect, opt, "MButtonStyle");
- else
- d->drawBasicButton(p, subopt.text, subopt.icon, subopt.rect, opt, "MButtonStyle");
- }
- }
- break;
-
- case CE_ProgressBar: {
- if (const QStyleOptionProgressBar * pb
- = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
- QStyleOptionProgressBarV2 subopt = *pb;
- subopt.rect = subElementRect(SE_ProgressBarGroove, pb, widget);
- proxy()->drawControl(CE_ProgressBarGroove, &subopt, p, widget);
- subopt.rect = subElementRect(SE_ProgressBarContents, pb, widget);
- proxy()->drawControl(CE_ProgressBarContents, &subopt, p, widget);
- }
- }
- break;
-
- case CE_RadioButton:
- case CE_CheckBox: {
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
-
- bool isCheckBox = (element == CE_CheckBox);
-
- QStyleOptionButton subopt = *btn;
- subopt.rect = subElementRect(isCheckBox ? SE_CheckBoxIndicator
- : SE_RadioButtonIndicator,
- btn, widget);
-
- d->drawCheckBox(p, QString(), subopt.icon, subopt.rect, opt);
-
- subopt.rect = subElementRect(isCheckBox ? SE_CheckBoxContents
- : SE_RadioButtonContents,
- btn, widget);
-
- proxy()->drawControl(isCheckBox ? CE_CheckBoxLabel
- : CE_RadioButtonLabel,
- &subopt, p, widget);
- }
- break;
- }
- case CE_TabBarTabShape: {
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
-
- QStyleOptionButton btn;
- btn.initFrom(widget);
- btn.rect = tab->rect;
- btn.state = tab->state;
-
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(opt->state,
- "MButtonStyle"));
- // Don't show the edge of the button that is closest to the
- // TabBarBase.
- // FIXME: Solve for other tab bar orientations
- if (style && style->backgroundImage()) {
- int left, right, top, bottom;
- style->backgroundImage()->borders(&left, &right, &top, &bottom);
-
- qreal cutOff = 0;
- qreal origSize = 0;
-
- const QPixmap *pixmap = style->backgroundImage()->pixmap();
- if (pixmap) {
- int buttonHeight = btn.rect.height();
- int buttonWidth = btn.rect.width();
-
- switch (tab->shape) {
- case QTabBar::RoundedNorth:
- case QTabBar::TriangularNorth:
- cutOff = bottom;
- origSize = pixmap->height();
- btn.rect.setHeight(buttonHeight * origSize / (origSize - cutOff));
- break;
-
- case QTabBar::RoundedSouth:
- case QTabBar::TriangularSouth:
- cutOff = top;
- origSize = pixmap->height();
- btn.rect.setTop(-buttonHeight * cutOff / origSize);
- btn.rect.setHeight(buttonHeight * origSize / (origSize - cutOff));
- break;
-
- case QTabBar::RoundedWest:
- case QTabBar::TriangularWest:
- cutOff = right;
- origSize = pixmap->width();
- btn.rect.setWidth(buttonWidth * origSize / (origSize - cutOff));
- break;
-
- case QTabBar::RoundedEast:
- case QTabBar::TriangularEast:
- cutOff = left;
- origSize = pixmap->width();
- btn.rect.setLeft(-buttonWidth * cutOff / origSize);
- btn.rect.setWidth(buttonWidth * origSize / (origSize - cutOff));
- break;
-
- default:
- break;
- }
- }
- }
-
- d->drawBasicButton(p, QString(), QIcon(),
- btn.rect, &btn, style);
- p->setPen(style->textColor());
- p->drawText(tab->rect, tab->text, QTextOption(Qt::AlignCenter));
- }
- break;
- }
- case CE_TabBarTabLabel:
- // don't draw the label, it's already handled by CE_TabBarTabShape
- break;
- case CE_ToolBar: {
- //const QToolBar* toolBar = qobject_cast<const QToolBar*>(widget);
- if (widget->actions().count() > 0)
- QtMaemo6TestStyle::drawControl(element, opt, p, widget);
- break;
- }
- case CE_ProgressBarGroove: {
- if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
- const MProgressIndicatorStyle *style =
- static_cast<const MProgressIndicatorStyle *>(QtMaemo6StylePrivate::mStyle(bar->state,
- "MProgressIndicatorStyle", QString(), "bar"));
- if (style && style->backgroundImage())
- d->drawScalableImage(p, opt, bar->rect, style->backgroundImage(), style, widget, "groove");
- }
- break;
- }
- case CE_ProgressBarContents: {
-
- if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
- const MProgressIndicatorStyle *style =
- static_cast<const MProgressIndicatorStyle *>(QtMaemo6StylePrivate::mStyle(bar->state,
- "MProgressIndicatorStyle", QString(), "bar"));
- if (style && style->knownBarTexture()) {
-
- bool reverse = qApp->isRightToLeft();
-
- QRect r(bar->rect);
-
- int left, right;
- style->knownBarTexture()->borders(&left, &right, NULL, NULL);
-
- qreal position = (qreal)(bar->progress - bar->minimum) / (qreal)(bar->maximum - bar->minimum);
- qreal distance = position * (qreal) r.width();
-
- // need to draw in 1 or 2 parts, depending if the indicator element goes across the ends
- // one draw call
- if (!reverse) {
- r.setLeft(0);
- r.setRight(distance);
- } else {
- r.setRight(r.width());
- r.setLeft(r.width() - distance);
- }
- d->drawScalableImage(p, opt, r, style->knownBarTexture(), style, widget, "contents", false);
- }
- }
- break;
- }
- case CE_ScrollBarAddLine:
- case CE_ScrollBarSubLine:
- case CE_ScrollBarAddPage:
- case CE_ScrollBarSubPage:
- case CE_ScrollBarFirst:
- case CE_ScrollBarLast:
- //QtMaemo6TestStyle::drawControl(element, opt, p, widget);
- //these cases do not occur
- break;
- case CE_ScrollBarSlider: {
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- const MPositionIndicatorStyle *style =
- static_cast<const MPositionIndicatorStyle *>(QtMaemo6StylePrivate::mStyle(slider->state,
- "MPositionIndicatorStyle"));
-
- drawBackground(p, opt, slider->rect, style, widget);
-
- //retrieving the slider size, and position within the groove
- QRect scSliderRect = subControlRect(CC_ScrollBar, slider, SC_ScrollBarSlider, widget);
-
- d->drawScalableImage(p, opt, scSliderRect, style->indicatorImage(), style, widget, "groove", false);
- }
- }
- break;
- case CE_ItemViewItem: {
- if (const QStyleOptionViewItemV4 *item = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- proxy()->drawPrimitive(PE_PanelItemViewItem, opt, p, widget);
- const MContentItemStyle *style =
- static_cast<const MContentItemStyle *>(QtMaemo6StylePrivate::mStyle(item->state,
- "MContentItemStyle"));
- if(style) {
- const MLabelStyle *labelTitle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(item->state,
- "MLabelStyle", style->titleObjectName()));
- //subtitles for list view items are currently not supported by qt.
- //const MLabelStyle* labelSubTitle =
- // static_cast<const MLabelStyle*>( QtMaemo6StylePrivate::mStyle( item->state,
- // "MLabelStyle", style->subtitleObjectName() ) );
- const MImageWidgetStyle *labelIcon =
- static_cast<const MImageWidgetStyle *>(QtMaemo6StylePrivate::mStyle(item->state,
- "MImageWidgetStyle", style->imageObjectName()));
-
- QString itemText = qvariant_cast<QString>(item->index.data(Qt::DisplayRole));
- QIcon itemIcon = qvariant_cast<QIcon>(item->index.data(Qt::DecorationRole));
-
- QRect rect = item->rect;
-
- if (!itemIcon.isNull() && labelIcon) {
- rect.setTop(rect.top() + labelIcon->marginTop());
- rect.setLeft(rect.left() + labelIcon->marginLeft());
- p->drawPixmap(rect.topLeft(), itemIcon.pixmap(labelIcon->preferredSize()));
- rect.setLeft(rect.left() + labelIcon->preferredSize().width() + labelIcon->marginRight());
- }
-
- if(labelTitle) {
- rect.setLeft(rect.left() + labelTitle->marginLeft());
- QFont labelFont = labelTitle->font();
-
- p->setFont(labelFont);
- p->setPen(labelTitle->color());
-
- p->drawText(rect, itemText, QTextOption(Qt::AlignLeft | Qt::AlignTop));
- }
- }
- }
- }
- break;
- case CE_HeaderSection: {
- if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
- const MButtonStyle * style =
- static_cast<const MButtonStyle *>( QtMaemo6StylePrivate::mStyle( header->state,
- "MButtonStyle") );
-
- if(style) {
- int left, top, right, bottom;
- style->backgroundImage()->borders(&left, &top, &right, &bottom);
-
- p->fillRect(opt->rect, Qt::transparent);
-
- QtMaemo6StylePrivate::Borders leftBorder = QtMaemo6StylePrivate::leftBorder;
- QtMaemo6StylePrivate::Borders rightBorder = QtMaemo6StylePrivate::rightBorder;
-
- if(opt->direction == Qt::RightToLeft) {
- leftBorder = QtMaemo6StylePrivate::rightBorder;
- rightBorder = QtMaemo6StylePrivate::leftBorder;
- }
-
- if(header->orientation == Qt::Horizontal) {
- if(header->position == QStyleOptionHeader::Beginning) {
- QPixmap pix = d->borderCroppedPixmap(style->backgroundImage(), opt->rect.size(),
- QtMaemo6StylePrivate::bottomBorder | rightBorder);
- p->drawPixmap(opt->rect.topLeft(), pix);
- } else if(header->position == QStyleOptionHeader::Middle) {
- QPixmap pix = d->borderCroppedPixmap(style->backgroundImage(), opt->rect.size(),
- QtMaemo6StylePrivate::bottomBorder | rightBorder | leftBorder,
- QtMaemo6StylePrivate::bottomBorder | rightBorder);
- p->drawPixmap(opt->rect.topLeft(), pix);
- } else if(header->position == QStyleOptionHeader::End) {
- QPixmap pix = d->borderCroppedPixmap(style->backgroundImage(), opt->rect.size(),
- QtMaemo6StylePrivate::bottomBorder | leftBorder,
- QtMaemo6StylePrivate::bottomBorder);
- p->drawPixmap(opt->rect.topLeft(), pix);
- }
- } else if(header->orientation == Qt::Vertical) {
- if(header->position == QStyleOptionHeader::Beginning) {
- QPixmap pix = d->borderCroppedPixmap(style->backgroundImage(), opt->rect.size(),
- QtMaemo6StylePrivate::bottomBorder | rightBorder);
- p->drawPixmap(opt->rect.topLeft(), pix);
- } else if(header->position == QStyleOptionHeader::Middle) {
- QPixmap pix = d->borderCroppedPixmap(style->backgroundImage(), opt->rect.size(),
- QtMaemo6StylePrivate::bottomBorder | QtMaemo6StylePrivate::topBorder | rightBorder,
- QtMaemo6StylePrivate::bottomBorder | rightBorder);
- p->drawPixmap(opt->rect.topLeft(), pix);
- } else if(header->position == QStyleOptionHeader::End) {
- QPixmap pix = d->borderCroppedPixmap(style->backgroundImage(), opt->rect.size(),
- QtMaemo6StylePrivate::topBorder | rightBorder,
- rightBorder);
- p->drawPixmap(opt->rect.topLeft(), pix);
- }
- }
-
- p->setPen(style->textColor());
- p->drawText(header->rect, header->text, QTextOption(Qt::AlignCenter));
- }
- }
- }
- break;
- case CE_HeaderLabel:
- // don't draw header labels, it's already done by CE_HeaderSection
- break;
- default: {
- QtMaemo6TestStyle::drawControl(element, opt, p, widget);
- }
- break;
- }
-}
-
-void QtMaemo6Style::drawComplexControl(ComplexControl control,
- const QStyleOptionComplex *opt,
- QPainter *p,
- const QWidget *widget /* = 0*/) const
-{
- if( !isStyled( widget ) ) {
- QPlastiqueStyle::drawComplexControl(control, opt, p, widget);
- return;
- }
-
- // Handle rare case where this method is invoked before the polish is invoked
- Q_D(const QtMaemo6Style);
- if (!d->m_isMInitialized) {
- mDebug("PlainQt Style") << Q_FUNC_INFO << "entered before initialization of MComponentData";
- return;
- }
-
- switch (control) {
- case CC_ComboBox: {
- if (const QStyleOptionComboBox *btn = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
- mDebug("PlainQt Style") << "### drawing ComboBox";
- QStyleOptionComboBox subopt = *btn;
- subopt.rect = subControlRect(control, opt, SC_ToolButton, widget);
-
- const MComboBoxStyle *cbStyle =
- static_cast<const MComboBoxStyle *>(QtMaemo6StylePrivate::mStyle(subopt.state, "MComboBoxStyle", "", "button"));
- const MListItemStyle *liStyle =
- static_cast<const MListItemStyle *>(QtMaemo6StylePrivate::mStyle(subopt.state, "MListItemStyle", "", "button", false, new MComboBox()));
-
- if (widget)
- d->drawComboBoxButton(p, cbStyle, liStyle, subopt.currentText, subopt.rect, opt, widget->layoutDirection());
- else
- d->drawComboBoxButton(p, cbStyle, liStyle, subopt.currentText, subopt.rect, opt, qApp->layoutDirection());
- }
- }
- break;
- case CC_ToolButton: {
- QWidget *parentOfControl = widget->parentWidget();
-
- if (const QStyleOptionToolButton *btn = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
- QStyleOptionToolButton subopt = *btn;
- subopt.rect = subControlRect(control, opt, SC_ToolButton, widget);
-
- //a ToolButton on a ToolBar
- if (qobject_cast<QToolBar *>(parentOfControl)) {
- QtMaemo6TestStyle::drawComplexControl(control, opt, p, widget);
- //a ToolButton on the MTitleBar
- } else if (qobject_cast<QtMaemo6TitleBar *>(parentOfControl)) {
- QtMaemo6TestStyle::drawComplexControl(control, opt, p, widget);
- //a ToolButton anywhere else on the Screen should be drawn like a PushButton
- } else {
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(subopt.state, "MButtonStyle"));
- const MButtonStyle *styleFont =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(subopt.state, "MButtonStyle",
- "NavigationBarToolBarButton"));
-
-// qDebug("PlainQt Style: Button \"%s\" font-size: %d, icon-size: %d", subopt.text.toLocal8Bit().constData(),
-// styleFont->font().pixelSize(), styleFont->iconSize().width());
-
- d->drawBasicButton(p, subopt.text, subopt.icon, subopt.rect, opt, style, styleFont->font(), styleFont->iconSize());
- }
- }
- }
- break;
-
- case CC_Slider: {
- p->save();
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- const MSliderStyle *style =
- static_cast<const MSliderStyle *>(QtMaemo6StylePrivate::mStyle(slider->state,
- "MSliderStyle"));
-
- // draw widget background
- drawBackground(p, opt, widget->rect(), style, widget);
-
- // draw groove
- bool isHorizontal = slider->orientation == Qt::Horizontal;
-
- QRect grooveArea = proxy()->subControlRect(CC_Slider, opt,
- SC_SliderGroove,
- widget);
-
- int maxSliderLength = proxy()->pixelMetric(PM_SliderLength,
- slider, widget);
- int grooveThickness = style->grooveThickness();
-
- QRect grooveRect;
- if (isHorizontal) {
- grooveRect = grooveArea.adjusted(maxSliderLength / 2,
- (grooveArea.height() - grooveThickness) / 2,
- - maxSliderLength / 2,
- - (grooveArea.height() - grooveThickness) / 2);
- } else {
- grooveRect = grooveArea.adjusted((grooveArea.width() - grooveThickness) / 2,
- maxSliderLength / 2,
- - (grooveArea.width() - grooveThickness) / 2,
- - maxSliderLength / 2);
- }
-
- QtMaemo6StylePrivate::drawSliderBaseBackground(p, opt, grooveRect, style, maxSliderLength);
-
- // Handle
- QPixmap handlePixmap;
-
- if (isHorizontal) {
- const QPixmap *handleSourcePixmap =
- (slider->state & State_Sunken)
- ? style->handlePressedPixmap()
- : style->handlePixmap();
- handlePixmap = *handleSourcePixmap;
- } else {
- const QPixmap *handleSourcePixmap =
- (slider->state & State_Sunken)
- ? style->handleVerticalPressedPixmap()
- : style->handleVerticalPixmap();
- handlePixmap = *handleSourcePixmap;
- }
-
- QRect handleRect = proxy()->subControlRect(CC_Slider, opt,
- SC_SliderHandle,
- widget);
- p->drawPixmap(handleRect, handlePixmap);
- }
- p->restore();
- }
- break;
- case CC_SpinBox: {
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
- p->save();
-
- // Draw the line edit background
- QStyleOptionFrame frameOpt;
- if (QLineEdit *lineedit = qFindChild<QLineEdit *>(widget))
- frameOpt.initFrom(lineedit);
-
- frameOpt.rect = spinBox->rect;
- frameOpt.state |= QStyle::State_Sunken;
-
- drawPrimitive(QStyle::PE_PanelLineEdit, &frameOpt, p, widget);
-
- bool upSunken = (spinBox->activeSubControls & SC_SpinBoxUp) && (spinBox->state & (State_Sunken | State_On));
- bool downSunken = (spinBox->activeSubControls & SC_SpinBoxDown) && (spinBox->state & (State_Sunken | State_On));
-
- // Rects
- QRect upRect = proxy()->subControlRect(CC_SpinBox, opt, SC_SpinBoxUp, widget);
- QRect downRect = proxy()->subControlRect(CC_SpinBox, opt, SC_SpinBoxDown, widget);
- QRect frameEditRect = proxy()->subControlRect(CC_SpinBox, opt, SC_SpinBoxEditField, widget);
-
- // Best guess for size of +/- symbols
- int offset = frameEditRect.height() / 6;
- if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
- QPoint center;
- if (spinBox->subControls & SC_SpinBoxUp) {
- center = upRect.center();
- // offset for pressed state
- if (upSunken) {
- ++center.rx();
- ++center.ry();
- }
-
- // Choose correct palette for + symbol
- QPalette pal = spinBox->palette;
- if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
- pal.setCurrentColorGroup(QPalette::Disabled);
- }
- // Draw + symbol
- QBrush indicatorBrush = pal.buttonText();
- p->setPen(QPen(indicatorBrush, 2));
-
- p->drawLine(center.x(), center.y() - offset, center.x(), center.y() + offset);
- p->drawLine(center.x() - offset, center.y(), center.x() + offset, center.y());
- }
- if (spinBox->subControls & SC_SpinBoxDown) {
- center = downRect.center();
- // offset for pressed state
- if (downSunken) {
- ++center.rx();
- ++center.ry();
- }
-
- // Choose correct palette for - symbol
- QPalette pal = spinBox->palette;
- if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
- pal.setCurrentColorGroup(QPalette::Disabled);
- }
- // Draw - symbol
- QBrush indicatorBrush = pal.buttonText();
- p->setPen(QPen(indicatorBrush, 2));
-
- p->drawLine(center.x() - offset, center.y(), center.x() + offset, center.y());
- }
- }
-
- // Draw the separator lines between the edit rect and the buttons
- QPen separatorPen(Qt::DashLine);
- p->setPen( separatorPen );
-
- p->drawLine( frameEditRect.topRight() + QPoint(1,0),
- frameEditRect.bottomRight() + QPoint(1,0) );
- p->drawLine( frameEditRect.topLeft() - QPoint(1,0),
- frameEditRect.bottomLeft() - QPoint(1,0) );
-
- p->restore();
- }
- }
- break;
- case CC_ScrollBar: {
- drawControl(CE_ScrollBarSlider, opt, p, widget);
- }
- break;
- case CC_GroupBox: {
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
- const MContainerStyle *groupBoxStyle =
- static_cast<const MContainerStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MContainerStyle"));
- //causes problems because requires to include a private header file
- //MContainerHeader containerHeaderLabel;
- //const MLabelStyle * headerLabelStyle =
- // static_cast<const MLabelStyle *>( QtMaemo6StylePrivate::mStyle( groupBox->state,
- // "MLabelStyle", "", "", &containerHeaderLabel ) );
-
- const MLabelStyle *headerStyle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MContainerHeaderStyle"));
-
- const MSeparatorStyle *separatorStyle =
- static_cast<const MSeparatorStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MSeparatorStyle"));
-
- if(groupBoxStyle && headerStyle && separatorStyle) {
- QRect headerTextRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget);
-
- int headMarginLeft = headerStyle->paddingLeft()
- + headerStyle->marginLeft();
- int headMarginRight = headerStyle->paddingRight()
- + headerStyle->marginRight();
- int headMarginBottom = headerStyle->paddingBottom()
- + headerStyle->marginBottom()
- + 4; // Make it look good fix (while the header text padding in mcontainer is broken)
-
- QRect unitedRect = headerTextRect.united(checkBoxRect);
- int headerBottom = unitedRect.bottom() + headMarginBottom;
-
- int sepMarginLeft = separatorStyle->marginLeft() + separatorStyle->paddingLeft();
- int sepMarginRight = separatorStyle->marginRight() + separatorStyle->paddingRight();
- int sepMarginTop = separatorStyle->marginTop() + separatorStyle->paddingTop();
-
- QRect separatorRect(groupBox->rect.left() + sepMarginLeft,
- headerBottom + sepMarginTop,
- groupBox->rect.width()
- - headMarginLeft - headMarginRight
- - sepMarginLeft - sepMarginRight,
- separatorStyle->span());
-
- // Draw frame
- // Draw widget background
- QRect headerRect = widget->rect();
- headerRect.setBottom(headerBottom);
- QRect containerRect = widget->rect();
- containerRect.adjust(0, headerRect.height(), 0, 0);
-
- drawBackground(p, groupBox, headerRect, headerStyle, widget);
- drawBackground(p, groupBox, containerRect, groupBoxStyle, widget);
- // drawWidgetBackground( p, groupBox, separatorRect, separatorStyle );
-
- // Draw title
- if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
-
- QColor headerColor = Qt::white; //FIXME: = headerLabelStyle->color();
- if (headerColor.isValid()) {
- p->setPen(headerColor);
- }
-
- int alignment = int(groupBox->textAlignment);
- if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, opt, widget))
- alignment |= Qt::TextHideMnemonic;
-
- p->drawText(headerTextRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
- groupBox->text);
- }
-
- // Draw checkbox
- if (groupBox->subControls & SC_GroupBoxCheckBox) {
- d->drawCheckBox(p, QString(), QIcon(), checkBoxRect, groupBox);
- }
- }
- }
- }
- break;
- default: {
- QtMaemo6TestStyle::drawComplexControl(control, opt, p, widget);
- }
- break;
- }
-}
-
-QRect QtMaemo6Style::subControlRect(ComplexControl control,
- const QStyleOptionComplex *option,
- SubControl subControl,
- const QWidget *widget /* = 0*/) const
-{
- if( !isStyled( widget ) ) {
- return QPlastiqueStyle::subControlRect(control, option, subControl, widget);
- }
-
- // Handle rare case where this method is invoked before the polish is invoked
- Q_D(const QtMaemo6Style);
- if (!d->m_isMInitialized) {
- mDebug("PlainQt Style") << Q_FUNC_INFO << "entered before initialization of MComponentData";
- return QRect();
- }
-
- switch (control) {
- case CC_ToolButton: {
- }
- break;
-
- case CC_Slider: {
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int maxSliderThickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
- int maxSliderLength = proxy()->pixelMetric(PM_SliderLength, slider, widget);
- bool isHorizontal = (slider->orientation == Qt::Horizontal);
-
- switch (subControl) {
- case SC_SliderHandle: {
- int span = (isHorizontal)
- ? slider->rect.width() - maxSliderLength
- : slider->rect.height() - maxSliderLength;
-
- int handlePos = sliderPositionFromValue(slider->minimum,
- slider->maximum,
- slider->sliderPosition,
- span,
- slider->upsideDown);
- if (isHorizontal)
- return QRect(slider->rect.x() + handlePos,
- slider->rect.y(),
- maxSliderLength,
- maxSliderThickness);
- else
- return QRect(slider->rect.x(),
- slider->rect.y() + handlePos,
- maxSliderThickness,
- maxSliderLength);
- }
- break;
- case SC_SliderGroove: {
- if (isHorizontal)
- return QRect(slider->rect.x(),
- slider->rect.y(),
- slider->rect.width(),
- maxSliderThickness);
- else
- return QRect(slider->rect.x(),
- slider->rect.y(),
- maxSliderThickness,
- slider->rect.height());
- }
- break;
- default:
- break;
- }
- }
- }
- break;
- case CC_SpinBox: {
- QRect rect;
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
-
- int widthPlusMinus = spinBox->rect.height();
-
- switch (subControl) {
- case SC_SpinBoxUp:
- if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons)
- return QRect();
- rect = visualRect(spinBox->direction, spinBox->rect, rect);
- rect.setRect(spinBox->rect.right() - widthPlusMinus,
- spinBox->rect.top(),
- widthPlusMinus,
- spinBox->rect.height());
- rect = visualRect(spinBox->direction, spinBox->rect, rect);
- break;
- case SC_SpinBoxDown:
- if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons)
- return QRect();
- rect = visualRect(spinBox->direction, spinBox->rect, rect);
- rect.setRect(spinBox->rect.left(),
- spinBox->rect.top(),
- widthPlusMinus,
- spinBox->rect.height());
- rect = visualRect(spinBox->direction, spinBox->rect, rect);
- break;
- case SC_SpinBoxEditField: {
- int frameLeft = 0;
- int frameRight = 0;
- int frameTop = 0;
- int frameBottom = 0;
-
- const MTextEditStyle *style =
- static_cast<const MTextEditStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Sunken,
- "MTextEditStyle"));
-
- if (style) {
- // Check the recommended border size ...
- if (style->backgroundImage()) {
- style->backgroundImage()->borders(&frameLeft, &frameRight,
- &frameTop, &frameBottom);
- }
- }
-
- if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
- rect = spinBox->rect.adjusted(widthPlusMinus, 0, -widthPlusMinus, 0);
- frameLeft = 0;
- frameRight = 0;
- } else {
- rect = spinBox->rect;
- }
- rect.adjust( frameLeft / 2, frameTop / 2,
- -frameRight / 2, -frameBottom / 2);
- rect = visualRect(spinBox->direction, spinBox->rect, rect);
- break;
- }
- default:
- break;
- }
- }
- return rect;
- }
- break;
- case CC_ScrollBar: {
- if (subControl == SC_ScrollBarSlider)
- return d->scrollBarSliderRect(option, widget);
- break;
- }
- case CC_GroupBox: {
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- switch (subControl) {
- case SC_GroupBoxFrame:
- // Fall Through
- case SC_GroupBoxContents: {
- QRect contentsRect;
-
- const MLabelStyle *headerStyle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MLabelStyle",
- "MContainerTitle"));
-
- QFont headerFont = headerStyle->font();
- QFontMetrics fontMetrics(headerFont);
- int height = fontMetrics.height();
-
- const MContainerStyle *groupBoxStyle =
- static_cast<const MContainerStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MContainerStyle"));
- const MSeparatorStyle *separatorStyle =
- static_cast<const MSeparatorStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MSeparatorStyle"));
-
- int sepMarginTop = separatorStyle->marginTop() + separatorStyle->paddingTop();
- int sepMarginBottom = separatorStyle->marginBottom() + separatorStyle->paddingBottom();
-
- int leftMargin = groupBoxStyle->paddingLeft()
- + groupBoxStyle->marginLeft();
-
- int rightMargin = groupBoxStyle->paddingRight()
- + groupBoxStyle->marginRight();
-
- int topMargin = groupBoxStyle->paddingTop()
- + groupBoxStyle->marginTop()
- + headerStyle->paddingTop()
- + headerStyle->marginTop()
- + sepMarginTop
- + separatorStyle->span()
- + sepMarginBottom;
-
- int checkMarkHeight = 0;
-
- bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
-
- if (hasCheckBox) {
- QStyleOptionButton checkBox;
- checkBox.QStyleOption::operator=(*option);
- checkMarkHeight = proxy()->pixelMetric(PM_IndicatorHeight, &checkBox, widget);
- }
-
- topMargin += qMax(height, checkMarkHeight);
-
- contentsRect = groupBox->rect.adjusted(leftMargin,
- topMargin,
- -rightMargin,
- 0);
-
- return contentsRect;
- break;
- }
- case SC_GroupBoxCheckBox:
- // Fall Through
- case SC_GroupBoxLabel: {
- QRect labelRect;
-
- const MLabelStyle *headerStyle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MLabelStyle",
- "MContainerTitle"));
- QFont headerFont = headerStyle->font();
- QFontMetrics fontMetrics(headerFont);
- int height = fontMetrics.height();
- int textWidth = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text).width() + 1;
-
- const MContainerStyle *groupBoxStyle =
- static_cast<const MContainerStyle *>(QtMaemo6StylePrivate::mStyle(groupBox->state,
- "MContainerStyle"));
-
- int leftMargin = groupBoxStyle->paddingLeft()
- + groupBoxStyle->marginLeft()
- + headerStyle->paddingLeft()
- + headerStyle->marginLeft();
-
- int rightMargin = groupBoxStyle->paddingRight()
- + groupBoxStyle->marginRight()
- + headerStyle->paddingRight()
- + headerStyle->marginRight();
-
- int topMargin = groupBoxStyle->paddingTop()
- + groupBoxStyle->marginTop()
- + headerStyle->paddingTop()
- + headerStyle->marginTop();
-
- //unused
- //int bottomMargin = groupBoxStyle->paddingBottom()
- // + groupBoxStyle->marginBottom()
- // + headerStyle->paddingBottom()
- // + headerStyle->marginBottom();
-
- labelRect = groupBox->rect.adjusted(leftMargin,
- topMargin,
- -rightMargin,
- 0);
-
- labelRect.setHeight(height);
-
- // We need a QStyleOptionButton based style option in order
- // to get correct geometries.
- QStyleOptionButton checkBox;
- checkBox.QStyleOption::operator=(*option);
- bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
- int checkMarkWidth = 0;
- if (hasCheckBox) {
- checkMarkWidth = proxy()->pixelMetric(PM_IndicatorWidth, &checkBox, widget);
- + proxy()->pixelMetric(PM_CheckBoxLabelSpacing, &checkBox, widget);
- }
- QRect totalRect = alignedRect(groupBox->direction,
- groupBox->textAlignment,
- QSize(textWidth + checkMarkWidth, height),
- labelRect);
-
- // Adjust totalRect if checkbox is set
- if (hasCheckBox) {
- int checkMarkHeight = proxy()->pixelMetric(PM_IndicatorHeight, &checkBox, widget);
-
- bool leftToRight = (groupBox->direction == Qt::LeftToRight);
- int left = 0;
- // Adjust for check box
- if (subControl == SC_GroupBoxCheckBox) {
- left = leftToRight ? totalRect.left() : (totalRect.right() - checkMarkWidth);
- int top = totalRect.top();
- totalRect.setRect(left, top, checkMarkWidth, checkMarkHeight);
- // Adjust for label
- } else {
- left = leftToRight ? (totalRect.left() + checkMarkWidth) : totalRect.left();
- int top = totalRect.top() + (checkMarkHeight - fontMetrics.height()) / 2;
- totalRect.setRect(left, top,
- totalRect.width() - checkMarkWidth, totalRect.height());
- }
- }
- return totalRect;
-
- break;
- }
- default:
- break;
- }
- }
- break;
- }
- default:
- break;
- }
- return QtMaemo6TestStyle::subControlRect(control, option, subControl, widget);
-}
-
-QRect QtMaemo6Style::subElementRect(SubElement element,
- const QStyleOption* option,
- const QWidget* widget) const
-{
- if( !isStyled( widget ) ) {
- return QPlastiqueStyle::subElementRect(element, option, widget);
- }
-
- // Handle rare case where this method is invoked before the polish is invoked
- Q_D(const QtMaemo6Style);
- if (!d->m_isMInitialized) {
- mDebug("PlainQt Style") << Q_FUNC_INFO << "entered before initialization of MComponentData";
- return QRect();
- }
-
- QRect retRect = QtMaemo6TestStyle::subElementRect(element, option, widget);
- switch(element) {
- case SE_LineEditContents: {
- if(widget) {
- const MTextEditStyle *style =
- static_cast<const MTextEditStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Sunken,
- "MTextEditStyle"));
- QFontMetrics fm(widget->font());
- if(style) {
- const QLineEdit *lineEdit = qobject_cast<const QLineEdit *>(widget);
- if (lineEdit && lineEdit->layoutDirection() == Qt::RightToLeft)
- retRect.adjust(style->paddingRight(), 0, -style->paddingLeft(), 0);
- else // layoutDirection is Qt::LeftToRight/default
- retRect.adjust(style->paddingLeft(), 0, -style->paddingRight(), 0);
- }
- if(fm.height() > retRect.height())
- retRect.setHeight(fm.height());
- }
- }
- break;
- default:
- retRect = QtMaemo6TestStyle::subElementRect(element, option, widget);
- };
- return retRect;
-}
-
-
-const MFeedback * QtMaemo6Style::feedback(const QString& feedbackName, const QWidget *widget)
-{
- if ( widget ) {
-
- // First check for dynamic properties
- if ( widget->dynamicPropertyNames().contains("NoMFeedback") )
- return 0;
-
- // Then check for the class type
-
- QString meegoClassString;
-
- // classes that are lower in the inheritance chain need to
- // be placed first to allow for the string to be overwritten.
- if(qobject_cast<const QWidget*>(widget))
- meegoClassString = "MWidgetStyle";
-
- // We don't map the QAbstract* widget classes since inherited
- // classes are often enough semantically quite different.
-
- if(qobject_cast<const QCheckBox*>(widget))
- meegoClassString = "MCheckboxStyle";
-
- if(qobject_cast<const QComboBox*>(widget))
- meegoClassString = "MComboBoxStyle";
-
- if(qobject_cast<const QDialog*>(widget))
- meegoClassString = "MDialogStyle";
-
- if(qobject_cast<const QLabel*>(widget))
- meegoClassString = "MLabelStyle";
-
- if(qobject_cast<const QListWidget*>(widget))
- meegoClassString = "MListStyle";
-
- if(qobject_cast<const QMenu*>(widget))
- meegoClassString = "MApplicationMenuStyle";
-
- if(qobject_cast<const QMessageBox*>(widget))
- meegoClassString = "MMessageBoxStyle";
-
- if(qobject_cast<const QProgressBar*>(widget))
- meegoClassString = "MProgressIndicatorStyle";
-
- if(qobject_cast<const QPushButton*>(widget))
- meegoClassString = "MButtonStyle";
-
- if(qobject_cast<const QScrollArea*>(widget))
- meegoClassString = "MPannableWidgetStyle";
-
- if(qobject_cast<const QSlider*>(widget))
- meegoClassString = "MSliderStyle";
-
- if(qobject_cast<const QTextEdit*>(widget))
- meegoClassString = "MTextEditStyle";
-
- if(qobject_cast<const QToolBar*>(widget))
- meegoClassString = "MToolbarStyle";
-
- if ( meegoClassString.isEmpty() )
- return 0;
-
- QStyleOption opt;
- opt.initFrom(widget);
-
- const MWidgetStyle *style = static_cast<const MWidgetStyle *>(
- QtMaemo6StylePrivate::mStyle(opt.state, meegoClassString, ""));
-
- if ( feedbackName == MFeedback::Press )
- return &(style->pressFeedback());
- if ( feedbackName == MFeedback::Release )
- return &(style->releaseFeedback());
- if ( feedbackName == MFeedback::Cancel )
- return &(style->cancelFeedback());
- }
-
- return 0;
-}
-
-QSize QtMaemo6Style::sizeFromContents(ContentsType type,
- const QStyleOption *option,
- const QSize &contentsSize,
- const QWidget *widget) const
-{
- if( !isStyled( widget ) ) {
- return QPlastiqueStyle::sizeFromContents(type, option, contentsSize, widget);
- }
-
- // Handle rare case where this method is invoked before the polish is invoked
- Q_D(const QtMaemo6Style);
- if (!d->m_isMInitialized) {
- mDebug("PlainQt Style") << Q_FUNC_INFO << "entered before initialization of MComponentData";
- return QSize();
- }
-
- QSize retSize = QtMaemo6TestStyle::sizeFromContents(type, option, contentsSize, widget);
-
- switch (type) {
- case CT_ScrollBar:
- if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
-
- int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
- int scrollBarSliderMinimum = proxy()->pixelMetric(PM_ScrollBarSliderMin, option, widget);
- if (scrollBar->orientation == Qt::Horizontal) {
- retSize = QSize(scrollBarSliderMinimum, scrollBarExtent);
- } else {
- retSize = QSize(scrollBarExtent, scrollBarSliderMinimum);
- }
- }
- break;
- case CT_Slider: {
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int sliderThickness = proxy()->pixelMetric(PM_SliderThickness, slider, widget);
-
- bool isHorizontal = (slider->orientation == Qt::Horizontal);
- if (isHorizontal)
- retSize.setHeight(sliderThickness);
- else
- retSize.setWidth(sliderThickness);
- return retSize;
- }
- }
- break;
- case CT_ComboBox:
- case CT_ToolButton:
- if (widget) {
- QWidget *parentOfControl = widget->parentWidget();
-
- if (const QStyleOptionToolButton *btn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- //a ToolButton on a ToolBar
- if (dynamic_cast<QToolBar *>(parentOfControl)) {
- //intentionally no code here at the moment
- //a ToolButton on the MTitleBar
- } else if (dynamic_cast<QtMaemo6TitleBar *>(parentOfControl)) {
- //intentionally no code here at the moment
- //a ToolButton anywhere else on the Screen should be drawn like a PushButton
- } else {
- QStyleOptionToolButton subopt = *btn;
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(subopt.state, "MButtonStyle"));
- const MButtonStyle *styleFont =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(subopt.state, "MButtonStyle",
- "NavigationBarToolBarButton"));
-
- if(style && styleFont) {
- int borderTop, borderRight, borderBottom, borderLeft;
- d->paddingFromStyle(style, &borderLeft, &borderTop, &borderRight, &borderBottom);
- //borderTop = borderRight = borderBottom = borderLeft = 0;
-
- QRect textAndIconRect = d->getTextAndIconRect(style, subopt.text, subopt.icon, styleFont->font(), styleFont->iconSize());
- textAndIconRect.setWidth(textAndIconRect.width() + borderLeft + borderRight);
- textAndIconRect.setHeight(textAndIconRect.height() + borderTop + borderBottom);
- retSize = textAndIconRect.size();
- } else {
- qCritical() << "MButtonStyle for QToolButton could not be loaded";
- }
- }
- }
- }
- break;
- case CT_PushButton: {
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- QStyleOptionButton subopt = *btn;
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(subopt.state, "MButtonStyle"));
-
- if(style) {
- QSize bs = d->heuristicSizeFromStyle(style);
- if (bs.isValid()) {
- bs.setWidth(bs.width() + style->marginLeft() + style->marginRight());
- bs.setHeight(bs.height() + style->marginBottom() + style->marginTop());
- } else {
- bs = QSize(500, 100);
- }
- retSize = bs;
-// QRect textAndIconRect = d->getTextAndIconRect(style, subopt.text, subopt.icon);
-// textAndIconRect.setWidth(textAndIconRect.width() + style->marginLeft() + style->marginRight());
-// textAndIconRect.setHeight(textAndIconRect.height() + style->marginBottom() + style->marginTop());
-// retSize = textAndIconRect.size();
- } else {
- qCritical() << "MButtonStyle for QPushButton could not be loaded";
- }
- }
- }
- break;
- case CT_CheckBox: {
- //ToDo
- }
- break;
- case CT_ItemViewItem:
- if (const QStyleOptionViewItemV4 *item = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- const MContentItemStyle *style =
- static_cast<const MContentItemStyle *>(QtMaemo6StylePrivate::mStyle(option->state,
- "MContentItemStyle"));
- const MLabelStyle *labelTitle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(option->state,
- "MLabelStyle", style->titleObjectName()));
- // subtitles for ListViewItems are currently not provided by qt.
- //const MLabelStyle* labelSubTitle =
- // static_cast<const MLabelStyle*>( QtMaemo6StylePrivate::mStyle( option->state,
- // "MLabelStyle", style->subtitleObjectName() ) );
- const MImageWidgetStyle *labelIcon =
- static_cast<const MImageWidgetStyle *>(QtMaemo6StylePrivate::mStyle(option->state,
- "MImageWidgetStyle", style->imageObjectName()));
-
- QString itemText = qvariant_cast<QString>(item->index.data(Qt::DisplayRole)); //.toString();
- QIcon itemIcon = qvariant_cast<QIcon>(item->index.data(Qt::DecorationRole));
-
- //always calculate icon size, even if the index has no item,
- // to get equal row heights
- QSize iconSize = labelIcon->preferredSize() +
- QSize(labelIcon->marginLeft() + labelIcon->marginRight(),
- labelIcon->marginTop() + labelIcon->marginBottom());
-
- QFontMetrics fontMetrics(labelTitle->font());
- QRect textRect = fontMetrics.boundingRect(itemText);
- textRect.setWidth(textRect.width() +
- labelTitle->marginLeft() + labelTitle->marginRight());
-
- retSize.setWidth(textRect.width() + iconSize.width());
- if (iconSize.height() < textRect.height())
- retSize.setHeight(textRect.height());
- else
- retSize.setHeight(iconSize.height());
-
- }
- break;
- case CT_MenuBar: {
- //return 0 size because the menubar should not be drawn
- // this is done by the windowdecoration
- if (widget == d->m_menuBar)
- retSize = QSize(0, 0);
- }
- break;
- case CT_LineEdit: {
- retSize = QtMaemo6TestStyle::sizeFromContents(type, option, contentsSize, widget);
- if(widget) {
- QFontMetrics fm(widget->font());
-
- const MTextEditStyle *style =
- static_cast<const MTextEditStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Sunken,
- "MTextEditStyle"));
- int requiredHeight = fm.height();
- if(style) {
- requiredHeight += style->paddingTop() + style->paddingBottom();
- }
- if(retSize.height() < requiredHeight)
- retSize.setHeight(requiredHeight);
- }
- }
- break;
- default:
- break;
- }
- return retSize;
-}
-
-int QtMaemo6Style::pixelMetric(PixelMetric metric,
- const QStyleOption *option,
- const QWidget *widget) const
-{
- if ( !isStyled( widget ) ) {
- return QPlastiqueStyle::pixelMetric(metric, option, widget);
- }
-
- // Handle rare case where this method is invoked before the polish is invoked
- Q_D(const QtMaemo6Style);
- if (!d->m_isMInitialized) {
- mDebug("PlainQt Style") << Q_FUNC_INFO << "entered before initialization of MComponentData";
- return QPlastiqueStyle::pixelMetric(metric, option, widget);
- }
-
- switch (metric) {
- case PM_ScrollBarExtent:
- case PM_ScrollBarSliderMin: {
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- const MPositionIndicatorStyle *style =
- static_cast<const MPositionIndicatorStyle *>(QtMaemo6StylePrivate::mStyle(slider->state,
- "MPositionIndicatorStyle"));
-
- QSize pixmapSize = style->indicatorImage()->pixmap()->size();
-
- int minSize;
- if (slider->orientation == Qt::Horizontal)
- minSize = pixmapSize.width();
- else
- minSize = pixmapSize.height();
- return minSize;
-
- }
- }
- break;
- case PM_SliderThickness:
- case PM_SliderControlThickness: {
- int sliderThickness = 0;
-
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- const MSliderStyle *style =
- static_cast<const MSliderStyle *>(QtMaemo6StylePrivate::mStyle(slider->state,
- "MSliderStyle"));
- if (style) {
- bool isHorizontal = slider->orientation == Qt::Horizontal;
- const QPixmap *handleSourcePixmap = (isHorizontal)
- ? style->handlePixmap()
- : style->handleVerticalPixmap();
- const QPixmap *handlePressedSourcePixmap = (isHorizontal)
- ? style->handlePressedPixmap()
- : style->handleVerticalPressedPixmap();
-
- QSize sliderHandleSize = handleSourcePixmap->size();
- QSize sliderHandlePressedSize = handlePressedSourcePixmap->size();
- QSize maxHandleSize = sliderHandleSize.expandedTo(sliderHandlePressedSize);
- sliderThickness = maxHandleSize.height();
- }
- }
- return sliderThickness;
- }
- break;
- case PM_SliderLength: {
- int sliderLength = 0;
-
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- const MSliderStyle *style =
- static_cast<const MSliderStyle *>(QtMaemo6StylePrivate::mStyle(slider->state,
- "MSliderStyle"));
- if (style) {
- bool isHorizontal = slider->orientation == Qt::Horizontal;
- const QPixmap *handleSourcePixmap = (isHorizontal)
- ? style->handlePixmap()
- : style->handleVerticalPixmap();
- const QPixmap *handlePressedSourcePixmap = (isHorizontal)
- ? style->handlePressedPixmap()
- : style->handleVerticalPressedPixmap();
-
- QSize sliderHandleSize = handleSourcePixmap->size();
- QSize sliderHandlePressedSize = handlePressedSourcePixmap->size();
- QSize maxHandleSize = sliderHandleSize.expandedTo(sliderHandlePressedSize);
- sliderLength = maxHandleSize.width();
- }
- }
- return sliderLength;
- }
- break;
- case PM_ExclusiveIndicatorWidth:
- case PM_IndicatorWidth: {
-
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(btn->state,
- "MCheckboxStyle",
- QString(),
- "checkbox"));
-
- if (style) {
- return d->heuristicSizeFromStyle(style).width();
- }
- }
- }
- break;
- case PM_ExclusiveIndicatorHeight:
- case PM_IndicatorHeight: {
-
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- const MButtonStyle *style =
- static_cast<const MButtonStyle *>(QtMaemo6StylePrivate::mStyle(btn->state,
- "MCheckboxStyle",
- QString(),
- "checkbox"));
- if (style) {
- return d->heuristicSizeFromStyle(style).height();
- }
- }
- }
- break;
- case PM_TabBarScrollButtonWidth:
- return widget->height();
- default:
- break;
- }
-
- return QtMaemo6TestStyle::pixelMetric(metric, option, widget);
-}
-
-QIcon QtMaemo6Style::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
- const QWidget *widget) const
-{
- if ( !isStyled( widget ) ) {
- return QPlastiqueStyle::standardIconImplementation(standardIcon, option, widget);
- }
-
- QIcon icon;
- QPixmap pixmap;
-
- switch (standardIcon) {
- case QStyle::SP_MessageBoxInformation: // 09
- return QIcon();
- case QStyle::SP_MessageBoxWarning: // 10
- return QIcon();
- case QStyle::SP_MessageBoxCritical: // 11
- return QIcon();
- case QStyle::SP_MessageBoxQuestion: // 12
- return QIcon();
- case QStyle::SP_DialogOkButton: // 38
- return QIcon();
- case QStyle::SP_DialogCancelButton: // 39
- return QIcon();
- case QStyle::SP_DialogHelpButton: // 40
- return QIcon();
- case QStyle::SP_DialogOpenButton: // 41
- return QIcon();
- case QStyle::SP_DialogSaveButton: // 42
- return QIcon();
- case QStyle::SP_DialogCloseButton: // 43
- return QIcon();
- case QStyle::SP_DialogApplyButton: // 44
- return QIcon();
- case QStyle::SP_DialogResetButton: // 45
- return QIcon();
- case QStyle::SP_DialogDiscardButton: // 46
- return QIcon();
- case QStyle::SP_DialogYesButton: // 47
- return QIcon();
- case QStyle::SP_DialogNoButton: // 48
- return QIcon();
- default:
- break;
- }
-
- if (icon.isNull())
- icon = QCommonStyle::standardIconImplementation(standardIcon, option, widget);
- return icon;
-}
-
-int QtMaemo6Style::styleHint(StyleHint hint, const QStyleOption *option,
- const QWidget *widget, QStyleHintReturn *returnData) const
-{
- if( !isStyled( widget ) ) {
- return QPlastiqueStyle::styleHint(hint, option, widget, returnData);
- }
-
- if (hint == QStyle::SH_ToolBar_Movable) {
- return false;
- } else if (hint == QStyle::SH_RequestSoftwareInputPanel) {
- return QStyle::RSIP_OnMouseClick;
- }
-
- return QtMaemo6TestStyle::styleHint(hint, option, widget, returnData);
-}
-
-void QtMaemo6Style::ensureFocusedWidgetVisible(QRect rect) {
- QWidget* widget = qApp->focusWidget();
- if(widget) {
- Q_D(QtMaemo6Style);
- if(rect.isValid()) {
- QRect screenRect = QRect(QPoint(0,0), MDeviceProfile::instance()->resolution());
- int spaceAbove = rect.top();
- int spaceBelow = screenRect.height() - (rect.top() + rect.height());
-
- if(spaceAbove > spaceBelow) {
- int maxY = rect.top();
- d->ensureWidgetVisible(widget, QRect(QPoint(0,0), QSize(screenRect.width(), maxY)));
- } else {
- int minY = rect.top() + rect.height();
- d->ensureWidgetVisible(widget, QRect(QPoint(0,minY), QSize(screenRect.width(), screenRect.height()-minY)));
- }
- } else {
- d->ensureWidgetVisible(widget, rect);
- }
- }
-}
-
-void QtMaemo6StylePrivate::ensureWidgetVisible(QWidget* widget, QRect visibleArea)
-{
- QWidget* parent = widget->parentWidget();
- QtMaemo6Window* window = NULL;
- //search the parent QtMameo6Window and pass the request there
- while(!(window = qobject_cast<QtMaemo6Window*>(parent)) && parent)
- parent = parent->parentWidget();
- if(window) {
- window->ensureWidgetVisible(widget, visibleArea);
- } else {
- mDebug("PlainQt Style") << "Can't focus on" << widget << "because there is no top level window";
- }
-}
-
-
-void QtMaemo6Style::doOrientationChange()
-{
- Q_D(QtMaemo6Style);
- mDebug("PlainQt Style") << "orientation Change" << d->m_isOrientationChangeEnabled;
- if(d->m_isOrientationChangeEnabled) {
- M::OrientationAngle currentOrientation = orientation();
- MInputMethodState::instance()->setActiveWindowOrientationAngle(currentOrientation);
- emit orientationChanged(currentOrientation);
- //also emit this with int as parameter for meegotouch independent use
- emit orientationChanged(static_cast<int>(currentOrientation));
- }
-}
-
-void QtMaemo6Style::updateDirtyWidgets() {
- Q_D(QtMaemo6Style);
- if(!d->m_dirtyWidgets.isEmpty()) {
- foreach(QWidget* w, d->m_dirtyWidgets.keys()) {
- const MScalableImage* image = d->m_dirtyWidgets.take(w);
- //if there is an image in the cache list, set it as background for the widget
- if(image)
- setPaletteBackground(w, image);
- w->update();
- }
- }
-}
-
-/*
- Private implementation specific methods:
- */
-
-
-
-
-
-
-
-
diff --git a/plainqt/style/qtmaemo6style.h b/plainqt/style/qtmaemo6style.h
deleted file mode 100644
index dc0c060a..00000000
--- a/plainqt/style/qtmaemo6style.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6STYLE_H
-#define QTMAEMO6STYLE_H
-
-#include <QFont>
-#include <QMap>
-#include <QLabel>
-#include "qtmaemo6teststyle.h"
-
-#include <mexport.h>
-#include <mnamespace.h>
-
-class MComponentData;
-class MStyle;
-class MButtonStyle;
-class MFeedback;
-class MWidgetStyle;
-class MScalableImage;
-class MSliderStyle;
-class QScrollBar;
-class QTimer;
-class QSequentialAnimationGroup;
-class QAbstractScrollArea;
-
-class QtMaemo6StylePrivate;
-
-
-/*!
- * This global function adds opacity to a pixmap
- */
-QPixmap setPixmapOpacity(const QPixmap &pixmap, double opacity);
-
-/*!
- * This class emulates the M windowdecoration, it provides a emulation
- * of the M titlebar, adds scrolling functionality and places a statusbar
- * on the bottom of the screen, if the application has one.
- * This class inherits indirectly from QPlastiqueStyle and reimplements
- * necessarry methods for doing the correct m-like styling.
- * Currently it inherits from QtMaemo6TestStyle (inherits QPlastiqueStyle),
- * which is currently only for testing purposes and may be deprecated in future.
- */
-class M_EXPORT QtMaemo6Style : public QtMaemo6TestStyle
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QtMaemo6Style)
- friend class QtMaemo6StyleEventFilter;
- Q_PROPERTY(int kineticScrollStartDelay READ kineticScrollStartDelay WRITE setKineticScrollStartDelay);
- Q_PROPERTY(int kineticScrollStartOffset READ kineticScrollStartOffset WRITE setKineticScrollStartOffset);
- Q_PROPERTY(int kineticDeaccelerationInterval READ kineticDeaccelerationInterval WRITE setKineticDeaccelerationInterval);
- Q_PROPERTY(int kineticDeaccelerationStrength READ kineticDeaccelerationStrength WRITE setKineticDeaccelerationStrength);
- Q_PROPERTY(int kineticMaxKineticScrollSpeed READ kineticMaxKineticScrollSpeed WRITE setKineticMaxKineticScrollSpeed);
- Q_PROPERTY(bool orientationChangeEnabled READ isOrientationChangeEnabled WRITE setOrientationChangeEnabled);
-public:
- QtMaemo6Style();
- virtual ~QtMaemo6Style();
-
- /*! \reimp */
- virtual void init();
-
- virtual void polish(QApplication *app);
- virtual void polish(QWidget *w);
-
- virtual void drawPrimitive(PrimitiveElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget = 0) const;
-
- virtual void drawControl(ControlElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget = 0) const;
-
- virtual void drawComplexControl(ComplexControl control,
- const QStyleOptionComplex *option,
- QPainter *painter,
- const QWidget *widget = 0) const;
-
- QSize sizeFromContents(ContentsType type,
- const QStyleOption *option,
- const QSize &contentsSize,
- const QWidget *widget = 0) const;
-
- int pixelMetric(PixelMetric metric,
- const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
-
- virtual QRect subControlRect(ComplexControl control,
- const QStyleOptionComplex *option,
- SubControl subControl,
- const QWidget *widget = 0) const;
-
- virtual QRect subElementRect(SubElement element,
- const QStyleOption* option,
- const QWidget* widget = 0 ) const;
-
- const MFeedback * feedback(const QString &feedbackName, const QWidget *widget = 0);
-
- /*! \reimp_end */
-
- /*!
- * \brief Returns the current scroll delay in milliseconds.
- *
- * After a press event a move must been made within this time
- * before the scrolling starts. If there is no move within this time
- * the mouse press event is forwarded to the widget under the mouse.
- * Default is 50ms.
- * \see kineticScrollStartOffset
- */
- int kineticScrollStartDelay() const;
-
- /*!
- * \brief Returns the current scroll offset in milliseconds.
- *
- * After a press event a move must been made with at least this manhattan
- * length before the scrolling starts. If there is no move within this length
- * the mouse press event is forwarded to the widget under the mouse.
- * Default is 5.
- * \see kineticScrollStartDelay()
- */
- int kineticScrollStartOffset() const;
-
- /*!
- * \brief Returns the current interval in milliseconds the deacceleration methode
- * is called.
- *
- * After a press event a move must been made with at least this manhattan
- * length before the scrolling starts. If there is no move within this length
- * the mouse press event is forwarded to the widget under the mouse.
- * Default is 20ms.
- */
- int kineticDeaccelerationInterval() const;
-
- /*!
- * \brief Returns the current deaccelaration strength.
- *
- * This is the value of speed in pixels the kinetic scrolling will be decreased
- * every deaccelaration interval.
- * Default is 1.
- */
- int kineticDeaccelerationStrength() const;
-
- /*!
- * \brief Returns the max value of the kinetic scrolling speed in pixels per interval.
- *
- * Default is 64.
- */
- int kineticMaxKineticScrollSpeed() const;
-
- bool isStyled( const QWidget * widget = 0 ) const;
-
- /*!
- * \brief: returns true if the orientation change support is enabled
- */
- bool isOrientationChangeEnabled() const;
-
-public Q_SLOTS:
- /*!
- * \brief Sets the scroll delay in milliseconds.
- *
- * /see kineticScrollStartDelay()
- */
- void setKineticScrollStartDelay(int delay);
-
- /*!
- * \brief Sets the scroll offset in milliseconds.
- *
- * \see kineticScrollStartOffset()
- */
- void setKineticScrollStartOffset(int offset);
-
- /*!
- * \brief sets the deaccelaration interval in milliseconds
- *
- * /see kineticDeaccelerationInterval()
- */
- void setKineticDeaccelerationInterval(int interval);
-
- /*!
- * \brief Sets the deaccelaration strength.
- *
- * \see kineticDeaccelerationStrength()
- */
- void setKineticDeaccelerationStrength(int strength);
-
- /*!
- * \brief Sets the maximum speed of kinetic scrolling in pixels per interval.
- *
- * \see kineticMaxKineticScrollSpeed()
- */
- void setKineticMaxKineticScrollSpeed(int speed);
-
- /*!
- * \brief: set to true to enable orientation change support
- */
- void setOrientationChangeEnabled(bool b);
-
- /*!
- * \brief Returns the current orientation of the device
- */
- M::OrientationAngle orientation();
-
- /*!
- * \brief returns the current orientation of the device within the given int
- * for external meegotouch independent use
- * this gives you the orientation angle as int, so the value might be 0, 90,
- * 180 or 270.
- */
- void orientation(int*);
-
- /*!
- * sets the background image from the style to the palette of the widget
- * returns true if the image is loaded and drawn
- * returns false if the image is not loaded yet (and then of course wasn't drawn)
- * but the loading process was invoked then.
- */
- bool setPaletteBackground(QWidget *,
- QString styleObject = QString(),
- QString styleClass = QString()) const;
- bool setPaletteBackground(QWidget *,
- const MScalableImage*) const;
- bool drawBackground (QPainter *p,
- const QStyleOption *option,
- const QRect &rect,
- const MWidgetStyle *style,
- const QWidget* w = 0) const;
-
-Q_SIGNALS:
- void orientationChanged(M::OrientationAngle angle);
- void orientationChanged(int);
-
-protected Q_SLOTS:
- /*! \reimp */
- QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
- const QWidget *widget = 0) const;
-
- virtual int styleHint(StyleHint hint, const QStyleOption *option = 0,
- const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
- /*! \reimp_end */
-
- void ensureFocusedWidgetVisible(QRect rect);
-
- void doOrientationChange();
-
- /*!
- * \brief update all widgets marked as dirty
- *
- * How asynchronous image loading and painting works within the QtMaemo6 style:
- * When calling QtMaemo6StylePrivate::drawScalableImage() the image may not be
- * painted imediately, because it is not loaded yet. In this case, the widget
- * will be remembered as dirty.
- * If you provide an explicit widget to drawScalableImage(), it is assumed you
- * want to use the image as background of the widget, which means just repainting
- * the widget isn't enough but the palette of the widget has to be changed.
- * This is done by the style automaticall if you provide the widget here.
- * If no widget is provided, the widget just receives an update when the image is
- * loaded, but it is not set to the palette's background role.
- *
- * \see QtMaemo6StylePrivate::drawScalableImage()
- */
- void updateDirtyWidgets();
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6style_p.h b/plainqt/style/qtmaemo6style_p.h
deleted file mode 100644
index 8336f6eb..00000000
--- a/plainqt/style/qtmaemo6style_p.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6STYLE_P_H
-#define QTMAEMO6STYLE_P_H
-
-#include <QPointer>
-
-#include "qtmaemo6style.h"
-#include "qtmaemo6teststyle_p.h"
-#include "qtmaemo6styleeventfilter.h"
-#include "qtmaemo6scrollbareventfilter.h"
-
-#ifdef HAVE_CONTEXTSUBSCRIBER
-#include "contextproperty.h"
-#endif //HAVE_CONTEXTSUBSCRIBER
-
-class MComponentData;
-class MWidgetController;
-class QToolButton;
-class QAction;
-class QStatusBar;
-class QMenuBar;
-class QtMaemo6KineticScrolling;
-class QStyleOptionButton;
-
-class MComboBoxStyle;
-class MListItemStyle;
-
-
-class QtMaemo6StylePrivate : public QtMaemo6TestStylePrivate
-{
-public:
- Q_DECLARE_PUBLIC(QtMaemo6Style)
-
- QtMaemo6StylePrivate();
- virtual ~QtMaemo6StylePrivate();
-
- /*!
- * Initialization of the M framework.
- * init() gets called by the style constructor.
- * At that point we don't know yet whether the application object is a M
- * application or not. As we only need to fully initialize the M framework
- * for non-M application we need to defer the initialization of the M
- * framework to a later point of the application life cycle.
- */
- void initM();
-
- /*!
- * returns a MStyle corresponding the given parameters
- */
- static const MStyle *mStyle(QStyle::State state,
- const QString &styleClass,
- const QString &styleObject = QString(),
- const QString &type = QString(),
- const bool hasFocus = false,
- const MWidgetController *parent = NULL);
-
- /*!
- * returns a string generated from the QStyle::state, m can use
- */
- static QString modeFromState(QStyle::State state) ;
-
- /*!
- * draws a scalable image onto painter
- * \param p the painter to draw on
- * \param option style option used for drawing
- * \param rect the rect into which is drawn, the scalable image will be
- * drawn to fit into this rect
- * \param scalableImage the image that should be drawn
- * \param style optional if given transparency and background color of the
- * style will be used if there is no suitable image
- * \param widget optional if image should be used as background of a widget
- * you must provide the widget here. The widget will
- * be marked as dirty due asynchronous loading.
- * The MScalableImage will then be set as background for
- * this widget by the style as soon as the image is
- * loaded and the widget gets an update.
- * \param purpose optional provide a key used for caching. This is needed if
- * you want to use different backgrounds for the same
- * widget.
- * \param enableCache optional if true the images will be cached locally by
- * the style
- * \return true if the image is loaded and drawn
- * false if the image is not loaded yet (and then of course wasn't drawn)
- * but the loading process was invoked then.
- */
- bool drawScalableImage(QPainter *p,
- const QStyleOption *option,
- const QRect &rect,
- const MScalableImage *scalableImage,
- const MWidgetStyle *style,
- const QWidget* widget = 0,
- const QString &purpose = "bg",
- bool enableCache = true) const;
-
- /*!
- * draws the background of a slider
- */
- static void drawSliderBaseBackground(QPainter *p,
- const QStyleOption *option,
- const QRect &rect,
- const MSliderStyle *style,
- int maxSliderLength);
-
- /*!
- * Draws the text on the button.
- * \param style the m style which is used to draw the button
- * \param painter
- * \param textRect the rect within the button in which the text (and icon) is drawn
- * \param text the text
- * \param align the alignment the text uses within the textRect!!
- * \param font font used instead of font from the style
- */
- void drawButtonText(const MButtonStyle *style,
- QPainter *painter,
- const QRectF &textRect,
- const QString &text,
- Qt::Alignment align,
- const QFont &font) const;
- /*!
- * Draws the text on the button.
- * overload: uses the font from style to draw the text
- * \param style the m style which is used to draw the button
- * \param painter
- * \param textRect the rect within the button in which the text (and icon) is drawn
- * \param text the text
- * \param align the alignment the text uses within the textRect!!
- */
- void drawButtonText(const MButtonStyle *style,
- QPainter *painter,
- const QRectF &textRect,
- const QString &text,
- Qt::Alignment align) const;
-
- /*!
- * Draws the icon on the button.
- * \param style the m style which is used to draw the button
- * \param painter
- * \param contentsRect the rect within the button in which the text (and icon) is drawn
- * \param icon the icon
- * \param iconSize optional overrides the icon size from style
- * \param centerAlways don't use the icon-align property, but center always
- */
- void drawButtonIcon(const MButtonStyle *style,
- QPainter *painter,
- const QRect &contentsRect,
- const QIcon &icon,
- const QSize &iconSize = QSize(),
- const bool centerAlways = false) const;
-
- /*!
- * Draws the button.
- * \param painter
- * \param text the text on the button
- * \param icon the icon on the button
- * \param rect the rect in which the button is drawn
- * \param option the QStyleOption used to draw the button
- * \param style the m style used to draw the button
- */
- void drawBasicButton(QPainter *painter,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const MButtonStyle *style) const;
-
- /*!
- * Draws the button (overloaded)
- * \param painter
- * \param text the text on the button
- * \param icon the icon on the button
- * \param rect the rect in which the button is drawn
- * \param option the QStyleOption used for the button
- * \param styleClass style class that should be used
- * \param styleObject style object that should be used
- */
- void drawBasicButton(QPainter *painter,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const QString &styleClass,
- const QString &styleObject = QString()) const;
-
- /*!
- * Draws the button.
- * \param painter
- * \param text the text on the button
- * \param icon the icon on the button
- * \param rect the rect in which the button is drawn
- * \param option the QStyleOption used to draw the button
- * \param style the m style used to draw the button
- * \param font use this font instead of the font from the style
- * \param font use this icon size instead of icon size from the style
- */
- void drawBasicButton(QPainter *painter,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const MButtonStyle *style,
- const QFont &font,
- const QSize &iconSize) const;
-
- /*!
- * Draws the toggle button
- * \param painter
- * \param text the text on the button
- * \param rect the rect in which the button is drawn
- * \param icon the icon on the button
- * \param option the QStyleOption used to draw the button
- * \param styleClass style class that should be used
- * \param styleObject style object that should be used
- */
- void drawToggleButton(QPainter *painter,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option,
- const QString &styleClass,
- const QString &styleObject = QString()) const;
-
- /*!
- * Draws the combo box button, i.e. a button which informs about the current
- * selection. If the user clicks on the button, a popup list should be opeend.
- * \param painter
- * \param cbStyle the m style that delivers the indicator image
- * \param liStyle the m style used to draw the button
- * \param currentText the selected text
- * \param rect the rect in which the combobox button is drawn
- * \param option the QStyleOption used to draw the button
- * \param layoutDirection the direction (either Qt::LeftToRight or Qt::RightToLeft)
- */
- void drawComboBoxButton(QPainter *p,
- const MComboBoxStyle *cbStyle,
- const MListItemStyle *liStyle,
- const QString &currentText,
- const QRect &rect,
- const QStyleOption *option,
- const Qt::LayoutDirection layoutDirection = Qt::LeftToRight) const;
-
-
- /*!
- * Draws the checkbox
- * \param painter
- * \param text the text besides the checkBox
- * \param rect the rect in which the checkBox is drawn
- * \param icon the icon on the button
- * \param option the QStyleOption used to draw the checkBox
- */
- void drawCheckBox(QPainter *painter,
- const QString &text,
- const QIcon &icon,
- const QRect &rect,
- const QStyleOption *option) const;
-
- /*!
- * calculates a rect the text and icon earn
- * returns a rect within the button's rect used by the text and icon
- * the rect already includes the margins
- * \param style the m style used to draw the button
- * \param text the text on the button
- * \param icon optional the icon on the button
- * \param font optional used instead of the font from the style
- * \param iconSize optional used instead of iconSize from the style if valid
- */
- QRect getTextAndIconRect(const MButtonStyle *style,
- const QString &text,
- const QIcon &icon = QIcon(),
- const QFont &font = QFont(),
- const QSize &iconSize = QSize()) const;
- /*!
- * returns the rect of the text with font font
- * includes no margins
- * \param text the text
- * \param font font used to calculate the text size
- */
- QRect textBoundingRect(const QString &text, const QFont &font) const;
-
- /*!
- * returns the effective padding used for the style
- * uses the borders of the MScalableImage, but if the padding specified in the style is
- * greater than the border of the MScalableImage, the borders from style are used
- * \param style the used style
- * \param left border in the left side
- * \param top border in the top side
- * \param right border in the right side
- * \param bottom border in the bottom side
- */
- void paddingFromStyle(const MWidgetStyle *style,
- int *left,
- int *top,
- int *right,
- int *bottom) const;
-
- /*!
- * returns a size computed from the style properties maximumSize, minimumSize
- * and preferredSize. This method uses a heuristic to follow m sizes as far as possible
- * \param style the style from which the optimal size is computed
- */
- QSize heuristicSizeFromStyle(const MWidgetStyle *style) const;
-
-
-
- /*!
- * returns the rect a slider uses
- */
- QRect scrollBarSliderRect(const QStyleOptionComplex *option, const QWidget *widget = 0) const;
-
- /*!
- * \brief returns a Pixmap with the given borders cropped away
- * The given borders of the scalable image are cut away, the resulting pixmap will
- * have size as size. If drawLines is true, lines are drawn on the cut away borders
- * to close the pixmap. The color of these lines is taken from one of the pixmaps
- * outermost pixels.
- * \param image the image used as base
- * \param size target size of the pixmap
- * \param borders combined Borders flags that should be cut away
- * \param borderLines optional draw closing lines on the given border sides. If not
- * given border lines are drawn for all cut borders
- */
- enum Borders {
- leftBorder = 1,
- topBorder = 2,
- rightBorder = 4,
- bottomBorder = 8
- };
- QPixmap borderCroppedPixmap(const MScalableImage* image, QSize size, int borders, int borderLines) const;
- QPixmap borderCroppedPixmap(const MScalableImage* image, QSize size, int borders) const {
- return borderCroppedPixmap(image, size, borders, borders);
- }
-
- /*!
- * returns an inverted Alignment, so align right will become align left, top
- * will become bottom and so on
- */
- Qt::Alignment invertAlignment(Qt::Alignment align) const;
-
- bool hasVerticalAlignment(Qt::Alignment align) const {
- return (align & 0xF0) > 0;
- };
- bool hasHorizontalAlignment(Qt::Alignment align) const {
- return (align & 0xF) > 0;
- };
- Qt::Alignment verticalAlignment(Qt::Alignment align) const {
- return align & 0xF0;
- };
- Qt::Alignment horizontalAlignment(Qt::Alignment align) const {
- return align & 0xF;
- };
-
- void ensureWidgetVisible(QWidget* widget, QRect visibleArea);
-
- bool hasMWindowParent(const QWidget*) const;
-public:
- QList<QToolButton *> m_toolButtonsInTitleBar;
- QList<QAction *> m_toolBarActions;
- QPointer<QStatusBar> m_statusBar;
-
- const int m_actionsInTitleBarCount;
-
- MComponentData *m_componentData;
-
-#ifdef HAVE_CONTEXTSUBSCRIBER
- ContextProperty m_orientation;
-#endif //HAVE_CONTEXTSUBSCRIBER
-
- bool m_isMInitialized;
- bool m_isMApplication;
- bool m_isOrientationChangeEnabled;
-
- QtMaemo6ScrollBarEventFilter *m_scrollBarEventFilter;
- QtMaemo6StyleEventFilter *m_windowEventFilter;
-
- QMenuBar *m_menuBar;
-
- QtMaemo6KineticScrolling* m_kinetic;
-
- //QList<QWidget*> m_delayedPolishing;
-
- QList<QString> m_excludeClasses;
-
- //this is the cache list for widgets that need updating due to asynchronous
- // image loading. If there is an MScalabaleImage for the widget in this list,
- // this image is supposed to be used as background for the widget.
- // if the image is NULL, the widget just needs an update.
- mutable QMap<QWidget*, const MScalableImage*> m_dirtyWidgets;
-
- //prints style information
- //useful for finding adequate style --> mode mappings
- static void printStateFlags(QStyle::State state);
-
-
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6styleeventfilter.cpp b/plainqt/style/qtmaemo6styleeventfilter.cpp
deleted file mode 100644
index 23ad721f..00000000
--- a/plainqt/style/qtmaemo6styleeventfilter.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6styleeventfilter.h"
-#include "qtmaemo6style_p.h"
-#include "qtmaemo6windowdecoration.h"
-#include "qtmaemo6dialogproxy.h"
-#include "qtmaemo6comboboxpopup.h"
-#include "qtmaemo6submenu.h"
-
-#include <QApplication>
-#include <QWidget>
-#include <QEvent>
-#include <QKeyEvent>
-#include <QLayout>
-#include <QMainWindow>
-#include <QDialog>
-#include <QDialogButtonBox>
-#include <QPushButton>
-#include <QToolButton>
-#include <QLineEdit>
-#include <QTreeView>
-#include <QComboBox>
-#include <QMenu>
-#include <QDir>
-#include <QDate>
-#include <QTime>
-#include <QDesktopWidget>
-
-#include <MComponentData>
-#include <mfeedback.h>
-#include <mdeviceprofile.h>
-#include <MTheme>
-#include <mbuttonstyle.h>
-#include <MWindow>
-#include <MDebug>
-
-#include "qtmaemo6clicklabel.h"
-
-//krazy:excludeall=qclasses
-
-QtMaemo6StyleEventFilter::QtMaemo6StyleEventFilter(QtMaemo6TestStyle *parent)
- : QtMaemo6TestStyleEventFilter(parent)
-{
-}
-
-bool QtMaemo6StyleEventFilter::eventFilter(QObject *obj, QEvent *event)
-{
- QWidget *widget = qobject_cast<QWidget *>(obj);
-
- switch (event->type()) {
- case QEvent::Show: {
- if (NULL != widget) {
- if (widget->isWindow() && !widget->graphicsProxyWidget()) {
- if (QDialog *dialog = qobject_cast<QDialog *>(widget)) {
- QtMaemo6DialogProxy *dialogProxy = new QtMaemo6DialogProxy(dialog, m_style->m_windowDecoration);
- dialogProxy->setTitle(widget->windowTitle());
- dialogProxy->showFastMaximized();
- return true;
- } else if(QMenu* menu = qobject_cast<QMenu*>(widget)) {
- //also show menus styled like m menus, even if they are not called from a menubar
- QtMaemo6SubMenu *subMenu = new QtMaemo6SubMenu(menu, NULL);
- QtMaemo6WindowDecoration *decoration = new QtMaemo6WindowDecoration(subMenu, NULL);
- decoration->showFastMaximized();
- //these both must be done after the show, because the status- and
- // menubar is added on show event
- decoration->setStatusBar(NULL);
- decoration->setMenuBar(NULL);
- bool navigationBarVisible = !qApp->dynamicPropertyNames().contains(M::NoMNavigationBar);
- decoration->showNavigationBar( navigationBarVisible );
- } else if (!qobject_cast<QtMaemo6Window *>(widget) &&
- !widget->inherits("QTipLabel") && //don't create a new window for every tooltip!
- !qobject_cast<MWindow*>(widget)) {
- if(0 == qobject_cast<QtMaemo6WindowDecoration*>(widget->parent())) {
- //test the windowflags before embedding the widget into the decoration!
- //the dynamic property overrides all other settings
- bool hideNavigationBar = qApp->dynamicPropertyNames().contains(M::NoMNavigationBar);
- if(!hideNavigationBar)
- hideNavigationBar = widget->windowFlags().testFlag(Qt::FramelessWindowHint) || widget->windowState().testFlag(Qt::WindowFullScreen);
- bool hideStatusBar = qApp->dynamicPropertyNames().contains(M::NoMStatusBar);
- if(!hideStatusBar)
- hideStatusBar = widget->windowFlags().testFlag(Qt::FramelessWindowHint) || widget->windowState().testFlag(Qt::WindowFullScreen);
-
- m_style->m_windowDecoration = new QtMaemo6WindowDecoration(widget);
-
- m_style->m_windowDecoration->showNavigationBar( !hideNavigationBar );
- m_style->m_windowDecoration->showDeviceStatusBar( !hideStatusBar );
-
- m_style->m_windowDecoration->showFastMaximized();
- return true;
- }
- }
- }
- // Unfortunately this can't be safely done in polish:
- if (QDialogButtonBox *box = qobject_cast<QDialogButtonBox *>(widget)) {
- QPushButton *okButton = box->button(QDialogButtonBox::Ok);
- //~ uispec-document DirectUI_Common_Strings_UI_Specification_0.7.doc
- //: Command for confirmation
- //% "Done"
- if (okButton) okButton->setText(qtTrId("qtn_comm_command_done"));
- QPushButton *cancelButton = box->button(QDialogButtonBox::Cancel);
- if (cancelButton) cancelButton->hide();
- }
- if (QPushButton *button = qobject_cast<QPushButton *>(widget)) {
- QString okString = tr("OK");
- //~ uispec-document DirectUI_Common_Strings_UI_Specification_0.7.doc
- //: Command for confirmation
- //% "Done"
- QString doneString = qtTrId("qtn_comm_command_done");
- if (button->text() == okString) button->setText(doneString);
- QString cancelString = tr("Cancel");
- if (button->text() == cancelString) {
- button->hide();
- }
- }
- if(QLineEdit* le = qobject_cast<QLineEdit*>(widget)) {
- //poor way to hide the lineedit of a combobox if it is editable
- if(qobject_cast<QComboBox*>(le->parentWidget())) {
- le->setVisible(false);
- return true;
- }
- }
- if (QTreeView *treeWidget = qobject_cast<QTreeView *>(widget)) {
- //unfortunately this must be done in showEvent, because it's
- // a property of QTreeWidget, that can't be influenzed by the
- // style
-
- //FIXME: really bad to do all that in showEvent
- QToolButton button;
- QStyleOptionToolButton option;
- option.initFrom(&button);
- option.text = '+';
- QSize size = m_style->sizeFromContents(QStyle::CT_ToolButton, &option, QSize(), &button);
-
- //only set the indentation if the required buttonsize is bigger
- // than original indentation
- if (size.width() > treeWidget->indentation()) {
- treeWidget->setIndentation(size.width());
- }
- }
-
- /*
- if(QtMaemo6Style* style = qobject_cast<QtMaemo6Style*>(widget->style())) {
- style->delayedPolish(widget);
- }
- */
- }
-
- }
- break;
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseButtonPress: {
- // now send press feedback
- if(QtMaemo6Style* style = qobject_cast<QtMaemo6Style*>(widget->style())) {
- const MFeedback * feedback = style->feedback(MFeedback::Press, widget);
- if ( feedback ) feedback->play();
- }
-
- if(QComboBox* comboBox = qobject_cast<QComboBox*>(widget)) {
- //done in mousePress, because in this way the original popup is completely suppressed
- QtMaemo6ComboBoxPopup *comboBoxPopup = new QtMaemo6ComboBoxPopup(comboBox, NULL);
- QtMaemo6DialogProxy* dialog = new QtMaemo6DialogProxy(comboBoxPopup, comboBox);
- dialog->showFastMaximized();
- dialog->setTitle(tr("Choose a value"));
- return true;
- }
- }
- break;
- case QEvent::MouseButtonRelease: {
- // now send release feedback
- if(QtMaemo6Style* style = qobject_cast<QtMaemo6Style*>(widget->style())) {
- const MFeedback * feedback = style->feedback(MFeedback::Release, widget);
- if ( feedback ) feedback->play();
- }
- }
- break;
- case QEvent::Wheel: {
- if(qobject_cast<QComboBox*>(widget)) {
- return true;
- }
- }
- break;
- case QEvent::KeyPress: {
- QKeyEvent* k = static_cast<QKeyEvent*>(event);
- if(Qt::Key_T == k->key() && k->modifiers () & (Qt::ControlModifier | Qt::AltModifier)
- && (k->modifiers () & Qt::ShiftModifier)) {
- mDebug("PlainQt Style") << "Taking screenshot";
- QPixmap screenshot;
- screenshot = QPixmap::grabWindow(QApplication::desktop()->winId());
-
- QString path = QDir::homePath() + "/MyDocs/.images";
- if (!QDir(path).exists())
- path = QDir::homePath();
-
- QString imageFile = QString("%1/%2-%3.png").arg(path)
- .arg(QDate::currentDate().toString("yyyyMMdd"))
- .arg(QTime::currentTime().toString("hhmmss"));
- if (!screenshot.save(imageFile))
- mDebug("PlainQt Style") << "Could not save screenshot to" << imageFile;
- else
- mDebug("PlainQt Style") << "Screenshot saved to" << imageFile;
- return true;
- }
- }
- break;
- default:
- break;
- }
- // standard event processing
- return QObject::eventFilter(obj, event);
-}
-
diff --git a/plainqt/style/qtmaemo6styleeventfilter.h b/plainqt/style/qtmaemo6styleeventfilter.h
deleted file mode 100644
index 75bbebc8..00000000
--- a/plainqt/style/qtmaemo6styleeventfilter.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6STYLEEVENTFILTER_H
-#define QTMAEMO6STYLEEVENTFILTER_H
-
-#include "qtmaemo6teststyle.h"
-
-/*!
- * the eventfilter for the basic style. Currently this is only used for
- * testing purposes and may be deprecated
- */
-class QtMaemo6StyleEventFilter : public QtMaemo6TestStyleEventFilter
-{
- Q_OBJECT
-public:
- explicit QtMaemo6StyleEventFilter(QtMaemo6TestStyle *parent);
- virtual ~QtMaemo6StyleEventFilter() {};
-protected:
- /*! \reimp */
- bool eventFilter(QObject *obj, QEvent *event);
- /*! \reimp_end */
-
-};
-
-
-#endif //QTMAEMO6STYLEEVENTFILTER_H
diff --git a/plainqt/style/qtmaemo6styleplugin.cpp b/plainqt/style/qtmaemo6styleplugin.cpp
deleted file mode 100644
index d4b8377c..00000000
--- a/plainqt/style/qtmaemo6styleplugin.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6styleplugin.h"
-
-#include "qtmaemo6style.h"
-
-QStringList QtMaemo6StylePlugin::keys() const
-{
- return QStringList()
- << "maemo6"
- << "MBasicQtStyle"
- << "meegotouch"
- << "bqs";
-}
-
-QStyle *QtMaemo6StylePlugin::create(const QString &key)
-{
- QString lkey = key.toLower();
-
- if ((lkey == "mbasicqtstyle") || (lkey == "bqs"))
- return new QtMaemo6TestStyle;
-
- if ((lkey == "maemo6") || (lkey == "meegotouch"))
- return new QtMaemo6Style;
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(pnp_qtmaemo6styleplugin, QtMaemo6StylePlugin)
diff --git a/plainqt/style/qtmaemo6styleplugin.h b/plainqt/style/qtmaemo6styleplugin.h
deleted file mode 100644
index 0a30c04b..00000000
--- a/plainqt/style/qtmaemo6styleplugin.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6STYLEPLUGIN_H
-#define QTMAEMO6STYLEPLUGIN_H
-
-#include <QStylePlugin>
-
-/*!
- * this class provides the QtMaemo6Style as a plugin
- */
-class QtMaemo6StylePlugin : public QStylePlugin
-{
-public:
- /*! \reimp */
- QStringList keys() const;
- QStyle *create(const QString &key);
- /*! \reimp_end */
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6submenu.cpp b/plainqt/style/qtmaemo6submenu.cpp
deleted file mode 100644
index 1467cef2..00000000
--- a/plainqt/style/qtmaemo6submenu.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6submenu.h"
-#include "qtmaemo6windowdecoration.h"
-#include "qtmaemo6style_p.h"
-
-#include <QMenu>
-
-QtMaemo6SubMenu::QtMaemo6SubMenu(QMenu *m, QWidget *parent) : QListWidget(parent)
-{
- setObjectName("Qt_Maemo6_SubMenu");
- if(m)
- fillListWidget(m);
-
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
- connect(this, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(listItemClicked(QListWidgetItem *)));
-}
-
-QtMaemo6SubMenu::~QtMaemo6SubMenu()
-{
-
-}
-
-void QtMaemo6SubMenu::fillListWidget(QMenu *m)
-{
- m_actionItemList.clear();
- foreach(QPointer<QAction> action, m->actions()) {
- if (!action->isSeparator() && action->isEnabled()) {
- QListWidgetItem *item = new QListWidgetItem(action->icon(), action->text(), this);
- m_actionItemList.insert(item, action);
- }
- }
-}
-
-void QtMaemo6SubMenu::listItemClicked(QListWidgetItem *item)
-{
- QAction *action = m_actionItemList.value(item);
- if (action) {
- if (action->menu()) {
- QtMaemo6SubMenu *subMenu = new QtMaemo6SubMenu(action->menu(), NULL);
- QtMaemo6WindowDecoration *decoration = new QtMaemo6WindowDecoration(subMenu, NULL);
- decoration->showFastMaximized();
- //these both must be done after the show, because the status- and
- // menubar is added on show event
- decoration->setStatusBar(NULL);
- decoration->setMenuBar(NULL);
- } else {
- action->activate(QAction::Trigger);
- }
- }
- close();
-}
diff --git a/plainqt/style/qtmaemo6submenu.h b/plainqt/style/qtmaemo6submenu.h
deleted file mode 100644
index f5a3126f..00000000
--- a/plainqt/style/qtmaemo6submenu.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6SUBMENU_H
-#define QTMAEMO6SUBMENU_H
-
-#include "qtmaemo6window.h"
-
-#include <QListWidget>
-
-class QMenu;
-class QListWidgetItem;
-
-/*!
- * This class shows a submenu out of the menubar
- */
-class QtMaemo6SubMenu : public QListWidget
-{
- Q_OBJECT
-public:
- explicit QtMaemo6SubMenu(QMenu *m, QWidget *parent);
- virtual ~QtMaemo6SubMenu();
-protected Q_SLOTS:
- void listItemClicked(QListWidgetItem *);
-protected:
- void fillListWidget(QMenu *m);
-private:
- QMap< QListWidgetItem *, QPointer<QAction> > m_actionItemList;
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6teststyle.cpp b/plainqt/style/qtmaemo6teststyle.cpp
deleted file mode 100644
index de01a0b3..00000000
--- a/plainqt/style/qtmaemo6teststyle.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6teststyle.h"
-#include "qtmaemo6teststyle_p.h"
-#include "qtmaemo6windowdecoration.h"
-
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QMainWindow>
-#include <QFont>
-#include <QDialog>
-
-QtMaemo6TestStyleEventFilter::QtMaemo6TestStyleEventFilter(QtMaemo6TestStyle *parent)
- : QObject(parent)
-{
- m_style = parent;
-}
-
-bool QtMaemo6TestStyleEventFilter::eventFilter(QObject *obj, QEvent *event)
-{
- QWidget *widget = qobject_cast<QWidget *>(obj);
- if (widget) {
- QWidget *parent = qobject_cast<QWidget *>(widget->parent());
-
- switch (event->type()) {
- case QEvent::Show: {
- if (NULL != widget && (qobject_cast<QMainWindow *>(widget) || qobject_cast<QDialog *>(widget))) {
- //QMainWindow* main_window(qobject_cast<QMainWindow*>(widget));
- //if (NULL != main_window) {
- if (widget->windowFlags() & Qt::Window) {
- if (!parent || !qobject_cast<QtMaemo6WindowDecoration *>(parent)) {
- parent = m_style->m_windowDecoration = new QtMaemo6WindowDecoration(widget);
- }
- parent->showMaximized();
- }
- }
- }
- break;
- default:
- break;
- }
- }
- // standard event processing
- return QObject::eventFilter(obj, event);
-}
-
-QtMaemo6TestStyle::QtMaemo6TestStyle(QtMaemo6TestStylePrivate &dd)
- : d_ptr(& dd), // this is a special case, since we start our shared d-pointer hierarchy within m right here
- m_windowEventFilter(NULL),
- m_windowDecoration(NULL)
-{
- Q_D(QtMaemo6TestStyle);
- d->q_ptr = this;
- d->m_styleInitialized = false;
-}
-
-QtMaemo6TestStyle::QtMaemo6TestStyle()
- : QPlastiqueStyle(),
- d_ptr(new QtMaemo6TestStylePrivate()),
- m_windowEventFilter(NULL),
- m_windowDecoration(NULL)
-{
- Q_D(QtMaemo6TestStyle);
- d->q_ptr = this;
- d->m_styleInitialized = false;
-}
-
-
-QtMaemo6TestStyle::~QtMaemo6TestStyle()
-{
- delete d_ptr;
-}
-
-void QtMaemo6TestStylePrivate::initStyle()
-{
- //FIXME: remove magic numbers!
- qApp->setGlobalStrut(QSize(48, 48));
- QFont font("Nokia Sans");
- font.setPointSize(25);
- qApp->setFont(font);
-
- m_styleInitialized = true;
-}
-
-void QtMaemo6TestStyle::init()
-{
- m_windowEventFilter = new QtMaemo6TestStyleEventFilter(this);
-}
-
-void QtMaemo6TestStyle::polish(QApplication *app)
-{
- Q_UNUSED(app);
-}
-
-void QtMaemo6TestStyle::polish(QPalette &palette)
-{
- Q_UNUSED(palette);
- /*
- QPixmap backgroundPixmap( ":/bg2.png" );
-
- //setTexture( palette, QPalette::Button, backgroundPixmap );
- palette.setBrush( QPalette::Background, Qt::black );
- setTexture( palette, QPalette::Mid, backgroundPixmap );
- setTexture( palette, QPalette::Window, backgroundPixmap );
-
-
- palette.setBrush( QPalette::Text, Qt::white );
- palette.setBrush( QPalette::ButtonText, Qt::white );
- palette.setBrush( QPalette::WindowText, Qt::white );
-
- QBrush half_transparent(QColor(0,0,0,128));
-
- palette.setBrush( QPalette::Button, half_transparent );
- palette.setBrush( QPalette::Base, half_transparent );
- */
-}
-
-void QtMaemo6TestStyle::polish(QWidget *widget)
-{
- if(qobject_cast<QDesktopWidget*>(widget))
- return;
-
- Q_D(QtMaemo6TestStyle);
- if (!d->m_styleInitialized) {
- d->initStyle();
- }
-
- widget->installEventFilter(m_windowEventFilter);
-}
-
-void QtMaemo6TestStyle::setTexture(QPalette &palette, QPalette::ColorRole role,
- const QPixmap &pixmap)
-{
- for (int i = 0; i < QPalette::NColorGroups; ++i) {
- QColor color = palette.brush(QPalette::ColorGroup(i), role).color();
- palette.setBrush(QPalette::ColorGroup(i), role, QBrush(color, pixmap));
- }
-}
diff --git a/plainqt/style/qtmaemo6teststyle.h b/plainqt/style/qtmaemo6teststyle.h
deleted file mode 100644
index f399f41f..00000000
--- a/plainqt/style/qtmaemo6teststyle.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6TESTSTYLE_H
-#define QTMAEMO6TESTSTYLE_H
-
-#include <QPlastiqueStyle>
-
-class QtMaemo6WindowDecoration;
-class QtMaemo6TestStyle;
-class QtMaemo6TestStylePrivate;
-
-class QtMaemo6TestStyleEventFilter : public QObject
-{
- Q_OBJECT
-public:
- explicit QtMaemo6TestStyleEventFilter(QtMaemo6TestStyle *parent);
- virtual ~QtMaemo6TestStyleEventFilter() {};
-protected:
- bool eventFilter(QObject *obj, QEvent *event);
-protected:
- QtMaemo6TestStyle *m_style;
-};
-
-/*!
- * this class is a basic QStyle. It is currently only used for testing purposes
- * and may be deprecated in future
- */
-class QtMaemo6TestStyle : public QPlastiqueStyle
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QtMaemo6TestStyle)
- Q_DISABLE_COPY(QtMaemo6TestStyle)
-
- friend class QtMaemo6TestStyleEventFilter;
- //FIXME: bad dependency
- friend class QtMaemo6StyleEventFilter;
-public:
- QtMaemo6TestStyle();
- virtual ~QtMaemo6TestStyle();
-
- /*! \reimp */
- virtual void polish(QApplication *app);
- virtual void polish(QPalette &palette);
- virtual void polish(QWidget *widget);
- /*! \reimp_end */
-
- /*!
- * initializes the style
- */
- virtual void init();
-protected:
- QtMaemo6TestStylePrivate *const d_ptr;
- QtMaemo6TestStyle(QtMaemo6TestStylePrivate &dd);
-
-protected:
-
- QtMaemo6TestStyleEventFilter *m_windowEventFilter;
- QtMaemo6WindowDecoration *m_windowDecoration;
-
-private:
- void setTexture(QPalette &palette,
- QPalette::ColorRole role,
- const QPixmap &pixmap);
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6teststyle_p.h b/plainqt/style/qtmaemo6teststyle_p.h
deleted file mode 100644
index cb2d6c0a..00000000
--- a/plainqt/style/qtmaemo6teststyle_p.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6TESTSTYLEPRIVATE_H
-#define QTMAEMO6TESTSTYLEPRIVATE_H
-
-#include "qtmaemo6teststyle.h"
-
-/*!
- * private part of the teststyle. This does nothing specific, it's just
- * used as base class for the final style's private class
- */
-class QtMaemo6TestStylePrivate
-{
- Q_DECLARE_PUBLIC(QtMaemo6TestStyle)
-public:
- QtMaemo6TestStylePrivate()
- : m_styleInitialized(false),
- q_ptr(0)
- {};
- virtual ~QtMaemo6TestStylePrivate() {};
-
- void initStyle();
-
- bool m_styleInitialized;
-protected:
- QtMaemo6TestStyle *q_ptr;
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6titlebar.cpp b/plainqt/style/qtmaemo6titlebar.cpp
deleted file mode 100644
index 6bc85c41..00000000
--- a/plainqt/style/qtmaemo6titlebar.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6titlebar.h"
-#include "qtmaemo6clicklabel.h"
-#include "qtmaemo6style_p.h"
-
-#include <QCoreApplication>
-#include <QToolButton>
-#include <QPushButton>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QStyleOption>
-#include <QPainter>
-
-#include <MDebug>
-#include <mapplicationmenubuttonstyle.h>
-#include <mhomebuttonpanelstyle.h>
-#include <mescapebuttonpanelstyle.h>
-#include <mlabelstyle.h>
-#include <MTheme>
-#include <mnavigationbarstyle.h>
-
-
-
-//FIXME: this is not defined by any MStyle right now and also hardcoded in
-// libmeegotouch. If this is finally defined anywhere else, remove this.
-const int QtMaemo6TitleBar::titleBarHeight = 70;
-
-QtMaemo6TitleBar::QtMaemo6TitleBar(QWidget *parent) : QWidget(parent)
-{
- setObjectName(QString("Qt_Maemo6_TitleBar"));
-
- QStyleOption option;
- option.initFrom(this);
-
- m_minimizeButton = new QtMaemo6ClickLabel(this);
- m_minimizeButton->setObjectName( QString( "Qt_Maemo6_TitleBar_Home" ) );
- m_minimizeButton->setScaledContents(true);
- const MHomeButtonPanelStyle *homeButtonStyle =
- static_cast<const MHomeButtonPanelStyle *>(QtMaemo6StylePrivate::mStyle(option.state,
- "MHomeButtonPanelStyle", ""));
- if(homeButtonStyle) {
- m_minimizeButton->setMinimumWidth(homeButtonStyle->minimumSize().width());
- m_minimizeButton->setFixedHeight(homeButtonStyle->minimumSize().height());
- m_minimizeButton->setPixmap(*MTheme::pixmapCopy(homeButtonStyle->homeButtonIconId()));
- }
- connect(m_minimizeButton, SIGNAL(clicked()), this, SIGNAL(minimizeButtonClicked()));
-
- m_titleLabel = new QtMaemo6ClickLabel(this);
- m_titleLabel->setObjectName("Qt_Maemo6_TitleBar_Title");
- connect(m_titleLabel, SIGNAL(clicked()), this, SIGNAL(menuLabelClicked()));
-
- m_titleLabelMenuButton = new QtMaemo6ClickLabel(this);
- m_titleLabelMenuButton->setObjectName("Qt_Maemo6_TitleBar_Menu");
-
- const MApplicationMenuButtonStyle *iconStyle =
- static_cast<const MApplicationMenuButtonStyle *>(QtMaemo6StylePrivate::mStyle(option.state,
- "MApplicationMenuButtonStyle", "NavigationBarMenuButton"));
- if (iconStyle) {
- m_titleLabel->setMinimumWidth(iconStyle->minimumSize().width());
- m_titleLabel->setFixedHeight(iconStyle->minimumSize().height());
- if(!iconStyle->arrowIcon().isEmpty())
- m_titleLabelMenuButton->setPixmap(*MTheme::pixmapCopy(iconStyle->arrowIcon(), iconStyle->arrowIconSize()));
- }
- connect(m_titleLabelMenuButton, SIGNAL(clicked()), this, SIGNAL(menuLabelClicked()));
-
- const MLabelStyle *menuButtonLabelStyle =
- static_cast<const MLabelStyle *>(QtMaemo6StylePrivate::mStyle(option.state,
- "MLabelStyle", "NavigationBarMenuButtonLabel"));
- if(menuButtonLabelStyle) {
- QPalette pal = m_titleLabel->palette();
- pal.setBrush(m_titleLabel->foregroundRole(), menuButtonLabelStyle->color());
- m_titleLabel->setPalette(pal);
- }
-
- m_closeButton = new QtMaemo6ClickLabel(this);
- m_closeButton->setObjectName( QString( "Qt_Maemo6_TitleBar_Close" ) );
- m_closeButton->setScaledContents(true);
- const MEscapeButtonPanelStyle *escapeButtonStyle =
- static_cast<const MEscapeButtonPanelStyle *>(QtMaemo6StylePrivate::mStyle(option.state,
- "MEscapeButtonPanelStyle", ""));
- if(escapeButtonStyle) {
- m_closeButton->setPixmap(*MTheme::pixmapCopy(escapeButtonStyle->closeButtonIconId()));
- m_closeButton->setMinimumWidth(escapeButtonStyle->minimumSize().width());
- m_closeButton->setFixedHeight(escapeButtonStyle->minimumSize().height());
- }
- connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(closeButtonClicked()));
-
- m_titleBarLayout = new QBoxLayout(QBoxLayout::LeftToRight, this);
- m_titleBarLayout->setMargin(0);
- m_titleBarLayout->setSpacing(0);
- m_titleBarLayout->setContentsMargins(0,0,0,0);
- m_titleBarLayout->addWidget(m_minimizeButton);
- m_titleBarLayout->addWidget(m_titleLabel);
- m_titleBarLayout->addWidget(m_titleLabelMenuButton);
- m_titleBarLayout->addStretch();
-
- //m_titleBarLayout->addLayout(m_buttonsLayout);
- m_titleBarLayout->addWidget(m_closeButton);
-
- //TODO: use style and menuStyle once the properties inside work actually.
- // This would also remove the magic numbers.
- setItemSpacing( 20 );
-
- setOrientation(M::Angle0);
-
-}
-
-QtMaemo6TitleBar::~QtMaemo6TitleBar()
-{
-
-}
-
-void QtMaemo6TitleBar::resizeEvent(QResizeEvent *e) {
- QWidget::resizeEvent(e);
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(style())) {
- s->setPaletteBackground(this, "MNavigationBarStyle");
- s->setPaletteBackground(m_closeButton, "MEscapeButtonPanelStyle");
- s->setPaletteBackground(m_minimizeButton, "MHomeButtonPanelStyle");
- s->setPaletteBackground(m_titleLabel, "MLabelStyle", "NavigationBarMenuButton");
- }
-}
-
-void QtMaemo6TitleBar::setTitle(const QString &title)
-{
- m_titleLabel->setText(title);
-}
-
-void QtMaemo6TitleBar::setMargin(int margin)
-{
- m_titleBarLayout->setMargin( margin );
-}
-
-void QtMaemo6TitleBar::setItemSpacing(int spacing)
-{
- m_titleBarLayout->setSpacing( spacing );
-}
-
-QString QtMaemo6TitleBar::title() const
-{
- return m_titleLabel->text();
-}
-
-QColor QtMaemo6TitleBar::titleColor() const
-{
- return m_titleLabel->palette().color( QPalette::Foreground );
-}
-
-int QtMaemo6TitleBar::margin() const
-{
- return m_titleBarLayout->margin();
-}
-
-int QtMaemo6TitleBar::itemSpacing() const
-{
- return m_titleBarLayout->spacing();
-}
-
-void QtMaemo6TitleBar::setMenuButtonVisible(bool visible)
-{
- m_titleLabelMenuButton->setVisible(visible);
-}
-
-void QtMaemo6TitleBar::addAction(QAction *action)
-{
- QToolButton *tbtn = new QToolButton(this);
- tbtn->setDefaultAction(action);
- tbtn->setIconSize(QSize(48, 48));
- tbtn->setAutoRaise(true);
-
- addButton(tbtn);
-}
-
-void QtMaemo6TitleBar::addButton(QToolButton *button)
-{
- Q_UNUSED(button);
- /*
- m_buttonsLayout->addWidget(button);
- m_buttonsLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
-
- */
-}
-
-void QtMaemo6TitleBar::setOrientation(M::OrientationAngle angle) {
- QBoxLayout::Direction direction;
- switch(angle) {
- default:
- case M::Angle0:
- direction = QBoxLayout::LeftToRight;
- setFixedHeight(titleBarHeight);
- setMaximumWidth(1000);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
- break;
- case M::Angle90:
- direction = QBoxLayout::TopToBottom;
- setFixedWidth(titleBarHeight);
- setMaximumHeight(1000);
- setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
- break;
- case M::Angle180:
- direction = QBoxLayout::RightToLeft;
- setFixedHeight(titleBarHeight);
- setMaximumWidth(1000);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
- break;
- case M::Angle270:
- direction = QBoxLayout::BottomToTop;
- setFixedWidth(titleBarHeight);
- setMaximumHeight(1000);
- setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
- break;
- }
- update();
-
- m_titleBarLayout->setDirection(direction);
-
- m_titleBarLayout->setDirection(direction);
- m_minimizeButton->setOrientation(angle);
- m_titleLabel->setOrientation(angle);
- m_titleLabelMenuButton->setOrientation(angle);
- m_closeButton->setOrientation(angle);
- m_orientationAngle = angle;
-
- layout()->activate();
-}
diff --git a/plainqt/style/qtmaemo6titlebar.h b/plainqt/style/qtmaemo6titlebar.h
deleted file mode 100644
index 47c80a27..00000000
--- a/plainqt/style/qtmaemo6titlebar.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6TITLEBAR_H
-#define QTMAEMO6TITLEBAR_H
-
-#include <QWidget>
-#include <QToolButton>
-#include <QHBoxLayout>
-
-#include <mnamespace.h>
-
-class QtMaemo6ClickLabel;
-
-/*!
- * this class emulates a m titlebar
- */
-class QtMaemo6TitleBar : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY(QString title READ title WRITE setTitle)
-public:
- explicit QtMaemo6TitleBar(QWidget *parent);
- virtual ~QtMaemo6TitleBar();
-
- /*!
- * returns the title of titlebar
- */
- QString title() const;
-
- /*!
- * returns the title of titlebar
- */
- QColor titleColor() const;
-
- /*!
- * returns the margin
- */
- int margin() const;
-
- /*!
- * returns the spacing between the items
- */
- int itemSpacing() const;
-
- /*!
- * hides or shows the Menu Button
- */
- void setMenuButtonVisible(bool visible);
-public Q_SLOTS:
- /*!
- * sets the title of the titlebar
- */
- void setTitle(const QString &title);
-
- /*!
- * sets the margin
- */
- void setMargin(int spacing);
-
- /*!
- * sets the spacing between the items
- */
- void setItemSpacing(int spacing);
-
- /*!
- * adds a QAction to the titlebar
- * /see addButton()
- */
- void addAction(QAction *action);
-
- /*!
- * adds a button to the titlebar
- */
- void addButton(QToolButton *button);
-
- /*!
- * sets the orientation of the titlebar
- */
- void setOrientation(M::OrientationAngle);
-
- M::OrientationAngle orientation() const { return m_orientationAngle; };
-Q_SIGNALS:
- /*!
- * this signal is emitted if the home button was pressed
- */
- void closeButtonClicked();
-
- /*!
- * this signal is emitted if the close button was pressed
- */
- void minimizeButtonClicked();
-
- /*!
- * this signal is emitted if the title label was pressed
- */
- void menuLabelClicked();
-
-protected:
- /*! \reimp */
- void resizeEvent(QResizeEvent *);
- /*! \reimp_end */
-
-private:
- static const int titleBarHeight;
- QtMaemo6ClickLabel *m_titleLabel;
- QtMaemo6ClickLabel *m_titleLabelMenuButton;
- QtMaemo6ClickLabel *m_minimizeButton;
- QtMaemo6ClickLabel *m_closeButton;
- QBoxLayout *m_buttonsLayout;
- QBoxLayout *m_titleBarLayout;
- M::OrientationAngle m_orientationAngle;
-};
-
-#endif
diff --git a/plainqt/style/qtmaemo6window.cpp b/plainqt/style/qtmaemo6window.cpp
deleted file mode 100644
index c838b5be..00000000
--- a/plainqt/style/qtmaemo6window.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6window.h"
-
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QWidget>
-#include <QEvent>
-#include <QApplication>
-#include <QCloseEvent>
-#include <QDialog>
-#include <QPainter>
-
-#include <mdeviceprofile.h>
-
-#include "qtmaemo6dialogtitle.h"
-#include "qtmaemo6style_p.h"
-
-QtMaemo6Window::QtMaemo6Window(QWidget *originalWidget, QWidget *parent /* = NULL*/)
- : QWidget(parent)
- , m_window(originalWidget)
- , m_centralWidget(0)
- , m_scrollArea(0)
- , m_closeFromChild(false)
- , m_orientationAngle(M::Angle0)
-{
- setWindowFlags(Qt::Window
- | Qt::CustomizeWindowHint
- | Qt::FramelessWindowHint);
- setAttribute(Qt::WA_DeleteOnClose);
-
- //FIXME: this sort of layouting is not nice
- // spacers and widgets should be handled within this class
- m_windowLayout = new QGridLayout(this);
- m_windowLayout->setMargin(0);
- m_windowLayout->setSpacing(0);
-
- setCentralWidget(m_window);
-
- connect(style(), SIGNAL(orientationChanged(M::OrientationAngle)),
- this, SLOT(setOrientation(M::OrientationAngle)));
-
- if(centralWidget())
- centralWidget()->setAutoFillBackground(true);
-}
-
-QtMaemo6Window::~QtMaemo6Window()
-{
-}
-
-void QtMaemo6Window::doLayoutOrientation()
-{
- //clear layout
- QGridLayout* newLayout = new QGridLayout(this);
- newLayout->setMargin(0);
- newLayout->setSpacing(0);
-
- //iterate through the layout in reverse order
- for(int i = m_windowLayout->count()-1; i >= 0; --i) {
- int row, col, rowspan, colspan;
- m_windowLayout->getItemPosition(i, &row, &col, &rowspan, &colspan);
- QLayoutItem* item = m_windowLayout->takeAt(i);
- //insert item into new layout with reversed row and col and reversed spans
- newLayout->addItem(item, col, row, colspan, rowspan);
- }
- delete layout();
-
- setLayout(newLayout);
- m_windowLayout = newLayout;
- m_windowLayout->activate();
-}
-
-void QtMaemo6Window::setOrientation(M::OrientationAngle angle) {
- //in this case orientation changes betweend landscape and portrait.
- // We need to relayout then, otherwise flipping the layout orientation is enough
- if((m_orientationAngle - angle) % 180 != 0)
- doLayoutOrientation();
-
- Qt::Corner corner;
- switch(angle) {
- default:
- case M::Angle0: corner = Qt::TopLeftCorner; break;
- case M::Angle90:
- //if RTL Layout is set, reverse the whole thing in portrait view
- if(qApp->isRightToLeft())
- corner = Qt::TopLeftCorner;
- else
- corner = Qt::TopRightCorner;
- break;
- case M::Angle180: corner = Qt::BottomRightCorner; break;
- case M::Angle270:
- if(qApp->isRightToLeft())
- corner = Qt::BottomRightCorner;
- else
- corner = Qt::BottomLeftCorner;
- break;
- }
- m_windowLayout->setOriginCorner(corner);
- m_windowLayout->update();
- update();
-
- m_orientationAngle = angle;
- emit orientationChanged(m_orientationAngle);
-}
-
-QSize QtMaemo6Window::maxViewportSize() const
-{
- return m_centralWidget->maximumViewportSize();
-}
-
-void QtMaemo6Window::closeEvent(QCloseEvent *event)
-{
- //prevent deleting the original Widget by Qt
- QWidget* w = 0;
- if (m_scrollArea)
- w = m_scrollArea->takeWidget();
- if(!w) {
- w = m_window;
- layout()->removeWidget(w);
- }
-
- //this must be set back to dialog, so that the dialog can be shown again!
- w->setParent(0);
- w->setAttribute(Qt::WA_DeleteOnClose, false);
- w->setWindowFlags(m_originalFlags);
- QWidget::closeEvent(event);
-}
-
-bool QtMaemo6Window::eventFilter(QObject *obj, QEvent *event)
-{
- switch (event->type()) {
- case QEvent::Close:
- if (!m_closeFromChild) {
- m_closeFromChild = true;
-
- // the decoration is closed, even if the widget is only hidden,
- // because the decoration is created again, when the widget is
- // shown
- this->close();
- return true;
- }
- break;
- case QEvent::Resize:
- if (!qobject_cast<QDialog*>(obj))
- break;
- // Fall through for all dialog cases.
- // Both Resize and Show are needed to cover all cases
- case QEvent::Show: {
- if (m_scrollArea && m_scrollArea->widget())
- m_scrollArea->widget()->setMinimumWidth(maxViewportSize().width());
- }
- break;
- default:
- break;
- }
- return QWidget::eventFilter(obj, event);
-}
-
-void QtMaemo6Window::resizeEvent(QResizeEvent *e) {
- QWidget::resizeEvent(e);
-
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(centralWidget()))
- s->setPaletteBackground(this);
-}
-
-void QtMaemo6Window::paintEvent(QPaintEvent* e) {
- //by default a window with no content is transparent.
- // in derived classes you have to care for the content to draw its own
- // background
- QPainter p(this);
- p.setPen(Qt::NoPen);
- p.setBrush(palette().window());
- p.drawRect(e->rect());
- QWidget::paintEvent(e);
-}
-
-void QtMaemo6Window::showFastMaximized()
-{
- // Size policy instead?
- //set fixed size, to force size also when orientation changes!
- setFixedSize(MDeviceProfile::instance()->resolution());
- show();
-}
-
-void QtMaemo6Window::setCentralWidget(QWidget *widget)
-{
- if (widget) {
- m_window = widget;
- m_originalFlags = m_window->windowFlags();
- m_window->setWindowFlags(Qt::Widget);
-
- m_window->installEventFilter(this);
-
- //remove the current central widget (and scrollArea if set)
- // but don't delete the central widget
- if (m_scrollArea) {
- m_windowLayout->removeWidget(m_scrollArea);
- m_scrollArea->takeWidget();
- delete m_scrollArea;
- m_scrollArea = NULL;
- } else {
- if (m_centralWidget)
- m_windowLayout->removeWidget(m_centralWidget);
- }
- m_centralWidget = NULL;
-
- if (qobject_cast<QAbstractScrollArea *>(widget))
- m_centralWidget = qobject_cast<QAbstractScrollArea *>(widget);
- else {
- m_centralWidget = m_scrollArea = new QScrollArea();
- m_scrollArea->setFrameShape(QFrame::NoFrame);
- m_scrollArea->setWidget(widget);
- }
-
- //If the widget has size policy expanding, then care for the widget to
- //use at least the scroll area viewport's size
- if(widget->sizePolicy().horizontalPolicy() == QSizePolicy::Expanding)
- widget->setMinimumWidth(maxViewportSize().width());
- if(widget->sizePolicy().verticalPolicy() == QSizePolicy::Expanding)
- widget->setMinimumHeight(maxViewportSize().height());
- }
-}
-
-QWidget* QtMaemo6Window::centralWidget() const {
- if(!m_scrollArea)
- return m_window;
- return m_scrollArea;
-}
diff --git a/plainqt/style/qtmaemo6window.h b/plainqt/style/qtmaemo6window.h
deleted file mode 100644
index ae9232d1..00000000
--- a/plainqt/style/qtmaemo6window.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6WINDOW
-#define QTMAEMO6WINDOW
-
-#include <QWidget>
-#include <QScrollArea>
-#include <QPointer>
-#include <QPen>
-
-#include "mnamespace.h"
-
-class QGridLayout;
-
-/*!
- * this is an abstract base class for emulating m windows, such as the
- * application window, dialogs or menus.
- * It may put some decoration around the window and puts the original Widget
- * into a scrollarea, if it is not a scrollarea by itself.
- * The window uses a layout like
- * +------------------------------------------+
- * | topSpacer |
- * +------------+---------------+-------------+
- * | leftSpacer | centralWidget | rightSpacer |
- * +------------+---------------+-------------+
- * | bottomSpacer |
- * +------------------------------------------+
- * the centralWidget is automatically added to the layout's center
- * if you wan't to add spacing you must add the spacers by yourself
- */
-class QtMaemo6Window : public QWidget
-{
- Q_OBJECT
-public:
- /*!
- * Consturct a new window
- * \param originalWidget the widget that should be embedded in this window
- * \param parent the parent widget
- */
- explicit QtMaemo6Window(QWidget *originalWidget, QWidget *parent = NULL);
-
- virtual ~QtMaemo6Window();
-
- /*!
- * returns the maximum size the viewport of the scrollarea
- * may take
- */
- QSize maxViewportSize() const;
-
- /*!
- * shows the window full screen
- * use this instead of showMaximized()
- */
- void showFastMaximized();
-
- /*!
- * \brief sets the widget that is shown inside the window
- * the given widget will be used as the central widget within this window.
- * The widget is not added to any layout, this must be done by the user.
- * If the widget inherits QAbstractScrollArea, it will be added directly. If
- * it does not, a scrollArea will be created and the widget is set as the
- * scrollarea's viewport. Note: in this case, the centralWidget of the window
- * will be the scrollArea, not the given widget!
- */
- void setCentralWidget(QWidget *widget);
-
- /*!
- * \brief returns the central widget of this window
- * If no widget is set, this returns NULL. The returned widget may not be
- * the widget, which was set with setCentralWidget().
- * \see setCentralWidget()
- */
- QWidget* centralWidget() const;
-
- /*!
- * \brief returns the widget set with central widget
- * in opposite to centralWidget() this always returns the added widget.
- */
- QWidget* widget() const { return m_window; }
-
- /*!
- * \brief returns the current orientation angle of the window
- */
- M::OrientationAngle orientation() const { return m_orientationAngle; }
-
-
- /*!
- * \brief this moves the given widget, so that is contained in visibleArea
- */
- virtual void ensureWidgetVisible(QWidget* widget, QRect visibleArea) = 0;
-
-public Q_SLOTS:
- /*!
- * \brief sets a new orientation to this window
- * this method implements a generic orientation change based on the
- * QGridLayout of the QtMaemo6Window.
- * If you need a custom orientation change for a window you can overwrite this
- * method but don't forgett to emit the orientationChanged() signal.
- * Note: This only rotates the layout. Widgets need to care themselfs for drawing
- * their contents rotated.
- */
- virtual void setOrientation(M::OrientationAngle);
-Q_SIGNALS:
- void orientationChanged(M::OrientationAngle);
-protected:
- QtMaemo6Window() {}
-
- void doLayoutOrientation();
-
- /*! \reimp */
- virtual void closeEvent(QCloseEvent *event);
- virtual bool eventFilter(QObject *obj, QEvent *event);
- virtual void resizeEvent(QResizeEvent *);
- virtual void paintEvent(QPaintEvent* e);
- /*! \reimp_end */
-protected:
- QGridLayout *m_windowLayout;
-private:
- QPointer<QWidget> m_window;
- QAbstractScrollArea *m_centralWidget;
- QScrollArea *m_scrollArea;
-
- Qt::WindowFlags m_originalFlags;
- bool m_closeFromChild;
- bool m_hideFromChild;
- M::OrientationAngle m_orientationAngle;
-
-};
-
-#endif //QTMAEMO6WINDOW
diff --git a/plainqt/style/qtmaemo6windowdecoration.cpp b/plainqt/style/qtmaemo6windowdecoration.cpp
deleted file mode 100644
index f293c406..00000000
--- a/plainqt/style/qtmaemo6windowdecoration.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmaemo6windowdecoration.h"
-#include "qtmaemo6style.h"
-#include "qtmaemo6titlebar.h"
-#include "qtmaemo6menuproxy.h"
-#include "qtmaemo6style_p.h"
-
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QWidget>
-#include <QEvent>
-#include <QApplication>
-#include <QCloseEvent>
-#include <MNavigationBar>
-#include <QGraphicsLinearLayout>
-#include <QStatusBar>
-#include <QMenuBar>
-#include <QFile>
-#include <QDir>
-#include <MDebug>
-#include <mdeviceprofile.h>
-
-const int QtMaemo6WindowDecoration::layoutOffset = 2;
-
-
-QtMaemo6WindowDecoration::QtMaemo6WindowDecoration(QWidget *mw, QWidget *parent /* = NULL*/)
- : QtMaemo6Window(mw, parent),
- m_menuBar(0),
- m_statusBar(0),
- m_statusBarParent(0),
- m_deviceStatusBarTimerId(-1)
-{
- m_titleBar = new QtMaemo6TitleBar(NULL);
- m_titleBar->setMenuButtonVisible(false);
- m_titleBar->setTitle(mw->windowTitle());
-
- m_deviceStatusBar = new QLabel();
- //FIXME: set fixed height to 30, because haven't found a place where this is defined
- m_deviceStatusBar->setAlignment(Qt::AlignLeft | Qt::AlignTop);
- updateStatusBarSharedPixmap();
- //FIXME: use XDamage to update the pixmap. As long as this don't work, update every 2 sec
- m_deviceStatusBarTimerId = startTimer(500);
-
- //build the layout, assuming orientation is Angle0
- m_windowLayout->addWidget(m_deviceStatusBar, layoutOffset-2, layoutOffset);
- m_windowLayout->addWidget(m_titleBar, layoutOffset-1, layoutOffset);
- m_windowLayout->addWidget(centralWidget(), layoutOffset, layoutOffset);
-
-
- connect(m_titleBar, SIGNAL(closeButtonClicked()), this, SLOT(close()));
- connect(m_titleBar, SIGNAL(minimizeButtonClicked()), this, SLOT(showMinimized()));
- connect(m_titleBar, SIGNAL(menuLabelClicked()), this, SLOT(showMenuBar()));
- connect(this, SIGNAL(orientationChanged(M::OrientationAngle)),
- m_titleBar, SLOT(setOrientation(M::OrientationAngle)));
- //also update the statusbar pixmap to get correct orientation
- connect(this, SIGNAL(orientationChanged(M::OrientationAngle)),
- this, SLOT(updateStatusBarSharedPixmap(M::OrientationAngle)));
-
-}
-
-QtMaemo6WindowDecoration::~QtMaemo6WindowDecoration()
-{
- //the statusBar must not be deleted by the window decoration on destruction
- if (m_statusBar) {
- m_windowLayout->removeWidget(m_statusBar);
- m_statusBar->setParent(m_statusBarParent);
- }
-}
-
-#ifdef Q_WS_X11
-void QtMaemo6WindowDecoration::updateStatusBarSharedPixmap(M::OrientationAngle angle)
-{
- //destroyXDamageForSharedPixmap();
-
- Qt::HANDLE handle;
- QPixmap statusBarPixmap;
- if (fetchStatusBarSharedPixmapHandle(&handle)) {
- statusBarPixmap = QPixmap::fromX11Pixmap(handle, QPixmap::ExplicitlyShared);
- //m_deviceStatusBar->setPixmap(statusBarPixmap);
- }
-
- QPixmap modifiedPixmap;
-
- //set label size due to orientation
- if(angle == M::Angle0 || angle == M::Angle180) {
- m_deviceStatusBar->setFixedHeight(30);
- m_deviceStatusBar->setMinimumWidth(0);
- m_deviceStatusBar->setMaximumWidth(9999);
-
- modifiedPixmap = statusBarPixmap.copy(0, 0, statusBarPixmap.width(), 30);
- if(angle == M::Angle180) {
- QMatrix m;
- m.rotate(180);
- modifiedPixmap = modifiedPixmap.transformed(m);
- m_deviceStatusBar->setAlignment(Qt::AlignRight | Qt::AlignBottom);
- } else
- m_deviceStatusBar->setAlignment(Qt::AlignLeft | Qt::AlignTop);
- }
- else {
- m_deviceStatusBar->setFixedWidth(30);
- m_deviceStatusBar->setMinimumHeight(0);
- m_deviceStatusBar->setMaximumHeight(9999);
- QMatrix m;
- m.rotate(angle);
- modifiedPixmap = statusBarPixmap.copy(0, 30, width(), 30).transformed(m);
- if(angle == M::Angle90)
- m_deviceStatusBar->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
- else
- m_deviceStatusBar->setAlignment(Qt::AlignRight | Qt::AlignTop);
- }
- m_deviceStatusBar->setPixmap(modifiedPixmap);
-
- /*
- if (!sharedPixmap.isNull()) {
- setupXDamageForSharedPixmap();
- }
- */
-}
-
-bool QtMaemo6WindowDecoration::fetchStatusBarSharedPixmapHandle(Qt::HANDLE *handle)
-{
- QFile handleTempFile(QDir::temp().filePath("mstatusbar_pixmap_handle"));
-
- if (!handleTempFile.exists())
- return false;
-
- if (!handleTempFile.open(QIODevice::ReadOnly))
- return false;
-
- quint32 intHandle;
- QDataStream dataStream(&handleTempFile);
- dataStream >> intHandle;
-
- *handle = intHandle;
-
- return true;
-}
-#endif
-
-void QtMaemo6WindowDecoration::setStatusBar(QStatusBar *statusBar)
-{
- if (!m_windowLayout)
- return;
-
- if (statusBar) {
- m_statusBarParent = statusBar->parentWidget();
- m_windowLayout->addWidget(statusBar, layoutOffset+1, layoutOffset);
- } else {
- if (m_statusBar) {
- m_windowLayout->removeWidget(m_statusBar);
- m_statusBar->setParent(m_statusBarParent);
- m_statusBarParent = NULL;
- }
- }
-
- m_statusBar = statusBar;
-}
-
-void QtMaemo6WindowDecoration::setMenuBar(QMenuBar *menuBar)
-{
- if (menuBar) {
- m_menuBar = menuBar;
- m_titleBar->setMenuButtonVisible(m_menuBar->actions().count() > 0);
- } else {
- m_menuBar = NULL;
- m_titleBar->setMenuButtonVisible(false);
- }
-}
-
-
-void QtMaemo6WindowDecoration::setOrientation(M::OrientationAngle angle) {
- //currently this method does nothing but calling the base method.
- // reimplement an custom orientation change here
- QtMaemo6Window::setOrientation(angle);
-}
-
-
-void QtMaemo6WindowDecoration::showMenuBar()
-{
- if (m_menuBar) {
- QtMaemo6MenuProxy* menuProxy = new QtMaemo6MenuProxy(m_menuBar, this);
- menuProxy->showFastMaximized();
- }
-}
-
-void QtMaemo6WindowDecoration::showNavigationBar( bool visible )
-{
- m_titleBar->setVisible(visible);
-}
-
-void QtMaemo6WindowDecoration::showDeviceStatusBar( bool visible ) {
- m_deviceStatusBar->setVisible(visible);
-}
-
-void QtMaemo6WindowDecoration::ensureWidgetVisible(QWidget* widget, QRect visibleArea) {
- if(visibleArea.isValid()) {
- QAbstractScrollArea* sa = qobject_cast<QAbstractScrollArea*>(centralWidget());
- if(sa) {
- QWidget* viewport = sa->viewport();
-
- //that is the real visible area of the viewport, the navigation bar is excluded here
- QRect realVisibleRect = visibleArea.intersected(
- QRect(viewport->mapToGlobal(QPoint(0,0)), viewport->size() ));
-
- QRect globalWidgetRect = QRect(
- widget->mapToGlobal(QPoint(0,0)),
- widget->size()
- );
-
- QPoint widgetGlobalPosition = widget->mapToGlobal(QPoint(0,0));
-
- //the widget is not fully covered by the visible Area
- if(globalWidgetRect.intersected(realVisibleRect) != globalWidgetRect) {
- QPoint originalViewportPos = viewport->mapToGlobal(QPoint(0,0));
- m_originalWidgetPos.widget = viewport;
- m_originalWidgetPos.position = viewport->pos();
-
- int newXPos = realVisibleRect.top() + ((realVisibleRect.height() - widget->height()) / 2);
- QPoint moveBy = QPoint(0, widgetGlobalPosition.y() - newXPos);
-
- //centered in visibleArea
- viewport->move(-moveBy);
- }
- } else {
-// mDebug("PlainQt Style") << "Can't focus on" << widget << "because scroll area contains no viewport";
- }
- } else {
- if(m_originalWidgetPos.widget) {
- m_originalWidgetPos.widget->move(m_originalWidgetPos.position);
- m_originalWidgetPos.widget = 0;
- }
- }
-}
-
-bool QtMaemo6WindowDecoration::eventFilter(QObject *watched, QEvent *event)
-{
- if (event->type() == QEvent::WindowTitleChange) {
- m_titleBar->setTitle(widget()->windowTitle());
- }
-
- return QtMaemo6Window::eventFilter(watched, event);
-}
-
-void QtMaemo6WindowDecoration::resizeEvent(QResizeEvent * e) {
- QWidget::resizeEvent(e);
- if(QtMaemo6Style* s = qobject_cast<QtMaemo6Style*>(style()))
- s->setPaletteBackground(this);
-}
-
-void QtMaemo6WindowDecoration::timerEvent(QTimerEvent *e) {
- if(e->timerId() == m_deviceStatusBarTimerId)
- updateStatusBarSharedPixmap(orientation());
-}
diff --git a/plainqt/style/qtmaemo6windowdecoration.h b/plainqt/style/qtmaemo6windowdecoration.h
deleted file mode 100644
index e19ed8a6..00000000
--- a/plainqt/style/qtmaemo6windowdecoration.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMAEMO6WINDOWDECORATION_H
-#define QTMAEMO6WINDOWDECORATION_H
-
-#include <QGraphicsView>
-#include <QWidget>
-#include <QScrollArea>
-#include <QPointer>
-
-#include "qtmaemo6window.h"
-
-class QLabel;
-class QStatusBar;
-class QtMaemo6TitleBar;
-class QVBoxLayout;
-class QMenuBar;
-
-/*!
- * this class emulates the m windowdecoration
- * it adds a titlebar and places an statusbar on the bottom of the screen,
- * if available
- */
-class QtMaemo6WindowDecoration : public QtMaemo6Window
-{
- Q_OBJECT
-public:
- explicit QtMaemo6WindowDecoration(QWidget *mw, QWidget *parent = NULL);
- ~QtMaemo6WindowDecoration();
-
- /*!
- * sets the given statusbar as the applications status bar
- * this one stays on the bottom of the screen
- * it takes the ownership of the menuBar
- */
- void setStatusBar(QStatusBar *statusBar);
-
- /*!
- * sets the menuBar for this windowDecoration
- * it takes the ownership of the menuBar
- */
- void setMenuBar(QMenuBar *menuBar);
-
- void showNavigationBar( bool visible );
-
- void showDeviceStatusBar( bool visible );
-
- void ensureWidgetVisible(QWidget* widget, QRect visibleArea);
-protected Q_SLOTS:
- virtual void setOrientation(M::OrientationAngle);
- void showMenuBar();
-protected:
- QtMaemo6WindowDecoration() {}
-
- /*! \reimp */
- virtual bool eventFilter(QObject *obj, QEvent *event);
- virtual void resizeEvent(QResizeEvent *);
- virtual void timerEvent(QTimerEvent *);
- /*! \reimp_end */
-
-#ifdef Q_WS_X11
-protected Q_SLOTS:
- void updateStatusBarSharedPixmap(M::OrientationAngle angle = M::Angle0);
-protected:
- bool fetchStatusBarSharedPixmapHandle(Qt::HANDLE *handle);
-#endif
-private:
- QLabel* m_deviceStatusBar;
- static const int layoutOffset;
-
- QtMaemo6TitleBar *m_titleBar;
- QMenuBar *m_menuBar;
- QStatusBar *m_statusBar;
- QWidget *m_statusBarParent;
-
- int m_deviceStatusBarTimerId;
-
- struct WidgetPos {
- WidgetPos() : widget(NULL) {};
- WidgetPos(QWidget* w, QPoint p) : widget(w), position(p) {};
- WidgetPos(const WidgetPos& other) { widget = other.widget; position = other.position; }
- QWidget* widget;
- QPoint position;
- };
- WidgetPos m_originalWidgetPos;
-};
-
-#endif
diff --git a/plainqt/style/qtmeegofilepicker.cpp b/plainqt/style/qtmeegofilepicker.cpp
deleted file mode 100644
index 4b1ae289..00000000
--- a/plainqt/style/qtmeegofilepicker.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "qtmeegofilepicker.h"
-
-#include <maemo-meegotouch-interfaces/contentsearchinterface.h>
-
-
-typedef QStringList (*_qt_file_open_filenames_hook)
- (QWidget * parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter, QFileDialog::Options options);
-
-typedef QString (*_qt_file_open_filename_hook)
- (QWidget * parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter, QFileDialog::Options options);
-
-typedef QString (*_qt_file_save_filename_hook)
- (QWidget * parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter, QFileDialog::Options options);
-
-typedef QString (*_qt_file_existing_directory_hook)
- (QWidget *parent, const QString &caption, const QString &dir,
- QFileDialog::Options options);
-
-Q_GUI_EXPORT _qt_file_open_filename_hook qt_filedialog_open_filename_hook;
-Q_GUI_EXPORT _qt_file_open_filenames_hook qt_filedialog_open_filenames_hook;
-Q_GUI_EXPORT _qt_file_save_filename_hook qt_filedialog_save_filename_hook;
-Q_GUI_EXPORT _qt_file_existing_directory_hook qt_filedialog_existing_directory_hook;
-
-
-class MeegoFilePickerQtNative {
-
- public:
- MeegoFilePickerQtNative()
- {
- qt_filedialog_open_filename_hook = &openFilename;
- qt_filedialog_save_filename_hook = &saveFilename;
- qt_filedialog_open_filenames_hook = &openFilenames;
- qt_filedialog_existing_directory_hook = &openDirectory;
- }
-
- static QString openFilename(QWidget *parent, const QString &caption,
- const QString &dir, const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options)
- {
- Q_UNUSED( caption )
- Q_UNUSED( dir )
- Q_UNUSED( filter )
- Q_UNUSED( selectedFilter )
- Q_UNUSED( options )
-
- MeegoFilePicker picker(parent);
- picker.SetMode(MeegoFilePicker::Mode_OpenFile);
- picker.exec();
-
- QStringList selectedFiles = picker.getSelectedFileNames();
-
- if (!selectedFiles.isEmpty())
- return selectedFiles[0];
- return "";
- }
-
- static QString saveFilename(QWidget *parent, const QString &caption,
- const QString &dir, const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options)
- {
- Q_UNUSED( caption )
- Q_UNUSED( dir )
- Q_UNUSED( filter )
- Q_UNUSED( selectedFilter )
- Q_UNUSED( options )
-
- MeegoFilePicker picker(parent);
- picker.SetMode(MeegoFilePicker::Mode_SaveFile);
- picker.exec();
-
- return "";
- }
-
- static QString openDirectory(QWidget *parent, const QString &caption, const
- QString &dir, QFileDialog::Options options)
- {
- Q_UNUSED( caption )
- Q_UNUSED( dir )
- Q_UNUSED( options )
-
- MeegoFilePicker picker(parent);
- picker.SetMode(MeegoFilePicker::Mode_OpenDirectory);
- picker.exec();
-
- return "";
- }
-
- static QStringList openFilenames(QWidget *parent, const QString &caption,
- const QString &dir, const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options)
- {
- Q_UNUSED( caption )
- Q_UNUSED( dir )
- Q_UNUSED( filter )
- Q_UNUSED( selectedFilter )
- Q_UNUSED( options )
-
- MeegoFilePicker picker(parent);
- picker.SetMode(MeegoFilePicker::Mode_OpenFiles);
- picker.exec();
-
- return picker.getSelectedFileNames();
- }
-};
-
-static MeegoFilePickerQtNative qtNative;
-
-
-MeegoFilePicker::MeegoFilePicker(QObject * aParent)
-: QEventLoop(aParent)
-, mMode(Mode_Unknown)
-{
- // a unique id for the picker
- mId = QUuid::createUuid().toString();
-
- mSearchIf = new ContentSearchInterface(
- "com.nokia.maemo.meegotouch.ContentSearch");
- connect(mSearchIf, SIGNAL(contentItemSelected(const QString &,
- const QString &)),
- this, SLOT(contentItemSelected(const QString &,
- const QString &)));
- connect(mSearchIf, SIGNAL(contentItemsSelected(const QString &,
- const QStringList &)),
- this, SLOT(contentItemsSelected(const QString &,
- const QStringList &)));
-}
-
-MeegoFilePicker::~MeegoFilePicker()
-{
-}
-
-int MeegoFilePicker::exec(ProcessEventsFlags aFlags)
-{
- switch(mMode)
- {
- case Mode_OpenFile:
- OpenFile();
- break;
- case Mode_OpenFiles:
- OpenFiles();
- break;
- //not implemented yet
- case Mode_OpenDirectory:
- case Mode_SaveFile:
- default:
- return 0;
- }
- return QEventLoop::exec(aFlags);
-}
-
-void MeegoFilePicker::OpenFile()
-{
- mSearchIf->selectSingleContentItem(mId, QString(), QStringList() <<
- "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject",
- QString());
-}
-
-void MeegoFilePicker::OpenFiles()
-{
- mSearchIf->selectMultipleContentItems(mId, QString(), QStringList() <<
- "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject",
- QStringList());
-}
-
-void MeegoFilePicker::SetMode(MeegoFilePickerMode aMode)
-{
- mMode = aMode;
-}
-
-QStringList MeegoFilePicker::getSelectedFileNames()
-{
- return mSelectedFileNames;
-}
-
-void MeegoFilePicker::contentItemSelected(const QString &aCallerId,
- const QString &aContentItem)
-{
- if ( mId != aCallerId )
- return;
-
- mSelectedFileNames.clear();
-
- if (aContentItem.isEmpty())
- {
- exit(0);
- return;
- }
-
- Live<nfo::FileDataObject> data = ::tracker()->liveNode(QUrl(aContentItem));
- QUrl fileUrl = data->getUrl();
- QFileInfo fileInfo(fileUrl.toLocalFile());
- if (fileInfo.isFile()) {
- mSelectedFileNames << fileInfo.canonicalFilePath();
- }
-
- exit(0);
-}
-
-void MeegoFilePicker::contentItemsSelected(const QString &aCallerId,
- const QStringList &aContentItems)
-{
- if ( mId != aCallerId )
- return;
-
- mSelectedFileNames.clear();
-
- foreach(const QString& contentItem, aContentItems)
- {
- Live<nfo::FileDataObject> data =
- ::tracker()->liveNode(QUrl(contentItem));
- QUrl fileUrl = data->getUrl();
- QFileInfo fileInfo(fileUrl.toLocalFile());
- if (fileInfo.isFile())
- mSelectedFileNames << fileInfo.canonicalFilePath();
- }
- exit(0);
-}
-
diff --git a/plainqt/style/qtmeegofilepicker.h b/plainqt/style/qtmeegofilepicker.h
deleted file mode 100644
index 6400a65e..00000000
--- a/plainqt/style/qtmeegofilepicker.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QTMEEGOFILEPICKER_H
-#define QTMEEGOFILEPICKER_H
-
-#include <MApplication>
-#include <MApplicationWindow>
-#include <MScene>
-#include <MApplicationPage>
-
-#include <QtGui/QFileDialog>
-
-// Use Qt Tracker API to get attachment data from tracker:
-#include <QtTracker/Tracker>
-#include <QtTracker/ontologies/nie.h>
-#include <QtTracker/ontologies/nfo.h>
-
-using namespace SopranoLive;
-
-class ContentSearchInterface;
-
-
-class MeegoFilePicker : public QEventLoop
-{
- Q_OBJECT
-public:
- enum MeegoFilePickerMode {
- Mode_Unknown = -1,
- Mode_OpenFile = 0,
- Mode_OpenFiles = 1,
- Mode_SaveFile = 2,
- Mode_OpenDirectory = 3
- };
-
- MeegoFilePicker(QObject *aParent = 0);
- virtual ~MeegoFilePicker();
-
- void SetMode(MeegoFilePickerMode aMode);
- QStringList getSelectedFileNames();
-
- int exec(ProcessEventsFlags aFlags = QEventLoop::AllEvents);
-
-public slots:
- void contentItemSelected(const QString &aCaller, const QString &aItem);
- void contentItemsSelected(const QString &aCaller, const QStringList &aItems);
-
-private:
- void OpenFile();
- void OpenFiles();
-
- QString mId;
- ContentSearchInterface* mSearchIf;
- MeegoFilePickerMode mMode;
- QStringList mSelectedFileNames;
-};
-
-#endif
-
-
diff --git a/plainqt/style/sensorial_bg_3.png b/plainqt/style/sensorial_bg_3.png
deleted file mode 100644
index 8e21b531..00000000
--- a/plainqt/style/sensorial_bg_3.png
+++ /dev/null
Binary files differ
diff --git a/plainqt/style/style.pri b/plainqt/style/style.pri
deleted file mode 100644
index 4b0c4de1..00000000
--- a/plainqt/style/style.pri
+++ /dev/null
@@ -1,50 +0,0 @@
-INCLUDEPATH+=../../src/views/style
-
-PUBLIC_HEADERS += \
- qtmaemo6style.h
-
-PRIVATE_HEADERS += \
- qtmaemo6teststyle.h \
- qtmaemo6teststyle_p.h \
- qtmaemo6style_p.h \
- qtmaemo6styleeventfilter.h \
- qtmaemo6scrollbareventfilter.h \
- qtmaemo6sliderpopup.h \
- qtmaemo6styleplugin.h \
- qtmaemo6titlebar.h \
- qtmaemo6windowdecoration.h \
- qtmaemo6dialogproxy.h \
- qtmaemo6dialogtitle.h \
- qtmaemo6clicklabel.h \
- qtmaemo6window.h \
- qtmaemo6menuproxy.h \
- qtmaemo6menu.h \
- qtmaemo6submenu.h \
- qtmaemo6comboboxpopup.h \
- qtmaemo6kineticscrolling.h
-
-SOURCES = \
- qtmaemo6teststyle.cpp \
- qtmaemo6style.cpp \
- qtmaemo6styleeventfilter.cpp \
- qtmaemo6scrollbareventfilter.cpp \
- qtmaemo6sliderpopup.cpp \
- qtmaemo6styleplugin.cpp \
- qtmaemo6titlebar.cpp \
- qtmaemo6windowdecoration.cpp \
- qtmaemo6dialogproxy.cpp \
- qtmaemo6dialogtitle.cpp \
- qtmaemo6clicklabel.cpp \
- qtmaemo6window.cpp \
- qtmaemo6menuproxy.cpp \
- qtmaemo6menu.cpp \
- qtmaemo6submenu.cpp \
- qtmaemo6comboboxpopup.cpp \
- qtmaemo6kineticscrolling.cpp
-
-contains( DEFINES, HAVE_NATIVE_FILEDIALOG ) {
- PRIVATE_HEADERS += \
- qtmeegofilepicker.h
- SOURCES += \
- qtmeegofilepicker.cpp
-}
diff --git a/plainqt/style/style.pro b/plainqt/style/style.pro
deleted file mode 100644
index 0ba08dc7..00000000
--- a/plainqt/style/style.pro
+++ /dev/null
@@ -1,63 +0,0 @@
-MROOT = ../..
-
-include($$MROOT/mkspecs/common.pri)
-
-system(pkg-config --exists qttracker):HAVE_TRACKER=TRUE
-
-#contains( HAVE_TRACKER, TRUE ) \
-#: exists( $$[QMAKE_MKSPECS]/features/contentsearchinterface-maemo-meegotouch.prf) \
-#: exists( $$[QMAKE_MKSPECS]/features/contentmanager.prf ) {
-# message("Using the Native File Dialog")
-# DEFINES += HAVE_NATIVE_FILEDIALOG
-#}
-#else {
-# message("Build-Dependencies for Native File Dialog are missing! " )
-# message("Please ensure that these packages are installed:" )
-# message("libqttracker-dev, libcontentmanager-dev, maemo-meegotouch-interfaces)")
-#}
-
-include(style.pri)
-
-MLIB = $$MROOT/lib
-MSRC = $$MROOT/src
-MSRCINCLUDE = $$MSRC/include
-MSFWINCLUDE = $$MROOT/servicefw/include
-
-INCLUDEPATH += . \
- $$MSRCINCLUDE \
- $$MROOT/src/corelib/style \
-
-win32|macx {
- macx {
- QMAKE_LFLAGS += -F../../lib
- LIBS += -framework m
- }
- win32:LIBS += -lmeegotouchcore0
-} else {
- LIBS += -lmeegotouchcore -lmeegotouchviews
-}
-contains(DEFINES, HAVE_CONTEXTSUBSCRIBER) {
- LIBS += -lcontextsubscriber
- INCLUDEPATH += /usr/include/contextsubscriber
-}
-
-contains( DEFINES, HAVE_NATIVE_FILEDIALOG ) {
- LIBS += -lmaemomeegotouchcontentsearchinterface -lqttracker
-}
-
-TEMPLATE = lib
- CONFIG += plugin
-
-TARGET = meegotouchqtstyleplugin
-target.path = $$[QT_INSTALL_PLUGINS]/styles
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
-
-install_headers.path = $$M_INSTALL_HEADERS
-install_headers.files = \
- $$PUBLIC_HEADERS
-
-INSTALLS += target \
- install_headers
-
-RESOURCES += style.qrc
diff --git a/plainqt/style/style.qrc b/plainqt/style/style.qrc
deleted file mode 100644
index 7635a3d2..00000000
--- a/plainqt/style/style.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
- <qresource>
- <file>bg2.png</file>
- <file alias="Icon-back.png">../icons/Icon-back.png</file>
- <file alias="Icon-close.png">../icons/Icon-close.png</file>
- <file alias="Icon-home.png">../icons/Icon-home.png</file>
- </qresource>
-</RCC>
-
diff --git a/projects.pro b/projects.pro
index 5f8a2643..8e8484cf 100644
--- a/projects.pro
+++ b/projects.pro
@@ -47,9 +47,6 @@ for(PROJECT, $$list($$lower($$unique(M_BUILD_PARTS)))) {
mthemedaemon \
tools
}
- } else:isEqual(PROJECT, plainqt) {
- SUBDIRS += plainqt
- macx:SUBDIRS -= plainqt
} else:isEqual(PROJECT, tests) {
SUBDIRS += tests
macx:SUBDIRS -= tests
@@ -67,12 +64,7 @@ for(PROJECT, $$list($$lower($$unique(M_BUILD_PARTS)))) {
}
}
-# put mmoc, mgen, src and plainqt dirs in right build order...
-
-contains( SUBDIRS, plainqt ) {
- SUBDIRS -= plainqt
- SUBDIRS = plainqt $$SUBDIRS
-}
+# put mmoc, mgen and src dirs in right build order...
contains( SUBDIRS, src ) {
SUBDIRS -= src
diff --git a/src/translations/translations.pro b/src/translations/translations.pro
index 145b8470..6b1e69b6 100644
--- a/src/translations/translations.pro
+++ b/src/translations/translations.pro
@@ -1,6 +1,6 @@
LANGUAGES = ar de en fi hu ur zh_CN
CATALOGNAME = libmeegotouch
-SOURCEDIR = $$PWD/.. $$PWD/../../plainqt
+SOURCEDIR = $$PWD/..
TRANSLATIONDIR = $$PWD
MROOT = ../..
# these include files are installed to $$[QT_INSTALL_DATA]/mkspecs/features
diff --git a/tests/tests.pro b/tests/tests.pro
index 0d5c1cd4..a8f03f07 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -196,11 +196,6 @@ SUBDIRS += \
ft_mmoc
}
-contains(M_BUILD_PARTS, "plainqt") {
-SUBDIRS += \
- ut_qtmaemo6style
-}
-
QMAKE_STRIP = echo
include(shell.pri)
include(runtests.pri)
diff --git a/tests/ut_qtmaemo6style/.gitignore b/tests/ut_qtmaemo6style/.gitignore
deleted file mode 100644
index e88fafc5..00000000
--- a/tests/ut_qtmaemo6style/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-ut_qtmaemo6style
diff --git a/tests/ut_qtmaemo6style/ut_qtmaemo6style.cpp b/tests/ut_qtmaemo6style/ut_qtmaemo6style.cpp
deleted file mode 100644
index 6dd024ed..00000000
--- a/tests/ut_qtmaemo6style/ut_qtmaemo6style.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QObject>
-#include <QApplication>
-#include <QStyle>
-#include <QMainWindow>
-#include <QPushButton>
-#include <QTimer>
-#include <QDebug>
-#include <QPainter>
-
-#include <qtmaemo6style.h>
-#include "mapplication.h"
-
-#include "ut_qtmaemo6style.h"
-
-/*
- NOTE: this test is only included into test package if the Qt Maemo 6 style is
- included to libmeegotouch.
-*/
-
-void Ut_QtMaemo6Style::init()
-{
-}
-
-void Ut_QtMaemo6Style::cleanup()
-{
-}
-
-void Ut_QtMaemo6Style::initTestCase()
-{
-}
-
-void Ut_QtMaemo6Style::cleanupTestCase()
-{
-}
-
-void Ut_QtMaemo6Style::testStyleLoadedByDefault() {
- //only test it, if at least there is a plugin, otherwise we asume the
- // style is intentionally not installed
- if(QFile::exists("/usr/lib/qt4/plugins/styles/libmeegotouchqtstyleplugin.so")) {
- static int argc = 1;
- static char *argv[1] = { (char *) "./ut_qtmaemo6style" };
- QApplication app(argc, argv);
- QStyle* style = app.style();
- QVERIFY(style->inherits("QtMaemo6Style"));
- } else {
- qDebug() << "Assuming style plugin not installed attentionally";
- }
-}
-
-void Ut_QtMaemo6Style::testLoadOtherStyle() {
- //only test it, if at least there is a plugin, otherwise we asume the
- // style is intentionally not installed
- if(QFile::exists("/usr/lib/qt4/plugins/styles/libmeegotouchqtstyleplugin.so")) {
- static int argc = 3;
- static char *argv[3] = { (char *) "./ut_qtmaemo6style", (char *) "-style", (char *) "windows"};
- QApplication app(argc, argv);
- QStyle* style = app.style();
- QVERIFY(style->inherits("QWindowsStyle"));
- }
-}
-
-void Ut_QtMaemo6Style::testWindowDecoration() {
- //only test it, if at least there is a plugin, otherwise we asume the
- // style is intentionally not installed
- if(QFile::exists("/usr/lib/qt4/plugins/styles/libmeegotouchqtstyleplugin.so")) {
- static int argc = 3;
- static char *argv[3] = { (char *) "./ut_qtmaemo6style", (char *) "-style", (char *) "maemo6"};
- m_app = new QApplication(argc, argv);
- QVERIFY(m_app->style()->inherits("QtMaemo6Style"));
-
- m_mw = new QMainWindow();
- m_mw->show();
- QTimer::singleShot(1000, this, SLOT(testWindowDecorationSlot()));
- //just ensure that the application quits, even if the test fails
- QTimer::singleShot(5000, m_app, SLOT(quit()));
- m_app->exec();
-
- delete m_mw;
- m_mw = 0;
- delete m_app;
- m_app = 0;
- }
-}
-
-void Ut_QtMaemo6Style::testWindowDecorationSlot() {
- //only test it, if at least there is a plugin, otherwise we asume the
- // style is intentionally not installed
- if(QFile::exists("/usr/lib/qt4/plugins/styles/libmeegotouchqtstyleplugin.so")) {
- //this is called by testWindowDecoration(), but also called by the
- //testframework but needs testWindowDecoration() as precondition
- if(m_app && m_mw) {
- QWidget* pw = 0;
- pw = m_mw->parentWidget();
- QVERIFY(pw != 0);
- //search the toplevel widget
- while(pw->parentWidget())
- pw = pw->parentWidget();
- QVERIFY(pw != 0);
- QVERIFY(pw->inherits("QtMaemo6WindowDecoration"));
- m_app->quit();
- }
- }
-}
-
-void Ut_QtMaemo6Style::testFonts() {
- //only test it, if at least there is a plugin, otherwise we asume the
- // style is intentionally not installed
- if(QFile::exists("/usr/lib/qt4/plugins/styles/libmeegotouchqtstyleplugin.so")) {
- static int argc = 1;
- static char *argv[1] = { (char *) "./ut_qtmaemo6style" };
- QApplication app(argc, argv);
- Q_UNUSED(app);
- //font settings on a button should be ignored
- // the font of m style is used
- QPushButton button;
- button.setText("Test");
- button.setFont(QFont("Arial"));
- QSize size1 = button.sizeHint();
-
- QPixmap pix1(size1);
- pix1.fill(Qt::white);
- QPainter p1(&pix1);
- button.render(&p1);
-
- button.setFont(QFont("Helvetica"));
- QSize size2 = button.sizeHint();
- //changing the font shouldn't effect the size
- QCOMPARE(size1, size2);
-
- QPixmap pix2(size2);
- pix2.fill(Qt::white);
- QPainter p2(&pix2);
- button.render(&p2);
- QCOMPARE(pix1.toImage(), pix2.toImage());
- }
-}
-
-QTEST_APPLESS_MAIN(Ut_QtMaemo6Style)
diff --git a/tests/ut_qtmaemo6style/ut_qtmaemo6style.h b/tests/ut_qtmaemo6style/ut_qtmaemo6style.h
deleted file mode 100644
index 167e8095..00000000
--- a/tests/ut_qtmaemo6style/ut_qtmaemo6style.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef UT_QTMAEMO6STYLE_H
-#define UT_QTMAEMO6STYLE_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-class QMainWindow;
-
-// the real unit/QtMaemo6Style class declaration
-#include <qtmaemo6style.h>
-
-Q_DECLARE_METATYPE(QtMaemo6Style *);
-
-class Ut_QtMaemo6Style : public QObject
-{
- Q_OBJECT
-private slots:
- void init();
- void cleanup();
- void initTestCase();
- void cleanupTestCase();
-
- void testStyleLoadedByDefault();
- void testLoadOtherStyle();
-
- void testWindowDecoration();
- void testWindowDecorationSlot();
-
- void testFonts();
-
-private:
- QApplication* m_app;
- QMainWindow* m_mw;
-};
-
-#endif
diff --git a/tests/ut_qtmaemo6style/ut_qtmaemo6style.pro b/tests/ut_qtmaemo6style/ut_qtmaemo6style.pro
deleted file mode 100644
index f5d1260d..00000000
--- a/tests/ut_qtmaemo6style/ut_qtmaemo6style.pro
+++ /dev/null
@@ -1,32 +0,0 @@
-include(../common_top.pri)
-TARGET = ut_qtmaemo6style
-INCLUDEPATH += $$MSRCDIR/corelib/widgets $$MSRCDIR/corelib/style $$MSRCDIR/../plainqt/style
-
-TEST_SOURCES = \
- $$MSRCDIR/../plainqt/style/qtmaemo6style.cpp \
-
-# unit test and unit
-SOURCES += \
- ut_qtmaemo6style.cpp \
-
-# base classes
-SOURCES += \
-
-
-# service classes
-SOURCES += \
- $$STUBSDIR/stubbase.cpp \
-
-# unit test and unit
-HEADERS += \
- ut_qtmaemo6style.h \
-
-# base classes
-HEADERS += \
-
-
-# service classes
-HEADERS += \
-
-
-include(../common_bot.pri)