-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnewcoldlg.cpp
More file actions
49 lines (36 loc) · 1.21 KB
/
Copy pathnewcoldlg.cpp
File metadata and controls
49 lines (36 loc) · 1.21 KB
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
39
40
41
42
43
44
45
46
47
48
49
#include "newcoldlg.h"
#include "ui_newcoldlg.h"
#include "macros.hpp"
#include <QMessageBox>
#include <golem_string.h>
const GString TypeStrings[] = { L"CHAR", L"DECIMAL", L"DOUBLE PRECISION", L"FLOAT", L"BIGINT", L"NUMERIC", L"SMALLINT",L"TIMESTAMP", L"VARCHAR" };
NewColDlg::NewColDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::NewColDlg)
{
ui->setupUi(this);
rEvent.dataType = 999;
}
NewColDlg::~NewColDlg()
{
delete ui;
}
void NewColDlg::accept()
{
IF_ERROR(ui->edtFill->text().isEmpty(),"Fill is empty");
IF_ERROR(ui->edtColumnName->text().isEmpty(),"Column name is empty.");
IF_ERROR(ui->edtColumnName->text().contains(" ",Qt::CaseInsensitive),"Column name cannot contain spaces.");
rEvent.dataType = 999;
GString sDataTypeStr = ui->comboDType->currentText().toStdWString();
for (unsigned short i = 0; i < 9; i++) {
if (sDataTypeStr == TypeStrings[i])
rEvent.dataType = i;
}
IF_ERROR(rEvent.dataType == 999,"CRITICAL ERROR: Failed to match data type. You shouldn't be seeing this error");
rEvent.fill = ui->edtFill->text();
rEvent.name = ui->edtColumnName->text();
QDialog::accept();
}
void NewColDlg::on_buttonBox_accepted()
{
}