src/MyFtp/mytreewidget.h

00001 /****************************************************************************
00002 ** Simple gestion du drag and drop
00003 ** Créé par Anacr0x : anacr0x@free.fr
00004 **
00005 ** Sous licence GPL v2 ou plus
00006 ****************************************************************************/
00007 
00008 #ifndef MYTREEWIDGET_H
00009 #define MYTREEWIDGET_H
00010 
00011 #include <QtCore>
00012 #include <QtGui>
00013 #include <QtNetwork>
00014 #include "BasicTreeWidget/basictreewidget.h"
00015 
00016 class MyTreeWidgetItem;
00017 
00018 /*************************************************************************/
00020 
00024 /*************************************************************************/
00025 
00026 class MyTreeWidget:public BasicTreeWidget
00027 {
00028         Q_OBJECT
00029 
00030 public:
00032         enum Select { AllFiles, AllDirs, AllFilesAndDirs };
00033 
00035         MyTreeWidget (QWidget * parent);
00036 
00037 public slots:
00039         void slotSelect (int select);
00040 
00042         inline void slotSelectFiles ()
00043         {
00044                 slotSelect (MyTreeWidget::AllFiles);
00045         }
00046 
00048         inline void slotSelectDirs ()
00049         {
00050                 slotSelect (MyTreeWidget::AllDirs);
00051         }
00052 
00054         inline void slotSelectFilesAndDirs ()
00055         {
00056                 slotSelect (MyTreeWidget::AllFilesAndDirs);
00057         }
00058 
00059 signals:
00061         void startDownloadOrUpload (const QString &destDir);
00062 
00063 private:
00065         void mouseMoveEvent (QMouseEvent *event);
00066 
00068         void dragEnterEvent (QDragEnterEvent *event);
00069 
00071         void dropEvent (QDropEvent *event);
00072 };
00073 
00074 
00075 /*************************************************************************/
00077 
00084 /*************************************************************************/
00085 
00086 class MyTreeWidgetItem:public QTreeWidgetItem
00087 {
00088 private:
00090         bool DirOrNot;
00091 
00092 public:
00095         MyTreeWidgetItem (QTreeWidget * parent, bool dir, const QString & name, const QString & size = "", const QString & lastModified = "", const QString & droits = "", const QString & proprietaire = "");
00096 
00098         enum State
00099         {
00100             Root, Refresh, CdUp, Dir, DirLocked, File
00101         };
00102 
00104         State state;
00105 
00107         enum FileState
00108         {
00109             None, Image, Video, Audio, Archive, Texte, Document, Internet, Autre
00110         };
00111 
00113         FileState fileState;
00114 
00116         inline bool isDir ()
00117         {
00118                 return DirOrNot;
00119         }
00120 
00122         static bool isSimple (const QString & filename);
00123 
00125         inline bool isSimple ()
00126         {
00127                 return isSimple (text (0));
00128         }
00129 
00131         inline State getState ()
00132         {
00133                 return state;
00134         }
00135 
00137         inline FileState getFileState ()
00138         {
00139                 return fileState;
00140         }
00141 };
00142 
00143 #endif

Generated on Fri Jun 29 00:02:56 2007 for Scythia by  doxygen 1.5.2