2017-06-11 09:31:45 +02:00
|
|
|
#include "widgets/textinputdialog.hpp"
|
2017-01-17 00:15:44 +01:00
|
|
|
#include <QSizePolicy>
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-01-17 00:15:44 +01:00
|
|
|
TextInputDialog::TextInputDialog(QWidget *parent)
|
|
|
|
: QDialog(parent)
|
2017-04-12 17:46:44 +02:00
|
|
|
, _vbox(this)
|
|
|
|
, _okButton("OK")
|
|
|
|
, _cancelButton("Cancel")
|
2017-01-17 00:15:44 +01:00
|
|
|
{
|
2017-04-12 17:46:44 +02:00
|
|
|
_vbox.addWidget(&_lineEdit);
|
|
|
|
_vbox.addLayout(&_buttonBox);
|
|
|
|
_buttonBox.addStretch(1);
|
|
|
|
_buttonBox.addWidget(&_okButton);
|
|
|
|
_buttonBox.addWidget(&_cancelButton);
|
2017-01-17 00:15:44 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
QObject::connect(&_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
|
|
|
|
QObject::connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
|
2017-01-17 00:15:44 +01:00
|
|
|
|
|
|
|
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
setWindowFlags((windowFlags() & ~(Qt::WindowContextHelpButtonHint)) | Qt::Dialog |
|
|
|
|
Qt::MSWindowsFixedSizeDialogHint);
|
2017-01-17 00:15:44 +01:00
|
|
|
}
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
void TextInputDialog::okButtonClicked()
|
2017-01-17 00:15:44 +01:00
|
|
|
{
|
|
|
|
accept();
|
2017-01-17 00:42:32 +01:00
|
|
|
close();
|
2017-01-17 00:15:44 +01:00
|
|
|
}
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
void TextInputDialog::cancelButtonClicked()
|
2017-01-17 00:15:44 +01:00
|
|
|
{
|
|
|
|
reject();
|
2017-01-17 00:42:32 +01:00
|
|
|
close();
|
2017-01-17 00:15:44 +01:00
|
|
|
}
|
2017-06-07 10:09:24 +02:00
|
|
|
|
2018-04-07 21:21:56 +02:00
|
|
|
void TextInputDialog::highlightText()
|
|
|
|
{
|
|
|
|
this->_lineEdit.selectAll();
|
|
|
|
}
|
|
|
|
|
2017-06-07 10:09:24 +02:00
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|