GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
set-path-model.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2019-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 (octave_set_path_model_h)
27 #define octave_set_path_model_h 1
28 
29 #include <QAbstractListModel>
30 #include <QFileInfo>
31 #include <QIcon>
32 #include <QList>
33 #include <QStringList>
34 
35 #include "qt-interpreter-events.h"
36 
37 namespace octave
38 {
40  {
41  Q_OBJECT
42 
43  public:
44 
45  set_path_model (QObject *p = nullptr);
46 
47  ~set_path_model (void) = default;
48 
49  void clear (void);
50 
51  void add_dir (const QString& p);
52 
53  void rm_dir (const QModelIndexList& indices);
54 
55  void move_dir_up (const QModelIndexList& indices);
56 
57  void move_dir_down (const QModelIndexList& indices);
58 
59  void move_dir_top (const QModelIndexList& indices);
60 
61  void move_dir_bottom (const QModelIndexList& indices);
62 
63  std::string to_string (void);
64 
65  // Overloaded Qt methods
66 
67  void model_to_path (void);
68 
69  int rowCount (const QModelIndex& p = QModelIndex ()) const;
70 
71  QVariant data (const QModelIndex& idx, int role) const;
72 
73  signals:
74 
75  void update_data_signal (const QStringList& dirs);
76 
77  void interpreter_event (const fcn_callback& fcn);
78  void interpreter_event (const meth_callback& meth);
79 
80  public slots:
81 
82  void path_to_model (void);
83 
84  void save (void);
85 
86  void revert (void);
87 
88  void revert_last (void);
89 
90  private slots:
91 
92  void update_data (const QStringList& dirs);
93 
94  private:
95 
96  QStringList m_dirs;
97 
98  QStringList m_orig_dirs;
99 
100  QStringList m_last_dirs;
101 
103  };
104 }
105 
106 #endif
std::string to_string(void)
void move_dir_down(const QModelIndexList &indices)
~set_path_model(void)=default
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 interpreter_event(const meth_callback &meth)
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)
std::function< void(octave::interpreter &)> meth_callback
Definition: event-manager.h:47
std::function< void(void)> fcn_callback
Definition: event-manager.h:46