Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

TrapperApp Class Reference

The base class of the application. It sets up the main window and providing a menubar, toolbar and statusbar. For the main view, an instance of class TrapperView is created which creates your view. More...

#include <trapper.h>

List of all members.

Public Types

typedef std::multimap< QString,
TrapperDoc * > 
str_doc_map

Public Slots

void slotCreateClient (QString modeView)
void slotFileQuit ()

Public Member Functions

 TrapperApp ()
virtual ~TrapperApp ()
void setDbHomeDir (QString dir)
void setViewModeConfFile (QString filename)
void openDocumentFile (const char *file=0)
void exportToFile (QString toXmlFile)

Protected Member Functions

bool queryExit ()
virtual bool eventFilter (QObject *object, QEvent *event)
void createClient (TrapperDoc *doc, QString modeview=QString::null)

Private Slots

void slotFileNew ()
void slotFileOpen ()
void slotFileSave ()
void slotFileSaveAs ()
void slotFileClose ()
void slotFileFlush ()
void slotFilePrint ()
void slotEditUndo ()
void slotEditCut ()
void slotEditCopy ()
void slotEditPaste ()
void slotEditSelectAll ()
void slotEditSelectBetween ()
void slotEditFindRead ()
void slotViewToolBar (bool toggle)
void slotViewStatusBar (bool toggle)
void slotWindowNewWindow ()
void slotHelpAbout ()
void slotHelpManual ()
void slotStatusHelpMsg (const QString &text)
void showAssistantErrors (const QString &err)
void windowMenuAboutToShow ()
void windowMenuActivated (int id)
void slotImport ()
void slotNewImport ()
void slotChromatImport ()
void slotMateImport ()
void slotPhdImport ()
void slotExport ()
void slotZoomIn ()
void slotZoomInX ()
void slotZoomInY ()
void slotZoomOut ()
void slotZoomOutX ()
void slotZoomOutY ()
void slotEnlarge ()
void slotShrink ()
void slotShowStatistics ()
void slotConfigureViewModes ()
void slotNormalMode ()
void slotDragMode ()
void slotActivatedWindow (QWidget *w)

Private Member Functions

void initActions ()
void initMenuBar ()
void initToolBar ()
void initStatusBar ()
void initView ()
void scroll (int dx, int dy)
void open_docs_not_already_open (QPtrList< TrapperDoc > &notOpenBefore)
void map_reads_to_docs (str_doc_map &readmap, QPtrList< TrapperDoc > &notOpenBefore)
QStringList contigNamesInProjectDir ()

Private Attributes

QFile viewmodefile
QPopupMenu * pFileMenu
QPopupMenu * pEditMenu
QPopupMenu * pViewMenu
QPopupMenu * pHelpMenu
QPopupMenu * pWindowMenu
QPopupMenu * pToolsMenu
QToolBar * fileToolbar
QWorkspace * pWorkspace
QPrinter * printer
int untitledCount
QList< TrapperDoc > * pDocList
QAction * fileNew
QAction * fileOpen
QAction * fileSave
QAction * fileSaveAs
QAction * fileClose
QAction * filePrint
QAction * fileQuit
QAction * fileFlush
QAction * editUndo
QAction * editCut
QAction * editCopy
QAction * editPaste
QAction * editSelectAll
QAction * editSelectBetween
QAction * editFindRead
QAction * viewToolBar
QAction * viewStatusBar
QAction * zoomInAction
QAction * zoomInXAction
QAction * zoomInYAction
QAction * zoomOutAction
QAction * zoomOutXAction
QAction * zoomOutYAction
QAction * enlargeAction
QAction * shrinkAction
QAction * showStatisticsAction
QAction * configureViewModesAction
QActionGroup * windowAction
QAction * windowNewWindow
QAction * windowTile
QAction * windowCascade
QActionGroup * modeActionGroup
QAction * normalModeAction
QAction * dragModeAction
QAction * importAction
QAction * importNewAction
QAction * importChromatAction
QAction * importMateAction
QAction * importPhdAction
QAction * exportAction
QAction * helpAboutApp
QAction * helpManualApp
QAssistantClient * assistant
QString projectDir
DbEnv * dbenv


Detailed Description

The base class of the application. It sets up the main window and providing a menubar, toolbar and statusbar. For the main view, an instance of class TrapperView is created which creates your view.

Author:
Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
Version:
KDevelop version 1.3 code generation

Definition at line 56 of file trapper.h.


Member Typedef Documentation

typedef std::multimap<QString, TrapperDoc*> TrapperApp::str_doc_map
 

Definition at line 77 of file trapper.h.


Constructor & Destructor Documentation

TrapperApp::TrapperApp  ) 
 

construtor

Definition at line 53 of file trapper.cpp.

References dbenv, initActions(), initMenuBar(), initStatusBar(), initToolBar(), initView(), pDocList, printer, projectDir, pWorkspace, slotActivatedWindow(), untitledCount, viewStatusBar, and viewToolBar.

00054 {
00055     qDebug("in TrapperApp::TrapperApp()");
00056     setCaption(tr("Trapper " "0.9" ) );
00057     dbenv = new DbEnv( DB_CXX_NO_EXCEPTIONS );
00058 
00059     dbenv->set_cachesize(0, 1000000, 0);
00060 
00061     printer = new QPrinter;
00062     untitledCount=0;
00063     pDocList = new QList<TrapperDoc>();
00064     pDocList->setAutoDelete(true);
00065 
00066     ///////////////////////////////////////////////////////////////////
00067     // call inits to invoke all other construction parts
00068     initView();
00069     initActions();
00070     initMenuBar();
00071     initToolBar();
00072     initStatusBar();
00073     resize( 450, 400 );
00074 
00075     viewToolBar->setOn(true);
00076     viewStatusBar->setOn(true);
00077 
00078     projectDir = QString::null;
00079 
00080 //     assistant = new QAssistantClient(QDir("/home/erika/lib/qt/bin").absPath(), this);
00081 //     assistant = new QAssistantClient(QDir("bin/").absPath(), this);
00082 //     QStringList cmdLst;
00083 //     cmdLst << "-profile"<<"doc/trapperhelp.adp";
00084 //     assistant->setArguments( cmdLst );
00085 //     connect( assistant, SIGNAL(error(const QString&)),
00086 //              this, SLOT(showAssistantErrors(const QString&)) );
00087     
00088     connect(pWorkspace, SIGNAL(windowActivated(QWidget*)), this, SLOT(slotActivatedWindow(QWidget*)));
00089 
00090     
00091 }

TrapperApp::~TrapperApp  )  [virtual]
 

destructor

Definition at line 93 of file trapper.cpp.

References dbenv, and printer.

00094 {
00095     delete printer;
00096     dbenv->close(0);
00097 }


Member Function Documentation

QStringList TrapperApp::contigNamesInProjectDir  )  [private]
 

Definition at line 1367 of file trapper.cpp.

References projectDir.

Referenced by open_docs_not_already_open(), and slotImport().

01368 {
01369     QString contigName;
01370     QDir d( projectDir );
01371     Q_ASSERT( d.exists() );
01372     d.setFilter( QDir::Dirs | QDir::NoSymLinks );
01373     d.setSorting( QDir::Name );
01374     QStringList slist = d.entryList();
01375     return slist;
01376 }

void TrapperApp::createClient TrapperDoc doc,
QString  modeview = QString::null
[protected]
 

creates a new child window. The document that will be connected to it has to be created before and the instances filled, with e.g. openDocument(). Then call createClient() to get a new MDI child window.

See also:
TrapperDoc::addView

TrapperDoc::openDocument

Parameters:
doc pointer to the document instance that the view will be connected to.

Definition at line 461 of file trapper.cpp.

References TrapperDoc::addView(), pWorkspace, and slotCreateClient().

Referenced by openDocumentFile(), slotCreateClient(), and slotWindowNewWindow().

00462 {
00463   
00464   TrapperView* w = new TrapperView(doc, pWorkspace, modeView, modeView);
00465   w->installEventFilter(this);
00466   doc->addView(w);
00467   connect( w, SIGNAL( message( const QString& ) ), statusBar(), SLOT( message( const QString& ) ) );
00468   
00469   //The following line doesn't do anything as far as I can tell...?
00470   connect( w, SIGNAL( createView( QString ) ), this, SLOT( slotCreateClient( QString ) ) );
00471   if ( pWorkspace->windowList().isEmpty() ) // show the very first window in maximized mode
00472     w->showMaximized();
00473   else
00474     w->show();
00475 }

bool TrapperApp::eventFilter QObject *  object,
QEvent *  event
[protected, virtual]
 

event filter to catch close events for MDI child windows and is installed in createClient() on every child window. Closing a window calls the eventFilter first which removes the view from the connected documents' view list. If the last view is going to be closed, the eventFilter() tests if the document is modified; if yes, it asks the user to save the document. If the document title contains "Untitled", slotFileSaveAs() gets called to get a save name and path.

Definition at line 558 of file trapper.cpp.

References TrapperDoc::canCloseFrame(), TrapperDoc::firstView(), TrapperView::getDocument(), pDocList, pWorkspace, TrapperDoc::removeView(), and scroll().

00559 {
00560   if((event->type() == QEvent::Close) && ((TrapperApp*)object!=this) ) {
00561 
00562     QCloseEvent* e = (QCloseEvent*)event;
00563     TrapperView* pView = (TrapperView*)object;
00564     TrapperDoc* pDoc = pView->getDocument();
00565     if(pDoc->canCloseFrame(pView)) {
00566       pDoc->removeView(pView);
00567       if( !pDoc->firstView() ) {
00568         pDocList->remove(pDoc);
00569       }
00570       
00571       e->accept();
00572       
00573     }
00574     else {
00575       e->ignore();
00576     }
00577     return true;
00578   }
00579   else if ( (event->type() == QEvent::KeyPress) ) {
00580     QKeyEvent* e = (QKeyEvent*)event;
00581     int scrollfactor(10);
00582     if ( e->state() == Qt::ControlButton )
00583       scrollfactor *= 10;
00584     
00585     if ( e->key() == Qt::Key_Up ) {
00586       scroll(0, -1*scrollfactor);
00587       e->accept();
00588       return true;
00589     }
00590     else if ( e->key() == Qt::Key_Down ) {
00591       scroll(0, 1*scrollfactor);
00592       e->accept();
00593       return true;
00594     }
00595     else if ( e->key() == Qt::Key_Left ) {
00596       scroll(-1*scrollfactor, 0);
00597       e->accept();
00598       return true;
00599     }
00600     else if ( e->key() == Qt::Key_Right ) {
00601       scroll(1*scrollfactor, 0);
00602       e->accept();
00603       return true;
00604     }
00605     else if ( e->key() == Qt::Key_Tab ) {
00606       pWorkspace->activateNextWindow();
00607       e->accept();
00608       return true;
00609     }
00610     else if ( e->key() == Qt::Key_Backtab ) {
00611       pWorkspace->activatePrevWindow();
00612       e->accept();
00613       return true;
00614     }
00615     
00616     e->ignore();
00617   }
00618   
00619   
00620   return QWidget::eventFilter( object, event );    // standard event processing
00621 }

void TrapperApp::exportToFile QString  toXmlFile  ) 
 

Definition at line 1309 of file trapper.cpp.

References open_docs_not_already_open(), and pDocList.

Referenced by slotExport().

01310 {
01311   statusBar()->message(tr("Exporting project to file..."));
01312 
01313   //Open file and docs
01314 
01315   ofstream outFile(toXmlFile.ascii());
01316 //   ostream& outFile = cerr;
01317 
01318   outFile<<"<TRAPPER>\n";
01319   QPtrList<TrapperDoc> docListNotAlreadyOpen;
01320   docListNotAlreadyOpen.setAutoDelete(true);//Will delete docs itself when function exits
01321 
01322   open_docs_not_already_open( docListNotAlreadyOpen );
01323 
01324   //For each contig, write it to file
01325   for (TrapperDoc* doc = pDocList->first(); doc != 0; doc = pDocList->next() ) {
01326     doc->saveExport(outFile);
01327   }
01328   for (TrapperDoc* doc = docListNotAlreadyOpen.first(); doc != 0; doc = docListNotAlreadyOpen.next() ) {
01329     doc->saveExport(outFile);
01330   }
01331   
01332   //Close file
01333   outFile<<"</TRAPPER>\n";
01334   
01335   outFile.close();
01336   statusBar()->message(tr("Ready."));
01337   
01338 }

void TrapperApp::initActions  )  [private]
 

initializes all QActions of the application

Definition at line 99 of file trapper.cpp.

References configureViewModesAction, dragModeAction, editCopy, editCut, editFindRead, editPaste, editSelectAll, editSelectBetween, editUndo, enlargeAction, exportAction, fileClose, fileFlush, fileNew, fileOpen, filePrint, fileQuit, fileSave, fileSaveAs, helpAboutApp, importChromatAction, importMateAction, importNewAction, importPhdAction, modeActionGroup, normalModeAction, pWorkspace, showStatisticsAction, shrinkAction, slotChromatImport(), slotConfigureViewModes(), slotDragMode(), slotEditCopy(), slotEditCut(), slotEditFindRead(), slotEditPaste(), slotEditSelectAll(), slotEditSelectBetween(), slotEditUndo(), slotEnlarge(), slotExport(), slotFileClose(), slotFileFlush(), slotFileNew(), slotFileOpen(), slotFilePrint(), slotFileQuit(), slotFileSave(), slotHelpAbout(), slotMateImport(), slotNewImport(), slotNormalMode(), slotPhdImport(), slotShowStatistics(), slotShrink(), slotViewStatusBar(), slotViewToolBar(), slotWindowNewWindow(), slotZoomIn(), slotZoomInX(), slotZoomInY(), slotZoomOut(), slotZoomOutX(), slotZoomOutY(), viewStatusBar, viewToolBar, windowAction, windowCascade, windowNewWindow, windowTile, zoomInAction, zoomInXAction, zoomInYAction, zoomOutAction, zoomOutXAction, and zoomOutYAction.

Referenced by TrapperApp().

00100 {
00101     QPixmap openIcon, saveIcon, newIcon, selectAllIcon, zoomPlusIcon, zoomMinusIcon,
00102       zoomPlusIconX, zoomPlusIconY, zoomMinusIconX, zoomMinusIconY, flushIcon, dragIcon, pointerIcon;
00103 
00104     newIcon = QPixmap(filenew);
00105     openIcon = QPixmap(fileopen);
00106     saveIcon = QPixmap(filesave);
00107     selectAllIcon = QPixmap( editselectall );
00108     zoomPlusIcon = QPixmap( zoom_in );
00109     zoomPlusIconX = QPixmap( zoom_in_x );
00110     zoomPlusIconY = QPixmap( zoom_in_y );
00111     zoomMinusIcon = QPixmap( zoom_out );
00112     zoomMinusIconX = QPixmap( zoom_out_x);
00113     zoomMinusIconY = QPixmap( zoom_out_y);
00114     flushIcon = QPixmap( dbflush );
00115     pointerIcon = QPixmap(pointerbutton);
00116     dragIcon = QPixmap(dragbutton);
00117 
00118     fileNew = new QAction(tr("New Project"), newIcon, tr("&New"), QAccel::stringToKey(tr("Ctrl+N")), this);
00119     fileNew->setStatusTip(tr("Creates a new project"));
00120     fileNew->setWhatsThis(tr("New Project\n\nCreates a new project"));
00121     connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew()));
00122 
00123     fileOpen = new QAction(tr("Open Contig"), openIcon, tr("&Open..."), QAccel::stringToKey(tr("Ctrl+O")), this);
00124     fileOpen->setStatusTip(tr("Opens an existing contig or creates a new one"));
00125     fileOpen->setWhatsThis(tr("Open Contig\n\nOpens an existing contig or creates a new one. To create a new contig, simply create a new directory in the file dialog and choose it"));
00126     connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
00127 
00128     fileSave = new QAction(tr("Save File"), saveIcon, tr("&Save"), QAccel::stringToKey(tr("Ctrl+S")), this);
00129     fileSave->setStatusTip(tr("Saves the actual document"));
00130     fileSave->setWhatsThis(tr("Save File.\n\nSaves the actual document"));
00131     connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
00132 
00133     fileSaveAs = new QAction(tr("Save File As"), tr("Save &as..."), 0, this);
00134     fileSaveAs->setStatusTip(tr("Saves the actual document under a new filename"));
00135     fileSaveAs->setWhatsThis(tr("Save As\n\nSaves the actual document under a new filename"));
00136     connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSave()));
00137 
00138     fileClose = new QAction(tr("Close Project"), tr("&Close"), QAccel::stringToKey(tr("Ctrl+W")), this);
00139     fileClose->setStatusTip(tr("Closes the actual project"));
00140     fileClose->setWhatsThis(tr("Close Project\n\nCloses the actual project"));
00141     connect(fileClose, SIGNAL(activated()), this, SLOT(slotFileClose()));
00142 
00143     filePrint = new QAction(tr("Print File"), tr("&Print"), QAccel::stringToKey(tr("Ctrl+P")), this);
00144     filePrint->setStatusTip(tr("Prints out the actual document"));
00145     filePrint->setWhatsThis(tr("Print File\n\nPrints out the actual document"));
00146     connect(filePrint, SIGNAL(activated()), this, SLOT(slotFilePrint()));
00147 
00148     fileQuit = new QAction(tr("Exit"), tr("E&xit"), QAccel::stringToKey(tr("Ctrl+Q")), this);
00149     fileQuit->setStatusTip(tr("Quits the application"));
00150     fileQuit->setWhatsThis(tr("Exit\n\nQuits the application"));
00151     connect(fileQuit, SIGNAL(activated()), this, SLOT(slotFileQuit()));
00152 
00153     fileFlush = new QAction(tr("Flush"), flushIcon, tr("&Flush"), QAccel::stringToKey(tr("Ctrl+F")), this);
00154     fileFlush->setStatusTip(tr("Flushes cached data"));
00155     fileFlush->setWhatsThis(tr("Flush\n\nFlushes cached data to database"));
00156     connect(fileFlush, SIGNAL(activated()), this, SLOT(slotFileFlush()));
00157 
00158     editCut = new QAction(tr("Cut"), tr("Cu&t"), QAccel::stringToKey(tr("Ctrl+X")), this);
00159     editCut->setStatusTip(tr("Cuts the selected section and puts it to the clipboard"));
00160     editCut->setWhatsThis(tr("Cut\n\nCuts the selected section and puts it to the clipboard"));
00161     connect(editCut, SIGNAL(activated()), this, SLOT(slotEditCut()));
00162 
00163     editCopy = new QAction(tr("Copy"), tr("&Copy"), QAccel::stringToKey(tr("Ctrl+C")), this);
00164     editCopy->setStatusTip(tr("Copies the selected section to the clipboard"));
00165     editCopy->setWhatsThis(tr("Copy\n\nCopies the selected section to the clipboard"));
00166     connect(editCopy, SIGNAL(activated()), this, SLOT(slotEditCopy()));
00167 
00168     editUndo = new QAction(tr("Undo last move"), tr("&Undo last move"), QAccel::stringToKey(tr("Ctrl+Z")), this);
00169     editUndo->setStatusTip(tr("Reverts the last move"));
00170     editUndo->setWhatsThis(tr("Undo\n\nReverts the last read moving action"));
00171     connect(editUndo, SIGNAL(activated()), this, SLOT(slotEditUndo()));
00172 
00173     editPaste = new QAction(tr("Paste"), tr("&Paste"), QAccel::stringToKey(tr("Ctrl+V")), this);
00174     editPaste->setStatusTip(tr("Pastes the clipboard contents to actual position"));
00175     editPaste->setWhatsThis(tr("Paste\n\nPastes the clipboard contents to actual position"));
00176     connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
00177 
00178     editSelectAll = new QAction(tr("Select All"), selectAllIcon, tr("Select &All"), QAccel::stringToKey(tr("Ctrl+A")), this);
00179     editSelectAll->setStatusTip(tr("Selects all reads"));
00180     editSelectAll->setWhatsThis(tr("Select All\n\nSelects all reads"));
00181     connect(editSelectAll, SIGNAL(activated()), this, SLOT(slotEditSelectAll()));
00182 
00183     editSelectBetween = new QAction(tr("Select Between rows"), tr("Select &Between rows"), 0, this);
00184     editSelectBetween->setStatusTip(tr("Selects all reads between two rows"));
00185     editSelectBetween->setWhatsThis(tr("Select Between rows\n\nSelects all reads between two rows"));
00186     connect(editSelectBetween, SIGNAL(activated()), this, SLOT(slotEditSelectBetween()));
00187 
00188     editFindRead = new QAction(tr("Find Read"), tr("Find Read"), 0, this);
00189     editFindRead->setStatusTip(tr("Selects a specific read"));
00190     editFindRead->setWhatsThis(tr("Find Read\n\nSelects a specific read"));
00191     connect(editFindRead, SIGNAL(activated()), this, SLOT(slotEditFindRead()));
00192 
00193     viewToolBar = new QAction(tr("Toolbar"), tr("Tool&bar"), 0, this, 0, true);
00194     viewToolBar->setStatusTip(tr("Enables/disables the toolbar"));
00195     viewToolBar->setWhatsThis(tr("Toolbar\n\nEnables/disables the toolbar"));
00196     connect(viewToolBar, SIGNAL(toggled(bool)), this, SLOT(slotViewToolBar(bool)));
00197 
00198     viewStatusBar = new QAction(tr("Statusbar"), tr("&Statusbar"), 0, this, 0, true);
00199     viewStatusBar->setStatusTip(tr("Enables/disables the statusbar"));
00200     viewStatusBar->setWhatsThis(tr("Statusbar\n\nEnables/disables the statusbar"));
00201     connect(viewStatusBar, SIGNAL(toggled(bool)), this, SLOT(slotViewStatusBar(bool)));
00202 
00203     windowNewWindow = new QAction(tr("New Wiew"), tr("&New Wiew"), 0, this);
00204     windowNewWindow->setStatusTip(tr("Opens a new view for the current document"));
00205     windowNewWindow->setWhatsThis(tr("New Wiew\n\nOpens a new view for the current document"));
00206     connect(windowNewWindow, SIGNAL(activated()), this, SLOT(slotWindowNewWindow()));
00207 
00208     windowCascade = new QAction(tr("Cascade"), tr("&Cascade"), 0, this);
00209     windowCascade->setStatusTip(tr("Cascades all windows"));
00210     windowCascade->setWhatsThis(tr("Cascade\n\nCascades all windows"));
00211     connect(windowCascade, SIGNAL(activated()), pWorkspace, SLOT(cascade()));
00212 
00213     windowTile = new QAction(tr("Tile"), tr("&Tile"), 0, this);
00214     windowTile->setStatusTip(tr("Tiles all windows"));
00215     windowTile->setWhatsThis(tr("Tile\n\nTiles all windows"));
00216     connect(windowTile, SIGNAL(activated()), pWorkspace, SLOT(tile()));
00217 
00218     windowAction = new QActionGroup(this, 0, false);
00219     windowAction->add(windowNewWindow);
00220     windowAction->add(windowCascade);
00221     windowAction->add(windowTile);
00222     
00223     normalModeAction = new QAction(tr("Normal mode"), pointerIcon, tr("Normal mode"), 0, this);
00224     normalModeAction->setStatusTip(tr("Sets mode to normal"));
00225     normalModeAction->setWhatsThis(tr("Normal mode\n\nFor selection of reads, normal moving etc"));
00226     normalModeAction->setToggleAction(true);
00227     normalModeAction->setOn(true);
00228     connect(normalModeAction, SIGNAL(activated()), this, SLOT(slotNormalMode()));
00229     
00230     dragModeAction = new QAction(tr("Drag mode"), dragIcon, tr("Drag mode"), 0, this);
00231     dragModeAction->setStatusTip(tr("Sets mode to drag mode"));
00232     dragModeAction->setWhatsThis(tr("Drag mode\n\nFor moving reads between contigs, and sideways moving"));
00233     dragModeAction->setToggleAction(true);
00234     connect(dragModeAction, SIGNAL(activated()), this, SLOT(slotDragMode()));
00235 
00236     modeActionGroup = new QActionGroup(this, 0, true);
00237     modeActionGroup->add(normalModeAction);
00238     modeActionGroup->add(dragModeAction);
00239     
00240     helpAboutApp = new QAction(tr("About"), tr("&About..."), 0, this);
00241     helpAboutApp->setStatusTip(tr("About the application"));
00242     helpAboutApp->setWhatsThis(tr("About\n\nAbout the application"));
00243     connect(helpAboutApp, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
00244 
00245 //     helpManualApp = new QAction(tr("Manual"), tr("&Manual"), 0, this);
00246 //     helpManualApp->setStatusTip(tr("Trapper Manual"));
00247 //     helpManualApp->setWhatsThis(tr("Trapper Manual\n\nManual decribing how to use Trapper"));
00248 //     connect(helpManualApp, SIGNAL(activated()), this, SLOT(slotHelpManual()));
00249 
00250 //     importAction = new QAction(tr("Import project"), tr("&Import project"), 0, this);
00251 //     importAction->setStatusTip(tr("Imports project data"));
00252 //     importAction->setWhatsThis(tr("Imports project data"));
00253 //     connect(importAction, SIGNAL(activated()), this, SLOT(slotImport()));
00254 
00255     importNewAction = new QAction(tr("Import project"), tr("&Import project"), 0, this);
00256     importNewAction->setStatusTip(tr("Imports project data"));
00257     importNewAction->setWhatsThis(tr("Imports project data"));
00258     connect(importNewAction, SIGNAL(activated()), this, SLOT(slotNewImport()));
00259 
00260     importChromatAction = new QAction(tr("Import Chromatograms"), tr("Import Chromatograms"), 0, this);
00261     importChromatAction->setStatusTip(tr("Imports chromatogram data"));
00262     importChromatAction->setWhatsThis(tr("Imports chromatogram data"));
00263     connect(importChromatAction, SIGNAL(activated()), this, SLOT(slotChromatImport()));
00264 
00265     importMateAction = new QAction(tr("Import Mate pairs"), tr("Import Mate Pairs"), 0, this);
00266     importMateAction->setStatusTip(tr("Imports mate pair data"));
00267     importMateAction->setWhatsThis(tr("Imports mate pair data"));
00268     connect(importMateAction, SIGNAL(activated()), this, SLOT(slotMateImport()));
00269 
00270     importPhdAction = new QAction(tr("Import phd data"), tr("Import phd data"), 0, this);
00271     importPhdAction->setStatusTip(tr("Imports phd data"));
00272     importPhdAction->setWhatsThis(tr("Imports phd data"));
00273     connect(importPhdAction, SIGNAL(activated()), this, SLOT(slotPhdImport()));
00274 
00275     exportAction = new QAction(tr("Export"), tr("&Export"), 0, this);
00276     exportAction->setStatusTip(tr("Exports data"));
00277     exportAction->setWhatsThis(tr("Exports data"));
00278     connect(exportAction, SIGNAL(activated()), this, SLOT(slotExport()));
00279 
00280     zoomInAction = new QAction(tr("Zoom in"), zoomPlusIcon, tr("Zoom in"), Key_Plus, this);
00281     zoomInAction->setStatusTip(tr("Zooms in"));
00282     zoomInAction->setWhatsThis(tr("Zooms in"));
00283     connect(zoomInAction, SIGNAL(activated()), this, SLOT(slotZoomIn()));
00284 
00285     zoomInXAction = new QAction(tr("Zoom in X"), zoomPlusIconX, tr("Zoom in X"),CTRL + Key_Plus, this);
00286     zoomInXAction->setStatusTip(tr("Zooms in X"));
00287     zoomInXAction->setWhatsThis(tr("Zooms in X direction"));
00288     connect(zoomInXAction, SIGNAL(activated()), this, SLOT(slotZoomInX()));
00289 
00290     zoomInYAction = new QAction(tr("Zoom in Y"), zoomPlusIconY, tr("Zoom in Y"), CTRL + ALT + Key_Plus, this);
00291     zoomInYAction->setStatusTip(tr("Zooms in Y"));
00292     zoomInYAction->setWhatsThis(tr("Zooms in Y direction"));
00293     connect(zoomInYAction, SIGNAL(activated()), this, SLOT(slotZoomInY()));
00294 
00295     zoomOutAction = new QAction(tr("Zoom out"), zoomMinusIcon, tr("&Zoom out"), Key_Minus, this);
00296     zoomOutAction->setStatusTip(tr("Zooms out"));
00297     zoomOutAction->setWhatsThis(tr("Zooms out"));
00298     connect(zoomOutAction, SIGNAL(activated()), this, SLOT(slotZoomOut()));
00299 
00300     zoomOutXAction = new QAction(tr("Zoom out X"), zoomMinusIconX, tr("Zoom out X"), CTRL + Key_Minus, this);
00301     zoomOutXAction->setStatusTip(tr("Zooms out X"));
00302     zoomOutXAction->setWhatsThis(tr("Zooms out in X direction"));
00303     connect(zoomOutXAction, SIGNAL(activated()), this, SLOT(slotZoomOutX()));
00304 
00305     zoomOutYAction = new QAction(tr("Zoom out Y"), zoomMinusIconY, tr("Zoom out Y"), CTRL + ALT + Key_Minus, this);
00306     zoomOutYAction->setStatusTip(tr("Zooms out Y"));
00307     zoomOutYAction->setWhatsThis(tr("Zooms out in Y direction"));
00308     connect(zoomOutYAction, SIGNAL(activated()), this, SLOT(slotZoomOutY()));
00309 
00310     enlargeAction = new QAction(tr("Enlarge"), tr("&Enlarge"), 0, this);
00311     enlargeAction->setStatusTip(tr("Adds more viewable rows"));
00312     enlargeAction->setWhatsThis(tr("Enlarges view, so that more rows and columns can be displayed"));
00313     connect(enlargeAction, SIGNAL(activated()), this, SLOT(slotEnlarge()));
00314 
00315     shrinkAction = new QAction(tr("Shrink"), tr("&Shrink"), 0, this);
00316     shrinkAction->setStatusTip(tr("Removes viewable rows. Does not affect data."));
00317     shrinkAction->setWhatsThis(tr("Shrinks view, displaying fewer rows and columns. Does not affect data."));
00318     connect(shrinkAction, SIGNAL(activated()), this, SLOT(slotShrink()));
00319 
00320     showStatisticsAction = new QAction(tr("Show statistics"), tr("Show statistics"), 0, this);
00321     showStatisticsAction->setStatusTip(tr("Show statistics about contig"));
00322     showStatisticsAction->setWhatsThis(tr("Show underlying berkeley db statistics for this contig"));
00323     connect(showStatisticsAction, SIGNAL(activated()), this, SLOT(slotShowStatistics()));
00324 
00325     configureViewModesAction = new QAction(tr("Configure view modes"), tr("&Configure modes"), 0, this);
00326     configureViewModesAction->setStatusTip(tr("Configure view modes"));
00327     configureViewModesAction->setWhatsThis(tr("Configure view modes"));
00328     connect(configureViewModesAction, SIGNAL(activated()), this, SLOT(slotConfigureViewModes()));
00329 
00330     
00331 }

void TrapperApp::initMenuBar  )  [private]
 

initMenuBar creates the menu_bar and inserts the menuitems

Definition at line 333 of file trapper.cpp.

References editCopy, editCut, editFindRead, editPaste, editSelectAll, editSelectBetween, editUndo, enlargeAction, exportAction, fileClose, fileOpen, fileQuit, helpAboutApp, importChromatAction, importMateAction, importNewAction, importPhdAction, modeActionGroup, pEditMenu, pFileMenu, pHelpMenu, pToolsMenu, pViewMenu, pWindowMenu, showStatisticsAction, shrinkAction, viewStatusBar, viewToolBar, windowMenuAboutToShow(), zoomInAction, zoomInXAction, zoomInYAction, zoomOutAction, zoomOutXAction, and zoomOutYAction.

Referenced by TrapperApp().

00334 {
00335     ///////////////////////////////////////////////////////////////////
00336     // MENUBAR
00337 
00338     ///////////////////////////////////////////////////////////////////
00339     // menuBar entry pFileMenu
00340     pFileMenu=new QPopupMenu();
00341 //     fileNew->addTo(pFileMenu);
00342     fileOpen->addTo(pFileMenu);
00343     fileClose->addTo(pFileMenu);
00344 //     pFileMenu->insertSeparator();
00345 //     fileFlush->addTo( pFileMenu );//DANGEROUS??
00346     //    fileSave->addTo(pFileMenu);
00347     // fileSaveAs->addTo(pFileMenu);
00348 //     pFileMenu->insertSeparator();
00349 //     filePrint->addTo(pFileMenu);
00350     pFileMenu->insertSeparator();
00351     fileQuit->addTo(pFileMenu);
00352 
00353 
00354 
00355 
00356     ///////////////////////////////////////////////////////////////////
00357     // menuBar entry editMenu
00358     pEditMenu=new QPopupMenu();
00359     editUndo->addTo(pEditMenu);
00360 //     pEditMenu->insertSeparator();
00361     editCut->addTo(pEditMenu);
00362     editCopy->addTo(pEditMenu);
00363     editPaste->addTo(pEditMenu);
00364     editSelectAll->addTo(pEditMenu);
00365     editSelectBetween->addTo(pEditMenu);
00366     editFindRead->addTo(pEditMenu);
00367 
00368     ///////////////////////////////////////////////////////////////////
00369     // menuBar entry viewMenu
00370     pViewMenu=new QPopupMenu();
00371     pViewMenu->setCheckable(true);
00372     viewToolBar->addTo(pViewMenu);
00373     viewStatusBar->addTo(pViewMenu);
00374 
00375     zoomInAction->addTo(pViewMenu);
00376     zoomOutAction->addTo(pViewMenu);
00377     zoomInXAction->addTo(pViewMenu);
00378     zoomOutXAction->addTo(pViewMenu);
00379     zoomInYAction->addTo(pViewMenu);
00380     zoomOutYAction->addTo(pViewMenu);
00381     enlargeAction->addTo(pViewMenu);
00382     shrinkAction->addTo(pViewMenu);
00383     showStatisticsAction->addTo(pViewMenu);
00384 //     configureViewModesAction->addTo(pViewMenu);
00385 
00386     ///////////////////////////////////////////////////////////////////
00387     // EDIT YOUR APPLICATION SPECIFIC MENUENTRIES HERE
00388 
00389     pToolsMenu=new QPopupMenu();
00390 //     importAction->addTo(pToolsMenu);
00391     importNewAction->addTo(pToolsMenu);
00392     importChromatAction->addTo(pToolsMenu);
00393     importMateAction->addTo(pToolsMenu);
00394     importPhdAction->addTo(pToolsMenu);
00395     modeActionGroup->addTo(pToolsMenu);
00396     exportAction->addTo(pToolsMenu);
00397 
00398     ///////////////////////////////////////////////////////////////////
00399     // menuBar entry windowMenu
00400     pWindowMenu = new QPopupMenu(this);
00401     pWindowMenu->setCheckable(true);
00402     connect(pWindowMenu, SIGNAL(aboutToShow()), this, SLOT(windowMenuAboutToShow()));
00403 
00404     ///////////////////////////////////////////////////////////////////
00405     // menuBar entry helpMenu
00406     pHelpMenu=new QPopupMenu();
00407 //     helpManualApp->addTo(pHelpMenu);
00408     helpAboutApp->addTo(pHelpMenu);
00409     pHelpMenu->insertSeparator();
00410     pHelpMenu->insertItem(tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1);
00411 
00412     menuBar()->insertItem(tr("&Contig"), pFileMenu);
00413     menuBar()->insertItem(tr("&Edit"), pEditMenu);
00414     menuBar()->insertItem(tr("&View"), pViewMenu);
00415     menuBar()->insertItem(tr("&Window"), pWindowMenu);
00416     menuBar()->insertItem(tr("&Tools"), pToolsMenu);
00417     menuBar()->insertItem(tr("&Help"), pHelpMenu);
00418 
00419 }

void TrapperApp::initStatusBar  )  [private]
 

setup the statusbar

Definition at line 444 of file trapper.cpp.

Referenced by TrapperApp().

00445 {
00446     ///////////////////////////////////////////////////////////////////
00447     //STATUSBAR
00448     statusBar()->message(tr("Ready."));
00449 }

void TrapperApp::initToolBar  )  [private]
 

this creates the toolbars. Change the toobar look and add new toolbars in this function

Definition at line 421 of file trapper.cpp.

References editSelectAll, fileOpen, fileToolbar, modeActionGroup, zoomInAction, zoomInXAction, zoomInYAction, zoomOutAction, zoomOutXAction, and zoomOutYAction.

Referenced by TrapperApp().

00422 {
00423     ///////////////////////////////////////////////////////////////////
00424     // TOOLBAR
00425     fileToolbar = new QToolBar(this, "file operations");
00426 //     fileNew->addTo(fileToolbar);
00427     fileOpen->addTo(fileToolbar);
00428 //     fileFlush->addTo(fileToolbar);DANGEROUS??
00429 //     fileSave->addTo(fileToolbar);
00430     editSelectAll->addTo(fileToolbar);
00431     zoomInAction->addTo(fileToolbar);
00432     zoomOutAction->addTo(fileToolbar);
00433     zoomInXAction->addTo(fileToolbar);
00434     zoomOutXAction->addTo(fileToolbar);
00435     zoomInYAction->addTo(fileToolbar);
00436     zoomOutYAction->addTo(fileToolbar);
00437     
00438     fileToolbar->addSeparator();
00439     modeActionGroup->addTo(fileToolbar);
00440     fileToolbar->addSeparator();
00441     QWhatsThis::whatsThisButton(fileToolbar);
00442 }

void TrapperApp::initView  )  [private]
 

setup the mainview

Definition at line 451 of file trapper.cpp.

References pWorkspace.

Referenced by TrapperApp().

00452 {
00453     ////////////////////////////////////////////////////////////////////
00454     // set the main widget here
00455     QVBox* view_back = new QVBox( this );
00456     view_back->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
00457     pWorkspace = new QWorkspace( view_back );
00458     setCentralWidget(view_back);
00459 }

void TrapperApp::map_reads_to_docs str_doc_map readmap,
QPtrList< TrapperDoc > &  notOpenBefore
[private]
 

fills a map wit read names as keys and pointers to docs they're present in as values

Definition at line 1256 of file trapper.cpp.

References Database::SecondaryIterator< T >::answer(), Database::SecondaryIterator< T >::first(), ReadData::name(), Database::SecondaryIterator< T >::next(), and pDocList.

01257 {
01258   TrapperDoc* doc;
01259   
01260   for(doc=pDocList->first(); doc !=0; doc=pDocList->next()) {
01261     Database::SecondaryIterator<ReadData> name_it( "name", doc, "ReadData" );
01262     assert(name_it.first() == 0);
01263     do {
01264       readmap.insert(make_pair(QString(name_it.answer()->name()), doc));
01265     }while( name_it.next() == 0 );
01266     
01267     
01268   }
01269   for(doc=notOpenBefore.first(); doc !=0; doc=notOpenBefore.next()) {
01270     Database::SecondaryIterator<ReadData> name_it( "name", doc, "ReadData" );
01271     assert(name_it.first() == 0);
01272     do {
01273       readmap.insert(make_pair(name_it.answer()->name(), doc));
01274       
01275     }while( name_it.next() == 0 );
01276     
01277     
01278   }
01279   
01280 }

void TrapperApp::open_docs_not_already_open QPtrList< TrapperDoc > &  notOpenBefore  )  [private]
 

opens contigs that weren't already open and put them in list. User is responsible for deleting docs after use

Definition at line 1219 of file trapper.cpp.

References contigNamesInProjectDir(), dbenv, TrapperDoc::newDocument(), TrapperDoc::openDocument(), TrapperDoc::pathName(), pDocList, and projectDir.

Referenced by exportToFile(), slotChromatImport(), slotMateImport(), and slotPhdImport().

01220 {
01221 
01222   TrapperDoc* doc;
01223   set<QString> alreadyOpen;
01224   
01225   for(doc=pDocList->first(); doc !=0; doc=pDocList->next()) {
01226     
01227     alreadyOpen.insert(doc->pathName().section('/', -2));
01228   }
01229   
01230 
01231   QStringList contigs = contigNamesInProjectDir();
01232   
01233   for ( QStringList::Iterator it = contigs.begin(); it != contigs.end(); ++it ) {
01234     
01235     
01236     if ( *it != "." && *it != ".." && alreadyOpen.find( *it ) == alreadyOpen.end() ) {
01237       
01238       
01239       TrapperDoc* tdoc = new TrapperDoc(dbenv);
01240       tdoc->newDocument();
01241       if ( !tdoc->openDocument(projectDir + "/" + *it ) ) {
01242         QMessageBox::critical(thi