GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dialog.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2013-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <QFileInfo>
31 #include <QListView>
32 #include <QString>
33 #include <QStringList>
34 #include <QStringListModel>
35 // Could replace most of these with #include <QtGui>
36 #include <QGridLayout>
37 #include <QGroupBox>
38 #include <QHBoxLayout>
39 #include <QLabel>
40 #include <QMessageBox>
41 #include <QPushButton>
42 #include <QVBoxLayout>
43 
44 #include "dialog.h"
45 #include "octave-qobject.h"
46 #include "gui-preferences-global.h"
47 
48 namespace octave
49 {
51  : QObject (), m_octave_qobj (oct_qobj), m_dialog_result (-1),
52  m_dialog_button (), m_string_list (), m_list_index (), m_path_name ()
53  {
54  connect (this,
55  SIGNAL (create_dialog (const QString&, const QString&,
56  const QString&, const QStringList&,
57  const QString&, const QStringList&)),
58  this,
59  SLOT (handle_create_dialog (const QString&, const QString&,
60  const QString&, const QStringList&,
61  const QString&, const QStringList&)));
62 
63  connect (this,
64  SIGNAL (create_listview (const QStringList&, const QString&,
65  int, int, const QIntList&,
66  const QString&, const QStringList&,
67  const QString&, const QString&)),
68  this,
69  SLOT (handle_create_listview (const QStringList&, const QString&,
70  int, int, const QIntList&,
71  const QString&, const QStringList&,
72  const QString&, const QString&)));
73 
74  connect (this,
75  SIGNAL (create_inputlayout (const QStringList&, const QString&,
76  const QFloatList&, const QFloatList&,
77  const QStringList&)),
78  this,
79  SLOT (handle_create_inputlayout (const QStringList&,
80  const QString&,
81  const QFloatList&,
82  const QFloatList&,
83  const QStringList&)));
84 
85  connect (this,
86  SIGNAL (create_filedialog (const QStringList&,const QString&,
87  const QString&, const QString&,
88  const QString&)),
89  this,
90  SLOT (handle_create_filedialog (const QStringList&, const QString&,
91  const QString&, const QString&,
92  const QString&)));
93  }
94 
95  QString QUIWidgetCreator::rm_amp (const QString& text)
96  {
97  QString text_wo_amp = text;
98  text_wo_amp.replace (QRegExp ("&(\\w)"), "\\1");
99  return text_wo_amp;
100  }
101 
102  QString QUIWidgetCreator::message_dialog (const QString& message,
103  const QString& title,
104  const QString& icon,
105  const QStringList& buttons,
106  const QString& defbutton,
107  const QStringList& role)
108  {
109  QMutexLocker autolock (&m_mutex);
110 
111  // Store button text before a window-manager adds accelerators.
112 
113  m_button_list = buttons;
114 
115  // Use the last button in the list as the reject result, i.e., when
116  // no button is pressed such as in the case of the upper right close
117  // tab.
118  if (! buttons.isEmpty ())
119  m_dialog_button = buttons.last ();
120 
121  QString xicon = icon;
122  if (xicon.isEmpty ())
123  xicon = "none";
124 
125  emit create_dialog (message, title, xicon, buttons, defbutton, role);
126 
127  // Wait while the user is responding to message box.
128  wait ();
129 
130  // The GUI has sent a signal and the thread has been awakened.
131  return m_dialog_button;
132  };
133 
134  QPair<QIntList, int>
135  QUIWidgetCreator::list_dialog (const QStringList& list, const QString& mode,
136  int wd, int ht, const QList<int>& initial,
137  const QString& name,
138  const QStringList& prompt,
139  const QString& ok_string,
140  const QString& cancel_string)
141  {
142  if (list.isEmpty ())
143  return QPair<QIntList, int> ();
144 
145  QMutexLocker autolock (&m_mutex);
146 
147  emit create_listview (list, mode, wd, ht, initial, name,
148  prompt, ok_string, cancel_string);
149 
150  // Wait while the user is responding to message box.
151  wait ();
152 
153  // The GUI has sent a signal and the thread has been awakened.
154  return QPair<QIntList, int> (m_list_index, m_dialog_result);
155  };
156 
157  // Create a message dialog with specified string, buttons and
158  // decorative text.
159 
160  QStringList QUIWidgetCreator::input_dialog (const QStringList& prompt,
161  const QString& title,
162  const QFloatList& nr,
163  const QFloatList& nc,
164  const QStringList& defaults)
165  {
166  if (prompt.isEmpty ())
167  return QStringList ();
168 
169  QMutexLocker autolock (&m_mutex);
170 
171  emit create_inputlayout (prompt, title, nr, nc, defaults);
172 
173  // Wait while the user is responding to message box.
174  wait ();
175 
176  // The GUI has sent a signal and the thread has been awakened.
177  return m_string_list;
178  };
179 
180  QStringList QUIWidgetCreator::file_dialog (const QStringList& filters,
181  const QString& title,
182  const QString& filename,
183  const QString& dirname,
184  const QString& multimode)
185  {
186  QMutexLocker autolock (&m_mutex);
187 
188  emit create_filedialog (filters, title, filename, dirname, multimode);
189 
190  // Wait while the user is responding to dialog.
191  wait ();
192 
193  // The GUI has sent a signal and the thread has been awakened.
194  // Add all the file dialog results to a string list.
195  QStringList retval;
197  << m_path_name
198  << QString::number (m_dialog_result);
199 
200  return retval;
201  }
202 
204  const QString& title,
205  const QString& icon,
206  const QStringList& button,
207  const QString& defbutton,
208  const QStringList& role)
209  {
211  = new MessageDialog (m_octave_qobj, message, title, icon,
212  button, defbutton, role);
213 
214  connect (message_dialog, SIGNAL (buttonClicked (QAbstractButton *)),
215  this, SLOT (dialog_button_clicked (QAbstractButton *)));
216 
217  message_dialog->setAttribute (Qt::WA_DeleteOnClose);
218  message_dialog->show ();
219  }
220 
221  void QUIWidgetCreator::dialog_button_clicked (QAbstractButton *button)
222  {
223  // button is NULL when dialog is closed.
224  if (button)
225  {
226  // Check for a matching button text while ignoring accelerators
227  // because the window manager may have added one in the passed
228  // button.
229 
230  QString text_clean = rm_amp (button->text ());
231 
232  for (int i = 0; i < m_button_list.count (); i++)
233  {
234  if (rm_amp (m_button_list.at (i)) == text_clean)
235  {
236  // Text w/o extra accelerator.
238  break;
239  }
240  }
241  }
242 
243  // The value should always be 1 for the Octave functions.
244  m_dialog_result = 1;
245 
246  // Wake up Octave process so that it continues.
247  wake_all ();
248  }
249 
250  // Create a list dialog with specified list, initially selected, mode,
251  // view size and decorative text.
252 
253  void QUIWidgetCreator::handle_create_listview (const QStringList& list,
254  const QString& mode,
255  int wd, int ht,
256  const QIntList& initial,
257  const QString& name,
258  const QStringList& prompt,
259  const QString& ok_string,
260  const QString& cancel_string)
261  {
263  = new ListDialog (m_octave_qobj, list, mode, wd, ht, initial,
264  name, prompt, ok_string, cancel_string);
265 
266  connect (list_dialog, SIGNAL (finish_selection (const QIntList&, int)),
267  this, SLOT (list_select_finished (const QIntList&, int)));
268 
269  list_dialog->setAttribute (Qt::WA_DeleteOnClose);
270  list_dialog->show ();
271  }
272 
274  int button_pressed)
275  {
276  // Store the value so that builtin functions can retrieve.
277 
278  m_list_index = selected;
279  m_dialog_result = button_pressed;
280 
281  // Wake up Octave process so that it continues.
282  wake_all ();
283  }
284 
285  // Create an input dialog with specified prompts and defaults, title
286  // and row/column size specifications.
287 
288  void QUIWidgetCreator::handle_create_inputlayout (const QStringList& prompt,
289  const QString& title,
290  const QFloatList& nr,
291  const QFloatList& nc,
292  const QStringList& defaults)
293  {
295  = new InputDialog (m_octave_qobj, prompt, title, nr, nc, defaults);
296 
297  connect (input_dialog, SIGNAL (finish_input (const QStringList&, int)),
298  this, SLOT (input_finished (const QStringList&, int)));
299 
300  input_dialog->setAttribute (Qt::WA_DeleteOnClose);
301  input_dialog->show ();
302  }
303 
304  void QUIWidgetCreator::input_finished (const QStringList& input,
305  int button_pressed)
306  {
307  // Store the value so that builtin functions can retrieve.
308 
310  m_dialog_result = button_pressed;
311 
312  // Wake up Octave process so that it continues.
313  wake_all ();
314  }
315 
316  void QUIWidgetCreator::handle_create_filedialog (const QStringList& filters,
317  const QString& title,
318  const QString& filename,
319  const QString& dirname,
320  const QString& multimode)
321  {
323  = new FileDialog (m_octave_qobj, filters, title, filename,
324  dirname, multimode);
325 
326  connect (file_dialog, SIGNAL (finish_input (const QStringList&,
327  const QString&, int)),
328  this, SLOT (filedialog_finished (const QStringList&,
329  const QString&, int)));
330 
331  file_dialog->setAttribute (Qt::WA_DeleteOnClose);
332  file_dialog->show ();
333  }
334 
335  void QUIWidgetCreator::filedialog_finished (const QStringList& files,
336  const QString& path,
337  int filterindex)
338  {
339  // Store the value so that builtin functions can retrieve.
340 
341  m_string_list = files;
342  m_dialog_result = filterindex;
343  m_path_name = path;
344 
345  // Wake up Octave process so that it continues.
346  wake_all ();
347  }
348 
350  const QString& title, const QString& qsicon,
351  const QStringList& qsbutton,
352  const QString& defbutton,
353  const QStringList& role)
354  : QMessageBox (QMessageBox::NoIcon, title.isEmpty () ? " " : title,
355  message)
356  {
357  // Create a NonModal message.
358  setWindowModality (Qt::NonModal);
359 
360  // Interpret the icon string, because enumeration QMessageBox::Icon can't
361  // easily be made to pass through a signal.
362 
363  QMessageBox::Icon eicon = QMessageBox::NoIcon;
364 
365  if (qsicon == "error")
366  eicon = QMessageBox::Critical;
367  else if (qsicon == "warn")
368  eicon = QMessageBox::Warning;
369  else if (qsicon == "help")
370  eicon = QMessageBox::Information;
371  else if (qsicon == "quest")
372  eicon = QMessageBox::Question;
373 
374  setIcon (eicon);
375 
376  int N = (qsbutton.size () < role.size () ? qsbutton.size () : role.size ());
377 
378  if (N == 0)
379  addButton (QMessageBox::Ok);
380  else
381  {
382  for (int i = 0; i < N; i++)
383  {
384  // Interpret the button role string, because enumeration
385  // QMessageBox::ButtonRole can't be made to pass through a
386  // signal.
387 
388  QString srole = role.at (i);
389  QMessageBox::ButtonRole erole = QMessageBox::InvalidRole;
390  if (srole == "ResetRole")
391  erole = QMessageBox::ResetRole;
392  else if (srole == "YesRole")
393  erole = QMessageBox::YesRole;
394  else if (srole == "NoRole")
395  erole = QMessageBox::NoRole;
396  else if (srole == "RejectRole")
397  erole = QMessageBox::RejectRole;
398  else if (srole == "AcceptRole")
399  erole = QMessageBox::AcceptRole;
400 
401  QPushButton *pbutton = addButton (qsbutton.at (i), erole);
402  if (qsbutton.at (i) == defbutton)
403  setDefaultButton (pbutton);
404 
405  // Make the last button the button pressed when <esc> key activated.
406  if (i == N-1)
407  {
408  // FIXME: Why define and then immediately test value?
409 #define ACTIVE_ESCAPE 1
410 #if ACTIVE_ESCAPE
411  setEscapeButton (pbutton);
412 #else
413  setEscapeButton (0);
414 #endif
415 #undef ACTIVE_ESCAPE
416  }
417  }
418  }
419  }
420 
421  ListDialog::ListDialog (base_qobject&, const QStringList& list,
422  const QString& mode, int wd, int ht,
423  const QList<int>& initial, const QString& title,
424  const QStringList& prompt,
425  const QString& ok_string,
426  const QString& cancel_string)
427  : QDialog (), m_model (new QStringListModel (list))
428  {
429  QListView *view = new QListView;
430  view->setModel (m_model);
431 
432  if (mode == "single")
433  view->setSelectionMode (QAbstractItemView::SingleSelection);
434  else if (mode == "multiple")
435  view->setSelectionMode (QAbstractItemView::ExtendedSelection);
436  else
437  view->setSelectionMode (QAbstractItemView::NoSelection);
438 
439  selector = view->selectionModel ();
440  int i = 0;
441  for (auto it = initial.begin (); it != initial.end (); it++)
442  {
443  QModelIndex idx = m_model->index (initial.value (i++) - 1, 0,
444  QModelIndex ());
445  selector->select (idx, QItemSelectionModel::Select);
446  }
447 
448  bool fixed_layout = false;
449  if (wd > 0 && ht > 0)
450  {
451  view->setFixedSize (wd, ht);
452  fixed_layout = true;
453  }
454 
455  view->setEditTriggers (QAbstractItemView::NoEditTriggers);
456 
457  QVBoxLayout *listLayout = new QVBoxLayout;
458  if (! prompt.isEmpty ())
459  {
460  // For now, assume html-like Rich Text. May be incompatible
461  // with something down the road, but just testing capability.
462  QString prompt_string;
463  for (int j = 0; j < prompt.length (); j++)
464  {
465  if (j > 0)
466  // FIXME: Why define and then immediately test value?
467 #define RICH_TEXT 1
468 #if RICH_TEXT
469  prompt_string.append ("<br>");
470 #else
471  prompt_string.append ("\n");
472 #endif
473  prompt_string.append (prompt.at (j));
474  }
475  QLabel *plabel = new QLabel (prompt_string);
476 #if RICH_TEXT
477  plabel->setTextFormat (Qt::RichText);
478 #endif
479 #undef RICH_TEXT
480  listLayout->addWidget (plabel);
481  }
482  listLayout->addWidget (view);
483  QPushButton *select_all = new QPushButton (tr ("Select All"));
484  select_all->setVisible (mode == "multiple");
485  listLayout->addWidget (select_all);
486 
487  QPushButton *buttonOk = new QPushButton (ok_string);
488  QPushButton *buttonCancel = new QPushButton (cancel_string);
489  QHBoxLayout *buttonsLayout = new QHBoxLayout;
490  buttonsLayout->addStretch (1);
491  buttonsLayout->addWidget (buttonOk);
492  buttonsLayout->addWidget (buttonCancel);
493  buttonOk->setDefault (true);
494 
495  QVBoxLayout *mainLayout = new QVBoxLayout;
496  mainLayout->addLayout (listLayout);
497  mainLayout->addSpacing (12);
498  mainLayout->addLayout (buttonsLayout);
499  setLayout (mainLayout);
500  if (fixed_layout)
501  layout ()->setSizeConstraint (QLayout::SetFixedSize);
502 
503  // If empty, make blank rather than use default OS behavior.
504  setWindowTitle (title.isEmpty () ? " " : title);
505 
506  connect (select_all, SIGNAL (clicked ()),
507  view, SLOT (selectAll ()));
508 
509  connect (buttonOk, SIGNAL (clicked ()),
510  this, SLOT (buttonOk_clicked ()));
511 
512  connect (buttonCancel, SIGNAL (clicked ()),
513  this, SLOT (buttonCancel_clicked ()));
514 
515  connect (view, SIGNAL (doubleClicked (const QModelIndex&)),
516  this, SLOT (item_double_clicked (const QModelIndex&)));
517  }
518 
520  {
521  delete m_model;
522  }
523 
525  {
526  // Store information about what button was pressed so that builtin
527  // functions can retrieve.
528 
529  QModelIndexList selected_index = selector->selectedIndexes ();
530  QIntList selected_int;
531 
532  for (int i = 0; i < selected_index.size (); i++)
533  selected_int << selected_index.at (i).row () + 1;
534 
535  emit finish_selection (selected_int, 1);
536 
537  done (QDialog::Accepted);
538  }
539 
541  {
542  // Store information about what button was pressed so that builtin
543  // functions can retrieve.
544 
545  QIntList empty;
546 
547  emit finish_selection (empty, 0);
548 
549  done (QDialog::Rejected);
550  }
551 
552  void ListDialog::reject (void)
553  {
555  }
556 
557  void ListDialog::item_double_clicked (const QModelIndex&)
558  {
559  buttonOk_clicked ();
560  }
561 
562  InputDialog::InputDialog (base_qobject&, const QStringList& prompt,
563  const QString& title, const QFloatList& nr,
564  const QFloatList& nc, const QStringList& defaults)
565  : QDialog ()
566  {
567 
568 #define LINE_EDIT_FOLLOWS_PROMPT 0
569 
570 #if LINE_EDIT_FOLLOWS_PROMPT
571  // Prompt on left followed by input on right.
572  QGridLayout *promptInputLayout = new QGridLayout;
573 #else
574  // Prompt aligned above input.
575  QVBoxLayout *promptInputLayout = new QVBoxLayout;
576 #endif
577  int N_gridrows = prompt.size ();
578  for (int i = 0; i < N_gridrows; i++)
579  {
580  QLabel *label = new QLabel (prompt.at (i));
581  QLineEdit *line_edit = new QLineEdit ();
582  if (i < defaults.size ())
583  line_edit->setText (defaults.at (i));
584  if (i < nr.size () && nr.at (i) > 0)
585  {
586  QSize qsize = line_edit->sizeHint ();
587  int intval = qsize.height () * nr.at (i);
588  line_edit->setFixedHeight (intval);
589  if (i < nc.size () && nc.at (i) > 0)
590  {
591  intval = qsize.height () * nc.at (i) / 2;
592  line_edit->setFixedWidth (intval);
593  }
594  }
595  input_line << line_edit;
596 #if LINE_EDIT_FOLLOWS_PROMPT
597  promptInputLayout->addWidget (label, i + 1, 0);
598  promptInputLayout->addWidget (line_edit, i + 1, 1);
599 #else
600  promptInputLayout->addWidget (label);
601  promptInputLayout->addWidget (line_edit);
602 #endif
603  }
604 #undef LINE_EDIT_FOLLOWS_PROMPT
605 
606  QPushButton *buttonOk = new QPushButton ("OK");
607  QPushButton *buttonCancel = new QPushButton ("Cancel");
608  QHBoxLayout *buttonsLayout = new QHBoxLayout;
609  buttonsLayout->addStretch (1);
610  buttonsLayout->addWidget (buttonOk);
611  buttonsLayout->addWidget (buttonCancel);
612 
613  QVBoxLayout *mainLayout = new QVBoxLayout;
614  mainLayout->addLayout (promptInputLayout);
615  mainLayout->addSpacing (12);
616  mainLayout->addLayout (buttonsLayout);
617  setLayout (mainLayout);
618 
619  // If empty, make blank rather than use default OS behavior.
620  setWindowTitle (title.isEmpty () ? " " : title);
621 
622  connect (buttonOk, SIGNAL (clicked ()),
623  this, SLOT (buttonOk_clicked ()));
624 
625  connect (buttonCancel, SIGNAL (clicked ()),
626  this, SLOT (buttonCancel_clicked ()));
627  }
628 
630  {
631  // Store information about what button was pressed so that builtin
632  // functions can retrieve.
633 
634  QStringList string_result;
635  for (int i = 0; i < input_line.size (); i++)
636  string_result << input_line.at (i)->text ();
637  emit finish_input (string_result, 1);
638  done (QDialog::Accepted);
639  }
640 
642  {
643  // Store information about what button was pressed so that builtin
644  // functions can retrieve.
645 
646  QStringList empty;
647  emit finish_input (empty, 0);
648  done (QDialog::Rejected);
649  }
650 
652  {
654  }
655 
657  const QStringList& name_filters,
658  const QString& title, const QString& filename,
659  const QString& dirname, const QString& multimode)
660  : QFileDialog ()
661  {
662  // Create a NonModal message.
663  setWindowModality (Qt::NonModal);
664 
665  setWindowTitle (title.isEmpty () ? " " : title);
666  setDirectory (dirname);
667 
668  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
669  resource_manager& rmgr = oct_qobj.get_resource_manager ();
671  if (! settings->value (global_use_native_dialogs).toBool ())
672  setOption(QFileDialog::DontUseNativeDialog);
673 
674  if (multimode == "on") // uigetfile multiselect=on
675  {
676  setFileMode (QFileDialog::ExistingFiles);
677  setAcceptMode (QFileDialog::AcceptOpen);
678  }
679  else if (multimode == "create") // uiputfile
680  {
681  setFileMode (QFileDialog::AnyFile);
682  setAcceptMode (QFileDialog::AcceptSave);
683  setOption (QFileDialog::DontConfirmOverwrite, false);
684  }
685  else if (multimode == "dir") // uigetdir
686  {
687  setFileMode (QFileDialog::Directory);
688  setOption (QFileDialog::ShowDirsOnly, true);
689  setOption (QFileDialog::HideNameFilterDetails, true);
690  setAcceptMode (QFileDialog::AcceptOpen);
691  }
692  else // uigetfile multiselect=off
693  {
694  setFileMode (QFileDialog::ExistingFile);
695  setAcceptMode (QFileDialog::AcceptOpen);
696  }
697 
698  setNameFilters (name_filters);
699 
700  selectFile (filename);
701 
702  connect (this, SIGNAL (accepted ()), this, SLOT (acceptSelection ()));
703 
704  connect (this, SIGNAL (rejected ()), this, SLOT (rejectSelection ()));
705  }
706 
708  {
709  QStringList empty;
710  emit finish_input (empty, "", 0);
711  }
712 
714  {
715  QStringList string_result;
716  QString path;
717  int idx = 1;
718 
719  string_result = selectedFiles ();
720 
721  if (testOption (QFileDialog::ShowDirsOnly) && string_result.size () > 0)
722  path = string_result[0];
723  else
724  path = directory ().absolutePath ();
725 
726  // Matlab expects just the filename, whereas the file dialog gave us
727  // full path names, so fix it.
728 
729  for (int i = 0; i < string_result.size (); i++)
730  string_result[i] = QFileInfo (string_result[i]).fileName ();
731 
732  // If not showing only dirs, add end slash for the path component.
733  if (testOption (QFileDialog::ShowDirsOnly) == false)
734  path += '/';
735 
736  // Convert to native slashes.
737  path = QDir::toNativeSeparators (path);
738 
739  QStringList name_filters = nameFilters ();
740  idx = name_filters.indexOf (selectedNameFilter ()) + 1;
741 
742  // Send the selected info.
743  emit finish_input (string_result, path, idx);
744  }
745 }
FileDialog(base_qobject &oct_qobj, const QStringList &filters, const QString &title, const QString &filename, const QString &dirname, const QString &multimode)
Definition: dialog.cc:656
void acceptSelection(void)
Definition: dialog.cc:713
void finish_input(const QStringList &, const QString &, int)
void rejectSelection(void)
Definition: dialog.cc:707
InputDialog(base_qobject &oct_qobj, const QStringList &prompt, const QString &title, const QFloatList &nr, const QFloatList &nc, const QStringList &defaults)
Definition: dialog.cc:562
QList< QLineEdit * > input_line
Definition: dialog.h:233
void reject(void)
Definition: dialog.cc:651
void buttonOk_clicked(void)
Definition: dialog.cc:629
void finish_input(const QStringList &, int)
void buttonCancel_clicked(void)
Definition: dialog.cc:641
ListDialog(base_qobject &oct_qobj, const QStringList &list, const QString &mode, int width, int height, const QList< int > &initial, const QString &name, const QStringList &prompt, const QString &ok_string, const QString &cancel_string)
Definition: dialog.cc:421
QAbstractItemModel * m_model
Definition: dialog.h:226
void buttonCancel_clicked(void)
Definition: dialog.cc:540
void buttonOk_clicked(void)
Definition: dialog.cc:524
void item_double_clicked(const QModelIndex &)
Definition: dialog.cc:557
void finish_selection(const QIntList &, int)
void reject(void)
Definition: dialog.cc:552
QItemSelectionModel * selector
Definition: dialog.h:198
MessageDialog(base_qobject &oct_qobj, const QString &message, const QString &title, const QString &icon, const QStringList &button, const QString &defbutton, const QStringList &role)
Definition: dialog.cc:349
void handle_create_filedialog(const QStringList &filters, const QString &title, const QString &filename, const QString &dirname, const QString &multimode)
Definition: dialog.cc:316
QStringList input_dialog(const QStringList &prompt, const QString &title, const QFloatList &nr, const QFloatList &nc, const QStringList &defaults)
Definition: dialog.cc:160
void dialog_button_clicked(QAbstractButton *button)
Definition: dialog.cc:221
QString rm_amp(const QString &text)
Definition: dialog.cc:95
void handle_create_inputlayout(const QStringList &, const QString &, const QFloatList &, const QFloatList &, const QStringList &)
Definition: dialog.cc:288
void create_inputlayout(const QStringList &, const QString &, const QFloatList &, const QFloatList &, const QStringList &)
void create_listview(const QStringList &, const QString &, int, int, const QIntList &, const QString &, const QStringList &, const QString &, const QString &)
void input_finished(const QStringList &input, int button_pressed)
Definition: dialog.cc:304
QStringList file_dialog(const QStringList &filters, const QString &title, const QString &filename, const QString &dirname, const QString &multimode)
Definition: dialog.cc:180
void wake_all(void)
Definition: dialog.h:97
QStringList m_button_list
Definition: dialog.h:157
base_qobject & m_octave_qobj
Definition: dialog.h:151
void create_filedialog(const QStringList &filters, const QString &title, const QString &filename, const QString &dirname, const QString &multimode)
QUIWidgetCreator(base_qobject &oct_qobj)
Definition: dialog.cc:50
QString message_dialog(const QString &message, const QString &title, const QString &icon, const QStringList &button, const QString &defbutton, const QStringList &role)
Definition: dialog.cc:102
void handle_create_dialog(const QString &message, const QString &title, const QString &icon, const QStringList &button, const QString &defbutton, const QStringList &role)
Definition: dialog.cc:203
void list_select_finished(const QIntList &selected, int button_pressed)
Definition: dialog.cc:273
void create_dialog(const QString &, const QString &, const QString &, const QStringList &, const QString &, const QStringList &)
QStringList m_string_list
Definition: dialog.h:161
void filedialog_finished(const QStringList &files, const QString &path, int filterindex)
Definition: dialog.cc:335
QPair< QIntList, int > list_dialog(const QStringList &list, const QString &mode, int wd, int ht, const QList< int > &initial, const QString &name, const QStringList &prompt, const QString &ok_string, const QString &cancel_string)
Definition: dialog.cc:135
void handle_create_listview(const QStringList &list, const QString &mode, int width, int height, const QIntList &initial, const QString &name, const QStringList &prompt, const QString &ok_string, const QString &cancel_string)
Definition: dialog.cc:253
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
gui_settings * get_settings(void) const
QList< int > QIntList
Definition: dialog.h:40
void message(const char *name, const char *fmt,...)
Definition: error.cc:936
QString path
QString name
const gui_pref global_use_native_dialogs("use_native_file_dialogs", QVariant(true))
F77_RET_T const F77_INT & N
std::string dirname(const std::string &path)
Definition: file-ops.cc:363
static int input(yyscan_t yyscanner)
octave_value::octave_value(const Array< char > &chm, char type) return retval
Definition: ov.cc:811