From 4ae7aecb68b506f21bd5411bf92a1e8d9fe807bb Mon Sep 17 00:00:00 2001 From: Damian Jansen Date: Wed, 19 Oct 2011 15:04:15 +1000 Subject: Remove Q_WS_*, symbian and maemo code in QtDeclarative Change-Id: If64daf80f9d19973e0bc2d864b003a66be5ca61d Reviewed-by: Alan Alpert --- tools/qmlscene/main.cpp | 2 +- tools/qmlscene/qmlscene.pro | 4 - tools/qmlviewer/deviceorientation_maemo5.cpp | 148 --------------- tools/qmlviewer/deviceorientation_symbian.cpp | 192 ------------------- tools/qmlviewer/loggerwidget.cpp | 29 --- tools/qmlviewer/main.cpp | 44 +---- tools/qmlviewer/proxysettings.cpp | 4 - tools/qmlviewer/proxysettings.h | 4 - tools/qmlviewer/proxysettings_maemo5.ui | 177 ------------------ tools/qmlviewer/qdeclarativetester.cpp | 13 +- tools/qmlviewer/qml.pri | 20 +- tools/qmlviewer/qmlruntime.cpp | 224 +---------------------- tools/qmlviewer/qmlviewer.pro | 14 -- tools/qmlviewer/recopts_maemo5.ui | 254 -------------------------- tools/qmlviewer/texteditautoresizer_maemo5.h | 113 ------------ 15 files changed, 12 insertions(+), 1230 deletions(-) delete mode 100644 tools/qmlviewer/deviceorientation_maemo5.cpp delete mode 100644 tools/qmlviewer/deviceorientation_symbian.cpp delete mode 100644 tools/qmlviewer/proxysettings_maemo5.ui delete mode 100644 tools/qmlviewer/recopts_maemo5.ui delete mode 100644 tools/qmlviewer/texteditautoresizer_maemo5.h (limited to 'tools') diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 4706c72eb6..336fc899cd 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -514,7 +514,7 @@ int main(int argc, char ** argv) window->show(); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC window->raise(); #endif diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro index 66c2cda035..d0c4ec7a20 100644 --- a/tools/qmlscene/qmlscene.pro +++ b/tools/qmlscene/qmlscene.pro @@ -13,8 +13,4 @@ SOURCES += main.cpp CONFIG += console declarative_debug -symbian { - TARGET.EPOCHEAPSIZE = 0x20000 0x5000000 -} - DEFINES += QML_RUNTIME_TESTING diff --git a/tools/qmlviewer/deviceorientation_maemo5.cpp b/tools/qmlviewer/deviceorientation_maemo5.cpp deleted file mode 100644 index 59292d93ff..0000000000 --- a/tools/qmlviewer/deviceorientation_maemo5.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** 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 - -#include -#include - -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/qmlviewer/deviceorientation_symbian.cpp b/tools/qmlviewer/deviceorientation_symbian.cpp deleted file mode 100644 index deeb45dc5a..0000000000 --- a/tools/qmlviewer/deviceorientation_symbian.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** 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 -#include -#include -#include -#include - -class SymbianOrientation : public DeviceOrientation, public MSensrvDataListener -{ - Q_OBJECT -public: - SymbianOrientation() - : DeviceOrientation(), m_current(UnknownOrientation), m_sensorChannel(0), m_channelOpen(false) - { - TRAP_IGNORE(initL()); - if (!m_sensorChannel) - qWarning("No valid sensors found."); - } - - ~SymbianOrientation() - { - if (m_sensorChannel) { - m_sensorChannel->StopDataListening(); - m_sensorChannel->CloseChannel(); - delete m_sensorChannel; - } - } - - void initL() - { - CSensrvChannelFinder *channelFinder = CSensrvChannelFinder::NewLC(); - RSensrvChannelInfoList channelInfoList; - CleanupClosePushL(channelInfoList); - - TSensrvChannelInfo searchConditions; - searchConditions.iChannelType = KSensrvChannelTypeIdOrientationData; - channelFinder->FindChannelsL(channelInfoList, searchConditions); - - for (int i = 0; i < channelInfoList.Count(); ++i) { - TRAPD(error, m_sensorChannel = CSensrvChannel::NewL(channelInfoList[i])); - if (!error) - TRAP(error, m_sensorChannel->OpenChannelL()); - if (!error) { - TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0)); - m_channelOpen = true; - break; - } - if (error) { - delete m_sensorChannel; - m_sensorChannel = 0; - } - } - - channelInfoList.Close(); - CleanupStack::Pop(&channelInfoList); - CleanupStack::PopAndDestroy(channelFinder); - } - - Orientation orientation() const - { - return m_current; - } - - void setOrientation(Orientation) { } - -private: - DeviceOrientation::Orientation m_current; - CSensrvChannel *m_sensorChannel; - bool m_channelOpen; - void pauseListening() { - if (m_sensorChannel && m_channelOpen) { - m_sensorChannel->StopDataListening(); - m_sensorChannel->CloseChannel(); - m_channelOpen = false; - } - } - - void resumeListening() { - if (m_sensorChannel && !m_channelOpen) { - TRAPD(error, m_sensorChannel->OpenChannelL()); - if (!error) { - TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0)); - if (!error) { - m_channelOpen = true; - } - } - if (error) { - delete m_sensorChannel; - m_sensorChannel = 0; - } - } - } - - void DataReceived(CSensrvChannel &channel, TInt count, TInt dataLost) - { - Q_UNUSED(dataLost) - if (channel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdOrientationData) { - TSensrvOrientationData data; - for (int i = 0; i < count; ++i) { - TPckgBuf dataBuf; - channel.GetData(dataBuf); - data = dataBuf(); - Orientation orientation = UnknownOrientation; - switch (data.iDeviceOrientation) { - case TSensrvOrientationData::EOrientationDisplayUp: - orientation = Portrait; - break; - case TSensrvOrientationData::EOrientationDisplayRightUp: - orientation = Landscape; - break; - case TSensrvOrientationData::EOrientationDisplayLeftUp: - orientation = LandscapeInverted; - break; - case TSensrvOrientationData::EOrientationDisplayDown: - orientation = PortraitInverted; - break; - case TSensrvOrientationData::EOrientationUndefined: - case TSensrvOrientationData::EOrientationDisplayUpwards: - case TSensrvOrientationData::EOrientationDisplayDownwards: - default: - break; - } - - if (m_current != orientation && orientation != UnknownOrientation) { - m_current = orientation; - emit orientationChanged(); - } - } - } - } - - void DataError(CSensrvChannel& /* channel */, TSensrvErrorSeverity /* error */) - { - } - - void GetDataListenerInterfaceL(TUid /* interfaceUid */, TAny*& /* interface */) - { - } -}; - - -DeviceOrientation* DeviceOrientation::instance() -{ - static SymbianOrientation *o = 0; - if (!o) - o = new SymbianOrientation; - return o; -} - -#include "deviceorientation_symbian.moc" diff --git a/tools/qmlviewer/loggerwidget.cpp b/tools/qmlviewer/loggerwidget.cpp index a82336bfb9..0393299d1f 100644 --- a/tools/qmlviewer/loggerwidget.cpp +++ b/tools/qmlviewer/loggerwidget.cpp @@ -47,11 +47,6 @@ #include #include #include -#ifdef Q_WS_MAEMO_5 -# include -# include -# include "texteditautoresizer_maemo5.h" -#endif #include "loggerwidget.h" @@ -65,31 +60,7 @@ LoggerWidget::LoggerWidget(QWidget *parent) : setWindowTitle(tr("Warnings")); m_plainTextEdit = new QPlainTextEdit(); - -#if defined(Q_OS_SYMBIAN) - QAction* clearAction = new QAction(tr("Clear"), this); - clearAction->setSoftKeyRole(QAction::PositiveSoftKey); - connect(clearAction, SIGNAL(triggered()), m_plainTextEdit, SLOT(clear())); - addAction(clearAction); - - m_plainTextEdit->setReadOnly(true); - QAction* backAction = new QAction( tr("Back"), this ); - backAction->setSoftKeyRole( QAction::NegativeSoftKey ); - connect(backAction, SIGNAL(triggered()), this, SLOT(hide())); - addAction( backAction ); -#endif - -#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)")); m_noWarningsLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index cf33c4e365..91362bb241 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -76,13 +76,6 @@ void exitApp(int i) QWeakPointer logger; static QAtomicInt recursiveLock(0); -#if defined (Q_OS_SYMBIAN) -#include -#include -#include -#include -#endif - void myMessageOutput(QtMsgType type, const char *msg) { QString strMsg = QString::fromLatin1(msg); @@ -98,19 +91,6 @@ void myMessageOutput(QtMsgType type, const char *msg) warnings += QLatin1Char('\n'); } } -#if defined (Q_OS_SYMBIAN) - static int fd = -1; - if (fd == -1) - fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); - - ::write(fd, msg, strlen(msg)); - ::write(fd, "\n", 1); - ::fsync(fd); - switch (type) { - case QtFatalMsg: - abort(); - } -#endif if (systemMsgOutput) { systemMsgOutput(type, msg); @@ -154,7 +134,7 @@ void usage() qWarning(" -I ........................... prepend to the module import search path,"); qWarning(" display path if is empty"); qWarning(" -P ........................... prepend to the plugin search path"); -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) qWarning(" -no-opengl ............................... don't use a QGLWidget for the viewport"); qWarning(" -opengl .................................. use a QGLWidget for the viewport (default)"); #else @@ -212,12 +192,8 @@ struct ViewerOptions warningsConfig(DefaultWarnings), sizeToView(true) { -#if defined(Q_OS_SYMBIAN) - maximized = true; - useNativeFileBrowser = false; -#endif -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) useGL = true; #endif } @@ -522,22 +498,6 @@ QDeclarativeViewer *openFile(const QString &fileName) int main(int argc, char ** argv) { systemMsgOutput = qInstallMsgHandler(myMessageOutput); - -#if defined (Q_WS_X11) || defined (Q_WS_MAC) - //### default to using raster graphics backend for now - bool gsSpecified = false; - for (int i = 0; i < argc; ++i) { - QString arg = QString::fromAscii(argv[i]); - if (arg == QLatin1String("-graphicssystem")) { - gsSpecified = true; - break; - } - } - - if (!gsSpecified) - QApplication::setGraphicsSystem(QLatin1String("raster")); -#endif - Application app(argc, argv); app.setApplicationName(QLatin1String("QtQmlViewer")); app.setOrganizationName(QLatin1String("Nokia")); diff --git a/tools/qmlviewer/proxysettings.cpp b/tools/qmlviewer/proxysettings.cpp index 8bc778d18a..bb83d79db9 100644 --- a/tools/qmlviewer/proxysettings.cpp +++ b/tools/qmlviewer/proxysettings.cpp @@ -51,11 +51,7 @@ ProxySettings::ProxySettings (QWidget * parent) : QDialog (parent), Ui::ProxySettings() { 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/qmlviewer/proxysettings.h b/tools/qmlviewer/proxysettings.h index c801221c7b..c15dc198d4 100644 --- a/tools/qmlviewer/proxysettings.h +++ b/tools/qmlviewer/proxysettings.h @@ -44,11 +44,7 @@ #include #include -#ifdef Q_WS_MAEMO_5 -#include "ui_proxysettings_maemo5.h" -#else #include "ui_proxysettings.h" -#endif QT_BEGIN_NAMESPACE /** diff --git a/tools/qmlviewer/proxysettings_maemo5.ui b/tools/qmlviewer/proxysettings_maemo5.ui deleted file mode 100644 index 75875d835b..0000000000 --- a/tools/qmlviewer/proxysettings_maemo5.ui +++ /dev/null @@ -1,177 +0,0 @@ - - - ProxySettings - - - - 0 - 0 - 447 - 162 - - - - HTTP Proxy - - - - 16 - - - 0 - - - 16 - - - 8 - - - 16 - - - 0 - - - - - Use HTTP Proxy - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 16 - - - 0 - - - 0 - - - - - Server - - - - - - - Name or IP - - - - - - - Port - - - - - - - 8080 - - - - - - - Username - - - - - - - - - - Password - - - - - - - QLineEdit::Password - - - - - - - - - - Qt::Vertical - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - proxyCheckBox - proxyServerEdit - proxyPortEdit - usernameEdit - passwordEdit - buttonBox - - - - - buttonBox - accepted() - ProxySettings - accept() - - - 318 - 100 - - - 157 - 116 - - - - - buttonBox - rejected() - ProxySettings - reject() - - - 318 - 100 - - - 286 - 116 - - - - - diff --git a/tools/qmlviewer/qdeclarativetester.cpp b/tools/qmlviewer/qdeclarativetester.cpp index 842c3a369d..d07b22ea6b 100644 --- a/tools/qmlviewer/qdeclarativetester.cpp +++ b/tools/qmlviewer/qdeclarativetester.cpp @@ -49,9 +49,7 @@ #include #include #include -#ifndef Q_OS_SYMBIAN #include -#endif QT_BEGIN_NAMESPACE @@ -269,9 +267,8 @@ void QDeclarativeTester::save() void QDeclarativeTester::updateCurrentTime(int msec) { -#ifndef Q_OS_SYMBIAN QDeclarativeItemPrivate::setConsistentTime(msec); -#endif + if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot) return; @@ -280,14 +277,14 @@ void QDeclarativeTester::updateCurrentTime(int msec) if (options & QDeclarativeViewer::TestImages) { img.fill(qRgb(255,255,255)); -#ifdef Q_WS_MAC +/*#ifdef Q_OS_MAC //Compile failure on Cocoa x64 QTBUG-22304 bool oldSmooth = qt_applefontsmoothing_enabled; qt_applefontsmoothing_enabled = false; -#endif +#endif*/ QPainter p(&img); -#ifdef Q_WS_MAC +/*#ifdef Q_OS_MAC //Compile failure on Cocoa x64 QTBUG-22304 qt_applefontsmoothing_enabled = oldSmooth; -#endif +#endif*/ m_view->render(&p); } diff --git a/tools/qmlviewer/qml.pri b/tools/qmlviewer/qml.pri index e84dfb5c9b..8f54505f0e 100644 --- a/tools/qmlviewer/qml.pri +++ b/tools/qmlviewer/qml.pri @@ -19,25 +19,7 @@ SOURCES += $$PWD/qmlruntime.cpp \ RESOURCES = $$PWD/browser/browser.qrc \ $$PWD/startup/startup.qrc -symbian { - contains(QT_CONFIG, s60) { - LIBS += -lavkon -lcone - } - !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { - LIBS += -lsensrvclient -lsensrvutil - SOURCES += $$PWD/deviceorientation_symbian.cpp - } else { - SOURCES += $$PWD/deviceorientation.cpp - } - FORMS = $$PWD/recopts.ui \ - $$PWD/proxysettings.ui -} else: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/qmlviewer/qmlruntime.cpp b/tools/qmlviewer/qmlruntime.cpp index 5ece654d08..3daa3d4ea4 100644 --- a/tools/qmlviewer/qmlruntime.cpp +++ b/tools/qmlviewer/qmlruntime.cpp @@ -44,15 +44,7 @@ #ifdef hz #undef hz #endif -#ifdef Q_WS_MAEMO_5 -# include -# include -# include -# include -# include "ui_recopts_maemo5.h" -#else # include "ui_recopts.h" -#endif #include "qmlruntime.h" #include @@ -96,17 +88,12 @@ #include #include "proxysettings.h" #include "deviceorientation.h" +#include #ifdef GL_SUPPORTED #include #endif -#if defined(Q_WS_S60) -#include // For locking app orientation -#endif - -#include - QT_BEGIN_NAMESPACE class DragAndDropView : public QDeclarativeView @@ -193,60 +180,6 @@ private: bool activeWindow; }; - - -#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(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 m_actions; -}; - -#endif // Q_WS_MAEMO_5 - static struct { const char *name, *args; } ffmpegprofiles[] = { {"Maximum Quality", "-sameq"}, {"High Quality", "-qmax 2"}, @@ -263,9 +196,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::fromAscii(ffmpegprofiles[i].name)); } @@ -296,59 +227,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 +258,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 +273,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 +287,6 @@ public: return QSize(320,240); else return QSize(sizeWidth->value(), sizeHeight->value()); -#endif } @@ -616,11 +489,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; record_autotime = 0; @@ -743,10 +611,8 @@ void QDeclarativeViewer::createMenu() connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool))); showWarningsWindow = new QAction(tr("Show Warnings"), this); -#if !defined(Q_OS_SYMBIAN) showWarningsWindow->setCheckable((true)); showWarningsWindow->setChecked(loggerWindow->isVisible()); -#endif connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool))); QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this); @@ -764,30 +630,22 @@ void QDeclarativeViewer::createMenu() orientation->setExclusive(true); connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*))); -#if defined(Q_OS_SYMBIAN) - QAction *autoOrientationAction = new QAction(tr("Auto-orientation"), this); - autoOrientationAction->setCheckable(true); -#endif QAction *portraitAction = new QAction(tr("Portrait"), this); portraitAction->setCheckable(true); QAction *landscapeAction = new QAction(tr("Landscape"), this); landscapeAction->setCheckable(true); -#if !defined(Q_OS_SYMBIAN) QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this); portraitInvAction->setCheckable(true); QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this); landscapeInvAction->setCheckable(true); -#endif QAction *aboutAction = new QAction(tr("&About Qt..."), this); aboutAction->setMenuRole(QAction::AboutQtRole); connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); -#if !defined(Q_OS_SYMBIAN) QAction *closeAction = new QAction(tr("&Close"), this); closeAction->setShortcuts(QKeySequence::Close); connect(closeAction, SIGNAL(triggered()), this, SLOT(close())); -#endif QAction *quitAction = new QAction(tr("&Quit"), this); quitAction->setMenuRole(QAction::QuitRole); @@ -796,34 +654,12 @@ void QDeclarativeViewer::createMenu() QMenuBar *menu = menuBar(); 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 + return; QMenu *fileMenu = menu->addMenu(tr("&File")); fileMenu->addAction(openAction); fileMenu->addAction(openUrlAction); fileMenu->addAction(reloadAction); -#if !defined(Q_OS_SYMBIAN) fileMenu->addSeparator(); fileMenu->addAction(closeAction); fileMenu->addAction(quitAction); @@ -831,7 +667,6 @@ void QDeclarativeViewer::createMenu() QMenu *recordMenu = menu->addMenu(tr("&Recording")); recordMenu->addAction(snapshotAction); recordMenu->addAction(recordAction); -#endif // ! Q_OS_SYMBIAN QMenu *debugMenu = menu->addMenu(tr("&Debugging")); debugMenu->addAction(slowAction); @@ -839,25 +674,16 @@ void QDeclarativeViewer::createMenu() QMenu *settingsMenu = menu->addMenu(tr("&Settings")); settingsMenu->addAction(proxyAction); -#if defined(Q_OS_SYMBIAN) - settingsMenu->addAction(fullscreenAction); -#else settingsMenu->addAction(recordOptions); settingsMenu->addMenu(loggerWindow->preferencesMenu()); -#endif // !Q_OS_SYMBIAN settingsMenu->addAction(rotateAction); QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties")); -#if defined(Q_OS_SYMBIAN) - orientation->addAction(autoOrientationAction); -#endif orientation->addAction(portraitAction); orientation->addAction(landscapeAction); -#if !defined(Q_OS_SYMBIAN) orientation->addAction(portraitInvAction); orientation->addAction(landscapeInvAction); -#endif propertiesMenu->addActions(orientation->actions()); QMenu *helpMenu = menu->addMenu(tr("&Help")); @@ -881,23 +707,6 @@ void QDeclarativeViewer::proxySettingsChanged() void QDeclarativeViewer::rotateOrientation() { -#if defined(Q_WS_S60) - CAknAppUi *appUi = static_cast(CEikonEnv::Static()->AppUi()); - if (appUi) { - CAknAppUi::TAppUiOrientation oldOrientation = appUi->Orientation(); - QString newOrientation; - if (oldOrientation == CAknAppUi::EAppUiOrientationPortrait) { - newOrientation = QLatin1String("Landscape"); - } else { - newOrientation = QLatin1String("Portrait"); - } - foreach (QAction *action, orientation->actions()) { - if (action->text() == newOrientation) { - changeOrientation(action); - } - } - } -#else QAction *current = orientation->checkedAction(); QList actions = orientation->actions(); int index = actions.indexOf(current); @@ -906,7 +715,6 @@ void QDeclarativeViewer::rotateOrientation() QAction *newOrientation = actions[(index + 1) % actions.count()]; changeOrientation(newOrientation); -#endif } void QDeclarativeViewer::toggleFullScreen() @@ -919,11 +727,7 @@ void QDeclarativeViewer::toggleFullScreen() void QDeclarativeViewer::showWarnings(bool show) { -#if defined(Q_OS_SYMBIAN) - loggerWindow->showMaximized(); -#else loggerWindow->setVisible(show); -#endif } void QDeclarativeViewer::warningsWidgetOpened() @@ -1118,12 +922,7 @@ bool QDeclarativeViewer::open(const QString& file_or_url) canvas->engine()->clearComponentCache(); QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty(QLatin1String("qmlViewer"), this); -#ifdef Q_OS_SYMBIAN - ctxt->setContextProperty(QLatin1String("qmlViewerFolder"), QLatin1String("E:\\")); // Documents on your S60 phone -#else ctxt->setContextProperty(QLatin1String("qmlViewerFolder"), QDir::currentPath()); -#endif - ctxt->setContextProperty(QLatin1String("runtime"), Runtime::instance()); QString fileName = url.toLocalFile(); @@ -1443,22 +1242,6 @@ void QDeclarativeViewer::changeOrientation(QAction *action) return; QString o = action->text(); action->setChecked(true); -#if defined(Q_WS_S60) - CAknAppUi *appUi = static_cast(CEikonEnv::Static()->AppUi()); - if (appUi) { - CAknAppUi::TAppUiOrientation orientation = appUi->Orientation(); - if (o == QLatin1String("Auto-orientation")) { - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationAutomatic); - rotateAction->setVisible(false); - } else if (o == QLatin1String("Portrait")) { - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait); - rotateAction->setVisible(true); - } else if (o == QLatin1String("Landscape")) { - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); - rotateAction->setVisible(true); - } - } -#else if (o == QLatin1String("Portrait")) DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); else if (o == QLatin1String("Landscape")) @@ -1467,7 +1250,6 @@ void QDeclarativeViewer::changeOrientation(QAction *action) DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted); else if (o == QLatin1String("Landscape (inverted)")) DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted); -#endif } void QDeclarativeViewer::orientationChanged() @@ -1490,7 +1272,7 @@ void QDeclarativeViewer::setUseGL(bool useGL) #ifdef GL_SUPPORTED if (useGL) { QGLFormat format = QGLFormat::defaultFormat(); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC format.setSampleBuffers(true); format.setSwapInterval(1); #else diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qmlviewer/qmlviewer.pro index 1f7a6024f4..980c1d4b3c 100644 --- a/tools/qmlviewer/qmlviewer.pro +++ b/tools/qmlviewer/qmlviewer.pro @@ -17,20 +17,6 @@ DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII target.path = $$[QT_INSTALL_BINS] INSTALLS += target -maemo5 { - QT += maemo5 -} -symbian { - TARGET.UID3 = 0x20021317 - CONFIG += qt_demo - TARGET.EPOCHEAPSIZE = 0x20000 0x4000000 - TARGET.CAPABILITY = NetworkServices ReadUserData - - # Deploy plugin for remote debugging - qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmltooling/qmldbg_tcp$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/qmltooling/qmldbg_ost$${QT_LIBINFIX}.dll - qmldebuggingplugin.path = c:$$QT_PLUGINS_BASE_DIR/qmltooling - DEPLOYMENT += qmldebuggingplugin -} mac { QMAKE_INFO_PLIST=Info_mac.plist TARGET=QMLViewer diff --git a/tools/qmlviewer/recopts_maemo5.ui b/tools/qmlviewer/recopts_maemo5.ui deleted file mode 100644 index 3bb5ecabd9..0000000000 --- a/tools/qmlviewer/recopts_maemo5.ui +++ /dev/null @@ -1,254 +0,0 @@ - - - RecordingOptions - - - - 0 - 0 - 469 - 142 - - - - Video options - - - - QLayout::SetMinAndMaxSize - - - 16 - - - 0 - - - 16 - - - 8 - - - 16 - - - 0 - - - - - - - - Qt::Vertical - - - - 72 - 56 - - - - - - - - Size - - - - - - - - - - - - - VGA - - - - - QVGA - - - - - 720p - - - - - - - - Rate - - - - - - - - 60 Hz - - - - - 50 Hz - - - - - 25 Hz - - - - - 24 Hz - - - - - 20 Hz - - - - - 15 Hz - - - - - 10 Hz - - - - - - - - - - - - - - Profile - - - - - - - warning - - - true - - - - - - - Qt::Vertical - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - File - - - - - - - Options - - - - - - - - - buttonBox - accepted() - RecordingOptions - accept() - - - 258 - 424 - - - 60 - 219 - - - - - buttonBox - rejected() - RecordingOptions - reject() - - - 258 - 424 - - - 92 - 219 - - - - - profile - activated(int) - RecordingOptions - pickProfile(int) - - - 92 - 329 - - - 48 - 194 - - - - - args - textEdited(QString) - RecordingOptions - storeCustomArgs(QString) - - - 128 - 357 - - - 102 - 189 - - - - - - filePicked(QString) - argumentsPicked(QString) - pickFile() - pickProfile(int) - storeCustomArgs(QString) - - diff --git a/tools/qmlviewer/texteditautoresizer_maemo5.h b/tools/qmlviewer/texteditautoresizer_maemo5.h deleted file mode 100644 index 10bf4a1443..0000000000 --- a/tools/qmlviewer/texteditautoresizer_maemo5.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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 -#include -#include -#include -#include - -#ifndef TEXTEDITAUTORESIZER_H -#define TEXTEDITAUTORESIZER_H - -class TextEditAutoResizer : public QObject -{ - Q_OBJECT -public: - TextEditAutoResizer(QWidget *parent) - : QObject(parent), plainTextEdit(qobject_cast(parent)), - textEdit(qobject_cast(parent)), edit(qobject_cast(parent)) - { - // parent must either inherit QPlainTextEdit or QTextEdit! - Q_ASSERT(plainTextEdit || textEdit); - - connect(parent, SIGNAL(textChanged()), this, SLOT(textEditChanged())); - connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged())); - - textEditChanged(); - } - -private Q_SLOTS: - inline void textEditChanged(); - -private: - QPlainTextEdit *plainTextEdit; - QTextEdit *textEdit; - QFrame *edit; -}; - -void TextEditAutoResizer::textEditChanged() -{ - QTextDocument *doc = textEdit ? textEdit->document() : plainTextEdit->document(); - QRect cursor = textEdit ? textEdit->cursorRect() : plainTextEdit->cursorRect(); - - QSize s = doc->size().toSize(); - if (plainTextEdit) - s.setHeight((s.height() + 2) * edit->fontMetrics().lineSpacing()); - - const QRect fr = edit->frameRect(); - const QRect cr = edit->contentsRect(); - - edit->setMinimumHeight(qMax(70, s.height() + (fr.height() - cr.height() - 1))); - - // make sure the cursor is visible in case we have a QAbstractScrollArea parent - QPoint pos = edit->pos(); - QWidget *pw = edit->parentWidget(); - while (pw) { - if (qobject_cast(pw)) - break; - pw = pw->parentWidget(); - } - - if (pw) { - QScrollArea *area = static_cast(pw); - QPoint scrollto = area->widget()->mapFrom(edit, cursor.center()); - QPoint margin(10 + cursor.width(), 2 * cursor.height()); - -#ifdef Q_WS_MAEMO_5 - QScroller::scroller(area)->ensureVisible(scrollto, margin.x(), margin.y()); -#else - area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y()); -#endif - } -} - -#endif -- cgit v1.2.3