47 lines
988 B
C++
47 lines
988 B
C++
#include <QPushButton>
|
|
#include <QMessageBox>
|
|
#include "createEditor.h"
|
|
#include "projectManager.h"
|
|
#include "ui_createEditor.h"
|
|
|
|
CreateEditor::CreateEditor(QWidget *parent)
|
|
: QDialog(parent)
|
|
, ui(new Ui::createEditor)
|
|
{
|
|
ui->setupUi(this);
|
|
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
|
initial();
|
|
}
|
|
|
|
CreateEditor::~CreateEditor()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void CreateEditor::initial()
|
|
{
|
|
connect(ui->btn_ok,&QPushButton::clicked,this,&CreateEditor::onOkClicked);
|
|
connect(ui->btn_cancel,&QPushButton::clicked,this,&CreateEditor::onCancelClicked);
|
|
}
|
|
|
|
void CreateEditor::showDlg()
|
|
{
|
|
show();
|
|
ui->le_name->clear();
|
|
}
|
|
|
|
void CreateEditor::onOkClicked()
|
|
{
|
|
bool res = ProjectManager::instance().createEditorProject(ui->le_name->text());
|
|
if(res){
|
|
QMessageBox::information(NULL, QString("提示"), QString::fromWCharArray(L"项目名已存在"));
|
|
return;
|
|
}
|
|
hide();
|
|
}
|
|
|
|
void CreateEditor::onCancelClicked()
|
|
{
|
|
hide();
|
|
}
|