-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathnewleveldialog.cpp
More file actions
34 lines (27 loc) · 853 Bytes
/
newleveldialog.cpp
File metadata and controls
34 lines (27 loc) · 853 Bytes
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
#include "newleveldialog.h"
#include "ui_newleveldialog.h"
NewLevelDialog::NewLevelDialog(QWidget *parent, SettingsManager* settings) :
QDialog(parent),
ui(new Ui::NewLevelDialog)
{
ui->setupUi(this);
setWindowTitle(tr("Add Level..."));
ui->okButton->setText(tr("OK"));
ui->cancelButton->setText(tr("Cancel"));
ui->okButton->setEnabled(false);
connect(ui->okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
NewLevelDialog::~NewLevelDialog()
{
delete ui;
}
void NewLevelDialog::on_levelNameEdit_textChanged(const QString &text)
{
QRegularExpression re("^(.*?/)?\\d+-\\d+$");
ui->okButton->setEnabled(text.length() != 0 && re.match(text).hasMatch());
}
QString NewLevelDialog::getName()
{
return ui->levelNameEdit->text();
}