|
@@ -39,7 +39,7 @@ void CreateProjWidget::setMode(CreateProjWidget::Mode mode)
|
|
|
}
|
|
|
case Update: {
|
|
|
setWindowTitle("修改项目");
|
|
|
- m_confirm->setText("修改");
|
|
|
+ m_confirm->setText("保存");
|
|
|
break;
|
|
|
}
|
|
|
case Info: {
|
|
@@ -50,34 +50,36 @@ void CreateProjWidget::setMode(CreateProjWidget::Mode mode)
|
|
|
|
|
|
bool c = (mode == Create);
|
|
|
bool cu = (mode == Update || mode == Create);
|
|
|
+ bool i = (mode == Info);
|
|
|
|
|
|
- m_taskName->setEnabled(cu);
|
|
|
- m_evalTime->setEnabled(c);
|
|
|
- m_evalPurpose->setEnabled(cu);
|
|
|
- m_evalUnit->setEnabled(cu);
|
|
|
- m_evalCrew->setEnabled(cu);
|
|
|
+ m_task->setEnabled(cu);
|
|
|
+ m_time->setEnabled(c);
|
|
|
+ m_purpose->setEnabled(cu);
|
|
|
+ m_unit->setEnabled(cu);
|
|
|
+ m_crew->setEnabled(cu);
|
|
|
m_rank->setEnabled(cu);
|
|
|
m_note->setEnabled(cu);
|
|
|
- m_name->setEnabled(cu);
|
|
|
+ m_proj->setEnabled(cu);
|
|
|
m_type1->setEnabled(c);
|
|
|
m_type2->setEnabled(c);
|
|
|
m_type3->setEnabled(c);
|
|
|
|
|
|
+ m_edit->setVisible(i);
|
|
|
m_confirm->setVisible(cu);
|
|
|
m_cancel->setVisible(cu);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::resetInputs()
|
|
|
{
|
|
|
- m_taskName->clear();
|
|
|
- m_evalTime->setDateTime(QDateTime::currentDateTime());
|
|
|
- m_evalPurpose->clear();
|
|
|
- m_evalUnit->clear();
|
|
|
- m_evalCrew->clear();
|
|
|
+ m_task->clear();
|
|
|
+ m_time->setDateTime(QDateTime::currentDateTime());
|
|
|
+ m_purpose->clear();
|
|
|
+ m_unit->clear();
|
|
|
+ m_crew->clear();
|
|
|
m_rank->clear();
|
|
|
m_note->clear();
|
|
|
|
|
|
- m_name->clear();
|
|
|
+ m_proj->clear();
|
|
|
m_type1->setChecked(false);
|
|
|
m_type2->setChecked(false);
|
|
|
m_type3->setChecked(false);
|
|
@@ -91,15 +93,15 @@ ProjectInfo *CreateProjWidget::projInfo() const
|
|
|
ProjectInfo CreateProjWidget::editedProjInfo() const
|
|
|
{
|
|
|
ProjectInfo proj;
|
|
|
- proj.taskName = m_taskName->text();
|
|
|
- proj.estimateTime = QString::number(m_evalTime->dateTime().toTime_t());
|
|
|
- proj.estimateObjective = m_evalPurpose->text();
|
|
|
- proj.estimateDept = m_evalUnit->text();
|
|
|
- proj.estimatePerson = m_evalCrew->text();
|
|
|
+ proj.taskName = m_task->text();
|
|
|
+ proj.estimateTime = QString::number(m_time->dateTime().toTime_t());
|
|
|
+ proj.estimateObjective = m_purpose->text();
|
|
|
+ proj.estimateDept = m_unit->text();
|
|
|
+ proj.estimatePerson = m_crew->text();
|
|
|
proj.positionalTitles = m_rank->text();
|
|
|
proj.remark = m_note->toPlainText();
|
|
|
|
|
|
- proj.projectName = m_name->text();
|
|
|
+ proj.projectName = m_proj->text();
|
|
|
|
|
|
ProjectManager::EvalTypes t;
|
|
|
t |= (m_type1->isChecked() ? ProjectManager::Requirements : ProjectManager::None);
|
|
@@ -115,19 +117,21 @@ ProjectInfo CreateProjWidget::editedProjInfo() const
|
|
|
void CreateProjWidget::setProjectInfo(ProjectInfo *info)
|
|
|
{
|
|
|
m_projInfo = info;
|
|
|
- m_taskName->setText(info->taskName);
|
|
|
+ m_task->setText(info->taskName);
|
|
|
QDateTime time = QDateTime::fromTime_t(info->estimateTime.toUInt());
|
|
|
- m_evalTime->setDateTime(time);
|
|
|
- m_evalPurpose->setText(info->estimateObjective);
|
|
|
- m_evalUnit->setText(info->estimateDept);
|
|
|
- m_evalCrew->setText(info->estimatePerson);
|
|
|
+ m_time->setDateTime(time);
|
|
|
+ m_purpose->setText(info->estimateObjective);
|
|
|
+ m_unit->setText(info->estimateDept);
|
|
|
+ m_crew->setText(info->estimatePerson);
|
|
|
m_rank->setText(info->positionalTitles);
|
|
|
m_note->setPlainText(info->remark);
|
|
|
- m_name->setText(info->projectName);
|
|
|
+ m_proj->setText(info->projectName);
|
|
|
+
|
|
|
ProjectManager::EvalTypes types = ProjectManager::evalTypes(*info);
|
|
|
+
|
|
|
m_type1->setChecked((types & ProjectManager::Requirements) == ProjectManager::Requirements);
|
|
|
- m_type1->setChecked((types & ProjectManager::SchemeOptimization) == ProjectManager::SchemeOptimization);
|
|
|
- m_type1->setChecked((types & ProjectManager::OverallEfficiency) == ProjectManager::OverallEfficiency);
|
|
|
+ m_type2->setChecked((types & ProjectManager::SchemeOptimization) == ProjectManager::SchemeOptimization);
|
|
|
+ m_type3->setChecked((types & ProjectManager::OverallEfficiency) == ProjectManager::OverallEfficiency);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::initWindow()
|
|
@@ -139,51 +143,70 @@ void CreateProjWidget::initWindow()
|
|
|
setModal(true);
|
|
|
setWindowFlags(Qt::Dialog);
|
|
|
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
|
|
- resize(400, 600);
|
|
|
+ setFixedSize(400, 600);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::initWidgets()
|
|
|
{
|
|
|
m_summary = new QLabel(this);
|
|
|
m_summary->setText("项目概要:");
|
|
|
- m_taskName = new LineEdit(this);
|
|
|
- m_taskName->setPlaceholderText("任务名称");
|
|
|
- m_evalTime = new DateTimeEdit(this);
|
|
|
- m_evalPurpose = new LineEdit(this);
|
|
|
- m_evalPurpose->setPlaceholderText("评估目的");
|
|
|
- m_evalUnit = new LineEdit(this);
|
|
|
- m_evalUnit->setPlaceholderText("评估单位");
|
|
|
- m_evalCrew = new LineEdit(this);
|
|
|
- m_evalCrew->setPlaceholderText("评估人员");
|
|
|
+ m_task = new LineEdit(this);
|
|
|
+ m_task->setPlaceholderText("任务名称");
|
|
|
+ m_time = new DateTimeEdit(this);
|
|
|
+ m_purpose = new LineEdit(this);
|
|
|
+ m_purpose->setPlaceholderText("评估目的");
|
|
|
+ m_unit = new LineEdit(this);
|
|
|
+ m_unit->setPlaceholderText("评估单位");
|
|
|
+ m_crew = new LineEdit(this);
|
|
|
+ m_crew->setPlaceholderText("评估人员");
|
|
|
m_rank = new LineEdit(this);
|
|
|
m_rank->setPlaceholderText("职称");
|
|
|
m_note = new TextEdit(this);
|
|
|
m_note->setPlaceholderText("备注");
|
|
|
|
|
|
+ m_taskLabel = new QLabel(this);
|
|
|
+ m_taskLabel->setText("任务名称:");
|
|
|
+ m_timeLabel = new QLabel(this);
|
|
|
+ m_timeLabel->setText("评估时间:");
|
|
|
+ m_purposeLabel = new QLabel(this);
|
|
|
+ m_purposeLabel->setText("评估目的:");
|
|
|
+ m_unitLabel = new QLabel(this);
|
|
|
+ m_unitLabel->setText("评估单位:");
|
|
|
+ m_crewLabel = new QLabel(this);
|
|
|
+ m_crewLabel->setText("评估人员:");
|
|
|
+ m_rankLabel = new QLabel(this);
|
|
|
+ m_rankLabel->setText("职称:");
|
|
|
+ m_noteLabel = new QLabel(this);
|
|
|
+ m_noteLabel->setText("备注:");
|
|
|
+
|
|
|
m_separator = new QWidget(this);
|
|
|
m_separator->setFixedHeight(1);
|
|
|
m_separator->setStyleSheet("background-color:#dddddd");
|
|
|
|
|
|
- m_nameLabel = new QLabel(this);
|
|
|
- m_nameLabel->setText("项目名称:");
|
|
|
- m_name = new LineEdit(this);
|
|
|
- m_name->setPlaceholderText("请输入项目名称");
|
|
|
+ m_projLabel = new QLabel(this);
|
|
|
+ m_projLabel->setText("项目名称:");
|
|
|
+ m_proj = new LineEdit(this);
|
|
|
+ m_proj->setPlaceholderText("请输入项目名称");
|
|
|
m_typeLabel = new QLabel(this);
|
|
|
m_typeLabel->setText("评估类型:");
|
|
|
m_type1 = new CheckBox(EngineerInfo::nameOfEvalType(EngineerInfo::Requirements), this);
|
|
|
m_type2 = new CheckBox(EngineerInfo::nameOfEvalType(EngineerInfo::SchemeOptimization), this);
|
|
|
m_type3 = new CheckBox(EngineerInfo::nameOfEvalType(EngineerInfo::OverallEfficiency), this);
|
|
|
|
|
|
+ m_edit = new PushButton("修改", this);
|
|
|
m_confirm = new PushButton("创建", this);
|
|
|
m_cancel = new PushButton("取消", this);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::initLayout()
|
|
|
{
|
|
|
+ int minEditWidth = 220;
|
|
|
+
|
|
|
// 总体布局
|
|
|
m_layout = new QVBoxLayout(this);
|
|
|
m_layout->setContentsMargins(50, 20, 50, 20);
|
|
|
- m_summaryLayout = new QVBoxLayout();
|
|
|
+ m_layout->addWidget(m_summary);
|
|
|
+ m_summaryLayout = new QGridLayout();
|
|
|
m_layout->addLayout(m_summaryLayout);
|
|
|
m_layout->addWidget(m_separator);
|
|
|
m_projLayout = new QGridLayout();
|
|
@@ -192,19 +215,37 @@ void CreateProjWidget::initLayout()
|
|
|
m_layout->addLayout(m_btnLayout);
|
|
|
|
|
|
// 项目概要布局
|
|
|
- m_summaryLayout->addWidget(m_summary);
|
|
|
- m_summaryLayout->addWidget(m_taskName);
|
|
|
- m_summaryLayout->addWidget(m_evalTime);
|
|
|
- m_summaryLayout->addWidget(m_evalPurpose);
|
|
|
- m_summaryLayout->addWidget(m_evalUnit);
|
|
|
- m_summaryLayout->addWidget(m_evalCrew);
|
|
|
- m_summaryLayout->addWidget(m_rank);
|
|
|
- m_summaryLayout->addWidget(m_note);
|
|
|
+ m_task->setMinimumWidth(minEditWidth);
|
|
|
+ m_time->setMinimumWidth(minEditWidth);
|
|
|
+ m_purpose->setMinimumWidth(minEditWidth);
|
|
|
+ m_unit->setMinimumWidth(minEditWidth);
|
|
|
+ m_crew->setMinimumWidth(minEditWidth);
|
|
|
+ m_rank->setMinimumWidth(minEditWidth);
|
|
|
+ m_note->setMinimumWidth(minEditWidth);
|
|
|
+ m_noteLabel->setContentsMargins(0, 10, 0, 10);
|
|
|
+
|
|
|
+ m_summaryLayout->setMargin(10);
|
|
|
+ m_summaryLayout->addWidget(m_taskLabel, 1, 0, 1, 1, Qt::AlignRight);
|
|
|
+ m_summaryLayout->addWidget(m_timeLabel, 2, 0, 1, 1, Qt::AlignRight);
|
|
|
+ m_summaryLayout->addWidget(m_purposeLabel, 3, 0, 1, 1, Qt::AlignRight);
|
|
|
+ m_summaryLayout->addWidget(m_unitLabel, 4, 0, 1, 1, Qt::AlignRight);
|
|
|
+ m_summaryLayout->addWidget(m_crewLabel, 5, 0, 1, 1, Qt::AlignRight);
|
|
|
+ m_summaryLayout->addWidget(m_rankLabel, 6, 0, 1, 1, Qt::AlignRight);
|
|
|
+ m_summaryLayout->addWidget(m_noteLabel, 7, 0, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
|
|
+
|
|
|
+ m_summaryLayout->addWidget(m_task, 1, 1, 1, 1, Qt::AlignLeft);
|
|
|
+ m_summaryLayout->addWidget(m_time, 2, 1, 1, 1, Qt::AlignLeft);
|
|
|
+ m_summaryLayout->addWidget(m_purpose, 3, 1, 1, 1, Qt::AlignLeft);
|
|
|
+ m_summaryLayout->addWidget(m_unit, 4, 1, 1, 1, Qt::AlignLeft);
|
|
|
+ m_summaryLayout->addWidget(m_crew, 5, 1, 1, 1, Qt::AlignLeft);
|
|
|
+ m_summaryLayout->addWidget(m_rank, 6, 1, 1, 1, Qt::AlignLeft);
|
|
|
+ m_summaryLayout->addWidget(m_note, 7, 1, 1, 1, Qt::AlignLeft);
|
|
|
|
|
|
// 项目信息布局
|
|
|
- m_projLayout->addWidget(m_nameLabel, 0, 0, 1, 1, Qt::AlignLeft);
|
|
|
- m_projLayout->addWidget(m_name, 0, 1, 1, 5, Qt::AlignLeft);
|
|
|
- m_name->setMinimumWidth(200);
|
|
|
+ m_projLayout->setMargin(10);
|
|
|
+ m_proj->setMinimumWidth(minEditWidth);
|
|
|
+ m_projLayout->addWidget(m_projLabel, 0, 0, 1, 1, Qt::AlignLeft);
|
|
|
+ m_projLayout->addWidget(m_proj, 0, 1, 1, 5, Qt::AlignLeft);
|
|
|
m_projLayout->addWidget(new QWidget(this), 1, 1, 4, 1, Qt::AlignLeft);
|
|
|
m_projLayout->addWidget(m_typeLabel, 4, 0, 1, 1, Qt::AlignLeft);
|
|
|
m_projLayout->addWidget(m_type1, 4, 1, 1, 5, Qt::AlignLeft);
|
|
@@ -213,35 +254,28 @@ void CreateProjWidget::initLayout()
|
|
|
|
|
|
// 按钮布局
|
|
|
m_btnLayout->addStretch();
|
|
|
+ m_btnLayout->addWidget(m_edit);
|
|
|
m_btnLayout->addWidget(m_confirm);
|
|
|
m_btnLayout->addWidget(m_cancel);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::connectSignalsAndSlots()
|
|
|
{
|
|
|
- connect(m_taskName, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
- connect(m_evalPurpose, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
- connect(m_evalUnit, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
- connect(m_evalCrew, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_task, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_purpose, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_unit, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_crew, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
connect(m_rank, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
connect(m_note, &TextEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
- connect(m_name, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_proj, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
connect(m_type1, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
|
|
|
connect(m_type2, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
|
|
|
connect(m_type3, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
|
|
|
- connect(m_confirm, &PushButton::clicked, this, &CreateProjWidget::slotCreateClicked);
|
|
|
+ connect(m_edit, &PushButton::clicked, this, &CreateProjWidget::slotEditClicked);
|
|
|
+ connect(m_confirm, &PushButton::clicked, this, &CreateProjWidget::slotConfirmClicked);
|
|
|
connect(m_cancel, &PushButton::clicked, this, &CreateProjWidget::slotCancelClicked);
|
|
|
}
|
|
|
|
|
|
-void CreateProjWidget::updateCreateButtonState()
|
|
|
-{
|
|
|
- bool summaryValid = false;
|
|
|
- bool nameValid;
|
|
|
- bool typeValid;
|
|
|
-
|
|
|
- m_confirm->setEnabled(summaryValid && nameValid && typeValid);
|
|
|
-}
|
|
|
-
|
|
|
void CreateProjWidget::slotTextChanged()
|
|
|
{
|
|
|
LineEdit *lineEdit = dynamic_cast<LineEdit *>(sender());
|
|
@@ -252,16 +286,26 @@ void CreateProjWidget::slotTextChanged()
|
|
|
|
|
|
void CreateProjWidget::slotCheckBoxChanged() { }
|
|
|
|
|
|
-void CreateProjWidget::slotCreateClicked()
|
|
|
+void CreateProjWidget::slotEditClicked()
|
|
|
+{
|
|
|
+ setMode(Update);
|
|
|
+}
|
|
|
+
|
|
|
+void CreateProjWidget::slotConfirmClicked()
|
|
|
{
|
|
|
ProjectInfo p = editedProjInfo();
|
|
|
qDebug() << __FUNCTION__ << p.taskName << p.estimateTime << p.estimateObjective << p.estimateDept
|
|
|
<< p.estimatePerson << p.positionalTitles << p.remark << p.projectName << p.estimateType;
|
|
|
|
|
|
- emit signalCreate();
|
|
|
+ emit signalConfirm();
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::slotCancelClicked()
|
|
|
{
|
|
|
- close();
|
|
|
+ if (m_mode == Update) {
|
|
|
+ setMode(Info);
|
|
|
+ setProjectInfo(m_projInfo);
|
|
|
+ } else {
|
|
|
+ close();
|
|
|
+ }
|
|
|
}
|