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()));
51 closeAction = new QAction(tr("&Close"), this);
52 closeAction->setStatusTip(tr("Close this window"));
53 connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
55 createNewAnalysisAction = new QAction(tr("Define Analysis"), this);
56 connect(createNewAnalysisAction, SIGNAL(triggered()),
57 this, SLOT(createNewAnalysis()));
59 createSubAnalysisAction = new QAction(tr("Define SubAnalysis"), this);
60 connect(createSubAnalysisAction, SIGNAL(triggered()),
61 this, SLOT(createSubAnalysis()));
63 loadMotifListAction = new QAction(tr("Load Motif List"), this);
64 connect(loadMotifListAction, SIGNAL(triggered()),
65 this, SLOT(loadMotifList()));
67 loadMupaAction = new QAction(tr("Load Mussa Parameters"), this);
68 connect(loadMupaAction, SIGNAL(triggered()),
69 this, SLOT(loadMupa()));
71 loadSavedAnalysisAction = new QAction(tr("Load &Analysis"), this);
72 connect(loadSavedAnalysisAction, SIGNAL(triggered()),
73 this, SLOT(loadSavedAnalysis()));
75 saveMotifListAction = new QAction(tr("Save Motifs"), this);
76 connect(saveMotifListAction, SIGNAL(triggered()),
77 this, SLOT(saveMotifList()));
79 showMussaViewToolbarAction = new QAction(tr("Show Toolbar"), this);
80 connect(showMussaViewToolbarAction, SIGNAL(triggered()),
81 this, SLOT(showMussaToolbar()));
82 showMussaViewToolbarAction->setCheckable(true);
83 showMussaViewToolbarAction->setChecked(true);
85 toggleMotifsAction = new QAction(tr("Toggle Motifs"), this);
86 connect(toggleMotifsAction, SIGNAL(triggered()),
87 this, SLOT(toggleMotifs()));
89 toggleMotifsAction->setCheckable(true);
90 toggleMotifsAction->setIcon(QIcon("icons/motif_icon.png"));
93 void PathWindow::setupMainMenu()
95 // we need to run setupActions first
96 assert (closeAction != 0);
99 newMenu = menuBar()->addMenu(tr("&File"));
100 newMenu->addAction(createNewAnalysisAction);
101 newMenu->addAction(loadMupaAction);
102 newMenu->addAction(loadSavedAnalysisAction);
103 newMenu->addAction(createSubAnalysisAction);
104 newMenu->addSeparator();
105 newMenu->addAction(loadMotifListAction);
106 newMenu->addAction(saveMotifListAction);
107 newMenu->addSeparator();
108 newMenu->addAction(closeAction);
110 newMenu = menuBar()->addMenu(tr("&View"));
111 newMenu->addAction(showMussaViewToolbarAction);
113 newMenu = menuBar()->addMenu(tr("&Help"));
114 newMenu->addAction(aboutAction);
117 void PathWindow::about()
119 QMessageBox::about(this, tr("About mussa"),
120 tr("Welcome to Multiple Species Sequence Analysis\n"
121 "(c) 2005-2006 California Institute of Technology\n"
122 "Tristan De Buysscher, Diane Trout\n"));
125 void PathWindow::createNewAnalysis()
130 void PathWindow::createSubAnalysis()
135 void PathWindow::loadMotifList()
140 void PathWindow::loadMupa()
142 QString caption("Load a mussa parameter file");
143 QString filter("Mussa Parameters (*.mupa)");
144 QString mupa_path = QFileDialog::getOpenFileName(this,
148 mussaAnalysis.load_mupa_file(mupa_path.toStdString());
151 void PathWindow::loadSavedAnalysis()
156 void PathWindow::saveMotifList()
161 void PathWindow::showMussaToolbar()
163 std::clog << "isVis?" << mussaViewTB->isVisible() <<std::endl;
164 if (mussaViewTB->isVisible())
168 std::clog << "isVis?" << mussaViewTB->isVisible() <<std::endl;
171 void PathWindow::toggleMotifs()
176 void PathWindow::NotImplementedBox()
178 QMessageBox::warning(this, QObject::tr("mussa"), QObject::tr("Not implemented yet"));