+Preferences::Preferences(QWidget *parent):
+ QDialog(parent)
+{
+ setWindowTitle(tr("Preferences"));
+
+ QHBoxLayout *layout1 = new QHBoxLayout();
+ QVBoxLayout *layout2 = new QVBoxLayout();
+
+#ifdef Q_WS_MAEMO_5
+ QMaemo5ValueButton *rotation = new QMaemo5ValueButton(tr("Screen rotation"), this);
+ rotation_selector = new QMaemo5ListPickSelector(this);
+ QStandardItemModel *model = new QStandardItemModel(0, 1, this);
+ model->appendRow(new QStandardItem(tr("Automatic")));
+ model->appendRow(new QStandardItem(tr("Landscape")));
+ model->appendRow(new QStandardItem(tr("Portrait")));
+ rotation_selector->setModel(model);
+ rotation_selector->setCurrentIndex(settings.value("screen_rotation", 0).toInt());
+ rotation->setPickSelector(rotation_selector);
+ rotation->setValueLayout(QMaemo5ValueButton::ValueBesideText);
+ layout2->addWidget(rotation);
+
+ QMaemo5ValueButton *leftzoom = new QMaemo5ValueButton(tr("Left zoom button"), this);
+ leftzoom_selector = new QMaemo5ListPickSelector(this);
+ QStandardItemModel *key_model = new QStandardItemModel(0, 1, this);
+ key_model->insertRow(0, new QStandardItem(tr("Left click")));
+ key_model->insertRow(1, new QStandardItem(tr("Right click")));
+ key_model->insertRow(2, new QStandardItem(tr("Middle click")));
+ key_model->insertRow(3, new QStandardItem(tr("Wheel up")));
+ key_model->insertRow(4, new QStandardItem(tr("Wheel down")));
+ key_model->insertRow(5, new QStandardItem(tr("Page up")));
+ key_model->insertRow(6, new QStandardItem(tr("Page down")));
+ leftzoom_selector->setModel(key_model);
+ leftzoom_selector->setCurrentIndex(settings.value("left_zoom", 0).toInt());
+ leftzoom->setPickSelector(leftzoom_selector);
+ leftzoom->setValueLayout(QMaemo5ValueButton::ValueBesideText);
+ layout2->addWidget(leftzoom);
+
+ QMaemo5ValueButton *rightzoom = new QMaemo5ValueButton(tr("Right zoom button"), this);
+ rightzoom_selector = new QMaemo5ListPickSelector(this);
+ rightzoom_selector->setModel(key_model);
+ rightzoom_selector->setCurrentIndex(settings.value("right_zoom", 1).toInt());
+ rightzoom->setPickSelector(rightzoom_selector);
+ rightzoom->setValueLayout(QMaemo5ValueButton::ValueBesideText);
+ layout2->addWidget(rightzoom);
+
+ //useful if one only wants to click using the zoom buttons exclusively
+ disable_tapping = new QCheckBox(tr("Disable tapping"), this);
+ disable_tapping->setChecked(settings.value("disable_tapping", false).toBool());
+ layout2->addWidget(disable_tapping);
+#endif
+
+ always_show_local_cursor = new QCheckBox(tr("Always show local cursor"), this);
+ always_show_local_cursor->setChecked(settings.value("always_show_local_cursor", false).toBool());
+ layout2->addWidget(always_show_local_cursor);
+
+ zoom_to_cursor = new QCheckBox(tr("Zoom to cursor"), this);
+ zoom_to_cursor->setChecked(settings.value("zoom_to_cursor", true).toBool());
+ layout2->addWidget(zoom_to_cursor);
+
+ QPushButton *ok = new QPushButton(tr("Done"));
+ ok->setMaximumWidth(100);
+
+ layout1->addLayout(layout2);
+ layout1->addWidget(ok);
+
+ setLayout(layout1);
+
+ connect(ok, SIGNAL(clicked()),
+ this, SLOT(accept()));
+ connect(this, SIGNAL(accepted()),
+ this, SLOT(save()));