diff options
author | Robin Burchell <robin+qt@viroteck.net> | 2012-06-18 18:12:50 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-19 13:59:54 +0200 |
commit | ed0250efca989b330dc4838ed996810f4d75574a (patch) | |
tree | 4bed073c449ee9c4b2cc07038b66f49023ab7705 /tools | |
parent | 81a75bde3fb71ced76c975ff9ec9b75bbcc70bcf (diff) |
Strip out Maemo5 code.
Change-Id: Ia4315c32ba35f9ec7bd7b4e935bfcdbc21c1410d
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/deviceorientation_maemo5.cpp | 148 | ||||
-rw-r--r-- | tools/qml/loggerwidget.cpp | 15 | ||||
-rw-r--r-- | tools/qml/proxysettings.cpp | 4 | ||||
-rw-r--r-- | tools/qml/qml.pri | 8 | ||||
-rw-r--r-- | tools/qml/qml.pro | 3 | ||||
-rw-r--r-- | tools/qml/qmlruntime.cpp | 147 |
6 files changed, 2 insertions, 323 deletions
diff --git a/tools/qml/deviceorientation_maemo5.cpp b/tools/qml/deviceorientation_maemo5.cpp deleted file mode 100644 index 2f28bfd9..00000000 --- a/tools/qml/deviceorientation_maemo5.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used 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. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "deviceorientation.h" -#include <QtDBus> - -#include <mce/mode-names.h> -#include <mce/dbus-names.h> - -class MaemoOrientation : public DeviceOrientation -{ - Q_OBJECT -public: - MaemoOrientation() - : o(UnknownOrientation), sensorEnabled(false) - { - resumeListening(); - // connect to the orientation change signal - QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF, - MCE_DEVICE_ORIENTATION_SIG, - this, - SLOT(deviceOrientationChanged(QString))); - } - - ~MaemoOrientation() - { - // disable the orientation sensor - QDBusConnection::systemBus().call( - QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, - MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ)); - } - - inline Orientation orientation() const - { - return o; - } - - void setOrientation(Orientation o) - { - } - - void pauseListening() { - if (sensorEnabled) { - // disable the orientation sensor - QDBusConnection::systemBus().call( - QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, - MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ)); - sensorEnabled = false; - } - } - - void resumeListening() { - if (!sensorEnabled) { - // enable the orientation sensor - QDBusConnection::systemBus().call( - QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, - MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ)); - - QDBusMessage reply = QDBusConnection::systemBus().call( - QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, - MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET)); - - if (reply.type() == QDBusMessage::ErrorMessage) { - qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage())); - } else { - Orientation orientation = toOrientation(reply.arguments().value(0).toString()); - if (o != orientation) { - o = orientation; - emit orientationChanged(); - } - sensorEnabled = true; - } - } - } - -private Q_SLOTS: - void deviceOrientationChanged(const QString &newOrientation) - { - o = toOrientation(newOrientation); - - emit orientationChanged(); -// printf("%d\n", o); - } - -private: - static Orientation toOrientation(const QString &nativeOrientation) - { - if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE) - return Landscape; - else if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE_INVERTED) - return LandscapeInverted; - else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT) - return Portrait; - else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT_INVERTED) - return PortraitInverted; - return UnknownOrientation; - } - -private: - Orientation o; - bool sensorEnabled; -}; - -DeviceOrientation* DeviceOrientation::instance() -{ - static MaemoOrientation *o = new MaemoOrientation; - return o; -} - -#include "deviceorientation_maemo5.moc" diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp index 63b14f0f..baf5f83b 100644 --- a/tools/qml/loggerwidget.cpp +++ b/tools/qml/loggerwidget.cpp @@ -47,11 +47,6 @@ #include <QPlainTextEdit> #include <QLabel> #include <QVBoxLayout> -#ifdef Q_WS_MAEMO_5 -# include <QScrollArea> -# include <QVBoxLayout> -# include "texteditautoresizer_maemo5.h" -#endif #include "loggerwidget.h" @@ -65,17 +60,7 @@ LoggerWidget::LoggerWidget(QWidget *parent) : setWindowTitle(tr("Warnings")); m_plainTextEdit = new QPlainTextEdit(); - -#ifdef Q_WS_MAEMO_5 - new TextEditAutoResizer(m_plainTextEdit); - setAttribute(Qt::WA_Maemo5StackedWindow); - QScrollArea *area = new QScrollArea(); - area->setWidget(m_plainTextEdit); - area->setWidgetResizable(true); - setCentralWidget(area); -#else setCentralWidget(m_plainTextEdit); -#endif m_noWarningsLabel = new QLabel(m_plainTextEdit); m_noWarningsLabel->setText(tr("(No warnings)")); diff --git a/tools/qml/proxysettings.cpp b/tools/qml/proxysettings.cpp index e2278bee..e44cc1ab 100644 --- a/tools/qml/proxysettings.cpp +++ b/tools/qml/proxysettings.cpp @@ -52,10 +52,6 @@ ProxySettings::ProxySettings (QWidget * parent) { setupUi (this); -#if !defined Q_WS_MAEMO_5 - // the onscreen keyboard can't cope with masks - proxyServerEdit->setInputMask(QLatin1String("000.000.000.000;_")); -#endif QIntValidator *validator = new QIntValidator (0, 9999, this); proxyPortEdit->setValidator(validator); diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index 1563ae50..67cf0a4d 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -19,13 +19,7 @@ SOURCES += $$PWD/qmlruntime.cpp \ RESOURCES = $$PWD/browser/browser.qrc \ $$PWD/startup/startup.qrc -maemo5 { - QT += dbus - HEADERS += $$PWD/texteditautoresizer_maemo5.h - SOURCES += $$PWD/deviceorientation_maemo5.cpp - FORMS = $$PWD/recopts_maemo5.ui \ - $$PWD/proxysettings_maemo5.ui -} else:linux-g++-maemo { +linux-g++-maemo { QT += dbus SOURCES += $$PWD/deviceorientation_harmattan.cpp FORMS = $$PWD/recopts.ui \ diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index c159ed6b..54b037f9 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -27,9 +27,6 @@ wince* { QT += webkit } } -maemo5 { - QT += maemo5 -} mac { QMAKE_INFO_PLIST=Info_mac.plist diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 965fc765..0aaeb066 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -44,15 +44,7 @@ #ifdef hz #undef hz #endif -#ifdef Q_WS_MAEMO_5 -# include <QMaemo5ValueButton> -# include <QMaemo5ListPickSelector> -# include <QWidgetAction> -# include <QStringListModel> -# include "ui_recopts_maemo5.h" -#else -# include "ui_recopts.h" -#endif +#include "ui_recopts.h" #include "qmlruntime.h" #include <qdeclarativecontext.h> @@ -195,58 +187,6 @@ private: -#if defined(Q_WS_MAEMO_5) - -class Maemo5PickerAction : public QWidgetAction { - Q_OBJECT -public: - Maemo5PickerAction(const QString &text, QActionGroup *actions, QObject *parent) - : QWidgetAction(parent), m_text(text), m_actions(actions) - { } - - QWidget *createWidget(QWidget *parent) - { - QMaemo5ValueButton *button = new QMaemo5ValueButton(m_text, parent); - button->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered); - QMaemo5ListPickSelector *pick = new QMaemo5ListPickSelector(button); - button->setPickSelector(pick); - if (m_actions) { - QStringList sl; - int curIdx = -1, idx = 0; - foreach (QAction *a, m_actions->actions()) { - sl << a->text(); - if (a->isChecked()) - curIdx = idx; - idx++; - } - pick->setModel(new QStringListModel(sl)); - pick->setCurrentIndex(curIdx); - } else { - button->setEnabled(false); - } - connect(pick, SIGNAL(selected(QString)), this, SLOT(emitTriggered())); - return button; - } - -private slots: - void emitTriggered() - { - QMaemo5ListPickSelector *pick = qobject_cast<QMaemo5ListPickSelector *>(sender()); - if (!pick) - return; - int idx = pick->currentIndex(); - - if (m_actions && idx >= 0 && idx < m_actions->actions().count()) - m_actions->actions().at(idx)->trigger(); - } - -private: - QString m_text; - QPointer<QActionGroup> m_actions; -}; - -#endif // Q_WS_MAEMO_5 - static struct { const char *name, *args; } ffmpegprofiles[] = { {"Maximum Quality", "-sameq"}, {"High Quality", "-qmax 2"}, @@ -263,9 +203,7 @@ public: RecordingDialog(QWidget *parent) : QDialog(parent) { setupUi(this); -#ifndef Q_WS_MAEMO_5 hz->setValidator(new QDoubleValidator(hz)); -#endif for (int i=0; ffmpegprofiles[i].name; ++i) { profile->addItem(QString::fromLatin1(ffmpegprofiles[i].name)); } @@ -296,59 +234,25 @@ public: { QString str = tr("Original (%1x%2)").arg(s.width()).arg(s.height()); -#ifdef Q_WS_MAEMO_5 - sizeCombo->setItemText(0, str); -#else sizeOriginal->setText(str); if (sizeWidth->value()<=1) { sizeWidth->setValue(s.width()); sizeHeight->setValue(s.height()); } -#endif } void showffmpegOptions(bool b) { -#ifdef Q_WS_MAEMO_5 - profileLabel->setVisible(b); - profile->setVisible(b); - ffmpegHelp->setVisible(b); - args->setVisible(b); -#else ffmpegOptions->setVisible(b); -#endif } void showRateOptions(bool b) { -#ifdef Q_WS_MAEMO_5 - rateLabel->setVisible(b); - rateCombo->setVisible(b); -#else rateOptions->setVisible(b); -#endif } void setVideoRate(int rate) { -#ifdef Q_WS_MAEMO_5 - int idx; - if (rate >= 60) - idx = 0; - else if (rate >= 50) - idx = 2; - else if (rate >= 25) - idx = 3; - else if (rate >= 24) - idx = 4; - else if (rate >= 20) - idx = 5; - else if (rate >= 15) - idx = 6; - else - idx = 7; - rateCombo->setCurrentIndex(idx); -#else if (rate == 24) hz24->setChecked(true); else if (rate == 25) @@ -361,23 +265,10 @@ public: hzCustom->setChecked(true); hz->setText(QString::number(rate)); } -#endif } int videoRate() const { -#ifdef Q_WS_MAEMO_5 - switch (rateCombo->currentIndex()) { - case 0: return 60; - case 1: return 50; - case 2: return 25; - case 3: return 24; - case 4: return 20; - case 5: return 15; - case 7: return 10; - default: return 60; - } -#else if (hz24->isChecked()) return 24; else if (hz25->isChecked()) @@ -389,20 +280,10 @@ public: else { return hz->text().toInt(); } -#endif } QSize videoSize() const { -#ifdef Q_WS_MAEMO_5 - switch (sizeCombo->currentIndex()) { - case 0: return QSize(); - case 1: return QSize(640,480); - case 2: return QSize(320,240); - case 3: return QSize(1280,720); - default: return QSize(); - } -#else if (sizeOriginal->isChecked()) return QSize(); else if (size720p->isChecked()) @@ -413,7 +294,6 @@ public: return QSize(320,240); else return QSize(sizeWidth->value(), sizeHeight->value()); -#endif } @@ -616,10 +496,6 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) { QDeclarativeViewer::registerTypes(); setWindowTitle(tr("Qt QML Viewer")); -#ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_Maemo5StackedWindow); -// setPalette(QApplication::palette("QLabel")); -#endif devicemode = false; canvas = 0; @@ -788,27 +664,6 @@ void QDeclarativeViewer::createMenu() if (!menu) return; -#if defined(Q_WS_MAEMO_5) - menu->addAction(openAction); - menu->addAction(openUrlAction); - menu->addAction(reloadAction); - - menu->addAction(snapshotAction); - menu->addAction(recordAction); - - menu->addAction(recordOptions); - menu->addAction(proxyAction); - - menu->addAction(slowAction); - menu->addAction(showWarningsWindow); - - orientation->addAction(landscapeAction); - orientation->addAction(portraitAction); - menu->addAction(new Maemo5PickerAction(tr("Set orientation"), orientation, this)); - menu->addAction(fullscreenAction); - return; -#endif // Q_WS_MAEMO_5 - QMenu *fileMenu = menu->addMenu(tr("&File")); fileMenu->addAction(openAction); fileMenu->addAction(openUrlAction); |