26 #if defined (HAVE_CONFIG_H)
33 #include <QFileIconProvider>
34 #include <QMessageBox>
35 #include <QtAlgorithms>
62 QStringList::iterator it =
m_dirs.begin ();
68 path_str += it->toStdString ();
108 interp.
feval (
"savepath");
116 beginInsertRows (QModelIndex (), 0,
m_orig_dirs.size () - 1);
127 beginInsertRows (QModelIndex (), 0,
m_last_dirs.size () - 1);
138 beginInsertRows (QModelIndex (),
m_dirs.size (),
m_dirs.size ());
153 for (
int i = indices.size () - 1; i >= 0; i--)
155 const QModelIndex& idx = indices.at (i);
157 beginRemoveRows (idx, idx.row (), idx.row ());
158 m_dirs.removeAt (idx.row ());
169 for (
int i = 0; i < indices.size (); i++)
171 const QModelIndex& idx = indices.at (i);
173 if (idx.row () == 0 )
176 beginMoveRows (idx, idx.row (), idx.row (),
177 this->index (idx.row () - 1), idx.row () - 1);
179 m_dirs.move (idx.row (), idx.row () - 1);
191 for (
int i = indices.size () - 1; i >= 0; i--)
193 const QModelIndex& idx = indices.at (i);
194 int bottom =
m_dirs.size () - 1;
196 if (idx.row () >= bottom)
199 beginMoveRows (idx, idx.row (), idx.row (),
200 this->index (idx.row () + 1), idx.row () + 1);
202 m_dirs.move (idx.row (), idx.row () + 1);
214 for (
int i = 0; i < indices.size (); i++)
216 const QModelIndex& idx = indices.at (i);
221 beginMoveRows (idx, idx.row (), idx.row (), this->index (i), i);
223 m_dirs.move (idx.row (), i);
235 for (
int i = 0; i < indices.size (); i++)
237 const QModelIndex& idx = indices.at (i);
238 int target =
m_dirs.size () - 1 - i;
240 if (idx.row () == target)
243 beginMoveRows (idx, idx.row (), idx.row (),
244 this->index (target), target);
246 m_dirs.move (idx.row (), target);
266 case Qt::DisplayRole:
270 case Qt::DecorationRole:
271 retval = QVariant (QIcon ());
274 case Qt::SizeHintRole:
275 retval = QVariant (QSize (10, 20));
292 std::list<std::string> dir_list = lp.
dir_list ();
294 QStringList qs_dir_list;
296 for (
const auto& dir : dir_list)
322 emit dataChanged (QAbstractListModel::index (0, 0),
323 QAbstractListModel::index (
numel-1, 0));
static std::string path_sep_str(void)
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
load_path & get_load_path(void)
std::list< std::string > dir_list(void) const
void set(const std::string &p, bool warn=false, bool is_init=false)
std::string to_string(void)
void move_dir_down(const QModelIndexList &indices)
QVariant data(const QModelIndex &idx, int role) const
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)
void update_data_signal(const QStringList &dirs)
void update_data(const QStringList &dirs)
set_path_model(QObject *p=nullptr)
QString fromStdString(const std::string &s)
T::size_type numel(const T &str)
octave_value::octave_value(const Array< char > &chm, char type) return retval