File indexing completed on 2024-05-19 04:59:14

0001 /* ============================================================
0002 * AutoScroll - Autoscroll for Falkon
0003 * Copyright (C) 2014-2017 David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #include "autoscrollsettings.h"
0019 #include "ui_autoscrollsettings.h"
0020 #include "autoscroller.h"
0021 
0022 #include <QIcon>
0023 
0024 AutoScrollSettings::AutoScrollSettings(AutoScroller* scroller, QWidget* parent)
0025     : QDialog(parent)
0026     , ui(new Ui::AutoScrollSettings)
0027     , m_scroller(scroller)
0028 {
0029     setAttribute(Qt::WA_DeleteOnClose);
0030     ui->setupUi(this);
0031     ui->divider->setValue(m_scroller->scrollDivider());
0032     ui->iconLabel->setPixmap(QIcon(QStringLiteral(":/autoscroll/data/scroll_all.png")).pixmap(32));
0033 
0034     connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accepted()));
0035     connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
0036 }
0037 
0038 AutoScrollSettings::~AutoScrollSettings()
0039 {
0040     delete ui;
0041 }
0042 
0043 void AutoScrollSettings::accepted()
0044 {
0045     m_scroller->setScrollDivider(ui->divider->value());
0046     close();
0047 }