trapper.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002  *                                                                             *
00003  *   Copyright (C) 2003  Erik Sjolund,  (<html>Erik Sj&ouml;lund</html>)       *
00004  *                       Center for Genomics and Bioinformatics,               *
00005  *                       Karolinska Institutet,                                *
00006  *                       Stockholm,                                            *
00007  *                       Sweden                                                *
00008  *                                                                             *
00009  *  Author: Erik Sjolund                                                       *
00010  *  Email: erik.sjolund@adivo.se                                               *
00011  *                                                                             *
00012  *******************************************************************************
00013  */
00014 
00015 
00016 #ifndef TRAPPER_H
00017 #define TRAPPER_H
00018 
00019 // include files for QT
00020 #include <qapp.h>
00021 #include <qmainwindow.h>
00022 #include <qaction.h>
00023 #include <qworkspace.h>
00024 #include <qmenubar.h>
00025 #include <qtoolbar.h>
00026 #include <qstatusbar.h>
00027 #include <qwhatsthis.h>
00028 #include <qpopupmenu.h>
00029 #include <qaccel.h>
00030 #include <qtoolbutton.h>
00031 #include <qmsgbox.h>
00032 #include <qfiledialog.h>
00033 #include <qprinter.h>
00034 #include <qstring.h>
00035 #include <qpixmap.h>
00036 #include <qstringlist.h>
00037 #include <qspinbox.h>
00038 
00039 #include <db_cxx.h>
00040 
00041 #include <map>
00042 
00043 // forward declaration of the Trapper classes
00044 class TrapperDoc;
00045 class TrapperView;
00046 
00047 
00048 /** \brief The base class of the application. It sets up the main
00049   * window and providing a menubar, toolbar
00050   * and statusbar. For the main view, an instance of class TrapperView is
00051   * created which creates your view.
00052   *     
00053   * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
00054   * @version KDevelop version 1.3 code generation
00055   */
00056 class TrapperApp : public QMainWindow
00057 {
00058   Q_OBJECT
00059   
00060 public:
00061   /** construtor */
00062   TrapperApp();
00063   /** destructor */
00064   virtual ~TrapperApp();
00065   
00066   /** set the directory home for the database environment */
00067   void setDbHomeDir(QString dir);
00068   /** set the filename for the view modes configuration file */
00069   void setViewModeConfFile( QString filename );
00070   
00071   /** opens a file specified by commandline option
00072    */
00073   void openDocumentFile(const char *file=0);
00074   void exportToFile(QString toXmlFile);
00075   
00076   //typedefs:
00077   typedef std::multimap<QString, TrapperDoc*> str_doc_map;
00078  
00079   
00080 protected:
00081   /** overloaded for Message box on last window exit */
00082   bool queryExit();
00083   /** event filter to catch close events for MDI child windows and is installed in createClient() on every child window.
00084    * Closing a window calls the eventFilter first which removes the view from the connected documents' view list. If the
00085    * last view is going to be closed, the eventFilter() tests if the document is modified; if yes, it asks the user to
00086    * save the document. If the document title contains "Untitled", slotFileSaveAs() gets called to get a save name and path.
00087    */
00088   virtual bool eventFilter(QObject* object, QEvent* event);
00089   /** creates a new child window. The document that will be connected to it
00090    * has to be created before and the instances filled, with e.g. openDocument().
00091    * Then call createClient() to get a new MDI child window.
00092    * @see TrapperDoc#addView
00093    * @see TrapperDoc#openDocument
00094    * @param doc pointer to the document instance that the view will
00095    * be connected to.
00096    */
00097   void createClient(TrapperDoc* doc, QString modeview = QString::null );
00098 public slots:
00099   void slotCreateClient( QString modeView );
00100   /** exits the application */
00101   void slotFileQuit();
00102   
00103 private slots:
00104 
00105   /** generate a new document in the actual view */
00106   void slotFileNew();
00107   /** open a document */
00108   void slotFileOpen();
00109   /** save a document */
00110   void slotFileSave();
00111   /** save a document under a different filename*/
00112   void slotFileSaveAs();
00113   /** close the actual file */
00114   void slotFileClose();
00115   /** Flushes dbs */
00116   void slotFileFlush();
00117   /** print the actual file */
00118   void slotFilePrint();
00119   
00120   /** reverts the last editing action */
00121   void slotEditUndo();
00122   /** put the marked text/object into the clipboard and remove
00123    * it from the document */
00124   void slotEditCut();
00125   /** put the marked text/object into the clipboard*/
00126   void slotEditCopy();
00127   /** paste the clipboard into the document*/
00128   void slotEditPaste();
00129   
00130   /** Selects all reads*/
00131   void slotEditSelectAll();
00132   /** Selects all reads between two rows*/
00133   void slotEditSelectBetween();
00134   /** Selects all reads between two cols*/
00135   void slotEditSelectBetweenCols();
00136   /** Finds a specific read*/
00137   void slotEditFindRead();
00138   /** Finds a specific tag*/
00139   void slotEditFindTag();
00140   
00141   /** toggle the toolbar*/
00142   void slotViewToolBar(bool toggle);
00143   /** toggle the statusbar*/
00144   void slotViewStatusBar(bool toggle);
00145   /** creates a new view for the current document */
00146   void slotWindowNewWindow();
00147   /** shows an about dlg*/
00148   void slotHelpAbout();
00149   /** shows the online help*/
00150   void slotHelpManual();
00151   /** change the status message of the whole statusbar temporary */
00152   void slotStatusHelpMsg(const QString &text);
00153   /** gets called when the window menu is activated; recreates the window menu with all opened window titles. */
00154   void windowMenuAboutToShow();
00155   /** activates the MDI child widget when it gets selected from the window menu. */
00156   void windowMenuActivated( int id );
00157   /** imports data */
00158   void slotImport();
00159   /** imports data */
00160   void slotNewImport();
00161   /** imports chromat data */
00162   void slotChromatImport();
00163   /** imports mate data */
00164   void slotMateImport();
00165   /** imports time course data */
00166   void slotTcImport();
00167   /** imports phd data */
00168   void slotPhdImport();
00169   /** exports data */
00170   void slotExport();
00171   /** zooms in */
00172   void slotZoomIn();
00173   /** zooms in X */
00174   void slotZoomInX();
00175   /** zooms in Y */
00176   void slotZoomInY();
00177   /** zooms out */
00178   void slotZoomOut();
00179   /** zooms out X */
00180   void slotZoomOutX();
00181   /** zooms out Y */
00182   void slotZoomOutY();
00183   /** Enlarges view */
00184   void slotEnlarge();
00185   /** Shrinks view */
00186   void slotShrink();
00187   /** show statistics */
00188   void slotShowStatistics();
00189   /** configure view modes */
00190   void slotConfigureViewModes();
00191   /** normal pointer mode */
00192   void slotNormalMode();
00193   /** drag mode */
00194   void slotDragMode();
00195   /** time course visualization */
00196   void slotViewTimeCourse(bool toggle);
00197   /** normalize time course */
00198   void slotNormalizeTimeCourse(bool toggle);
00199   /** scroll to next cluster*/
00200   void slotScrollForward();
00201   /** scroll to previous cluster*/
00202   void slotScrollBackwards();
00203   /** change window size for cluster browsing*/
00204   void slotClusterWindowChanged(int window_size);
00205   /** change min read number for cluster browsing*/
00206   void slotClusterNumChanged(int num);
00207 
00208   /** active window*/
00209   void slotActivatedWindow(QWidget* w);
00210   
00211 private:
00212   
00213   /** initializes all QActions of the application */
00214   void initActions();
00215   /** initMenuBar creates the menu_bar and inserts the menuitems */
00216   void initMenuBar();
00217   /** this creates the toolbars. Change the toobar look and add new toolbars in this
00218    * function */
00219   void initToolBar();
00220   /** setup the statusbar */
00221   void initStatusBar();
00222   /** setup the mainview*/
00223   void initView();
00224   /** scroll active view*/
00225   void scroll(int dx, int dy);
00226   /** opens contigs that weren't already open and put them in list. User is responsible
00227    * for deleting docs after use */
00228   void open_docs_not_already_open(QPtrList<TrapperDoc>& notOpenBefore);
00229   /** fills a map wit read names as keys and pointers to docs they're present in as values */
00230 //   void map_reads_to_docs(str_doc_map& readmap, QPtrList<TrapperDoc>& notOpenBefore);
00231   
00232   
00233   QFile viewmodefile;
00234   
00235   QStringList contigNamesInProjectDir();
00236   
00237   
00238   
00239   
00240   /** file_menu contains all items of the menubar entry "File" */
00241   QPopupMenu *pFileMenu;
00242   /** edit_menu contains all items of the menubar entry "Edit" */
00243   QPopupMenu *pEditMenu;
00244   /** view_menu contains all items of the menubar entry "View" */
00245   QPopupMenu *pViewMenu;
00246   /** view_menu contains all items of the menubar entry "Help" */
00247   QPopupMenu *pHelpMenu;
00248   /** the window menu */
00249   QPopupMenu *pWindowMenu;
00250   /** the tools menu */
00251   QPopupMenu *pToolsMenu;
00252   
00253   QToolBar *fileToolbar;
00254   
00255   /** pWorkspace is the MDI frame widget that handles MDI child widgets. Inititalized in
00256    * initView()
00257    */
00258   QWorkspace *pWorkspace;
00259   /** the printer instance */
00260   QPrinter *printer;
00261   /** a counter that gets increased each time the user creates a new document with "File"->"New" */
00262   int untitledCount;
00263   /** a list of all open documents. If the last window of a document gets closed, the installed eventFilter
00264    * removes this document from the list. The document list is checked for modified documents when the user
00265    * is about to close the application. */
00266   QList<TrapperDoc> *pDocList;
00267   
00268   QAction *fileNew;
00269   QAction *fileOpen;
00270   QAction *fileSave;
00271   QAction *fileSaveAs;
00272   QAction *fileClose;
00273   QAction *filePrint;
00274   QAction *fileQuit;
00275   QAction *fileFlush;
00276   
00277   QAction *editUndo;
00278   QAction *editCut;
00279   QAction *editCopy;
00280   QAction *editPaste;
00281   QAction *editSelectAll;
00282   QAction *editSelectBetween;
00283   QAction *editSelectBetweenCols;
00284   QAction *editFindRead;
00285   QAction *editFindTag;
00286   
00287   QAction *viewToolBar;
00288   QAction *viewStatusBar;
00289   QAction *zoomInAction;
00290   QAction *zoomInXAction;
00291   QAction *zoomInYAction;
00292   QAction *zoomOutAction;
00293   QAction *zoomOutXAction;
00294   QAction *zoomOutYAction;
00295   QAction *enlargeAction;
00296   QAction *shrinkAction;
00297   QAction *showStatisticsAction;
00298   QAction *configureViewModesAction;
00299   
00300   QActionGroup *windowAction;
00301   QAction *windowNewWindow;
00302   QAction *windowTile;
00303   QAction *windowCascade;
00304 
00305   QActionGroup *modeActionGroup;
00306   QAction *normalModeAction;
00307   QAction *dragModeAction;
00308 
00309   QActionGroup *timecourseActionGroup;
00310   QAction *timecourseAction;
00311   QAction *normalizeAction;
00312 
00313   QAction *clusterScrollForwardAction;
00314   QAction *clusterScrollBackwardsAction;
00315   QSpinBox *clusterWindowBox;
00316   QSpinBox *clusterMinNumBox;
00317   
00318   
00319   QAction *importAction;
00320   QAction *importNewAction;
00321   QAction *importChromatAction;
00322   QAction *importMateAction;
00323   QAction *importTcAction;
00324   QAction *importPhdAction;
00325   QAction *exportAction;
00326   QAction *helpAboutApp;
00327   QAction *helpManualApp;
00328 
00329 
00330  
00331   QString projectDir;
00332   
00333   DbEnv * dbenv;
00334 };
00335 #endif

Generated on Fri Jul 17 20:19:29 2009 for ngsview by  doxygen 1.5.1