Falkon Develop
Cross-platform Qt-based web browser
mousegesturessettingsdialog.cpp
Go to the documentation of this file.
1/* ============================================================
2* Mouse Gestures plugin for Falkon
3* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
19#include "ui_mousegesturessettingsdialog.h"
20#include "licenseviewer.h"
21#include "mousegestures.h"
22
23#include <QLabel>
24
26 : QDialog(parent)
28 , m_gestures(gestures)
29{
30 setAttribute(Qt::WA_DeleteOnClose);
31 ui->setupUi(this);
32
33 if (QApplication::isRightToLeft()) {
34 ui->label_5->setPixmap(QPixmap(QSL(":/mousegestures/data/right.gif")));
35 ui->label_6->setPixmap(QPixmap(QSL(":/mousegestures/data/left.gif")));
36 ui->label_18->setPixmap(QPixmap(QSL(":/mousegestures/data/up-right.gif")));
37 ui->label_20->setPixmap(QPixmap(QSL(":/mousegestures/data/up-left.gif")));
38 }
39
40 m_gestures->loadSettings();
41 ui->mouseButtonComboBox->setCurrentIndex(m_gestures->buttonToIndex());
42 ui->enableRockerNavigation->setChecked(m_gestures->rockerNavigationEnabled());
43
44 setAttribute(Qt::WA_DeleteOnClose);
45
46 connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accepted()));
47 connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
48 connect(ui->licenseButton, &QAbstractButton::clicked, this, &MouseGesturesSettingsDialog::showLicense);
49}
50
52{
53 delete ui;
54}
55
56void MouseGesturesSettingsDialog::showLicense()
57{
58 auto* v = new LicenseViewer(this);
59 v->setLicenseFile(QSL(":mousegestures/data/copyright"));
60
61 v->show();
62}
63
64void MouseGesturesSettingsDialog::accepted()
65{
66 m_gestures->setGestureButtonByIndex(ui->mouseButtonComboBox->currentIndex());
67 m_gestures->setRockerNavigationEnabled(ui->enableRockerNavigation->isChecked());
68 m_gestures->saveSettings();
69 close();
70}
void setRockerNavigationEnabled(bool enable)
bool rockerNavigationEnabled() const
void setGestureButtonByIndex(int index)
int buttonToIndex() const
MouseGesturesSettingsDialog(MouseGestures *gestures, QWidget *parent=nullptr)
#define QSL(x)
Definition: qzcommon.h:40