26 #if defined (HAVE_CONFIG_H)
33 #include <QFileIconProvider>
34 #include <QMessageBox>
36 #include <QtAlgorithms>
63 QStringList::iterator it =
m_dirs.begin ();
69 path_str += it->toStdString ();
109 interp.
feval (
"savepath");
117 beginInsertRows (QModelIndex (), 0,
m_orig_dirs.size () - 1);
128 beginInsertRows (QModelIndex (), 0,
m_last_dirs.size () - 1);
139 beginInsertRows (QModelIndex (),
m_dirs.size (),
m_dirs.size ());
154 for (
int i = indices.size () - 1; i >= 0; i--)
156 const QModelIndex& idx = indices.at (i);
158 beginRemoveRows (idx, idx.row (), idx.row ());
159 m_dirs.removeAt (idx.row ());
170 for (
int i = 0; i < indices.size (); i++)
172 const QModelIndex& idx = indices.at (i);
174 if (idx.row () == 0 )
177 beginMoveRows (idx, idx.row (), idx.row (),
178 this->index (idx.row () - 1), idx.row () - 1);
180 m_dirs.move (idx.row (), idx.row () - 1);
192 for (
int i = indices.size () - 1; i >= 0; i--)
194 const QModelIndex& idx = indices.at (i);
195 int bottom =
m_dirs.size () - 1;
197 if (idx.row () >= bottom)
200 beginMoveRows (idx, idx.row (), idx.row (),
201 this->index (idx.row () + 1), idx.row () + 1);
203 m_dirs.move (idx.row (), idx.row () + 1);
215 for (
int i = 0; i < indices.size (); i++)
217 const QModelIndex& idx = indices.at (i);
222 beginMoveRows (idx, idx.row (), idx.row (), this->index (i), i);
224 m_dirs.move (idx.row (), i);
236 for (
int i = 0; i < indices.size (); i++)
238 const QModelIndex& idx = indices.at (i);
239 int target =
m_dirs.size () - 1 - i;
241 if (idx.row () == target)
244 beginMoveRows (idx, idx.row (), idx.row (),
245 this->index (target), target);
247 m_dirs.move (idx.row (), target);
267 case Qt::DisplayRole:
268 retval = QVariant (
m_dirs[idx.row ()]);
271 case Qt::DecorationRole:
272 retval = QVariant (QIcon ());
275 case Qt::SizeHintRole:
276 retval = QVariant (QSize (10, 20));
290 QPointer<set_path_model> this_spm (
this);
300 if (this_spm.isNull ())
305 std::list<std::string> dir_list = lp.
dir_list ();
307 QStringList qs_dir_list;
309 for (
const auto& dir : dir_list)
335 emit dataChanged (QAbstractListModel::index (0, 0),
336 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)
void set(const std::string &p, bool warn=false, bool is_init=false)
std::list< std::string > dir_list(void) const
void move_dir_down(const QModelIndexList &indices)
void add_dir(const QString &p)
void update_data_signal(const QStringList &dirs)
void move_dir_top(const QModelIndexList &indices)
void interpreter_event(const fcn_callback &fcn)
int rowCount(const QModelIndex &p=QModelIndex()) const
void move_dir_bottom(const QModelIndexList &indices)
QVariant data(const QModelIndex &idx, int role) const
std::string to_string(void)
void rm_dir(const QModelIndexList &indices)
void move_dir_up(const QModelIndexList &indices)
void update_data(const QStringList &dirs)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
for(octave_idx_type i=0;i< n;i++) ac+
QString fromStdString(const std::string &s)
T::size_type numel(const T &str)