From f0f805b5e6cd0fda0dafe6254debe6845ae2738b Mon Sep 17 00:00:00 2001 From: Akos Polster Date: Sun, 5 Sep 2010 21:59:17 +0200 Subject: [PATCH] Alive on Symbian. --- main.cpp | 18 +++++++++++++----- mainwindow.cpp | 21 +++++++++++++-------- pkg/symbian/fixnokiaqtsdk.bat | 1 + pkg/symbian/howto.txt | 20 ++++++++++++++++++++ widgets/adopterwindow.cpp | 13 +++++++++++++ widgets/adopterwindow.h | 2 ++ 6 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 pkg/symbian/howto.txt diff --git a/main.cpp b/main.cpp index c1c710d..fa8bbb0 100644 --- a/main.cpp +++ b/main.cpp @@ -12,12 +12,20 @@ static const char *DORIAN_VERSION = #include "pkg/version.txt" ; +static const QtMsgType DORIAN_DEFAULT_TRACE_LEVEL = +#ifdef Q_OS_SYMBIAN + QtDebugMsg +#else + QtWarningMsg +#endif + ; + int main(int argc, char *argv[]) { QApplication a(argc, argv); Trace::level = (QtMsgType)Settings::instance()-> - value("tracelevel", (int)QtWarningMsg).toInt(); + value("tracelevel", (int)DORIAN_DEFAULT_TRACE_LEVEL).toInt(); qInstallMsgHandler(Trace::messageHandler); a.setApplicationName("Dorian"); @@ -25,16 +33,16 @@ int main(int argc, char *argv[]) a.setOrganizationDomain("pipacs.com"); a.setOrganizationName("Pipacs"); -#ifdef Q_OS_SYMBIAN + MainWindow w; + w.show(); + +#if 0 // FIXME #ifdef Q_OS_SYMBIAN // Remove context menu from all widgets foreach (QWidget *w, QApplication::allWidgets()) { w->setContextMenuPolicy(Qt::NoContextMenu); } #endif // Q_OS_SYMBIAN - MainWindow w; - w.show(); - int ret = a.exec(); if (ret == 1000) { #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) diff --git a/mainwindow.cpp b/mainwindow.cpp index 28e9094..d565d4b 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -102,10 +102,7 @@ MainWindow::MainWindow(QWidget *parent): addToolBarAction(this, SLOT(about()), "about", tr("About")); #endif // Q_WS_MAEMO_5 - QFrame *frame = new QFrame(toolBar); - frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - toolBar->addWidget(frame); - + addToolBarSpace(); fullScreenAction = addToolBarAction(this, SLOT(showBig()), "view-fullscreen", tr("Full screen")); @@ -187,14 +184,18 @@ void MainWindow::showRegular() otherChildren << progress << previousButton << nextButton; takeChildren(view, otherChildren); QRect geo = geometry(); - qDebug() << "Geometry" << geo << "toolbar" << toolBar->height(); progress->setGeometry(0, 0, geo.width(), PROGRESS_HEIGHT); -#ifdef Q_WS_MAEMO_5 +#if defined(Q_WS_MAEMO_5) previousButton->setGeometry(0, geo.height() - toolBar->height() - TranslucentButton::pixels, TranslucentButton::pixels, TranslucentButton::pixels); nextButton->setGeometry(geo.width() - TranslucentButton::pixels, 0, TranslucentButton::pixels, TranslucentButton::pixels); +#elif defined(Q_OS_SYMBIAN) + previousButton->setGeometry(0, geo.height() - TranslucentButton::pixels, + TranslucentButton::pixels, TranslucentButton::pixels); + nextButton->setGeometry(geo.width() - TranslucentButton::pixels, + 0, TranslucentButton::pixels, TranslucentButton::pixels); #else previousButton->setGeometry(0, geo.height() - TranslucentButton::pixels, TranslucentButton::pixels, TranslucentButton::pixels); @@ -392,13 +393,17 @@ void MainWindow::resizeEvent(QResizeEvent *e) { Trace t("MainWindow::resizeEvent"); progress->setGeometry(QRect(0, 0, e->size().width(), PROGRESS_HEIGHT)); - qDebug() << "Toolbar height" << toolBar->height(); -#ifdef Q_WS_MAEMO_5 +#if defined(Q_WS_MAEMO_5) previousButton->setGeometry(0, e->size().height() - toolBar->height() - TranslucentButton::pixels, TranslucentButton::pixels, TranslucentButton::pixels); nextButton->setGeometry(e->size().width() - TranslucentButton::pixels, 0, TranslucentButton::pixels, TranslucentButton::pixels); +#elif defined(Q_OS_SYMBIAN) + previousButton->setGeometry(0, e->size().height() - TranslucentButton::pixels, + TranslucentButton::pixels, TranslucentButton::pixels); + nextButton->setGeometry(e->size().width() - TranslucentButton::pixels, + 0, TranslucentButton::pixels, TranslucentButton::pixels); #else previousButton->setGeometry(0, e->size().height() - TranslucentButton::pixels, TranslucentButton::pixels, TranslucentButton::pixels); diff --git a/pkg/symbian/fixnokiaqtsdk.bat b/pkg/symbian/fixnokiaqtsdk.bat index 9dff88f..135fdde 100644 --- a/pkg/symbian/fixnokiaqtsdk.bat +++ b/pkg/symbian/fixnokiaqtsdk.bat @@ -1,5 +1,6 @@ @echo off rem Add directories to stop warnings during build +rem Note: Apparently, this does not stops warnings at all c: cd \S60\devices\ if not exist Nokia_N97_SDK_v1.0 goto sdkmissing diff --git a/pkg/symbian/howto.txt b/pkg/symbian/howto.txt new file mode 100644 index 0000000..cfbd683 --- /dev/null +++ b/pkg/symbian/howto.txt @@ -0,0 +1,20 @@ +Install everything into default location on C: + +- Perl 5.8 +- N97 SDK +- OpenC plugin +- Qt for Symbian 4.6 +- Nokia Qt SDK 1.0 +- Nokia Ovi Suite + +My PATH is: + +C:\Perl\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Common Files\Symbian\tools;C:\NokiaQtSDK\Symbian\gcce\bin + +My test phone is a Nokia N97 mini + +Connect phone to PC via USB, using PC Suite mode. Add phone to Ovi Suite + +Install TRK to phone using Start/Programs/Nokia Qt SDK/Symbian/Install TRK +to Symbian device/TRK S60 5th Edition + diff --git a/widgets/adopterwindow.cpp b/widgets/adopterwindow.cpp index 844ebf0..8ffb22d 100644 --- a/widgets/adopterwindow.cpp +++ b/widgets/adopterwindow.cpp @@ -18,6 +18,8 @@ AdopterWindow::AdopterWindow(QWidget *parent): QMainWindow(parent), grabbingZoomKeys(false), mainChild(0) { + Trace t("AdopterWindow::AdopterWindow"); + #ifdef Q_WS_MAEMO_5 setAttribute(Qt::WA_Maemo5StackedWindow, true); #endif // Q_WS_MAEMO_5 @@ -125,6 +127,8 @@ QAction *AdopterWindow::addToolBarAction(QObject *receiver, const QString &iconName, const QString &text) { + Trace t("AdopterWindow::addToolBarAction"); + qDebug() << "icon" << iconName << "text" << text; #ifndef Q_OS_SYMBIAN return toolBar->addAction(QIcon(ICON_PREFIX + iconName + ".png"), text, receiver, member); @@ -136,3 +140,12 @@ QAction *AdopterWindow::addToolBarAction(QObject *receiver, return action; #endif } + +void AdopterWindow::addToolBarSpace() +{ +#ifndef Q_OS_SYMBIAN + QFrame *frame = new QFrame(toolBar); + frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + toolBar->addWidget(frame); +#endif +} diff --git a/widgets/adopterwindow.h b/widgets/adopterwindow.h index 55a4011..0c8d210 100644 --- a/widgets/adopterwindow.h +++ b/widgets/adopterwindow.h @@ -47,7 +47,9 @@ protected: void doGrabZoomKeys(bool grab); bool grabbingZoomKeys; QWidget *mainChild; +#ifndef Q_OS_SYMBIAN QToolBar *toolBar; +#endif }; #endif // ADOPTERWINDOW_H -- 1.7.9.5