From d20f8d98a664bd6a1c2261b49de28697c59a8695 Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 25 Oct 2017 12:35:37 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=94=EC=A7=80=EB=8B=88=EC=96=B4=EB=A7=81?= =?UTF-8?q?=20=EB=AA=A8=EB=93=9C=20=EC=B0=BD=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=20=EB=B0=A9=EC=A7=80=20=EB=8F=84=EC=9B=80=20?= =?UTF-8?q?=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/engineermenuwindow.cpp | 47 ++++++++++++++++++++++++----- app/gui/oven_control/engineermenuwindow.h | 14 +++++---- app/gui/oven_control/mainwindow.cpp | 9 ++++-- app/gui/oven_control/mainwindow.h | 2 ++ 4 files changed, 56 insertions(+), 16 deletions(-) diff --git a/app/gui/oven_control/engineermenuwindow.cpp b/app/gui/oven_control/engineermenuwindow.cpp index 5c11de0..f4a5bcc 100644 --- a/app/gui/oven_control/engineermenuwindow.cpp +++ b/app/gui/oven_control/engineermenuwindow.cpp @@ -25,6 +25,8 @@ EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) : ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); + child = Q_NULLPTR; + connect(ui->backButton, SIGNAL(clicked()), this, SLOT(close())); foreach (QPushButton *button, findChildren()) @@ -40,6 +42,12 @@ EngineerMenuWindow::~EngineerMenuWindow() delete ui; } +void EngineerMenuWindow::killChild() +{ + if (child) + child->deleteLater(); +} + void EngineerMenuWindow::keyPressEvent(QKeyEvent *event) { switch (event->key()) @@ -75,11 +83,19 @@ void EngineerMenuWindow::keyReleaseEvent(QKeyEvent *event) } } +void EngineerMenuWindow::onChildDestroyed(QObject *destroyed) +{ + if (destroyed == child) + child = NULL; +} + void EngineerMenuWindow::on_serviceHistoryButton_clicked() { ServiceHistoryMain *w = new ServiceHistoryMain(this); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); + + newChild(w); } void EngineerMenuWindow::on_operationTimeButton_clicked() @@ -87,6 +103,8 @@ void EngineerMenuWindow::on_operationTimeButton_clicked() OperationTimeMain *w = new OperationTimeMain(this); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); + + newChild(w); } void EngineerMenuWindow::on_realDataButton_clicked() @@ -94,6 +112,8 @@ void EngineerMenuWindow::on_realDataButton_clicked() RealtimeMain* w = new RealtimeMain(this); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); + + newChild(w); } void EngineerMenuWindow::on_functionTestButton_clicked() @@ -102,6 +122,8 @@ void EngineerMenuWindow::on_functionTestButton_clicked() w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + newChild(w); } void EngineerMenuWindow::on_engAdjustButton_clicked() @@ -111,21 +133,22 @@ void EngineerMenuWindow::on_engAdjustButton_clicked() w->showFullScreen(); w->raise(); + newChild(w); } void EngineerMenuWindow::on_stdConfigButton_clicked() { QDialog* dlg; QString usbPath=""; - if(!FileProcessor::detectUSB(usbPath)){ + if(FileProcessor::detectUSB(usbPath)) + dlg = new FileProcessDlg(this, Define::config_standard_info_upload, false); + else dlg = new UsbCheckPopupDlg(this); - dlg->exec(); - } - if(FileProcessor::detectUSB(usbPath)){ - qDebug() << "standard upload exe"; - dlg = new FileProcessDlg(this,Define::config_standard_info_upload, false); - dlg->exec(); - } + + dlg->showFullScreen(); + dlg->raise(); + + newChild(dlg); } void EngineerMenuWindow::on_modelTypeConfigButton_clicked() @@ -134,6 +157,14 @@ void EngineerMenuWindow::on_modelTypeConfigButton_clicked() w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + newChild(w); +} + +void EngineerMenuWindow::newChild(QWidget *w) +{ + child = w; + connect(w, SIGNAL(destroyed(QObject*)), SLOT(onChildDestroyed(QObject*))); } void EngineerMenuWindow::onEncoderLeft() diff --git a/app/gui/oven_control/engineermenuwindow.h b/app/gui/oven_control/engineermenuwindow.h index 88cbdb0..2156822 100644 --- a/app/gui/oven_control/engineermenuwindow.h +++ b/app/gui/oven_control/engineermenuwindow.h @@ -16,28 +16,30 @@ public: explicit EngineerMenuWindow(QWidget *parent = 0); ~EngineerMenuWindow(); + void killChild(); + protected: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); private slots: - void on_serviceHistoryButton_clicked(); + void onChildDestroyed(QObject *destroyed); + void on_serviceHistoryButton_clicked(); void on_operationTimeButton_clicked(); - void on_realDataButton_clicked(); - void on_functionTestButton_clicked(); - void on_engAdjustButton_clicked(); - void on_stdConfigButton_clicked(); - void on_modelTypeConfigButton_clicked(); private: Ui::EngineerMenuWindow *ui; + QWidget *child; + + void newChild(QWidget *w); + QWidget *pushed = NULL; void onEncoderLeft(); diff --git a/app/gui/oven_control/mainwindow.cpp b/app/gui/oven_control/mainwindow.cpp index 9e618ce..25af5ea 100644 --- a/app/gui/oven_control/mainwindow.cpp +++ b/app/gui/oven_control/mainwindow.cpp @@ -67,7 +67,6 @@ void MainWindow::killChild() bool MainWindow::killChildCook() { - if (instance->child && !instance->child->inherits("ConfigWindow")) { qDebug() << "kill child"; @@ -75,7 +74,13 @@ bool MainWindow::killChildCook() instance->child->deleteLater(); return true; } - else return false; + else + return false; +} + +EngineerMenuWindow *MainWindow::getEngineerMenuWindow() +{ + return instance->findChild(); } void MainWindow::keyPressEvent(QKeyEvent *event) diff --git a/app/gui/oven_control/mainwindow.h b/app/gui/oven_control/mainwindow.h index 2f0d407..bff3a5c 100644 --- a/app/gui/oven_control/mainwindow.h +++ b/app/gui/oven_control/mainwindow.h @@ -4,6 +4,7 @@ #include #include "define.h" +#include "engineermenuwindow.h" namespace Ui { class MainWindow; @@ -23,6 +24,7 @@ public: static void jump(QMainWindow *newChild); static void killChild(); static bool killChildCook(); + static EngineerMenuWindow *getEngineerMenuWindow(); protected: void keyPressEvent(QKeyEvent *event); -- 2.1.4