Mercurial > octave
comparison libgui/src/dialog.cc @ 31626:9034cf663768
eliminate unnecessary base_qobject object from GUI dialog classes
* dialog.h, dialog.cc (QUIWidgetCreator::m_octave_qobj):
Delete unnecessary data member.
(QUIWidgetCreator::QUIWidgetCreator, MessageDialog::MessageDialog,
ListDialog::ListDialog, InputDialog::InputDialog,
FileDialog::FileDialog): Eliminate base_qobject argument.
Change all uses.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 03 Dec 2022 01:00:04 -0500 |
parents | ad014fc78bd6 |
children | 431f80aba37a |
comparison
equal
deleted
inserted
replaced
31625:b26b768f23a4 | 31626:9034cf663768 |
---|---|
42 #include <QVBoxLayout> | 42 #include <QVBoxLayout> |
43 | 43 |
44 #include "dialog.h" | 44 #include "dialog.h" |
45 #include "gui-preferences-global.h" | 45 #include "gui-preferences-global.h" |
46 #include "gui-settings.h" | 46 #include "gui-settings.h" |
47 #include "octave-qobject.h" | |
48 | 47 |
49 namespace octave | 48 namespace octave |
50 { | 49 { |
51 QUIWidgetCreator::QUIWidgetCreator (base_qobject& oct_qobj) | 50 QUIWidgetCreator::QUIWidgetCreator () |
52 : QObject (), m_octave_qobj (oct_qobj), m_dialog_result (-1), | 51 : QObject (), m_dialog_result (-1), m_dialog_button (), |
53 m_dialog_button (), m_string_list (), m_list_index (), m_path_name () | 52 m_string_list (), m_list_index (), m_path_name () |
54 { | 53 { |
55 connect (this, &QUIWidgetCreator::create_dialog, | 54 connect (this, &QUIWidgetCreator::create_dialog, |
56 this, &QUIWidgetCreator::handle_create_dialog); | 55 this, &QUIWidgetCreator::handle_create_dialog); |
57 | 56 |
58 connect (this, &QUIWidgetCreator::create_listview, | 57 connect (this, &QUIWidgetCreator::create_listview, |
179 const QStringList& button, | 178 const QStringList& button, |
180 const QString& defbutton, | 179 const QString& defbutton, |
181 const QStringList& role) | 180 const QStringList& role) |
182 { | 181 { |
183 MessageDialog *message_dialog | 182 MessageDialog *message_dialog |
184 = new MessageDialog (m_octave_qobj, message, title, icon, | 183 = new MessageDialog (message, title, icon, button, defbutton, role); |
185 button, defbutton, role); | |
186 | 184 |
187 connect (message_dialog, &MessageDialog::buttonClicked, | 185 connect (message_dialog, &MessageDialog::buttonClicked, |
188 this, &QUIWidgetCreator::dialog_button_clicked); | 186 this, &QUIWidgetCreator::dialog_button_clicked); |
189 | 187 |
190 message_dialog->setAttribute (Qt::WA_DeleteOnClose); | 188 message_dialog->setAttribute (Qt::WA_DeleteOnClose); |
231 const QStringList& prompt, | 229 const QStringList& prompt, |
232 const QString& ok_string, | 230 const QString& ok_string, |
233 const QString& cancel_string) | 231 const QString& cancel_string) |
234 { | 232 { |
235 ListDialog *list_dialog | 233 ListDialog *list_dialog |
236 = new ListDialog (m_octave_qobj, list, mode, wd, ht, initial, | 234 = new ListDialog (list, mode, wd, ht, initial, |
237 name, prompt, ok_string, cancel_string); | 235 name, prompt, ok_string, cancel_string); |
238 | 236 |
239 connect (list_dialog, &ListDialog::finish_selection, | 237 connect (list_dialog, &ListDialog::finish_selection, |
240 this, &QUIWidgetCreator::list_select_finished); | 238 this, &QUIWidgetCreator::list_select_finished); |
241 | 239 |
263 const QFloatList& nr, | 261 const QFloatList& nr, |
264 const QFloatList& nc, | 262 const QFloatList& nc, |
265 const QStringList& defaults) | 263 const QStringList& defaults) |
266 { | 264 { |
267 InputDialog *input_dialog | 265 InputDialog *input_dialog |
268 = new InputDialog (m_octave_qobj, prompt, title, nr, nc, defaults); | 266 = new InputDialog (prompt, title, nr, nc, defaults); |
269 | 267 |
270 connect (input_dialog, &InputDialog::finish_input, | 268 connect (input_dialog, &InputDialog::finish_input, |
271 this, &QUIWidgetCreator::input_finished); | 269 this, &QUIWidgetCreator::input_finished); |
272 | 270 |
273 input_dialog->setAttribute (Qt::WA_DeleteOnClose); | 271 input_dialog->setAttribute (Qt::WA_DeleteOnClose); |
291 const QString& filename, | 289 const QString& filename, |
292 const QString& dirname, | 290 const QString& dirname, |
293 const QString& multimode) | 291 const QString& multimode) |
294 { | 292 { |
295 FileDialog *file_dialog | 293 FileDialog *file_dialog |
296 = new FileDialog (m_octave_qobj, filters, title, filename, | 294 = new FileDialog (filters, title, filename, dirname, multimode); |
297 dirname, multimode); | |
298 | 295 |
299 connect (file_dialog, &FileDialog::finish_input, | 296 connect (file_dialog, &FileDialog::finish_input, |
300 this, &QUIWidgetCreator::filedialog_finished); | 297 this, &QUIWidgetCreator::filedialog_finished); |
301 | 298 |
302 file_dialog->setAttribute (Qt::WA_DeleteOnClose); | 299 file_dialog->setAttribute (Qt::WA_DeleteOnClose); |
315 | 312 |
316 // Wake up Octave process so that it continues. | 313 // Wake up Octave process so that it continues. |
317 wake_all (); | 314 wake_all (); |
318 } | 315 } |
319 | 316 |
320 MessageDialog::MessageDialog (base_qobject&, const QString& message, | 317 MessageDialog::MessageDialog (const QString& message, |
321 const QString& title, const QString& qsicon, | 318 const QString& title, const QString& qsicon, |
322 const QStringList& qsbutton, | 319 const QStringList& qsbutton, |
323 const QString& defbutton, | 320 const QString& defbutton, |
324 const QStringList& role) | 321 const QStringList& role) |
325 : QMessageBox (QMessageBox::NoIcon, title.isEmpty () ? " " : title, | 322 : QMessageBox (QMessageBox::NoIcon, title.isEmpty () ? " " : title, |
387 } | 384 } |
388 } | 385 } |
389 } | 386 } |
390 } | 387 } |
391 | 388 |
392 ListDialog::ListDialog (base_qobject&, const QStringList& list, | 389 ListDialog::ListDialog (const QStringList& list, |
393 const QString& mode, int wd, int ht, | 390 const QString& mode, int wd, int ht, |
394 const QList<int>& initial, const QString& title, | 391 const QList<int>& initial, const QString& title, |
395 const QStringList& prompt, | 392 const QStringList& prompt, |
396 const QString& ok_string, | 393 const QString& ok_string, |
397 const QString& cancel_string) | 394 const QString& cancel_string) |
523 void ListDialog::item_double_clicked (const QModelIndex&) | 520 void ListDialog::item_double_clicked (const QModelIndex&) |
524 { | 521 { |
525 buttonOk_clicked (); | 522 buttonOk_clicked (); |
526 } | 523 } |
527 | 524 |
528 InputDialog::InputDialog (base_qobject&, const QStringList& prompt, | 525 InputDialog::InputDialog (const QStringList& prompt, |
529 const QString& title, const QFloatList& nr, | 526 const QString& title, const QFloatList& nr, |
530 const QFloatList& nc, const QStringList& defaults) | 527 const QFloatList& nc, const QStringList& defaults) |
531 : QDialog () | 528 : QDialog () |
532 { | 529 { |
533 | 530 |
617 void InputDialog::reject (void) | 614 void InputDialog::reject (void) |
618 { | 615 { |
619 buttonCancel_clicked (); | 616 buttonCancel_clicked (); |
620 } | 617 } |
621 | 618 |
622 FileDialog::FileDialog (base_qobject& oct_qobj, | 619 FileDialog::FileDialog (const QStringList& name_filters, |
623 const QStringList& name_filters, | |
624 const QString& title, const QString& filename, | 620 const QString& title, const QString& filename, |
625 const QString& dirname, const QString& multimode) | 621 const QString& dirname, const QString& multimode) |
626 : QFileDialog () | 622 : QFileDialog () |
627 { | 623 { |
628 // Create a NonModal message. | 624 // Create a NonModal message. |