File indexing completed on 2024-04-28 04:21:20

0001 /* SPDX-FileCopyrightText: 2003-2018 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "ViewerSizeConfig.h"
0007 
0008 #include <KLocalizedString>
0009 #include <qcheckbox.h>
0010 #include <qlabel.h>
0011 #include <qlayout.h>
0012 #include <qspinbox.h>
0013 
0014 Settings::ViewerSizeConfig::ViewerSizeConfig(const QString &title, QWidget *parent)
0015     : QGroupBox(title, parent)
0016 {
0017     QVBoxLayout *topLayout = new QVBoxLayout(this);
0018     setLayout(topLayout);
0019     m_fullScreen = new QCheckBox(i18n("Launch in full screen"), this);
0020     topLayout->addWidget(m_fullScreen);
0021 
0022     QWidget *sizeBox = new QWidget(this);
0023     topLayout->addWidget(sizeBox);
0024     QHBoxLayout *lay = new QHBoxLayout(sizeBox);
0025 
0026     QLabel *label = new QLabel(i18n("Size:"), sizeBox);
0027     lay->addWidget(label);
0028 
0029     m_width = new QSpinBox;
0030     m_width->setRange(100, 5000);
0031     m_width->setSingleStep(50);
0032     lay->addWidget(m_width);
0033 
0034     label = new QLabel(QString::fromLatin1("x"), sizeBox);
0035     lay->addWidget(label);
0036 
0037     m_height = new QSpinBox;
0038     m_height->setRange(100, 5000);
0039     m_height->setSingleStep(50);
0040     lay->addWidget(m_height);
0041 
0042     lay->addStretch(1);
0043     topLayout->addStretch(1);
0044 }
0045 
0046 void Settings::ViewerSizeConfig::setSize(const QSize &size)
0047 {
0048     m_width->setValue(size.width());
0049     m_height->setValue(size.height());
0050 }
0051 
0052 QSize Settings::ViewerSizeConfig::size()
0053 {
0054     return QSize(m_width->value(), m_height->value());
0055 }
0056 
0057 void Settings::ViewerSizeConfig::setLaunchFullScreen(bool b)
0058 {
0059     m_fullScreen->setChecked(b);
0060 }
0061 
0062 bool Settings::ViewerSizeConfig::launchFullScreen() const
0063 {
0064     return m_fullScreen->isChecked();
0065 }
0066 
0067 // vi:expandtab:tabstop=4 shiftwidth=4:
0068 
0069 #include "moc_ViewerSizeConfig.cpp"