Common Source Code Project for Qt (a.k.a for FM-7).
Revision | 0f5704214d04b042b5e7e93fa8f614b5bb104de1 (tree) |
---|---|
Zeit | 2023-01-27 11:54:15 |
Autor | K.Ohta <whatisthis.sowhat@gmai...> |
Commiter | K.Ohta |
[UI][Qt][MENU_METACLASS] Delete opened dialogs when exit.
@@ -12,7 +12,6 @@ | ||
12 | 12 | #include <QStyle> |
13 | 13 | #include <QApplication> |
14 | 14 | #include <QMenuBar> |
15 | -#include <QThreadPool> | |
16 | 15 | |
17 | 16 | //#include "emu.h" |
18 | 17 | //#include "vm.h" |
@@ -43,7 +42,6 @@ Menu_MetaClass::Menu_MetaClass(QMenuBar *root_entry, QString desc, std::shared_p | ||
43 | 42 | object_desc = QString::fromUtf8("Obj_") + desc; |
44 | 43 | object_desc.append(tmps); |
45 | 44 | setObjectName(object_desc); |
46 | - | |
47 | 45 | |
48 | 46 | for(ii = 0; ii < using_flags->get_max_d88_banks(); ii++) { |
49 | 47 | action_select_media_list[ii] = NULL; |
@@ -54,6 +52,9 @@ Menu_MetaClass::Menu_MetaClass(QMenuBar *root_entry, QString desc, std::shared_p | ||
54 | 52 | |
55 | 53 | ext_filter.clear(); |
56 | 54 | history.clear(); |
55 | + | |
56 | + dialogs.clear(); | |
57 | + | |
57 | 58 | inner_media_list.clear(); |
58 | 59 | window_title = QString::fromUtf8(""); |
59 | 60 |
@@ -62,7 +63,6 @@ Menu_MetaClass::Menu_MetaClass(QMenuBar *root_entry, QString desc, std::shared_p | ||
62 | 63 | icon_write_protected = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton); |
63 | 64 | icon_write_enabled = QIcon(); |
64 | 65 | setToolTipsVisible(true); |
65 | - | |
66 | 66 | |
67 | 67 | connect(this, SIGNAL(sig_emu_update_config()), p_wid, SLOT(do_emu_update_config())); |
68 | 68 |
@@ -73,6 +73,12 @@ Menu_MetaClass::Menu_MetaClass(QMenuBar *root_entry, QString desc, std::shared_p | ||
73 | 73 | |
74 | 74 | Menu_MetaClass::~Menu_MetaClass() |
75 | 75 | { |
76 | + for(auto i = dialogs.begin(); i != dialogs.end(); ++i) { | |
77 | + if((*i) != nullptr) { | |
78 | + dialogs.erase(i); | |
79 | + (*i)->deleteLater(); | |
80 | + } | |
81 | + } | |
76 | 82 | } |
77 | 83 | |
78 | 84 |
@@ -214,8 +220,7 @@ void Menu_MetaClass::do_open_dialog() | ||
214 | 220 | strncpy(app, initial_dir.toLocal8Bit().constData(), PATH_MAX - 1); |
215 | 221 | initial_dir = QString::fromLocal8Bit(get_parent_dir(app)); |
216 | 222 | } |
217 | - CSP_DiskDialog *dlg = new CSP_DiskDialog(nullptr); | |
218 | - | |
223 | + CSP_DiskDialog *dlg = new CSP_DiskDialog(this); | |
219 | 224 | dlg->setOption(QFileDialog::ReadOnly, false); |
220 | 225 | dlg->setOption(QFileDialog::DontUseNativeDialog, true); |
221 | 226 | //dlg->setAcceptMode(QFileDialog::AcceptSave); |
@@ -235,22 +240,25 @@ void Menu_MetaClass::do_open_dialog() | ||
235 | 240 | } |
236 | 241 | dlg->setWindowTitle(tmps); |
237 | 242 | |
243 | + | |
244 | + dlg->setModal(false); | |
245 | + | |
246 | + | |
238 | 247 | connect(dlg, SIGNAL(fileSelected(QString)), dlg->param, SLOT(_open_disk(QString))); |
239 | 248 | connect(dlg->param, SIGNAL(sig_open_disk(int, QString)), this, SLOT(do_open_media(int, QString))); |
240 | 249 | connect(dlg, SIGNAL(accepted()), this, SLOT(do_close_window()), Qt::QueuedConnection); |
241 | 250 | connect(dlg, SIGNAL(rejected()), this, SLOT(do_close_window()), Qt::QueuedConnection); |
242 | 251 | connect(dlg, SIGNAL(finished(int)), this, SLOT(do_finish(int)), Qt::QueuedConnection); |
243 | 252 | |
244 | - connect(this, SIGNAL(sig_show()), dlg, SLOT(open()), Qt::QueuedConnection); | |
253 | + connect(this, SIGNAL(sig_show()), dlg, SLOT(show()), Qt::QueuedConnection); | |
245 | 254 | dlg->do_update_params(); // update Extensions, directories |
246 | 255 | |
247 | - dlg->setModal(false); | |
248 | 256 | dialogs.append(dlg); |
249 | 257 | |
250 | 258 | //dlg->open(); |
251 | 259 | //dlg->show(); |
252 | - dlg->exec(); | |
253 | - //emit sig_show(); | |
260 | + //dlg->exec(); | |
261 | + emit sig_show(); | |
254 | 262 | return; |
255 | 263 | } |
256 | 264 |
@@ -24,6 +24,7 @@ | ||
24 | 24 | class EMU_TEMPLATE; |
25 | 25 | |
26 | 26 | QT_BEGIN_NAMESPACE |
27 | +class QThread; | |
27 | 28 | class QMenuBar; |
28 | 29 | class QAction; |
29 | 30 | class QActionGroup; |