1 #include "qui/PathWindow.h"
13 #include "qui/PathScene.h"
14 #include "qui/ThresholdWidget.h"
18 PathWindow::PathWindow(QWidget *) :
19 closeAction(0) // initialize one of the pointers to null as a saftey flag
24 scene = new PathScene(10000, 10, this);
25 setCentralWidget(scene);
27 mussaViewTB = new QToolBar("Path Views");
28 mussaViewTB->addAction(toggleMotifsAction);
30 ThresholdWidget *threshold = new ThresholdWidget;
31 threshold->setRange(21, 30);
32 scene->setClipPlane(21);
33 connect(threshold, SIGNAL(thresholdChanged(int)),
34 scene, SLOT(setClipPlane(int)));
35 mussaViewTB->addWidget(threshold);
36 addToolBar(mussaViewTB);
38 statusBar()->showMessage("Welcome to mussa", 2000);
41 void PathWindow::setupActions()
43 // we really don't want to run this more than once.
44 assert (closeAction == 0);
46 // the ever popular about box
47 aboutAction = new QAction(tr("&About"), this);
48 connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
49 aboutAction->setIcon(QIcon("icons/info.png"));
52 closeAction = new QAction(tr("&Close"), this);
53 closeAction->setStatusTip(tr("Close this window"));
54 connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
55 closeAction->setIcon(QIcon("icons/exit.png"));
57 createNewAnalysisAction = new QAction(tr("Define Analysis"), this);
58 connect(createNewAnalysisAction, SIGNAL(triggered()),
59 this, SLOT(createNewAnalysis()));
60 createNewAnalysisAction->setIcon(QIcon("icons/filenew.png"));
62 createSubAnalysisAction = new QAction(tr("Define SubAnalysis"), this);
63 connect(createSubAnalysisAction, SIGNAL(triggered()),
64 this, SLOT(createSubAnalysis()));
66 loadMotifListAction = new QAction(tr("Load Motif List"), this);
67 connect(loadMotifListAction, SIGNAL(triggered()),
68 this, SLOT(loadMotifList()));
70 loadMupaAction = new QAction(tr("Load Mussa Parameters"), this);
71 connect(loadMupaAction, SIGNAL(triggered()),
72 this, SLOT(loadMupa()));
74 loadSavedAnalysisAction = new QAction(tr("Load &Analysis"), this);
75 connect(loadSavedAnalysisAction, SIGNAL(triggered()),
76 this, SLOT(loadSavedAnalysis()));
77 loadSavedAnalysisAction->setIcon(QIcon("icons/fileopen.png"));
79 saveMotifListAction = new QAction(tr("Save Motifs"), this);
80 connect(saveMotifListAction, SIGNAL(triggered()),
81 this, SLOT(saveMotifList()));
82 saveMotifListAction->setIcon(QIcon("icons/filesave.png"));
84 showMussaViewToolbarAction = new QAction(tr("Show Toolbar"), this);
85 connect(showMussaViewToolbarAction, SIGNAL(triggered()),
86 this, SLOT(showMussaToolbar()));
87 showMussaViewToolbarAction->setCheckable(true);
88 showMussaViewToolbarAction->setChecked(true);
90 toggleMotifsAction = new QAction(tr("Toggle Motifs"), this);
91 connect(toggleMotifsAction, SIGNAL(triggered()),
92 this, SLOT(toggleMotifs()));
94 toggleMotifsAction->setCheckable(true);
95 toggleMotifsAction->setIcon(QIcon("icons/motif_icon.png"));
98 void PathWindow::setupMainMenu()
100 // we need to run setupActions first
101 assert (closeAction != 0);
104 newMenu = menuBar()->addMenu(tr("&File"));
105 newMenu->addAction(createNewAnalysisAction);
106 newMenu->addAction(loadMupaAction);
107 newMenu->addAction(loadSavedAnalysisAction);
108 newMenu->addAction(createSubAnalysisAction);
109 newMenu->addSeparator();
110 newMenu->addAction(loadMotifListAction);
111 newMenu->addAction(saveMotifListAction);
112 newMenu->addSeparator();
113 newMenu->addAction(closeAction);
115 newMenu = menuBar()->addMenu(tr("&View"));
116 newMenu->addAction(showMussaViewToolbarAction);
118 newMenu = menuBar()->addMenu(tr("&Help"));
119 newMenu->addAction(aboutAction);
122 void PathWindow::about()
124 QMessageBox::about(this, tr("About mussa"),
125 tr("Welcome to Multiple Species Sequence Analysis\n"
126 "(c) 2005-2006 California Institute of Technology\n"
127 "Tristan De Buysscher, Diane Trout\n"));
130 void PathWindow::createNewAnalysis()
135 void PathWindow::createSubAnalysis()
140 void PathWindow::loadMotifList()
145 void PathWindow::loadMupa()
147 QString caption("Load a mussa parameter file");
148 QString filter("Mussa Parameters (*.mupa)");
149 QString mupa_path = QFileDialog::getOpenFileName(this,
153 mussaAnalysis.load_mupa_file(mupa_path.toStdString());
156 void PathWindow::loadSavedAnalysis()
161 void PathWindow::saveMotifList()
166 void PathWindow::showMussaToolbar()
168 std::clog << "isVis?" << mussaViewTB->isVisible() <<std::endl;
169 if (mussaViewTB->isVisible())
173 std::clog << "isVis?" << mussaViewTB->isVisible() <<std::endl;
176 void PathWindow::toggleMotifs()
181 void PathWindow::NotImplementedBox()
183 QMessageBox::warning(this, QObject::tr("mussa"), QObject::tr("Not implemented yet"));