summaryrefslogtreecommitdiffstats
path: root/textenterdialog.cpp
blob: dae7a482127f4e5942f6fe764d2fabdd7a520c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
  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 <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QApplication>

#include "textenterdialog.h"

TextEnterDialog::TextEnterDialog(const QString &text, QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){
	QVBoxLayout *mainLayout = new QVBoxLayout;
	QLabel *l1 = new QLabel(text);
	mainLayout->addWidget(l1);
	mText = new QLineEdit;
	mainLayout->addWidget(mText);

	QHBoxLayout *buttonLayout = new QHBoxLayout;
	mOk = new QPushButton(tr("Ok"));
	connect(mOk, SIGNAL(clicked()), this, SLOT(accept()));
	buttonLayout->addStretch();
	buttonLayout->addWidget(mOk);
	mClose = new QPushButton(tr("Close"));
	connect(mClose, SIGNAL(clicked()), this, SLOT(reject()));
	buttonLayout->addWidget(mClose);

	mainLayout->addLayout(buttonLayout);

	QString title = QString(tr("%1 - Enter text")).arg(qApp->applicationName());
	setWindowTitle(title);

	setLayout(mainLayout);
}