00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __FILEWINDOW_H__
00019 #define __FILEWINDOW_H__
00020
00021 #include <qmainwindow.h>
00022 #include <qlistview.h>
00023 #include <qpopupmenu.h>
00024 #include <qtoolbar.h>
00025 #include <qtoolbutton.h>
00026 #include <qcombobox.h>
00027 #include <qmessagebox.h>
00028
00029 #ifdef USE_QT_GRID
00030 #include <unistd.h>
00031 #endif
00032
00033 #include "FileItem.h"
00034 #include "RioQt.h"
00035 #include "RioCopy.h"
00036
00037 class RioQt;
00038 class RioCopy;
00039
00040 class FileWindow : public QMainWindow, public RioExplorer
00041 {
00042 Q_OBJECT
00043
00044 public:
00045 FileWindow( QWidget *, RioQt *, int );
00046
00047 RioQt *getRioQt( void );
00048 int getType( void );
00049
00050 FileItem *getCurrentDir( void );
00051 void refreshDirectory( FileItem * = NULL );
00052
00053 bool connectRioServer( char *, char *, char * );
00054 QString getHost( void );
00055 CRioSession *getSession( void );
00056 QString getUserName( void );
00057
00058 bool downloadFromRio( FileItem *, QString * );
00059 bool uploadToRio( QString, QString );
00060
00061 void appendCopy( RioCopy * );
00062 void removeCopy( RioCopy * );
00063 bool hasPendingCopies( void );
00064
00065
00066 static const int LOCAL = 0;
00067 static const int RIO = 1;
00068
00069 static const int MAXLEN_FILE = 1024;
00070 static const int MAXLEN_MESSAGE = 1024*5;
00071
00072
00073 static const int PMID_MKDIR = 0;
00074 static const int PMID_RMFILE = 1;
00075 static const int PMID_REFRESH = 2;
00076 static const int PMID_REFRESHD = 3;
00077 static const int PMID_MKOBJ = 4;
00078 static const int PMID_DF = 5;
00079 static const int PMID_OPEN = 6;
00080 static const int PMID_RENAMEFILE = 7;
00081 static const int PMID_CREATEXML = 8;
00082 static const int PMID_PROPERTIES = 9;
00083
00084
00085
00086 static const int PMID_VIDEORATE = 10;
00087
00088 static const int POPUPMENU_DIRTREE = 0;
00089 static const int POPUPMENU_DIRTREE_ITEM = 1;
00090 static const int POPUPMENU_FILELIST = 2;
00091 static const int POPUPMENU_FILELIST_ITEM = 3;
00092
00093 private:
00094
00095 QString userName;
00096 QString homeDir;
00097 char *host;
00098 FileItem *currentDir;
00099 int type;
00100 QPtrList<RioCopy> pendingCopiesList;
00101
00102 unsigned int blockSize;
00103 char home[ MAXLEN_FILE + 1 ];
00104
00105 RioQt *rioQt;
00106
00107
00108 QListView *dirTree;
00109 QListView *fileList;
00110
00111
00112 QToolButton *tbUpDir;
00113 QToolButton *tbHomeDir;
00114 QToolButton *tbRefresh;
00115 QToolButton *tbEraseFile;
00116 QToolButton *tbCreateDir;
00117
00118
00119 QComboBox *comboLocation;
00120 QToolButton *tbEraseLocation;
00121 QToolButton *tbGoLocation;
00122
00123 QMessageBox *md5Box;
00124 QStringList locationList;
00125
00126
00127
00128 bool UseVideoRate;
00129
00130 void closeEvent( QCloseEvent * );
00131 static void dispatchSignals( int );
00132 FileItem *getItemDirTree( QString );
00133 FileItem *getParentDir( FileItem * );
00134 void removeFileList( QListView * );
00135 void createDirTree( QString );
00136 void popupOptLoad( int, QListViewItem *, bool = true );
00137 void startEditor( QString file_name,
00138 QString remote_file_name = "" );
00139 static void *playVideo( void * );
00140 static FileItem *findDirectoryInto( FileItem *, QString );
00141 void createDirectory();
00142 bool createObject( QString, unsigned int );
00143 void openDiskInfo( void );
00144 bool showMessage( int, string, string = "" );
00145 void popupExtraOption( int, QListViewItem * );
00146 void getDirContents( QString );
00147 void updateStatus();
00148 void invokeVideoPlayer( FileItem * );
00149 void invokeFileEditor( FileItem * );
00150 bool removeFile( FileItem * );
00151 bool renameFile( FileItem *, QString );
00152 void readDirectory( FileItem * );
00153 void createXmlFile( FileItem * );
00154 bool editXmlFile( QString );
00155 void updateCopyProgress( void );
00156 void setMD5Calculation( char *, bool );
00157 void setSyncCheck( char *, bool );
00158 void showProperties( QListView* );
00159 bool checkConnection ( void );
00160
00161 public slots:
00162 void showDirContents( QListViewItem * );
00163 void openFile( QListViewItem * );
00164 void openFileItem( FileItem * );
00165 void openDirectory( QListViewItem * );
00166 void exploreDirectory( FileItem * );
00167 void runPopupDirTree( QListViewItem *, const QPoint &, int );
00168 void runPopupFileList( QListViewItem *, const QPoint &, int );
00169 void upDir( void );
00170 void goHomeDir( void );
00171 void toolbarRefresh( void );
00172 void toolbarEraseFile( void );
00173 void toolbarCreateDir( void );
00174 void clearLocation( void );
00175 void goLocation( int = -1 );
00176 };
00177
00178 #endif