File indexing completed on 2025-01-12 05:02:05
0001 /* 0002 SPDX-FileCopyrightText: 2003-2007 Craig Drummond <craig@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include "PrintDialog.h" 0007 #include <KLocalizedString> 0008 #include <QDialogButtonBox> 0009 #include <QFrame> 0010 #include <QGridLayout> 0011 #include <QLabel> 0012 #include <QPushButton> 0013 #include <QVBoxLayout> 0014 0015 namespace KFI 0016 { 0017 CPrintDialog::CPrintDialog(QWidget *parent) 0018 : QDialog(parent) 0019 { 0020 setModal(true); 0021 setWindowTitle(i18n("Print Font Samples")); 0022 0023 QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 0024 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); 0025 okButton->setDefault(true); 0026 okButton->setShortcut(Qt::CTRL | Qt::Key_Return); 0027 connect(buttonBox, &QDialogButtonBox::accepted, this, &CPrintDialog::accept); 0028 connect(buttonBox, &QDialogButtonBox::rejected, this, &CPrintDialog::reject); 0029 0030 QVBoxLayout *mainLayout = new QVBoxLayout; 0031 setLayout(mainLayout); 0032 0033 QFrame *page = new QFrame(this); 0034 QGridLayout *layout = new QGridLayout(page); 0035 layout->setContentsMargins(0, 0, 0, 0); 0036 0037 QLabel *lbl = new QLabel(i18n("Select size to print font:"), page); 0038 lbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); 0039 layout->addWidget(lbl, 0, 0); 0040 m_size = new QComboBox(page); 0041 m_size->insertItem(0, i18n("Waterfall")); 0042 m_size->insertItem(1, i18n("12pt")); 0043 m_size->insertItem(2, i18n("18pt")); 0044 m_size->insertItem(3, i18n("24pt")); 0045 m_size->insertItem(4, i18n("36pt")); 0046 m_size->insertItem(5, i18n("48pt")); 0047 m_size->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); 0048 layout->addWidget(m_size, 0, 1); 0049 layout->addItem(new QSpacerItem(2, 2), 2, 0); 0050 0051 mainLayout->addWidget(page); 0052 mainLayout->addWidget(buttonBox); 0053 } 0054 0055 bool CPrintDialog::exec(int size) 0056 { 0057 m_size->setCurrentIndex(size); 0058 return QDialog::Accepted == QDialog::exec(); 0059 } 0060 0061 }