X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=settingswindow.cpp;h=1bf3b8d2acbdfbed4180b2d721fec8397a2275f4;hb=293b3b05eaaf7dc8f9b8380944157b3a1bfaa0b1;hp=5c5dce4d24c2c8ef1e6f60dea79bf3601e8c913a;hpb=a0350a125756f86873ddd67bda42dd22759fd1e8;p=dorian diff --git a/settingswindow.cpp b/settingswindow.cpp index 5c5dce4..1bf3b8d 100644 --- a/settingswindow.cpp +++ b/settingswindow.cpp @@ -3,6 +3,12 @@ #include "settingswindow.h" #include "settings.h" #include "toolbuttonbox.h" +#include "platform.h" +#include "trace.h" + +#ifdef Q_OS_SYMBIAN +#include "flickcharm.h" +#endif #ifdef Q_OS_SYMBIAN const char *DEFAULT_ORIENTATION = "portrait"; @@ -14,7 +20,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 +30,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 +46,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 QCheckBox *grabVolume = new QCheckBox(tr("Navigate with volume keys"), contents); @@ -65,7 +76,8 @@ SettingsWindow::SettingsWindow(QWidget *parent): QMainWindow(parent) QLabel *fontLabel = new QLabel(tr("Font:"), contents); layout->addWidget(fontLabel); QString defaultFamily = fontLabel->fontInfo().family(); - QString family = Settings::instance()->value("font", defaultFamily).toString(); + QString family = + Settings::instance()->value("font", defaultFamily).toString(); fontButton = new QFontComboBox(contents); fontButton->setCurrentFont(QFont(family)); fontButton->setEditable(false); @@ -75,10 +87,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") { @@ -91,6 +104,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); @@ -107,6 +121,7 @@ SettingsWindow::SettingsWindow(QWidget *parent): QMainWindow(parent) } else { orientationBox->toggle(OrientationLandscape); } +#endif // !Q_OS_SYMBIAN layout->addStretch(); scroller->setWidget(contents); @@ -115,7 +130,10 @@ SettingsWindow::SettingsWindow(QWidget *parent): QMainWindow(parent) setCentralWidget(scroller); - connect(backlight, SIGNAL(toggled(bool)), this, SLOT(onLightsToggled(bool))); +#ifndef Q_OS_SYMBIAN + connect(backlight, SIGNAL(toggled(bool)), + this, SLOT(onLightsToggled(bool))); +#endif connect(grabVolume, SIGNAL(toggled(bool)), this, SLOT(onGrabVolumeToggled(bool))); connect(zoomSlider, SIGNAL(valueChanged(int)), @@ -124,8 +142,17 @@ 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); + closeAction->setSoftKeyRole(QAction::NegativeSoftKey); + connect(closeAction, SIGNAL(triggered()), this, SLOT(close())); + QMainWindow::addAction(closeAction); +#endif } void SettingsWindow::onSliderValueChanged(int value) @@ -136,8 +163,8 @@ void SettingsWindow::onSliderValueChanged(int value) return; } zoomLabel->setText(tr("Zoom level: %1%").arg(value)); -#ifdef Q_WS_MAEMO_5 - // Re-scaling the book view is too much for the N900 +#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) + // Constant re-scaling of the book view is too much for mobiles #else Settings::instance()->setValue("zoom", value); #endif // Q_WS_MAEMO_5 @@ -182,20 +209,23 @@ void SettingsWindow::onOrientationButtonClicked(int id) #endif // Q_WS_MAEMO_5 } -#ifdef Q_WS_MAEMO_5 +#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) void SettingsWindow::closeEvent(QCloseEvent *e) { + TRACE; Settings *settings = Settings::instance(); settings->setValue("zoom", zoomSlider->value()); settings->setValue("font", fontButton->currentFont().family()); +#ifndef Q_OS_SYMBIAN settings->setValue("orientation", (orientationBox->checkedId() == OrientationLandscape)? "landscape": "portrait"); +#endif // Q_OS_SYMBIAN e->accept(); } -#endif // Q_WS_MAEMO_5 +#endif // Q_WS_MAEMO_5 || Q_OS_SYMBIAN void SettingsWindow::onLightsToggled(bool value) {