26#if defined (HAVE_CONFIG_H)
32#include <QDialogButtonBox>
33#include <QDirIterator>
63 :
QDialog (parent), m_octave_qobj (oct_qobj)
65 setWindowTitle (tr (
"Set Path"));
75 add_dir_menu->addAction (tr (
"Single Folder"),
77 add_dir_menu->addAction (tr (
"Folder With Subfolders"),
93 revert_menu->addAction (tr (
"Revert Last Change"),
95 revert_menu->addAction (tr (
"Revert All Changes"),
133 m_path_list->setSelectionBehavior (QAbstractItemView::SelectRows);
134 m_path_list->setSelectionMode (QAbstractItemView::ExtendedSelection);
136 m_path_list->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
139 QDialogButtonBox *button_box =
new QDialogButtonBox (Qt::Horizontal);
140 button_box->addButton (
m_save_button, QDialogButtonBox::ActionRole);
145 connect (button_box, &QDialogButtonBox::rejected,
146 this, &set_path_dialog::close);
151 QDialogButtonBox *path_edit_layout =
new QDialogButtonBox (Qt::Vertical);
154 path_edit_layout->addButton (
m_move_up_button, QDialogButtonBox::ActionRole);
157 path_edit_layout->addButton (
m_remove_button, QDialogButtonBox::ActionRole);
160 QHBoxLayout *main_hboxlayout =
new QHBoxLayout;
161 main_hboxlayout->addWidget(path_edit_layout);
164 QGridLayout *main_layout =
new QGridLayout;
166 main_layout->addLayout (main_hboxlayout, 1, 0);
167 main_layout->addWidget (button_box, 2, 0);
169 setLayout (main_layout);
186 = QFileDialog::getExistingDirectory (
this, tr (
"Open Directory"),
188 (QFileDialog::ShowDirsOnly
189 | QFileDialog::DontResolveSymlinks));
191 if (! dir.isEmpty ())
221 QItemSelectionModel *selmodel =
m_path_list->selectionModel ();
222 QModelIndexList indexlist = selmodel->selectedIndexes();
225 selmodel->clearSelection ();
231 QItemSelectionModel *selmodel =
m_path_list->selectionModel ();
232 QModelIndexList indexlist = selmodel->selectedIndexes();
236 selmodel->clearSelection ();
238 for (
int i = 0; i < indexlist.length (); i++)
240 int new_row =
std::max (indexlist.at (i).row () - 1, 0);
241 min_row =
std::min (min_row, new_row);
242 selmodel->select (m->index (new_row), QItemSelectionModel::Select);
251 QItemSelectionModel *selmodel =
m_path_list->selectionModel ();
252 QModelIndexList indexlist = selmodel->selectedIndexes();
256 selmodel->clearSelection ();
258 for (
int i = 0; i < indexlist.length (); i++)
261 max_row =
std::max (max_row, new_row);
262 selmodel->select (m->index (new_row), QItemSelectionModel::Select);
271 QItemSelectionModel *selmodel =
m_path_list->selectionModel ();
272 QModelIndexList indexlist = selmodel->selectedIndexes();
276 selmodel->clearSelection ();
277 for (
int i = 0; i < indexlist.length (); i++)
278 selmodel->select (m->index (i), QItemSelectionModel::Select);
286 QItemSelectionModel *selmodel =
m_path_list->selectionModel ();
287 QModelIndexList indexlist = selmodel->selectedIndexes();
291 selmodel->clearSelection ();
293 for (
int i = 0; i < indexlist.length (); i++)
294 selmodel->select (m->index (row_count - 1 - i),
295 QItemSelectionModel::Select);
311 QWidget::closeEvent (e);
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
gui_settings * get_settings(void) const
void interpreter_event(const fcn_callback &fcn)
QPushButton * m_remove_button
set_path_dialog(QWidget *parent, base_qobject &oct_qobj)
QPushButton * m_move_to_top_button
void move_dir_bottom(void)
void add_dir_subdirs(void)
void add_dir_common(bool subdirs)
base_qobject & m_octave_qobj
QPushButton * m_save_button
QPushButton * m_move_up_button
void modify_path_signal(const QStringList &dir_list, bool rm, bool subdirs)
Emitted, when the path has to be modified.
QPushButton * m_revert_button
QPushButton * m_add_folder_button
QPushButton * m_close_button
QPushButton * m_move_to_bottom_button
QPushButton * m_reload_button
QPushButton * m_move_down_button
void closeEvent(QCloseEvent *e)
void move_dir_down(const QModelIndexList &indices)
void interpreter_event(const fcn_callback &fcn)
void add_dir(const QString &p)
void move_dir_top(const QModelIndexList &indices)
void move_dir_up(const QModelIndexList &indices)
int rowCount(const QModelIndex &p=QModelIndex()) const
void rm_dir(const QModelIndexList &indices)
void move_dir_bottom(const QModelIndexList &indices)
const gui_pref pd_geometry("path_dlg_geometry", QVariant(QByteArray()))