|
@@ -1,5 +1,7 @@
|
|
|
#include "CreateProjWidget.h"
|
|
|
|
|
|
+#include <common/ProjectManager.h>
|
|
|
+
|
|
|
#include <dbService/ClassSet.h>
|
|
|
|
|
|
#include <Widgets/LineEdit.h>
|
|
@@ -33,6 +35,28 @@ void CreateProjWidget::clearInputs()
|
|
|
m_type3->setChecked(false);
|
|
|
}
|
|
|
|
|
|
+ProjectInfo CreateProjWidget::projectInfo() 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.positionalTitles = m_rank->text();
|
|
|
+ proj.remark = m_note->toPlainText();
|
|
|
+
|
|
|
+ proj.projectName = m_name->text();
|
|
|
+
|
|
|
+ ProjectManager::EvalTypes t;
|
|
|
+ t |= (m_type1->isChecked() ? ProjectManager::Requirements : ProjectManager::None);
|
|
|
+ t |= (m_type2->isChecked() ? ProjectManager::SchemeOptimization : ProjectManager::None);
|
|
|
+ t |= (m_type3->isChecked() ? ProjectManager::OverallEfficiency : ProjectManager::None);
|
|
|
+ proj.estimateType = QString::number(t);
|
|
|
+
|
|
|
+ return proj;
|
|
|
+}
|
|
|
+
|
|
|
void CreateProjWidget::initWindow()
|
|
|
{
|
|
|
setWindowTitle("新建工程");
|
|
@@ -122,28 +146,56 @@ void CreateProjWidget::initLayout()
|
|
|
|
|
|
void CreateProjWidget::connectSignalsAndSlots()
|
|
|
{
|
|
|
- connect(m_name, &LineEdit::textChanged, this, &CreateProjWidget::slotProjNameChanged);
|
|
|
+ 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_rank, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_note, &TextEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
+ connect(m_name, &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_cancel, &PushButton::clicked, this, &CreateProjWidget::slotCancelClicked);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::updateCreateButtonState()
|
|
|
{
|
|
|
- bool summaryValid;
|
|
|
+ bool summaryValid = false;
|
|
|
bool nameValid;
|
|
|
bool typeValid;
|
|
|
|
|
|
m_confirm->setEnabled(summaryValid && nameValid && typeValid);
|
|
|
}
|
|
|
|
|
|
-void CreateProjWidget::slotProjNameChanged(const QString &text)
|
|
|
+void CreateProjWidget::slotTextChanged()
|
|
|
{
|
|
|
- m_name->setText(text.trimmed());
|
|
|
- updateCreateButtonState();
|
|
|
+ LineEdit *lineEdit = dynamic_cast<LineEdit *>(sender());
|
|
|
+ if (lineEdit) {
|
|
|
+ lineEdit->setText(lineEdit->text().trimmed());
|
|
|
+ }
|
|
|
+ // qDebug() << __FUNCTION__ << __LINE__ << sender();
|
|
|
+
|
|
|
+ // TextEdit *textEdit = dynamic_cast<TextEdit *>(sender());
|
|
|
+
|
|
|
+ // qDebug() << __FUNCTION__ << __LINE__ << (textEdit == nullptr);
|
|
|
+
|
|
|
+ // if (textEdit != nullptr) {
|
|
|
+ // qDebug() << __FUNCTION__ << __LINE__ << textEdit->toPlainText();
|
|
|
+ // textEdit->setPlainText(textEdit->toPlainText().trimmed());
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
+void CreateProjWidget::slotCheckBoxChanged() { }
|
|
|
+
|
|
|
void CreateProjWidget::slotCreateClicked()
|
|
|
{
|
|
|
+ ProjectInfo p = projectInfo();
|
|
|
+ qDebug() << __FUNCTION__ << p.taskName << p.estimateTime << p.estimateObjective << p.estimateDept
|
|
|
+ << p.estimatePerson << p.positionalTitles << p.remark << p.projectName << p.estimateType;
|
|
|
+
|
|
|
+ return;
|
|
|
emit signalCreate();
|
|
|
close();
|
|
|
}
|