Commit d20f8d98a664bd6a1c2261b49de28697c59a8695
1 parent
0f8248de61
Exists in
master
and in
2 other branches
엔지니어링 모드 창 중복 실행 방지 도움 메소드 추가
Showing
4 changed files
with
56 additions
and
16 deletions
Show diff stats
app/gui/oven_control/engineermenuwindow.cpp
| ... | ... | @@ -25,6 +25,8 @@ EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) : |
| 25 | 25 | ui->clockContainer->setParent(ui->upperStack); |
| 26 | 26 | setAttribute(Qt::WA_DeleteOnClose); |
| 27 | 27 | |
| 28 | + child = Q_NULLPTR; | |
| 29 | + | |
| 28 | 30 | connect(ui->backButton, SIGNAL(clicked()), this, SLOT(close())); |
| 29 | 31 | |
| 30 | 32 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
| ... | ... | @@ -40,6 +42,12 @@ EngineerMenuWindow::~EngineerMenuWindow() |
| 40 | 42 | delete ui; |
| 41 | 43 | } |
| 42 | 44 | |
| 45 | +void EngineerMenuWindow::killChild() | |
| 46 | +{ | |
| 47 | + if (child) | |
| 48 | + child->deleteLater(); | |
| 49 | +} | |
| 50 | + | |
| 43 | 51 | void EngineerMenuWindow::keyPressEvent(QKeyEvent *event) |
| 44 | 52 | { |
| 45 | 53 | switch (event->key()) |
| ... | ... | @@ -75,11 +83,19 @@ void EngineerMenuWindow::keyReleaseEvent(QKeyEvent *event) |
| 75 | 83 | } |
| 76 | 84 | } |
| 77 | 85 | |
| 86 | +void EngineerMenuWindow::onChildDestroyed(QObject *destroyed) | |
| 87 | +{ | |
| 88 | + if (destroyed == child) | |
| 89 | + child = NULL; | |
| 90 | +} | |
| 91 | + | |
| 78 | 92 | void EngineerMenuWindow::on_serviceHistoryButton_clicked() |
| 79 | 93 | { |
| 80 | 94 | ServiceHistoryMain *w = new ServiceHistoryMain(this); |
| 81 | 95 | w->setWindowModality(Qt::WindowModal); |
| 82 | 96 | w->showFullScreen(); |
| 97 | + | |
| 98 | + newChild(w); | |
| 83 | 99 | } |
| 84 | 100 | |
| 85 | 101 | void EngineerMenuWindow::on_operationTimeButton_clicked() |
| ... | ... | @@ -87,6 +103,8 @@ void EngineerMenuWindow::on_operationTimeButton_clicked() |
| 87 | 103 | OperationTimeMain *w = new OperationTimeMain(this); |
| 88 | 104 | w->setWindowModality(Qt::WindowModal); |
| 89 | 105 | w->showFullScreen(); |
| 106 | + | |
| 107 | + newChild(w); | |
| 90 | 108 | } |
| 91 | 109 | |
| 92 | 110 | void EngineerMenuWindow::on_realDataButton_clicked() |
| ... | ... | @@ -94,6 +112,8 @@ void EngineerMenuWindow::on_realDataButton_clicked() |
| 94 | 112 | RealtimeMain* w = new RealtimeMain(this); |
| 95 | 113 | w->setWindowModality(Qt::WindowModal); |
| 96 | 114 | w->showFullScreen(); |
| 115 | + | |
| 116 | + newChild(w); | |
| 97 | 117 | } |
| 98 | 118 | |
| 99 | 119 | void EngineerMenuWindow::on_functionTestButton_clicked() |
| ... | ... | @@ -102,6 +122,8 @@ void EngineerMenuWindow::on_functionTestButton_clicked() |
| 102 | 122 | w->setWindowModality(Qt::WindowModal); |
| 103 | 123 | w->showFullScreen(); |
| 104 | 124 | w->raise(); |
| 125 | + | |
| 126 | + newChild(w); | |
| 105 | 127 | } |
| 106 | 128 | |
| 107 | 129 | void EngineerMenuWindow::on_engAdjustButton_clicked() |
| ... | ... | @@ -111,21 +133,22 @@ void EngineerMenuWindow::on_engAdjustButton_clicked() |
| 111 | 133 | w->showFullScreen(); |
| 112 | 134 | w->raise(); |
| 113 | 135 | |
| 136 | + newChild(w); | |
| 114 | 137 | } |
| 115 | 138 | |
| 116 | 139 | void EngineerMenuWindow::on_stdConfigButton_clicked() |
| 117 | 140 | { |
| 118 | 141 | QDialog* dlg; |
| 119 | 142 | QString usbPath=""; |
| 120 | - if(!FileProcessor::detectUSB(usbPath)){ | |
| 143 | + if(FileProcessor::detectUSB(usbPath)) | |
| 144 | + dlg = new FileProcessDlg(this, Define::config_standard_info_upload, false); | |
| 145 | + else | |
| 121 | 146 | dlg = new UsbCheckPopupDlg(this); |
| 122 | - dlg->exec(); | |
| 123 | - } | |
| 124 | - if(FileProcessor::detectUSB(usbPath)){ | |
| 125 | - qDebug() << "standard upload exe"; | |
| 126 | - dlg = new FileProcessDlg(this,Define::config_standard_info_upload, false); | |
| 127 | - dlg->exec(); | |
| 128 | - } | |
| 147 | + | |
| 148 | + dlg->showFullScreen(); | |
| 149 | + dlg->raise(); | |
| 150 | + | |
| 151 | + newChild(dlg); | |
| 129 | 152 | } |
| 130 | 153 | |
| 131 | 154 | void EngineerMenuWindow::on_modelTypeConfigButton_clicked() |
| ... | ... | @@ -134,6 +157,14 @@ void EngineerMenuWindow::on_modelTypeConfigButton_clicked() |
| 134 | 157 | w->setWindowModality(Qt::WindowModal); |
| 135 | 158 | w->showFullScreen(); |
| 136 | 159 | w->raise(); |
| 160 | + | |
| 161 | + newChild(w); | |
| 162 | +} | |
| 163 | + | |
| 164 | +void EngineerMenuWindow::newChild(QWidget *w) | |
| 165 | +{ | |
| 166 | + child = w; | |
| 167 | + connect(w, SIGNAL(destroyed(QObject*)), SLOT(onChildDestroyed(QObject*))); | |
| 137 | 168 | } |
| 138 | 169 | |
| 139 | 170 | void EngineerMenuWindow::onEncoderLeft() | ... | ... |
app/gui/oven_control/engineermenuwindow.h
| ... | ... | @@ -16,28 +16,30 @@ public: |
| 16 | 16 | explicit EngineerMenuWindow(QWidget *parent = 0); |
| 17 | 17 | ~EngineerMenuWindow(); |
| 18 | 18 | |
| 19 | + void killChild(); | |
| 20 | + | |
| 19 | 21 | protected: |
| 20 | 22 | void keyPressEvent(QKeyEvent *event); |
| 21 | 23 | void keyReleaseEvent(QKeyEvent *event); |
| 22 | 24 | |
| 23 | 25 | private slots: |
| 24 | - void on_serviceHistoryButton_clicked(); | |
| 26 | + void onChildDestroyed(QObject *destroyed); | |
| 25 | 27 | |
| 28 | + void on_serviceHistoryButton_clicked(); | |
| 26 | 29 | void on_operationTimeButton_clicked(); |
| 27 | - | |
| 28 | 30 | void on_realDataButton_clicked(); |
| 29 | - | |
| 30 | 31 | void on_functionTestButton_clicked(); |
| 31 | - | |
| 32 | 32 | void on_engAdjustButton_clicked(); |
| 33 | - | |
| 34 | 33 | void on_stdConfigButton_clicked(); |
| 35 | - | |
| 36 | 34 | void on_modelTypeConfigButton_clicked(); |
| 37 | 35 | |
| 38 | 36 | private: |
| 39 | 37 | Ui::EngineerMenuWindow *ui; |
| 40 | 38 | |
| 39 | + QWidget *child; | |
| 40 | + | |
| 41 | + void newChild(QWidget *w); | |
| 42 | + | |
| 41 | 43 | QWidget *pushed = NULL; |
| 42 | 44 | |
| 43 | 45 | void onEncoderLeft(); | ... | ... |
app/gui/oven_control/mainwindow.cpp
| ... | ... | @@ -67,7 +67,6 @@ void MainWindow::killChild() |
| 67 | 67 | |
| 68 | 68 | bool MainWindow::killChildCook() |
| 69 | 69 | { |
| 70 | - | |
| 71 | 70 | if (instance->child && !instance->child->inherits("ConfigWindow")) |
| 72 | 71 | { |
| 73 | 72 | qDebug() << "kill child"; |
| ... | ... | @@ -75,7 +74,13 @@ bool MainWindow::killChildCook() |
| 75 | 74 | instance->child->deleteLater(); |
| 76 | 75 | return true; |
| 77 | 76 | } |
| 78 | - else return false; | |
| 77 | + else | |
| 78 | + return false; | |
| 79 | +} | |
| 80 | + | |
| 81 | +EngineerMenuWindow *MainWindow::getEngineerMenuWindow() | |
| 82 | +{ | |
| 83 | + return instance->findChild<EngineerMenuWindow *>(); | |
| 79 | 84 | } |
| 80 | 85 | |
| 81 | 86 | void MainWindow::keyPressEvent(QKeyEvent *event) | ... | ... |
app/gui/oven_control/mainwindow.h
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | #include <QMainWindow> |
| 5 | 5 | |
| 6 | 6 | #include "define.h" |
| 7 | +#include "engineermenuwindow.h" | |
| 7 | 8 | |
| 8 | 9 | namespace Ui { |
| 9 | 10 | class MainWindow; |
| ... | ... | @@ -23,6 +24,7 @@ public: |
| 23 | 24 | static void jump(QMainWindow *newChild); |
| 24 | 25 | static void killChild(); |
| 25 | 26 | static bool killChildCook(); |
| 27 | + static EngineerMenuWindow *getEngineerMenuWindow(); | |
| 26 | 28 | |
| 27 | 29 | protected: |
| 28 | 30 | void keyPressEvent(QKeyEvent *event); | ... | ... |