Folder.h
Go to the documentation of this file.
/***************************************************************************
File : Folder.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2006 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Folder for the project explorer
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef FOLDER_H
#define FOLDER_H
#include <QObject>
#include <QEvent>
#include <q3listview.h>
#include <q3iconview.h>
#include "MdiSubWindow.h"
class FolderListItem;
class Table;
class Matrix;
class MultiLayer;
class Note;
class Graph3D;
class QDragEnterEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QDropEvent;
class Q3DragObject;
class Folder : public QObject
{
Q_OBJECT
public:
Folder( Folder *parent, const QString &name );
QList<MdiSubWindow *> windowsList(){return lstWindows;};
void addWindow( MdiSubWindow *w );
void removeWindow( MdiSubWindow *w );
QStringList subfolders();
QList<Folder*> folders();
Folder* findSubfolder(const QString& s, bool caseSensitive = true, bool partialMatch = false);
MdiSubWindow* findWindow(const QString& s, bool windowNames, bool labels,
bool caseSensitive, bool partialMatch);
MdiSubWindow *window(const QString &name, const char *cls="MdiSubWindow", bool recursive=false);
Table *table(const QString &name, bool recursive=false) { return (Table*) window(name, "Table", recursive); }
Matrix *matrix(const QString &name, bool recursive=false) { return (Matrix*) window(name, "Matrix", recursive); }
MultiLayer *graph(const QString &name, bool recursive=false) { return (MultiLayer*) window(name, "MultiLayer", recursive); }
Note *note(const QString &name, bool recursive=false) { return (Note*) window(name, "Note", recursive); }
Graph3D *plot3D(const QString &name, bool recursive=false) { return (Graph3D*) window(name, "Graph3D", recursive); }
QString path();
int depth();
Folder *folderBelow();
Folder* rootFolder();
QString sizeToString();
QString birthDate(){return birthdate;};
void setBirthDate(const QString& s){birthdate = s;};
QString modificationDate(){return modifDate;};
void setModificationDate(const QString& s){modifDate = s;};
FolderListItem * folderListItem(){return myFolderListItem;};
void setFolderListItem(FolderListItem *it){myFolderListItem = it;};
MdiSubWindow *activeWindow(){return d_active_window;};
void setActiveWindow(MdiSubWindow *w){d_active_window = w;};
QString logInfo(){return d_log_info;};
void appendLogInfo(const QString& text){d_log_info += text;};
void clearLogInfo(){d_log_info = QString();};
protected:
QString birthdate, modifDate;
QString d_log_info;
QList<MdiSubWindow *> lstWindows;
FolderListItem *myFolderListItem;
MdiSubWindow *d_active_window;
};
/*****************************************************************************
*
* Class WindowListItem
*
*****************************************************************************/
class WindowListItem : public Q3ListViewItem
{
public:
WindowListItem( Q3ListView *parent, MdiSubWindow *w );
MdiSubWindow *window() { return myWindow; };
protected:
MdiSubWindow *myWindow;
};
/*****************************************************************************
*
* Class FolderListItem
*
*****************************************************************************/
class FolderListItem : public Q3ListViewItem
{
public:
FolderListItem( Q3ListView *parent, Folder *f );
FolderListItem( FolderListItem *parent, Folder *f );
enum {RTTI = 1001};
void setActive( bool o );
virtual int rtti() const {return (int)RTTI;};
Folder *folder() { return myFolder; };
bool isChildOf(FolderListItem *src);
protected:
Folder *myFolder;
};
/*****************************************************************************
*
* Class FolderListView
*
*****************************************************************************/
class FolderListView : public Q3ListView
{
Q_OBJECT
public:
FolderListView( QWidget *parent = 0, const char *name = 0 );
public slots:
void adjustColumns();
protected slots:
void expandedItem(Q3ListViewItem *item);
protected:
void startDrag();
void contentsDropEvent( QDropEvent *e );
void contentsMouseMoveEvent( QMouseEvent *e );
void contentsMousePressEvent( QMouseEvent *e );
void contentsMouseDoubleClickEvent( QMouseEvent* e );
void keyPressEvent ( QKeyEvent * e );
void contentsMouseReleaseEvent( QMouseEvent *){mousePressed = false;};
void enterEvent(QEvent *){mousePressed = false;};
signals:
void dragItems(QList<Q3ListViewItem *> items);
void dropItems(Q3ListViewItem *dest);
void renameItem(Q3ListViewItem *item);
void addFolderItem();
void deleteSelection();
private:
bool mousePressed;
QPoint presspos;
};
#endif
FolderListView::keyPressEvent
void keyPressEvent(QKeyEvent *e)
Definition: Folder.cpp:348
Folder::d_active_window
MdiSubWindow * d_active_window
Pointer to the active window in the folder.
Definition: Folder.h:134
FolderListView::expandedItem
void expandedItem(Q3ListViewItem *item)
Definition: Folder.cpp:301
FolderListItem::myFolder
Folder * myFolder
Definition: Folder.h:181
MultiLayer
An MDI window (MdiSubWindow) managing one or more Graph objects.
Definition: MultiLayer.h:64
Folder::modifDate
QString modifDate
Definition: Folder.h:125
Note
Notes window class.
Definition: Note.h:43
Folder::folderListItem
FolderListItem * folderListItem()
Pointer to the corresponding QListViewItem in the main application.
Definition: Folder.h:117
Folder::matrix
Matrix * matrix(const QString &name, bool recursive=false)
Return matrix named name or NULL.
Definition: Folder.h:88
Folder::birthDate
QString birthDate()
Definition: Folder.h:110
Folder::myFolderListItem
FolderListItem * myFolderListItem
Definition: Folder.h:131
Folder::logInfo
QString logInfo()
Definition: Folder.h:123
FolderListView::contentsDropEvent
void contentsDropEvent(QDropEvent *e)
Definition: Folder.cpp:338
Folder::addWindow
void addWindow(MdiSubWindow *w)
Definition: Folder.cpp:180
Folder::setActiveWindow
void setActiveWindow(MdiSubWindow *w)
Definition: Folder.h:121
FolderListView::adjustColumns
void adjustColumns()
Definition: Folder.cpp:421
Folder::graph
MultiLayer * graph(const QString &name, bool recursive=false)
Return graph named name or NULL.
Definition: Folder.h:90
Folder::d_log_info
QString d_log_info
Definition: Folder.h:129
FolderListView::contentsMouseMoveEvent
void contentsMouseMoveEvent(QMouseEvent *e)
Definition: Folder.cpp:410
FolderListView::dropItems
void dropItems(Q3ListViewItem *dest)
FolderListItem::FolderListItem
FolderListItem(Q3ListView *parent, Folder *f)
Definition: Folder.cpp:238
FolderListItem
Folders list item class.
Definition: Folder.h:160
Folder::rootFolder
Folder * rootFolder()
The root of the hierarchy this folder belongs to.
Definition: Folder.cpp:224
Folder::windowsList
QList< MdiSubWindow * > windowsList()
Definition: Folder.h:60
Folder::findWindow
MdiSubWindow * findWindow(const QString &s, bool windowNames, bool labels, bool caseSensitive, bool partialMatch)
Pointer to the first window matching the search criteria.
Definition: Folder.cpp:131
WindowListItem
Windows list item class.
Definition: Folder.h:143
Folder::Folder
Folder(Folder *parent, const QString &name)
Definition: Folder.cpp:35
Folder::window
MdiSubWindow * window(const QString &name, const char *cls="MdiSubWindow", bool recursive=false)
get a window by name
Definition: Folder.cpp:165
FolderListView::contentsMouseDoubleClickEvent
void contentsMouseDoubleClickEvent(QMouseEvent *e)
Definition: Folder.cpp:382
Folder::activeWindow
MdiSubWindow * activeWindow()
Definition: Folder.h:120
Folder
Folder for the project explorer.
Definition: Folder.h:53
Folder::modificationDate
QString modificationDate()
Definition: Folder.h:113
FolderListItem::folder
Folder * folder()
Definition: Folder.h:172
Folder::appendLogInfo
void appendLogInfo(const QString &text)
Definition: Folder.h:124
WindowListItem::window
MdiSubWindow * window()
Definition: Folder.h:148
Folder::birthdate
QString birthdate
Definition: Folder.h:125
FolderListView::renameItem
void renameItem(Q3ListViewItem *item)
FolderListView::addFolderItem
void addFolderItem()
FolderListItem::setActive
void setActive(bool o)
Definition: Folder.cpp:260
Graph3D
3D graph widget.
Definition: Graph3D.h:62
Folder::sizeToString
QString sizeToString()
Size of the folder as a string.
Definition: Folder.cpp:206
Matrix
Matrix worksheet class.
Definition: Matrix.h:57
Folder::table
Table * table(const QString &name, bool recursive=false)
Return table named name or NULL.
Definition: Folder.h:86
Folder::clearLogInfo
void clearLogInfo()
Definition: Folder.h:125
WindowListItem::WindowListItem
WindowListItem(Q3ListView *parent, MdiSubWindow *w)
Definition: Folder.cpp:433
Folder::path
QString path()
The complete path of the folder in the project tree.
Definition: Folder.cpp:62
FolderListItem::isChildOf
bool isChildOf(FolderListItem *src)
Checks weather the folder item is a grandchild of the source folder.
Definition: Folder.cpp:270
FolderListItem::rtti
virtual int rtti() const
Definition: Folder.h:170
FolderListView
Folder list view class.
Definition: Folder.h:190
Folder::lstWindows
QList< MdiSubWindow * > lstWindows
Definition: Folder.h:130
Folder::depth
int depth()
The depth of the folder in the project tree.
Definition: Folder.cpp:73
Folder::subfolders
QStringList subfolders()
The list of subfolder names, including first generation children only.
Definition: Folder.cpp:50
FolderListView::dragItems
void dragItems(QList< Q3ListViewItem * > items)
FolderListView::mousePressed
bool mousePressed
Definition: Folder.h:222
MdiSubWindow
Base class of all MDI client windows.
Definition: MdiSubWindow.h:51
FolderListView::contentsMousePressEvent
void contentsMousePressEvent(QMouseEvent *e)
Definition: Folder.cpp:393
FolderListView::contentsMouseReleaseEvent
void contentsMouseReleaseEvent(QMouseEvent *)
Definition: Folder.h:211
FolderListView::deleteSelection
void deleteSelection()
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:57
MdiSubWindow.h
FolderListView::FolderListView
FolderListView(QWidget *parent=0, const char *name=0)
Definition: Folder.cpp:288
FolderListItem::RTTI
Definition: Folder.h:166
Folder::note
Note * note(const QString &name, bool recursive=false)
Return note named name or NULL.
Definition: Folder.h:92
Folder::plot3D
Graph3D * plot3D(const QString &name, bool recursive=false)
Return plot 3D named name or NULL.
Definition: Folder.h:94
Folder::findSubfolder
Folder * findSubfolder(const QString &s, bool caseSensitive=true, bool partialMatch=false)
Pointer to the subfolder called s.
Definition: Folder.cpp:104
Folder::setBirthDate
void setBirthDate(const QString &s)
Definition: Folder.h:111
FolderListView::presspos
QPoint presspos
Definition: Folder.h:223
Folder::folderBelow
Folder * folderBelow()
Definition: Folder.cpp:84
FolderListView::startDrag
void startDrag()
Definition: Folder.cpp:308
Folder::removeWindow
void removeWindow(MdiSubWindow *w)
Definition: Folder.cpp:189
Folder::setModificationDate
void setModificationDate(const QString &s)
Definition: Folder.h:114
WindowListItem::myWindow
MdiSubWindow * myWindow
Definition: Folder.h:148
Folder::folders
QList< Folder * > folders()
The list of subfolders.
Definition: Folder.cpp:42
Folder::setFolderListItem
void setFolderListItem(FolderListItem *it)
Definition: Folder.h:118
FolderListView::enterEvent
void enterEvent(QEvent *)
Definition: Folder.h:212