scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Folder.h
Go to the documentation of this file.
1 
11 
29 #ifndef FOLDER_H
30 #define FOLDER_H
31 
32 #include <qobject.h>
33 #include <QTreeWidget>
34 #include <QTreeWidgetItem>
35 //Added by qt3to4:
36 #include <QDragEnterEvent>
37 #include <QMouseEvent>
38 #include <QDragLeaveEvent>
39 #include <QDragMoveEvent>
40 #include <QKeyEvent>
41 #include <QEvent>
42 #include <QDropEvent>
43 #include <QMdiArea>
44 
45 #include "MyWidget.h"
46 #include "SciDAVisObject.h"
47 
48 class FolderListItem;
49 class FolderListView;
50 class Table;
51 class Matrix;
52 class MultiLayer;
53 class Note;
54 
55 class QDragEnterEvent;
56 class QDragMoveEvent;
57 class QDragLeaveEvent;
58 class QDropEvent;
59 
61 class Folder : public SciDAVisObject<QObject>
62 {
63  Q_OBJECT
64 
65 public:
66  Folder(const QString &name );
67 
68  QList<MyWidget *> windowsList(){return lstWindows;};
69 
70  void addWindow( MyWidget *w ) {
71  w->setFolder(this);
72  lstWindows.append( w );
73  };
74  void removeWindow( MyWidget *w ){
75  w->setFolder(0);
76  lstWindows.removeAll(w);
78  };
79 
80  int windowCount(bool recursive = false) const {
81  int result = lstWindows.size();
82  if (recursive)
83  foreach (Folder *folder, folders())
84  result += folder->windowCount(true);
85  return result;
86  };
87 
89  QStringList subfolders();
90 
92  QList<Folder*> folders() const;
93 
95  Folder* findSubfolder(const QString& s, bool caseSensitive = true, bool partialMatch = false);
96 
98  MyWidget* findWindow(const QString& s, bool windowNames, bool labels,
99  bool caseSensitive, bool partialMatch);
100 
102 
107  MyWidget *window(const QString &name, const char *cls="myWidget", bool recursive=false);
109  Table *table(const QString &name, bool recursive=false) { return (Table*) window(name, "Table", recursive); }
111  Matrix *matrix(const QString &name, bool recursive=false) { return (Matrix*) window(name, "Matrix", recursive); }
113  MultiLayer *graph(const QString &name, bool recursive=false) { return (MultiLayer*) window(name, "MultiLayer", recursive); }
115  Note *note(const QString &name, bool recursive=false) { return (Note*) window(name, "Note", recursive); }
116 
118  QString path();
119 
121  Folder* rootFolder();
122 
123  QString birthDate(){return birthdate;};
124  void setBirthDate(const QString& s){birthdate = s;};
125 
126  QString modificationDate(){return modifDate;};
127  void setModificationDate(const QString& s){modifDate = s;};
128 
132 
135 
136  // TODO: move to Aspect
137  QString name(){return objectName();}
138  void setName(const QString& s){setObjectName(s);}
139 protected:
141  QList<MyWidget *> lstWindows;
143 
146 };
147 
148 
153 class WindowListItem : public QTreeWidgetItem
155 {
156 public:
157  WindowListItem( QTreeWidget *parent, MyWidget *w );
158  static const int WindowType = QTreeWidgetItem::UserType+2;
159  void setData(int, int, const QVariant&);
160 
161  MyWidget *window() { return myWindow; };
162 
163  FolderListView* folderListView() { return (FolderListView*)treeWidget(); };
164 
165 protected:
167 };
168 
169 
174 class FolderListItem : public QTreeWidgetItem
176 {
177 public:
178  FolderListItem( QTreeWidget *parent, Folder *f );
179  FolderListItem( FolderListItem *parent, Folder *f );
180 
181  static const int FolderType = QTreeWidgetItem::UserType+1;
182 
183  void setActive( bool o );
184  void setData(int, int, const QVariant&);
185 
186  Folder *folder() { return myFolder; };
187  int depth();
188 
189  FolderListView* folderListView() { return (FolderListView*)treeWidget(); };
190 
191 
193 
196  bool isChildOf(FolderListItem *src);
197 
198 protected:
200 };
201 
202 
207 class FolderListView : public SciDAVisObject<QTreeWidget>
209 {
210  Q_OBJECT
211 
212  friend class FolderListItem;
213  friend class WindowListItem;
214 
215 public:
216  FolderListView(const QString& name = QString() );
217 
218 public slots:
219  void adjustColumns();
220  bool isRenaming() { return state() == QAbstractItemView::EditingState; };
221 
222 protected:
223  void startDrag(Qt::DropActions supportedActions=Qt::MoveAction) override;
224 
225  void dropEvent( QDropEvent *e ) override;
226  void mouseMoveEvent( QMouseEvent *e ) override;
227  void mousePressEvent( QMouseEvent *e ) override;
228  void mouseDoubleClickEvent( QMouseEvent* e ) override;
229  void keyPressEvent ( QKeyEvent * e ) override;
230  void mouseReleaseEvent( QMouseEvent *) override {mousePressed = false;};
231  void enterEvent(QEvent *) override {mousePressed = false;};
232 
233 signals:
234  void dragItems(QList<QTreeWidgetItem *> items);
235  void dropItems(QTreeWidgetItem *dest);
236  void renameItem(QTreeWidgetItem *item, int);
237  void itemRenamed(QTreeWidgetItem *item, int, const QString&);
240 
241 private:
243  QPoint presspos;
244 };
245 
246 #endif
Matrix
Matrix worksheet class.
Definition: Matrix.h:52
FolderListView::isRenaming
bool isRenaming()
Definition: Folder.h:220
Folder::birthdate
QString birthdate
Definition: Folder.h:140
WindowListItem::setData
void setData(int, int, const QVariant &)
Definition: Folder.cpp:418
FolderListItem::isChildOf
bool isChildOf(FolderListItem *src)
Checks weather the folder item is a grandchild of the source folder.
Definition: Folder.cpp:218
WindowListItem::folderListView
FolderListView * folderListView()
Definition: Folder.h:163
Folder::graph
MultiLayer * graph(const QString &name, bool recursive=false)
Return graph named name or NULL.
Definition: Folder.h:113
WindowListItem::myWindow
MyWidget * myWindow
Definition: Folder.h:163
FolderListItem::folderListView
FolderListView * folderListView()
Definition: Folder.h:189
FolderListItem
Folders list item class.
Definition: Folder.h:176
Folder::setFolderListItem
void setFolderListItem(FolderListItem *it)
Definition: Folder.h:131
WindowListItem::WindowType
static const int WindowType
Definition: Folder.h:158
FolderListView::mousePressEvent
void mousePressEvent(QMouseEvent *e) override
Definition: Folder.cpp:376
Folder::setModificationDate
void setModificationDate(const QString &s)
Definition: Folder.h:127
MultiLayer
An MDI window (MyWidget) managing one or more Graph objects.
Definition: MultiLayer.h:67
Folder::table
Table * table(const QString &name, bool recursive=false)
Return table named name or NULL.
Definition: Folder.h:109
FolderListItem::FolderType
static const int FolderType
Definition: Folder.h:181
FolderListView::adjustColumns
void adjustColumns()
Definition: Folder.cpp:397
SciDAVisObject.h
FolderListItem::myFolder
Folder * myFolder
Definition: Folder.h:199
Folder::modifDate
QString modifDate
Definition: Folder.h:140
MyWidget
Base class of all MDI client windows.
Definition: MyWidget.h:52
Folder::subfolders
QStringList subfolders()
The list of subfolder names, including first generation children only.
Definition: Folder.cpp:68
SciDAVisObject
Definition: SciDAVisObject.h:8
Folder::modificationDate
QString modificationDate()
Definition: Folder.h:126
Folder::folderListItem
FolderListItem * folderListItem()
Pointer to the corresponding QListViewItem in the main application.
Definition: Folder.h:130
FolderListView::addFolderItem
void addFolderItem()
Folder::myFolderListItem
FolderListItem * myFolderListItem
Definition: Folder.h:142
WindowListItem::window
MyWidget * window()
Definition: Folder.h:161
Folder::windowCount
int windowCount(bool recursive=false) const
Definition: Folder.h:80
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:51
Folder::activeWindow
MyWidget * activeWindow()
Definition: Folder.h:133
Folder::setActiveWindow
void setActiveWindow(MyWidget *w)
Definition: Folder.h:134
Folder::folders
QList< Folder * > folders() const
The list of subfolders.
Definition: Folder.cpp:60
Folder::setBirthDate
void setBirthDate(const QString &s)
Definition: Folder.h:124
MyWidget::setFolder
void setFolder(Folder *f)
Initializes the pointer to the parent folder of the window.
Definition: MyWidget.h:131
Folder::note
Note * note(const QString &name, bool recursive=false)
Return note named name or NULL.
Definition: Folder.h:115
FolderListItem::folder
Folder * folder()
Definition: Folder.h:186
Folder::windowsList
QList< MyWidget * > windowsList()
Definition: Folder.h:68
FolderListView::enterEvent
void enterEvent(QEvent *) override
Definition: Folder.h:231
Folder::window
MyWidget * window(const QString &name, const char *cls="myWidget", bool recursive=false)
get a window by name
Definition: Folder.cpp:159
FolderListView::FolderListView
FolderListView(const QString &name=QString())
Definition: Folder.cpp:258
FolderListView::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *e) override
Definition: Folder.cpp:386
Folder::rootFolder
Folder * rootFolder()
The root of the hierarchy this folder belongs to.
Definition: Folder.cpp:173
FolderListView::dropEvent
void dropEvent(QDropEvent *e) override
Definition: Folder.cpp:300
FolderListView::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *e) override
Definition: Folder.cpp:365
Folder::name
QString name()
Definition: Folder.h:137
FolderListView::startDrag
void startDrag(Qt::DropActions supportedActions=Qt::MoveAction) override
Definition: Folder.cpp:267
FolderListView::deleteSelection
void deleteSelection()
FolderListItem::setActive
void setActive(bool o)
Definition: Folder.cpp:208
FolderListView::keyPressEvent
void keyPressEvent(QKeyEvent *e) override
Definition: Folder.cpp:321
FolderListItem::FolderListItem
FolderListItem(QTreeWidget *parent, Folder *f)
Definition: Folder.cpp:187
Folder
Folder for the project explorer.
Definition: Folder.h:62
Folder::matrix
Matrix * matrix(const QString &name, bool recursive=false)
Return matrix named name or NULL.
Definition: Folder.h:111
Folder::addWindow
void addWindow(MyWidget *w)
Definition: Folder.h:70
Folder::lstWindows
QList< MyWidget * > lstWindows
Definition: Folder.h:141
Folder::d_active_window
MyWidget * d_active_window
Pointer to the active window in the folder.
Definition: Folder.h:145
Folder::setName
void setName(const QString &s)
Definition: Folder.h:138
FolderListView::dropItems
void dropItems(QTreeWidgetItem *dest)
FolderListView
Folder list view class.
Definition: Folder.h:209
Note
Notes window class.
Definition: Note.h:44
Folder::Folder
Folder(const QString &name)
Definition: Folder.cpp:50
name
char * name()
Definition: exp_saturation.c:45
Folder::findSubfolder
Folder * findSubfolder(const QString &s, bool caseSensitive=true, bool partialMatch=false)
Pointer to the subfolder called s.
Definition: Folder.cpp:91
MyWidget.h
Folder::removeWindow
void removeWindow(MyWidget *w)
Definition: Folder.h:74
FolderListItem::setData
void setData(int, int, const QVariant &)
Definition: Folder.cpp:243
FolderListItem::depth
int depth()
Definition: Folder.cpp:231
WindowListItem::WindowListItem
WindowListItem(QTreeWidget *parent, MyWidget *w)
Definition: Folder.cpp:409
FolderListView::dragItems
void dragItems(QList< QTreeWidgetItem * > items)
Folder::findWindow
MyWidget * findWindow(const QString &s, bool windowNames, bool labels, bool caseSensitive, bool partialMatch)
Pointer to the first window matching the search criteria.
Definition: Folder.cpp:117
FolderListView::renameItem
void renameItem(QTreeWidgetItem *item, int)
Folder::path
QString path()
The complete path of the folder in the project tree.
Definition: Folder.cpp:80
FolderListView::mousePressed
bool mousePressed
Definition: Folder.h:242
FolderListView::presspos
QPoint presspos
Definition: Folder.h:243
FolderListView::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *) override
Definition: Folder.h:230
FolderListView::itemRenamed
void itemRenamed(QTreeWidgetItem *item, int, const QString &)
WindowListItem
Windows list item class.
Definition: Folder.h:155
Folder::birthDate
QString birthDate()
Definition: Folder.h:123