2013-08-09 06:57:18 +02:00
|
|
|
#include "lc_global.h"
|
|
|
|
#include "lc_qcategorydialog.h"
|
|
|
|
#include "ui_lc_qcategorydialog.h"
|
|
|
|
#include "lc_category.h"
|
|
|
|
|
|
|
|
lcQCategoryDialog::lcQCategoryDialog(QWidget *parent, void *data) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::lcQCategoryDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
options = (lcLibraryCategory*)data;
|
|
|
|
|
2017-02-08 18:41:48 +01:00
|
|
|
if (!options->Name.isEmpty())
|
2013-08-09 06:57:18 +02:00
|
|
|
setWindowTitle(tr("Edit Category"));
|
|
|
|
else
|
|
|
|
setWindowTitle(tr("New Category"));
|
|
|
|
|
2017-02-08 18:41:48 +01:00
|
|
|
ui->name->setText(options->Name);
|
|
|
|
ui->keywords->setText(options->Keywords);
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
lcQCategoryDialog::~lcQCategoryDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQCategoryDialog::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;
|
|
|
|
}
|
|
|
|
|
2017-02-08 18:41:48 +01:00
|
|
|
options->Name = name;
|
|
|
|
options->Keywords = keywords.toLatin1();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
QDialog::accept();
|
|
|
|
}
|