Commit d20f8d98a664bd6a1c2261b49de28697c59a8695

Authored by 김태훈
1 parent 0f8248de61
Exists in master and in 2 other branches fhd, fhd-demo

엔지니어링 모드 창 중복 실행 방지 도움 메소드 추가

app/gui/oven_control/engineermenuwindow.cpp
@@ -25,6 +25,8 @@ EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) : @@ -25,6 +25,8 @@ EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) :
25 ui->clockContainer->setParent(ui->upperStack); 25 ui->clockContainer->setParent(ui->upperStack);
26 setAttribute(Qt::WA_DeleteOnClose); 26 setAttribute(Qt::WA_DeleteOnClose);
27 27
  28 + child = Q_NULLPTR;
  29 +
28 connect(ui->backButton, SIGNAL(clicked()), this, SLOT(close())); 30 connect(ui->backButton, SIGNAL(clicked()), this, SLOT(close()));
29 31
30 foreach (QPushButton *button, findChildren<QPushButton *>()) 32 foreach (QPushButton *button, findChildren<QPushButton *>())
@@ -40,6 +42,12 @@ EngineerMenuWindow::~EngineerMenuWindow() @@ -40,6 +42,12 @@ EngineerMenuWindow::~EngineerMenuWindow()
40 delete ui; 42 delete ui;
41 } 43 }
42 44
  45 +void EngineerMenuWindow::killChild()
  46 +{
  47 + if (child)
  48 + child->deleteLater();
  49 +}
  50 +
43 void EngineerMenuWindow::keyPressEvent(QKeyEvent *event) 51 void EngineerMenuWindow::keyPressEvent(QKeyEvent *event)
44 { 52 {
45 switch (event->key()) 53 switch (event->key())
@@ -75,11 +83,19 @@ void EngineerMenuWindow::keyReleaseEvent(QKeyEvent *event) @@ -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 void EngineerMenuWindow::on_serviceHistoryButton_clicked() 92 void EngineerMenuWindow::on_serviceHistoryButton_clicked()
79 { 93 {
80 ServiceHistoryMain *w = new ServiceHistoryMain(this); 94 ServiceHistoryMain *w = new ServiceHistoryMain(this);
81 w->setWindowModality(Qt::WindowModal); 95 w->setWindowModality(Qt::WindowModal);
82 w->showFullScreen(); 96 w->showFullScreen();
  97 +
  98 + newChild(w);
83 } 99 }
84 100
85 void EngineerMenuWindow::on_operationTimeButton_clicked() 101 void EngineerMenuWindow::on_operationTimeButton_clicked()
@@ -87,6 +103,8 @@ void EngineerMenuWindow::on_operationTimeButton_clicked() @@ -87,6 +103,8 @@ void EngineerMenuWindow::on_operationTimeButton_clicked()
87 OperationTimeMain *w = new OperationTimeMain(this); 103 OperationTimeMain *w = new OperationTimeMain(this);
88 w->setWindowModality(Qt::WindowModal); 104 w->setWindowModality(Qt::WindowModal);
89 w->showFullScreen(); 105 w->showFullScreen();
  106 +
  107 + newChild(w);
90 } 108 }
91 109
92 void EngineerMenuWindow::on_realDataButton_clicked() 110 void EngineerMenuWindow::on_realDataButton_clicked()
@@ -94,6 +112,8 @@ void EngineerMenuWindow::on_realDataButton_clicked() @@ -94,6 +112,8 @@ void EngineerMenuWindow::on_realDataButton_clicked()
94 RealtimeMain* w = new RealtimeMain(this); 112 RealtimeMain* w = new RealtimeMain(this);
95 w->setWindowModality(Qt::WindowModal); 113 w->setWindowModality(Qt::WindowModal);
96 w->showFullScreen(); 114 w->showFullScreen();
  115 +
  116 + newChild(w);
97 } 117 }
98 118
99 void EngineerMenuWindow::on_functionTestButton_clicked() 119 void EngineerMenuWindow::on_functionTestButton_clicked()
@@ -102,6 +122,8 @@ void EngineerMenuWindow::on_functionTestButton_clicked() @@ -102,6 +122,8 @@ void EngineerMenuWindow::on_functionTestButton_clicked()
102 w->setWindowModality(Qt::WindowModal); 122 w->setWindowModality(Qt::WindowModal);
103 w->showFullScreen(); 123 w->showFullScreen();
104 w->raise(); 124 w->raise();
  125 +
  126 + newChild(w);
105 } 127 }
106 128
107 void EngineerMenuWindow::on_engAdjustButton_clicked() 129 void EngineerMenuWindow::on_engAdjustButton_clicked()
@@ -111,21 +133,22 @@ void EngineerMenuWindow::on_engAdjustButton_clicked() @@ -111,21 +133,22 @@ void EngineerMenuWindow::on_engAdjustButton_clicked()
111 w->showFullScreen(); 133 w->showFullScreen();
112 w->raise(); 134 w->raise();
113 135
  136 + newChild(w);
114 } 137 }
115 138
116 void EngineerMenuWindow::on_stdConfigButton_clicked() 139 void EngineerMenuWindow::on_stdConfigButton_clicked()
117 { 140 {
118 QDialog* dlg; 141 QDialog* dlg;
119 QString usbPath=""; 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 dlg = new UsbCheckPopupDlg(this); 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 void EngineerMenuWindow::on_modelTypeConfigButton_clicked() 154 void EngineerMenuWindow::on_modelTypeConfigButton_clicked()
@@ -134,6 +157,14 @@ void EngineerMenuWindow::on_modelTypeConfigButton_clicked() @@ -134,6 +157,14 @@ void EngineerMenuWindow::on_modelTypeConfigButton_clicked()
134 w->setWindowModality(Qt::WindowModal); 157 w->setWindowModality(Qt::WindowModal);
135 w->showFullScreen(); 158 w->showFullScreen();
136 w->raise(); 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 void EngineerMenuWindow::onEncoderLeft() 170 void EngineerMenuWindow::onEncoderLeft()
app/gui/oven_control/engineermenuwindow.h
@@ -16,28 +16,30 @@ public: @@ -16,28 +16,30 @@ public:
16 explicit EngineerMenuWindow(QWidget *parent = 0); 16 explicit EngineerMenuWindow(QWidget *parent = 0);
17 ~EngineerMenuWindow(); 17 ~EngineerMenuWindow();
18 18
  19 + void killChild();
  20 +
19 protected: 21 protected:
20 void keyPressEvent(QKeyEvent *event); 22 void keyPressEvent(QKeyEvent *event);
21 void keyReleaseEvent(QKeyEvent *event); 23 void keyReleaseEvent(QKeyEvent *event);
22 24
23 private slots: 25 private slots:
24 - void on_serviceHistoryButton_clicked(); 26 + void onChildDestroyed(QObject *destroyed);
25 27
  28 + void on_serviceHistoryButton_clicked();
26 void on_operationTimeButton_clicked(); 29 void on_operationTimeButton_clicked();
27 -  
28 void on_realDataButton_clicked(); 30 void on_realDataButton_clicked();
29 -  
30 void on_functionTestButton_clicked(); 31 void on_functionTestButton_clicked();
31 -  
32 void on_engAdjustButton_clicked(); 32 void on_engAdjustButton_clicked();
33 -  
34 void on_stdConfigButton_clicked(); 33 void on_stdConfigButton_clicked();
35 -  
36 void on_modelTypeConfigButton_clicked(); 34 void on_modelTypeConfigButton_clicked();
37 35
38 private: 36 private:
39 Ui::EngineerMenuWindow *ui; 37 Ui::EngineerMenuWindow *ui;
40 38
  39 + QWidget *child;
  40 +
  41 + void newChild(QWidget *w);
  42 +
41 QWidget *pushed = NULL; 43 QWidget *pushed = NULL;
42 44
43 void onEncoderLeft(); 45 void onEncoderLeft();
app/gui/oven_control/mainwindow.cpp
@@ -67,7 +67,6 @@ void MainWindow::killChild() @@ -67,7 +67,6 @@ void MainWindow::killChild()
67 67
68 bool MainWindow::killChildCook() 68 bool MainWindow::killChildCook()
69 { 69 {
70 -  
71 if (instance->child && !instance->child->inherits("ConfigWindow")) 70 if (instance->child && !instance->child->inherits("ConfigWindow"))
72 { 71 {
73 qDebug() << "kill child"; 72 qDebug() << "kill child";
@@ -75,7 +74,13 @@ bool MainWindow::killChildCook() @@ -75,7 +74,13 @@ bool MainWindow::killChildCook()
75 instance->child->deleteLater(); 74 instance->child->deleteLater();
76 return true; 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 void MainWindow::keyPressEvent(QKeyEvent *event) 86 void MainWindow::keyPressEvent(QKeyEvent *event)
app/gui/oven_control/mainwindow.h
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 #include <QMainWindow> 4 #include <QMainWindow>
5 5
6 #include "define.h" 6 #include "define.h"
  7 +#include "engineermenuwindow.h"
7 8
8 namespace Ui { 9 namespace Ui {
9 class MainWindow; 10 class MainWindow;
@@ -23,6 +24,7 @@ public: @@ -23,6 +24,7 @@ public:
23 static void jump(QMainWindow *newChild); 24 static void jump(QMainWindow *newChild);
24 static void killChild(); 25 static void killChild();
25 static bool killChildCook(); 26 static bool killChildCook();
  27 + static EngineerMenuWindow *getEngineerMenuWindow();
26 28
27 protected: 29 protected:
28 void keyPressEvent(QKeyEvent *event); 30 void keyPressEvent(QKeyEvent *event);