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 "lc_global.h"
#include "lc_categorydialog.h"
#include "ui_lc_categorydialog.h"
#include "lc_category.h"
lcCategoryDialog::lcCategoryDialog(QWidget* Parent, lcLibraryCategory* Options)
: QDialog(Parent), ui(new Ui::lcCategoryDialog)
{
ui->setupUi(this);
mOptions = Options;
if (!mOptions->Name.isEmpty())
setWindowTitle(tr("Edit Category"));
else
setWindowTitle(tr("New Category"));
ui->name->setText(mOptions->Name);
ui->keywords->setText(mOptions->Keywords);
}
lcCategoryDialog::~lcCategoryDialog()
{
delete ui;
}
void lcCategoryDialog::accept()
{
QString Name = ui->name->text();
if (Name.isEmpty())
{
QMessageBox::information(this, "LeoCAD", tr("Name cannot be empty."));
return;
}
QString Keywords = ui->keywords->text();
if (Keywords.isEmpty())
{
QMessageBox::information(this, "LeoCAD", tr("Keywords cannot be empty."));
return;
}
mOptions->Name = Name;
mOptions->Keywords = Keywords.toLatin1();
QDialog::accept();
}
|