Remove non-working settings from Symbian build. Make settigs window fit
authorAkos Polster <akos@pipacs.com>
Tue, 2 Nov 2010 21:20:18 +0000 (22:20 +0100)
committerAkos Polster <akos@pipacs.com>
Tue, 2 Nov 2010 21:20:18 +0000 (22:20 +0100)
the screen. Make dialog contents finger-scrollable on Symbian.

13 files changed:
bookview.cpp
bookview.h
dorian.qrc
icons/symbian/style-day.png [new file with mode: 0644]
icons/symbian/style-default.png [new file with mode: 0644]
icons/symbian/style-night.png [new file with mode: 0644]
icons/symbian/style-sand.png [new file with mode: 0644]
platform.cpp
settingswindow.cpp
settingswindow.h
trace.h
widgets/dyalog.cpp
widgets/toolbuttonbox.cpp

index d1dc21b..101f0d1 100644 (file)
@@ -14,6 +14,7 @@
 #include "settings.h"
 #include "trace.h"
 #include "progress.h"
+#include "progressdialog.h"
 
 BookView::BookView(QWidget *parent):
     QWebView(parent), contentIndex(-1), mBook(0),
index 5c0e1cd..1c5bbd9 100644 (file)
@@ -13,6 +13,7 @@
 class QModelIndex;
 class Progress;
 class QAbstractKineticScroller;
+class ProgressDialog;
 
 /** Visual representation of a book. */
 class BookView: public QWebView
@@ -81,13 +82,13 @@ private:
     /** Go to a given (relative) position in current part. */
     void goToPosition(qreal position);
 
-    /** Show progress. */
+    /** Show reading progress. */
     void showProgress();
 
     int contentIndex;   /**< Current part in book. */
     Book *mBook;        /**< Book to show. */
     bool restorePositionAfterLoad;
-                        /**< If true, restoring position after load is needed. */
+                        /**< If true, restore current position after load. */
     qreal positionAfterLoad;
                         /**< Position to be restored after load. */
     QImage bookmarkImage;
index fb41696..f8ad9d3 100644 (file)
@@ -44,5 +44,9 @@
         <file>books/2BR02B.epub</file>
         <file>icons/search.png</file>
         <file>icons/mac/about.png</file>
+        <file>icons/symbian/style-sand.png</file>
+        <file>icons/symbian/style-day.png</file>
+        <file>icons/symbian/style-default.png</file>
+        <file>icons/symbian/style-night.png</file>
     </qresource>
 </RCC>
diff --git a/icons/symbian/style-day.png b/icons/symbian/style-day.png
new file mode 100644 (file)
index 0000000..ad39bf4
Binary files /dev/null and b/icons/symbian/style-day.png differ
diff --git a/icons/symbian/style-default.png b/icons/symbian/style-default.png
new file mode 100644 (file)
index 0000000..ad39bf4
Binary files /dev/null and b/icons/symbian/style-default.png differ
diff --git a/icons/symbian/style-night.png b/icons/symbian/style-night.png
new file mode 100644 (file)
index 0000000..1b1163b
Binary files /dev/null and b/icons/symbian/style-night.png differ
diff --git a/icons/symbian/style-sand.png b/icons/symbian/style-sand.png
new file mode 100644 (file)
index 0000000..978c559
Binary files /dev/null and b/icons/symbian/style-sand.png differ
index ca21dc8..f090489 100644 (file)
 #   define DORIAN_BASE ".dorian"
 #endif
 
-#ifdef Q_WS_MAC
+#if defined(Q_WS_MAC)
 #   define DORIAN_ICON_PREFIX ":/icons/mac/"
+#elif defined(Q_OS_SYMBIAN)
+#   define DORIAN_ICON_PREFIX ":/icons/symbian/"
 #else
 #   define DORIAN_ICON_PREFIX ":/icons/"
 #endif
@@ -31,7 +33,12 @@ QString Platform::dbPath()
 
 QString Platform::icon(const QString &name)
 {
-    return QString(DORIAN_ICON_PREFIX) + name + ".png";
+    QString iconName = QString(DORIAN_ICON_PREFIX) + name + ".png";
+    if (QFile(iconName).exists()) {
+        return iconName;
+    } else {
+        return QString(":/icons/") + name + ".png";
+    }
 }
 
 void Platform::restart(char *argv[])
index 4bece61..1150271 100644 (file)
@@ -3,6 +3,11 @@
 #include "settingswindow.h"
 #include "settings.h"
 #include "toolbuttonbox.h"
+#include "platform.h"
+
+#ifdef Q_OS_SYMBIAN
+#include "flickcharm.h"
+#endif
 
 #ifdef Q_OS_SYMBIAN
 const char *DEFAULT_ORIENTATION = "portrait";
@@ -14,7 +19,7 @@ const int ZOOM_MIN = 75;
 const int ZOOM_MAX = 250;
 const int ZOOM_STEP = 25;
 
-SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
+SettingsWindow::SettingsWindow(QWidget *parent):  AdopterWindow(parent)
 {
 #ifdef Q_WS_MAEMO_5
     setAttribute(Qt::WA_Maemo5StackedWindow, true);
@@ -24,9 +29,12 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
 
     Settings *settings = Settings::instance();
     QScrollArea *scroller = new QScrollArea(this);
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5)
     scroller->setProperty("FingerScrollable", true);
     scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+#elif defined(Q_OS_SYMBIAN)
+    FlickCharm *charm = new FlickCharm(this);
+    charm->activateOn(scroller);
 #else
     scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
 #endif
@@ -37,9 +45,11 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
     QVBoxLayout *layout = new QVBoxLayout(contents);
     contents->setLayout(layout);
 
+#ifndef Q_OS_SYMBIAN
     QCheckBox *backlight = new QCheckBox(tr("Keep backlight on"), contents);
     layout->addWidget(backlight);
     backlight->setChecked(settings->value("lightson", false).toBool());
+#endif
 
 #ifndef Q_OS_SYMBIAN
     QCheckBox *grabVolume =
@@ -78,10 +88,11 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
     layout->addWidget(colorLabel);
     ToolButtonBox *box = new ToolButtonBox(this);
     layout->addWidget(box);
-    box->addButton(SchemeDefault, tr("Default"), ":/icons/style-default.png");
-    box->addButton(SchemeNight, tr("Night"), ":/icons/style-night.png");
-    box->addButton(SchemeDay, tr("Day"), ":/icons/style-day.png");
-    box->addButton(SchemeSand, tr("Sand"), ":/icons/style-sand.png");
+    box->addButton(SchemeDefault, tr("Default"),
+                   Platform::icon("style-default"));
+    box->addButton(SchemeNight, tr("Night"), Platform::icon("style-night"));
+    box->addButton(SchemeDay, tr("Day"), Platform::icon("style-day"));
+    box->addButton(SchemeSand, tr("Sand"), Platform::icon("style-sand"));
     box->addStretch();
     QString scheme = settings->value("scheme", "default").toString();
     if (scheme == "night") {
@@ -94,6 +105,7 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
         box->toggle(SchemeDefault);
     }
 
+#ifndef Q_OS_SYMBIAN
     QLabel *orientationLabel = new QLabel(tr("Orientation:"), contents);
     layout->addWidget(orientationLabel);
     orientationBox = new ToolButtonBox(this);
@@ -110,6 +122,7 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
     } else {
         orientationBox->toggle(OrientationLandscape);
     }
+#endif // !Q_OS_SYMBIAN
 
     layout->addStretch();
     scroller->setWidget(contents);
@@ -118,9 +131,9 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
 
     setCentralWidget(scroller);
 
+#ifndef Q_OS_SYMBIAN
     connect(backlight, SIGNAL(toggled(bool)),
             this, SLOT(onLightsToggled(bool)));
-#ifndef Q_OS_SYMBIAN
     connect(grabVolume, SIGNAL(toggled(bool)),
             this, SLOT(onGrabVolumeToggled(bool)));
 #endif
@@ -130,8 +143,10 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
             this, SLOT(onCurrentFontChanged(const QFont &)));
     connect(box, SIGNAL(buttonClicked(int)),
             this, SLOT(onSchemeButtonClicked(int)));
+#ifndef Q_OS_SYMBIAN
     connect(orientationBox, SIGNAL(buttonClicked(int)),
             this, SLOT(onOrientationButtonClicked(int)));
+#endif
 
 #ifdef Q_OS_SYMBIAN
     QAction *closeAction = new QAction(parent? tr("Back"): tr("Exit"), this);
index e2b3353..bcead86 100644 (file)
@@ -1,10 +1,11 @@
 #ifndef SETTINGSWINDOW_H
 #define SETTINGSWINDOW_H
 
-#include <QMainWindow>
 #include <QLabel>
 #include <QSlider>
 
+#include "adopterwindow.h"
+
 class QPushButton;
 class QFontComboBox;
 class QFont;
@@ -14,7 +15,7 @@ class QLabel;
 class ToolButtonBox;
 
 /** Display settings. */
-class SettingsWindow: public QMainWindow
+class SettingsWindow: public AdopterWindow
 {
     Q_OBJECT
 
diff --git a/trace.h b/trace.h
index 74ade80..bd5acfc 100644 (file)
--- a/trace.h
+++ b/trace.h
@@ -7,7 +7,15 @@
 #include <QTime>
 #include <QEvent>
 
-#define TRACE Trace _(Q_FUNC_INFO)
+#ifdef Q_OS_SYMBIAN
+#   ifdef __PRETTY_FUNCTION__
+#       define TRACE Trace _(__PRETTY_FUNCTION__)
+#   else
+#       define TRACE Trace _(__FUNCTION__)
+#   endif
+#else
+#   define TRACE Trace _(Q_FUNC_INFO)
+#endif
 
 /** Trace helper. */
 class Trace
index 3bd10e1..3ffdfbc 100644 (file)
@@ -2,6 +2,10 @@
 
 #include "dyalog.h"
 
+#ifdef Q_OS_SYMBIAN
+#include "flickcharm.h"
+#endif
+
 Dyalog::Dyalog(QWidget *parent, bool showButtons_):
     QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
                     Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint),
@@ -9,9 +13,12 @@ Dyalog::Dyalog(QWidget *parent, bool showButtons_):
 {
     scroller = new QScrollArea(this);
 
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5)
     scroller->setProperty("FingerScrollable", true);
     scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+#elif defined(Q_OS_SYMBIAN)
+    FlickCharm *charm = new FlickCharm(this);
+    charm->activateOn(scroller);
 #else
     scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
 #endif
index 7884187..cab5a18 100644 (file)
@@ -9,7 +9,8 @@ ToolButtonBox::ToolButtonBox(QWidget *parent): QFrame(parent)
     setLayout(layout);
     group = new QButtonGroup(this);
     group->setExclusive(true);
-    connect(group, SIGNAL(buttonClicked(int)), this, SIGNAL(buttonClicked(int)));
+    connect(group, SIGNAL(buttonClicked(int)), this,
+            SIGNAL(buttonClicked(int)));
 }
 
 void ToolButtonBox::addButton(int id, const QString &title, const QString &icon)
@@ -19,7 +20,13 @@ void ToolButtonBox::addButton(int id, const QString &title, const QString &icon)
         button->setToolButtonStyle(Qt::ToolButtonTextOnly);
     } else {
         button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+#ifdef Q_OS_SYMBIAN
+        button->setIconSize(QSize(71, 81));
+        button->setFixedWidth(77);
+        qDebug() << button->palette();
+#else
         button->setIconSize(QSize(81, 81));
+#endif
         button->setIcon(QIcon(icon));
     }
     button->setText(title);