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 
00038         void autoResize();
00039 
00040 public slots:
00042         void slotSelect (int select);
00043 
00045         inline void slotSelectFiles ()
00046         {
00047                 slotSelect (MyTreeWidget::AllFiles);
00048         }
00049 
00051         inline void slotSelectDirs ()
00052         {
00053                 slotSelect (MyTreeWidget::AllDirs);
00054         }
00055 
00057         inline void slotSelectFilesAndDirs ()
00058         {
00059                 slotSelect (MyTreeWidget::AllFilesAndDirs);
00060         }
00061 
00062 signals:
00064         void startDownloadOrUpload (const QString &destDir);
00065 
00066 private:
00068         void mouseMoveEvent (QMouseEvent *event);
00069 
00071         void dragEnterEvent (QDragEnterEvent *event);
00072 
00074         void dropEvent (QDropEvent *event);
00075 };
00076 
00077 
00078 /*************************************************************************/
00080 
00087 /*************************************************************************/
00088 
00089 class MyTreeWidgetItem:public QTreeWidgetItem
00090 {
00091 private:
00093         bool DirOrNot;
00094 
00095 public:
00098         MyTreeWidgetItem (QTreeWidget * parent, bool dir, const QString & name, const QString & size = "", const QString &lastModified = "", const QString & droits = "", const QString & proprietaire = "");
00099 
00101         enum State
00102         {
00103                 Root, Refresh, CdUp, Dir, DirLocked, File
00104         };
00105 
00107         State state;
00108 
00110         enum FileState
00111         {
00112                 None, Image, Video, Audio, Archive, Texte, Document, Internet, Autre
00113         };
00114 
00116         FileState fileState;
00117 
00119         inline bool isDir ()
00120         {
00121                 return DirOrNot;
00122         }
00123 
00125         static bool isSimple (const QString & filename);
00126 
00128         inline bool isSimple ()
00129         {
00130                 return isSimple (text (0));
00131         }
00132 
00134         inline State getState ()
00135         {
00136                 return state;
00137         }
00138 
00140         inline FileState getFileState ()
00141         {
00142                 return fileState;
00143         }
00144 };
00145 
00146 #endif

Generated on Wed Jan 2 20:39:34 2008 for Scythia by  doxygen 1.5.4