1 #include "qui/PathWindow.h"
14 #include "qui/PathScene.h"
15 #include "qui/ThresholdWidget.h"
19 PathWindow::PathWindow(QWidget *) :
20 closeAction(0) // initialize one of the pointers to null as a saftey flag
25 scene = new PathScene(10000, 10, this);
26 //This next setWhatsThis function prevents
27 // a segfault when using WhatsThis feature with
29 scene->setWhatsThis(tr("Mussa in OpenGL!"));
30 setCentralWidget(scene);
32 mussaViewTB = new QToolBar("Path Views");
33 mussaViewTB->addAction(toggleMotifsAction);
35 ThresholdWidget *threshold = new ThresholdWidget;
36 threshold->setRange(21, 30);
37 scene->setClipPlane(21);
38 connect(threshold, SIGNAL(thresholdChanged(int)),
39 scene, SLOT(setClipPlane(int)));
40 mussaViewTB->addWidget(threshold);
41 addToolBar(mussaViewTB);
43 statusBar()->showMessage("Welcome to mussa", 2000);
46 void PathWindow::setupActions()
48 // we really don't want to run this more than once.
49 assert (closeAction == 0);
51 // the ever popular about box
52 aboutAction = new QAction(tr("&About"), this);
53 connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
54 aboutAction->setIcon(QIcon("icons/info.png"));
57 closeAction = new QAction(tr("&Close"), this);
58 closeAction->setStatusTip(tr("Close this window"));
59 connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
60 closeAction->setIcon(QIcon("icons/exit.png"));
62 createNewAnalysisAction = new QAction(tr("Define Analysis"), this);
63 connect(createNewAnalysisAction, SIGNAL(triggered()),
64 this, SLOT(createNewAnalysis()));
65 createNewAnalysisAction->setIcon(QIcon("icons/filenew.png"));
67 createSubAnalysisAction = new QAction(tr("Define SubAnalysis"), this);
68 connect(createSubAnalysisAction, SIGNAL(triggered()),
69 this, SLOT(createSubAnalysis()));
71 loadMotifListAction = new QAction(tr("Load Motif List"), this);
72 connect(loadMotifListAction, SIGNAL(triggered()),
73 this, SLOT(loadMotifList()));
75 loadMupaAction = new QAction(tr("Load Mussa Parameters"), this);
76 connect(loadMupaAction, SIGNAL(triggered()),
77 this, SLOT(loadMupa()));
79 loadSavedAnalysisAction = new QAction(tr("Load &Analysis"), this);
80 connect(loadSavedAnalysisAction, SIGNAL(triggered()),
81 this, SLOT(loadSavedAnalysis()));
82 loadSavedAnalysisAction->setIcon(QIcon("icons/fileopen.png"));
84 saveMotifListAction = new QAction(tr("Save Motifs"), this);
85 connect(saveMotifListAction, SIGNAL(triggered()),
86 this, SLOT(saveMotifList()));
87 saveMotifListAction->setIcon(QIcon("icons/filesave.png"));
89 showMussaViewToolbarAction = new QAction(tr("Show Toolbar"), this);
90 connect(showMussaViewToolbarAction, SIGNAL(triggered()),
91 this, SLOT(showMussaToolbar()));
92 showMussaViewToolbarAction->setCheckable(true);
93 showMussaViewToolbarAction->setChecked(true);
95 toggleMotifsAction = new QAction(tr("Toggle Motifs"), this);
96 connect(toggleMotifsAction, SIGNAL(triggered()),
97 this, SLOT(toggleMotifs()));
98 toggleMotifsAction->setCheckable(true);
99 toggleMotifsAction->setIcon(QIcon("icons/motif_icon.png"));
100 toggleMotifsAction->setWhatsThis(tr("Toggle motif annotations on/off\n\n"
101 "You can load motif annotations via "
102 "'File->Load Motif List' menu option."));
104 whatsThisAction = QWhatsThis::createAction(this);
105 whatsThisAction->setIcon(QIcon("icons/help.png"));
108 void PathWindow::setupMainMenu()
110 // we need to run setupActions first
111 assert (closeAction != 0);
114 newMenu = menuBar()->addMenu(tr("&File"));
115 newMenu->addAction(createNewAnalysisAction);
116 newMenu->addAction(loadMupaAction);
117 newMenu->addAction(loadSavedAnalysisAction);
118 newMenu->addAction(createSubAnalysisAction);
119 newMenu->addSeparator();
120 newMenu->addAction(loadMotifListAction);
121 newMenu->addAction(saveMotifListAction);
122 newMenu->addSeparator();
123 newMenu->addAction(closeAction);
125 newMenu = menuBar()->addMenu(tr("&View"));
126 newMenu->addAction(showMussaViewToolbarAction);
128 newMenu = menuBar()->addMenu(tr("&Help"));
129 newMenu->addAction(whatsThisAction);
130 newMenu->addSeparator();
131 newMenu->addAction(aboutAction);
134 void PathWindow::about()
136 QMessageBox::about(this, tr("About mussa"),
137 tr("Welcome to Multiple Species Sequence Analysis\n"
138 "(c) 2005-2006 California Institute of Technology\n"
139 "Tristan De Buysscher, Diane Trout\n"));
142 void PathWindow::createNewAnalysis()
147 void PathWindow::createSubAnalysis()
152 void PathWindow::loadMotifList()
157 void PathWindow::loadMupa()
159 QString caption("Load a mussa parameter file");
160 QString filter("Mussa Parameters (*.mupa)");
161 QString mupa_path = QFileDialog::getOpenFileName(this,
165 scene->mussaAnalysis.load_mupa_file(mupa_path.toStdString());
168 void PathWindow::loadSavedAnalysis()
173 void PathWindow::saveMotifList()
178 void PathWindow::showMussaToolbar()
180 std::clog << "isVis?" << mussaViewTB->isVisible() <<std::endl;
181 if (mussaViewTB->isVisible())
185 std::clog << "isVis?" << mussaViewTB->isVisible() <<std::endl;
188 void PathWindow::toggleMotifs()
193 void PathWindow::NotImplementedBox()
195 QMessageBox::warning(this, QObject::tr("mussa"), QObject::tr("Not implemented yet"));