/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #include #include #include #include #include #include #include "smdialog.h" #include "helper.h" SmDialog::SmDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) {} void SmDialog::showEvent(QShowEvent *){ Helper::centerWidget(this); } SeriesPartsDialog::SeriesPartsDialog(QWidget *parent, Qt::WindowFlags f) : SmDialog(parent, f){ QFormLayout *mainLayout = new QFormLayout; mSubtitle = new QLineEdit; mSubtitle->setMinimumWidth(300); mainLayout->addRow(tr("&Subtitle:"), mSubtitle); mPartno = new QSpinBox; mPartno->setValue(0); mPartno->setMinimum(0); mainLayout->addRow(tr("&Part no."), mPartno); mOk = new QPushButton(tr("Ok")); connect(mOk, SIGNAL(clicked()), this, SLOT(accept())); mCancel = new QPushButton(tr("Cancel")); connect(mCancel, SIGNAL(clicked()), this, SLOT(reject())); mCancel->setDefault(true); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(); buttonLayout->addWidget(mOk); buttonLayout->addWidget(mCancel); mainLayout->addRow(buttonLayout); setLayout(mainLayout); } QString SeriesPartsDialog::subtitle() const { return mSubtitle->text(); } void SeriesPartsDialog::setSubtitle(const QString &subtitle){ mSubtitle->setText(subtitle); } int SeriesPartsDialog::partNo() const { return mPartno->value(); } void SeriesPartsDialog::setPartno(int partNo){ mPartno->setValue(partNo); }