| 1 | //---------------------------------------------------------------------------------------------- |
|---|
| 2 | // $Date$ |
|---|
| 3 | // $Author$ |
|---|
| 4 | // $Revision$ |
|---|
| 5 | // $URL$ |
|---|
| 6 | //---------------------------------------------------------------------------------------------- |
|---|
| 7 | #include "form_input_ui.h" |
|---|
| 8 | //---------------------------------------------------------------------------------------------- |
|---|
| 9 | |
|---|
| 10 | FormInputUI::FormInputUI (QWidget* parent, const QString& header, const QString& message, const QString& text) : QDialog (parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint |
|---|
| 11 | #if QT_VERSION >= 0x040500 |
|---|
| 12 | | Qt::WindowCloseButtonHint |
|---|
| 13 | #endif |
|---|
| 14 | ) |
|---|
| 15 | { |
|---|
| 16 | resize(450, 78); |
|---|
| 17 | setFixedSize(width(), height()); |
|---|
| 18 | |
|---|
| 19 | setWindowTitle(header); |
|---|
| 20 | |
|---|
| 21 | m_layout = new QHBoxLayout(this); |
|---|
| 22 | |
|---|
| 23 | m_form_layout = new QVBoxLayout(); |
|---|
| 24 | |
|---|
| 25 | m_label = new QLabel(this); |
|---|
| 26 | m_label->setText(message); |
|---|
| 27 | m_label->setMinimumSize(350, 0); |
|---|
| 28 | m_form_layout->addWidget(m_label); |
|---|
| 29 | |
|---|
| 30 | m_text = new QLineEdit(this); |
|---|
| 31 | m_text->setText(text); |
|---|
| 32 | m_form_layout->addWidget(m_text); |
|---|
| 33 | |
|---|
| 34 | m_button_layout = new QVBoxLayout(); |
|---|
| 35 | |
|---|
| 36 | m_button_ok = new QPushButton(this); |
|---|
| 37 | m_button_ok->setText(QString::fromUtf8("OK")); |
|---|
| 38 | m_button_ok->setShortcut(QKeySequence("Return")); |
|---|
| 39 | m_button_ok->setDefault(true); |
|---|
| 40 | m_button_layout->addWidget(m_button_ok); |
|---|
| 41 | |
|---|
| 42 | m_button_cancel = new QPushButton(this); |
|---|
| 43 | m_button_cancel->setText(QString::fromUtf8("Отмена")); |
|---|
| 44 | m_button_cancel->setShortcut(QKeySequence("Esc")); |
|---|
| 45 | m_button_layout->addWidget(m_button_cancel); |
|---|
| 46 | |
|---|
| 47 | m_spacer_button = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); |
|---|
| 48 | m_button_layout->addItem(m_spacer_button); |
|---|
| 49 | |
|---|
| 50 | m_layout->addLayout(m_form_layout); |
|---|
| 51 | m_layout->addLayout(m_button_layout); |
|---|
| 52 | |
|---|
| 53 | connect(m_button_ok, SIGNAL(clicked()), this, SLOT(accept())); |
|---|
| 54 | connect(m_button_cancel, SIGNAL(clicked()), this, SLOT(reject())); |
|---|
| 55 | |
|---|
| 56 | m_text->setFocus(); |
|---|
| 57 | } |
|---|
| 58 | //---------------------------------------------------------------------------------------------- |
|---|
| 59 | |
|---|
| 60 | FormInputUI::~FormInputUI () |
|---|
| 61 | { |
|---|
| 62 | } |
|---|
| 63 | //---------------------------------------------------------------------------------------------- |
|---|