123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414 |
- #include "WaffleProgramPage.h"
- #include <QGroupBox>
- #include <QLineEdit>
- #include "Src/RewriteControl/Controls/SpinBox.h"
- #include "Src/RewriteControl/Controls/DoubleSpinBox.h"
- #include <QLabel>
- WaffleProgramPage::WaffleProgramPage(QWidget* parent)
- :QWidget(parent)
- {
- ui.setupUi(this);
- setStyleSheet(
- "QDoubleSpinBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
- "QSpinBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
- "QLineEdit{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
- "QCheckBox::indicator{width: 20px;height: 20px;}"
- "QCheckBox::indicator:unchecked{background - color: #FFFFFF;border-radius: 2px;}"
- "QComboBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}"
- "QComboBox::drop - down{width: 20px;}"
- );
- m_manageDB = CManageDB::GetInstance();
- if (m_manageDB == nullptr) return;
- m_pProduct = m_manageDB->GetCProduct();
- if (m_pProduct == nullptr) return;
- initPage();
- }
- WaffleProgramPage::~WaffleProgramPage()
- {
- }
- void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STRUCT matrixData, std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecSubMatrix)
- {
- int matrixNum = m_mapSubMatrixControls.size();
- int newMatrixID = ++matrixNum;
- QVector<QObject*> vecControls;
- QGroupBox* groupBox = new QGroupBox();
- QGridLayout* outMatrixGridLayout = new QGridLayout();
- outMatrixGridLayout->setSpacing(6);
- outMatrixGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
- groupBox->setLayout(outMatrixGridLayout);
- QGridLayout* subGridLayout = new QGridLayout();
- subGridLayout->setSpacing(6);
- subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
- //groupBox->setLayout(subGridLayout);
- QLabel* labelTitle = new QLabel(this);
- labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
- labelTitle->setText(tr("Sub Matrix ") + QString::number(vectorIndex));
- subGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
- vecControls.push_back(labelTitle);
- QLabel* labelRow = new QLabel(this);
- labelRow->setObjectName(QString::fromUtf8("labelRow"));
- labelRow->setText(tr("Row "));
- subGridLayout->addWidget(labelRow, 1, 0, 1, 1);
- vecControls.push_back(labelRow);
- SpinBox* spinBoxRow = new SpinBox(this);
- spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
- subGridLayout->addWidget(spinBoxRow, 1, 1, 1, 1);
- vecControls.push_back(spinBoxRow);
- QLabel* labelCol = new QLabel(this);
- labelCol->setObjectName(QString::fromUtf8("labelCol"));
- labelCol->setText(tr("Cow "));
- subGridLayout->addWidget(labelCol, 2, 0, 1, 1);
- vecControls.push_back(labelCol);
- SpinBox* spinBoxCol = new SpinBox(this);
- spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
- subGridLayout->addWidget(spinBoxCol, 2, 1, 1, 1);
- vecControls.push_back(spinBoxCol);
- QLabel* labelLeftTop = new QLabel(this);
- labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
- labelLeftTop->setText(tr("Left Top Pos "));
- subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
- vecControls.push_back(labelLeftTop);
- DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(this);
- doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
- subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxLeftTopX);
- DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(this);
- doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
- subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxLeftTopY);
- QLabel* labelRightTopPos = new QLabel(this);
- labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
- labelRightTopPos->setText(tr("Right Top Pos "));
- subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
- vecControls.push_back(labelRightTopPos);
- DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(this);
- doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
- subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopX);
- DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(this);
- doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
- subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopY);
- QLabel* labelRightButtomPos = new QLabel(this);
- labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
- labelRightButtomPos->setText(tr("Right Buttom pos"));
- subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
- vecControls.push_back(labelRightButtomPos);
- DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(this);
- doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
- subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightButtomX);
- DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(this);
- doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
- subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopX);
- QLabel* labelNoBondPts = new QLabel(this);
- labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
- labelNoBondPts->setText(tr("No Bond Points"));
- subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
- vecControls.push_back(labelNoBondPts);
- QLineEdit* lineEditNoBondPts = new QLineEdit(this);
- lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
- subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2);
- vecControls.push_back(lineEditNoBondPts);
- outMatrixGridLayout->addLayout(subGridLayout, 0, 0);
- QFrame* line = new QFrame();
- line->setFrameShape(QFrame::NoFrame); // 盧뇜칵훰움솥
- line->setFixedHeight(2); // �零미땍멕똑
- line->setStyleSheet("background-color: #C7CAEB;");
- outMatrixGridLayout->addWidget(line);
- ui.verticalLayout->addWidget(groupBox);
- for (int j = 0; j < matrixData.VecDieMatrixId.size(); j++)
- {
- for (int i = 0; i < m_vecSubWaffleMatrix.size(); i++)
- {
- if (matrixData.VecDieMatrixId[j] == m_vecSubWaffleMatrix[i].MatrixId)
- {
- AddSubMatrixPage(i, m_vecSubWaffleMatrix[i], outMatrixGridLayout);
- }
- }
- }
- //for (int i = 0; i = vecSubMatrix.size(); i++)
- //{
- // AddSubMatrixPage(i, vecSubMatrix[i], outMatrixGridLayout);
- //}
- connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].PackRow = spinBoxRow->value();
- });
- connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].PackCol = spinBoxCol->value();
- });
- connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
- });
-
- connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
- });
- connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value();
- });
- connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value();
- });
- connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
- });
- connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
- m_vecWaffleMatrix[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
- });
- connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
- });
- }
- void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout)
- {
- QVector<QObject*> vecControls;
- QGridLayout* subGridLayout = new QGridLayout();
- subGridLayout->setSpacing(6);
- subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
- //groupBox->setLayout(subGridLayout);
- QLabel* labelTitle = new QLabel(this);
- labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
- labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex));
- subGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
- vecControls.push_back(labelTitle);
- labelTitle->setStyleSheet("background-color: #F0F0F0;");
- QLabel* labelRow = new QLabel(this);
- labelRow->setObjectName(QString::fromUtf8("labelRow"));
- labelRow->setText(tr("Row "));
- subGridLayout->addWidget(labelRow, 1, 0, 1, 1);
- vecControls.push_back(labelRow);
- SpinBox* spinBoxRow = new SpinBox(this);
- spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
- subGridLayout->addWidget(spinBoxRow, 1, 1, 1, 1);
- vecControls.push_back(spinBoxRow);
- QLabel* labelCol = new QLabel(this);
- labelCol->setObjectName(QString::fromUtf8("labelCol"));
- labelCol->setText(tr("Cow "));
- subGridLayout->addWidget(labelCol, 2, 0, 1, 1);
- vecControls.push_back(labelCol);
- SpinBox* spinBoxCol = new SpinBox(this);
- spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
- subGridLayout->addWidget(spinBoxCol, 2, 1, 1, 1);
- vecControls.push_back(spinBoxCol);
- QLabel* labelLeftTop = new QLabel(this);
- labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
- labelLeftTop->setText(tr("Left Top Pos "));
- subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
- vecControls.push_back(labelLeftTop);
- DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(this);
- doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
- subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxLeftTopX);
- DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(this);
- doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
- subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxLeftTopY);
- QLabel* labelRightTopPos = new QLabel(this);
- labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
- labelRightTopPos->setText(tr("Right Top Pos "));
- subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
- vecControls.push_back(labelRightTopPos);
- DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(this);
- doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
- subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopX);
- DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(this);
- doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
- subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopY);
- QLabel* labelRightButtomPos = new QLabel(this);
- labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
- labelRightButtomPos->setText(tr("Right Buttom pos"));
- subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
- vecControls.push_back(labelRightButtomPos);
- DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(this);
- doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
- subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightButtomX);
- DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(this);
- doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
- subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopX);
- QLabel* labelNoBondPts = new QLabel(this);
- labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
- labelNoBondPts->setText(tr("No Bond Points"));
- subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
- vecControls.push_back(labelNoBondPts);
- QLineEdit* lineEditNoBondPts = new QLineEdit(this);
- lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
- subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2);
- vecControls.push_back(lineEditNoBondPts);
- layout->addLayout(subGridLayout, 11, 0);
- QFrame* line = new QFrame();
- line->setFrameShape(QFrame::NoFrame); // 盧뇜칵훰움솥
- line->setFixedHeight(2); // �零미땍멕똑
- line->setStyleSheet("background-color: #C7CAEB;");
- ui.verticalLayout->addWidget(line);
- connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].MatrixRow = spinBoxRow->value();
- });
- connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].MatrixCol = spinBoxCol->value();
- });
- connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
- });
- connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
- });
- connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value();
- });
- connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value();
- });
- connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
- });
- connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
- m_vecSubWaffleMatrix[subVectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
- });
- connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
- });
- }
- void WaffleProgramPage::SaveAllParam()
- {
- }
- void WaffleProgramPage::MatrixChangeEvent()
- {
- for (PROGRAM_WAFFLE_MATRIX_STRUCT& waffleMatrix : m_vecWaffleMatrix)
- {
- m_pProduct->SetWaffleMatrix(waffleMatrix.MatrixId, waffleMatrix);
- }
- m_pProduct->SetDieMatrix(m_vecSubWaffleMatrix, true);
- //for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vecWaffleMatrix)
- //{
- // m_manageDB->GetCProduct()->SetBondMatrix(bondMatrix.BondMatrixId, bondMatrix);
- //}
- //for (PROGRAM_POINT_MATRIX_STRUCT& pointMatrix : m_vecSubMatrixs)
- //{
- // m_manageDB->GetCProduct()->SetPointMatrix(pointMatrix.MatrixId, pointMatrix);
- //}
- }
- void WaffleProgramPage::initPage()
- {
- m_vecWaffleMatrix = m_pProduct->GetWaffleMatrix();
- for (int i = 0; i < m_vecWaffleMatrix.size(); i++)
- {
- for (int j = 0; j < m_vecWaffleMatrix[i].VecDieMatrixId.size(); j++)
- {
- PROGRAM_DIE_MATRIX_STRUCT subMatrix;
- m_pProduct->GetDieMatrix(m_vecWaffleMatrix[i].VecDieMatrixId[j], subMatrix);
- m_vecSubWaffleMatrix.push_back(subMatrix);
- //AddMatrixPage(i, j, subMatrix);
- }
- AddMatrixPage(i, m_vecWaffleMatrix[i], m_vecSubWaffleMatrix);
- //for (int j = 0; j < m_vecWaffleMatrix[i].VecDieMatrixId.size(); j++)
- //{
- // for (int k = 0; k < m_vecSubWaffleMatrix.size(); k++)
- // {
- // if (m_vecWaffleMatrix[i].VecDieMatrixId[j] == m_vecSubWaffleMatrix[k].MatrixId)
- // {
- // AddSubMatrixPage(i, m_vecSubWaffleMatrix[k],nullptr);
- // }
- // }
- //}
- }
- }
|