I went off on a fools errand of trying to get rid of the QObject::moveToThread
warnings that Qt was spitting out when trying to prepare an icon.
Qt does prefer widgets to be dynamically constructed and to have their
parent widget set, which is what I tried to do to cut down on the
useless chatter.
(Note the chatter only happens on OS X when the frameworks have been installed
into the application bundle).
14 files changed:
MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) :
QMainWindow(parent),
analysis(analysis_),
MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) :
QMainWindow(parent),
analysis(analysis_),
- default_dir(new QDir(QDir::home().absolutePath())),
- setup_analysis_dialog(new MussaSetupDialog(this)),
- subanalysis_window(new SubanalysisWindow(analysis)),
- browser(new SequenceBrowserWidget(default_dir, this)),
- mussaViewTB(new QToolBar("Path Views")),
- zoom(new ZoomWidget),
- threshold(new ThresholdWidget),
+ setup_analysis_dialog(0),
+ browser(0),
+ mussaViewTB(0),
+ zoom(0),
+ threshold(0),
progress_dialog(0),
aboutAction(0),
closeAction(0),
progress_dialog(0),
aboutAction(0),
closeAction(0),
viewMussaAlignmentAction(0),
manualAssistant(0)
{
viewMussaAlignmentAction(0),
manualAssistant(0)
{
+ setupMainMenu();
+
+ setWindowIcon(QIcon(":/icons/mussa.png"));
+ default_dir.reset(new QDir(QDir::home().absolutePath()));
- //This next setWhatsThis function prevents
- // a segfault when using WhatsThis feature with
- // opengl widget.
- //scene->setWhatsThis(tr("Mussa in OpenGL!"));
setCentralWidget(browser);
// well updatePosition isn't quite right as we really just need
// to call update()
setCentralWidget(browser);
// well updatePosition isn't quite right as we really just need
// to call update()
connect(this, SIGNAL(changedMotifs()), this, SLOT(updateAnnotations()));
connect(browser, SIGNAL(basepairsCopied(size_t)),
this, SLOT(showBasePairsCopied(size_t)));
connect(this, SIGNAL(changedMotifs()), this, SLOT(updateAnnotations()));
connect(browser, SIGNAL(basepairsCopied(size_t)),
this, SLOT(showBasePairsCopied(size_t)));
-
- //mussaViewTB->addAction(toggleMotifsAction);
- mussaViewTB->addWidget(zoom);
-
connect(zoom, SIGNAL(valueChanged(double)),
browser, SLOT(setZoom(double)));
connect(zoom, SIGNAL(valueChanged(double)),
browser, SLOT(setZoom(double)));
-
- // threshold range is set in updateAnalysis
-
- //scene->setClipPlane(20);
- // FIXME: for when we get the paths drawn at the appropriate depth
- //connect(threshold, SIGNAL(thresholdChanged(int)),
- // this, SLOT(setClipPlane(int)));
+ mussaViewTB->addWidget(zoom);
+
+ // threshold range is set in updateAnalysis
connect(threshold, SIGNAL(thresholdChanged(int)),
this, SLOT(setSoftThreshold(int)));
mussaViewTB->addWidget(threshold);
connect(threshold, SIGNAL(thresholdChanged(int)),
this, SLOT(setSoftThreshold(int)));
mussaViewTB->addWidget(threshold);
addToolBar(mussaViewTB);
statusBar()->showMessage("Welcome to mussa", 2000);
addToolBar(mussaViewTB);
statusBar()->showMessage("Welcome to mussa", 2000);
// FIXME: we should start refactoring the connect call to updateAnalysis or something
if (analysis) {
connect(analysis.get(), SIGNAL(progress(const QString&, int, int)),
// FIXME: we should start refactoring the connect call to updateAnalysis or something
if (analysis) {
connect(analysis.get(), SIGNAL(progress(const QString&, int, int)),
mussaManualAssistantAction = new QAction(tr("Mussagl Manual..."), this);
mussaManualAssistantAction->setIcon(QIcon(":/icons/contents.png"));
connect(mussaManualAssistantAction, SIGNAL(triggered()),
mussaManualAssistantAction = new QAction(tr("Mussagl Manual..."), this);
mussaManualAssistantAction->setIcon(QIcon(":/icons/contents.png"));
connect(mussaManualAssistantAction, SIGNAL(triggered()),
- this, SLOT(showManual()));
+ this, SLOT(showManual()));
newMussaWindowAction = new QAction(tr("&New Mussa Window"), this);
newMussaWindowAction->setStatusTip("open another mussa window to allow comparing results");
newMussaWindowAction = new QAction(tr("&New Mussa Window"), this);
newMussaWindowAction->setStatusTip("open another mussa window to allow comparing results");
+void MussaWindow::setupWidgets()
+{
+ setup_analysis_dialog = new MussaSetupDialog;
+ subanalysis_window.reset(new SubanalysisWindow(analysis));
+ browser = new SequenceBrowserWidget(default_dir);
+ mussaViewTB = new QToolBar("Path Views", this);
+ zoom = new ZoomWidget(mussaViewTB);
+ threshold = new ThresholdWidget(mussaViewTB);
+}
+
void MussaWindow::setupAssistant()
{
#if defined(QT_QTASSISTANT_FOUND)
void MussaWindow::setupAssistant()
{
#if defined(QT_QTASSISTANT_FOUND)
void closeEvent(QCloseEvent *event);
//! initialize this windows menu object
void setupMainMenu();
void closeEvent(QCloseEvent *event);
//! initialize this windows menu object
void setupMainMenu();
+ //! initialize all of our widgets
+ void setupWidgets();
//! initialize assistant client
void setupAssistant();
//! stub function to fill in QActions
//! initialize assistant client
void setupAssistant();
//! stub function to fill in QActions
// LCDRange.cpp
ThresholdWidget::ThresholdWidget(QWidget *parent, int min, int max)
: QWidget(parent),
// LCDRange.cpp
ThresholdWidget::ThresholdWidget(QWidget *parent, int min, int max)
: QWidget(parent),
- layout(new QHBoxLayout(this)),
- basepair_spinner(new QSpinBox(this)),
- window_size_label(new QLabel(this)),
- percent_label(new QLabel(this))
+ layout(0),
+ basepair_spinner(0),
+ window_size_label(0),
+ percent_label(0)
basepair_spinner->setWhatsThis("How many base pairs need to be conserved in the window size");
setRange(min, max);
basepair_spinner->setWhatsThis("How many base pairs need to be conserved in the window size");
setRange(min, max);
+void ThresholdWidget::setupWidgets()
+{
+ layout = new QHBoxLayout(this);
+ basepair_spinner = new QSpinBox(this);
+ window_size_label = new QLabel(this);
+ percent_label = new QLabel(this);
+}
+
void ThresholdWidget::setRange(int min, int max)
{
basepair_spinner->setRange(min, max);
void ThresholdWidget::setRange(int min, int max)
{
basepair_spinner->setRange(min, max);
void thresholdChanged(int new_threshold);
protected:
void thresholdChanged(int new_threshold);
protected:
QHBoxLayout *layout;
QSpinBox *basepair_spinner;
QLabel *window_size_label;
QHBoxLayout *layout;
QSpinBox *basepair_spinner;
QLabel *window_size_label;
ZoomWidget::ZoomWidget(QWidget *parent)
: QWidget(parent),
ZoomWidget::ZoomWidget(QWidget *parent)
: QWidget(parent),
- zoom(new QDoubleSpinBox),
+ zoom = new QDoubleSpinBox(this);
zoom->setRange(0.01, max_zoom_size);
zoom->setSingleStep(0.1);
connect(zoom, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
zoom->setRange(0.01, max_zoom_size);
zoom->setSingleStep(0.1);
connect(zoom, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(zoomLabel);
layout->addWidget(zoom);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(zoomLabel);
layout->addWidget(zoom);
- layout->addWidget(new QLabel("bp/pix"));
+ layout->addWidget(new QLabel("bp/pix", this));
setLayout(layout);
setToolTip(tr("Zoom"));
setLayout(layout);
setToolTip(tr("Zoom"));
MotifEditor::MotifEditor(MussaRef m, QWidget *parent)
: QWidget(parent),
analysis(m),
MotifEditor::MotifEditor(MussaRef m, QWidget *parent)
: QWidget(parent),
analysis(m),
- editor_layout(new QVBoxLayout(parent)),
- button_layout(new QHBoxLayout(parent)),
- table(new QTableView(this)),
- delegate(new MotifEditorDelegate(this)),
- applyButton(new QPushButton("apply")),
+ editor_layout(0),
+ button_layout(0),
+ table(0),
+ delegate(0),
+ applyButton(0),
assert (m != 0);
const set<Sequence> &motif = analysis->motifs();
vector<Sequence> motif_seq(motif.begin(), motif.end());
assert (m != 0);
const set<Sequence> &motif = analysis->motifs();
vector<Sequence> motif_seq(motif.begin(), motif.end());
+void MotifEditor::setupWidgets()
+{
+ editor_layout = new QVBoxLayout(this);
+ button_layout = new QHBoxLayout(this);
+ table = new QTableView(this);
+ delegate = new MotifEditorDelegate(this);
+ applyButton = new QPushButton("apply");
+}
+
void MotifEditor::updateModel()
{
MotifModel *new_model = new MotifModel(analysis);
void MotifEditor::updateModel()
{
MotifModel *new_model = new MotifModel(analysis);
void changedMotifs();
private:
void changedMotifs();
private:
+ //! initialize all our gui widgets
+ void setupWidgets();
MussaRef analysis;
QPushButton *applyButton;
MussaRef analysis;
QPushButton *applyButton;
cancelPushButton(new QPushButton(tr("Cancel"))),
seqSetupFrame(0)
{
cancelPushButton(new QPushButton(tr("Cancel"))),
seqSetupFrame(0)
{
+ analysisNameLineEdit = new QLineEdit;
+ windowEdit = new QSpinBox;
+ thresholdEdit = new QSpinBox;
+ numOfSequencesSpinBox = new QSpinBox;
+ createPushButton = new QPushButton(tr("Create"));
+ cancelPushButton = new QPushButton(tr("Cancel"));
+
// Analysis name
QLabel *analysisNameLabel = new QLabel(tr("Analysis Name"));
analysisNameLabel->setBuddy(analysisNameLineEdit);
// Analysis name
QLabel *analysisNameLabel = new QLabel(tr("Analysis Name"));
analysisNameLabel->setBuddy(analysisNameLineEdit);
void updateThreshold(int);
private:
void updateThreshold(int);
private:
QLineEdit *analysisNameLineEdit;
QSpinBox *windowEdit;
QSpinBox *thresholdEdit;
QLineEdit *analysisNameLineEdit;
QSpinBox *windowEdit;
QSpinBox *thresholdEdit;
//opts.doc_dir = get_doc_dir();
QApplication app(argc, argv, opts.useGUI);
Q_INIT_RESOURCE(icons);
//opts.doc_dir = get_doc_dir();
QApplication app(argc, argv, opts.useGUI);
Q_INIT_RESOURCE(icons);
- const QIcon mussa_icon(":/icons/mussa.png");
- app.setWindowIcon(mussa_icon);
initialize_mussa(opts, argc, argv);
if (opts.analysis == 0) {
return 1;
}
initialize_mussa(opts, argc, argv);
if (opts.analysis == 0) {
return 1;
}
-
- ThreadManager &thread = ThreadManagerFactory();
try {
#ifdef USE_PYTHON
if (opts.runAsPythonInterpeter) {
try {
#ifdef USE_PYTHON
if (opts.runAsPythonInterpeter) {
+ ThreadManager &thread = ThreadManagerFactory();
// allow the user to keep the interpreter open even after
// closing all the windows
app.setQuitOnLastWindowClosed(false);
// allow the user to keep the interpreter open even after
// closing all the windows
app.setQuitOnLastWindowClosed(false);
} else
#endif /* USE_PYTHON */
if (opts.useGUI) {
} else
#endif /* USE_PYTHON */
if (opts.useGUI) {
- MussaWindow win(opts.analysis);
- win.show();
+ MussaWindow *win = new MussaWindow(opts.analysis);
+ win->show();
ScrollableSequenceBrowser::ScrollableSequenceBrowser(QWidget *parent) :
QWidget(parent),
ScrollableSequenceBrowser::ScrollableSequenceBrowser(QWidget *parent) :
QWidget(parent),
- viewportBar(Qt::Horizontal)
+ sequence_browser(0),
+ viewportBar(0)
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ sequence_browser = new SequenceBrowser;
+ viewportBar = new QScrollBar(Qt::Horizontal);
// construct central opengl widget
// construct central opengl widget
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(&sequence_browser);
- layout->addWidget(&viewportBar);
+ layout->addWidget(sequence_browser);
+ layout->addWidget(viewportBar);
- connect(&viewportBar, SIGNAL(valueChanged(int)),
+ connect(viewportBar, SIGNAL(valueChanged(int)),
this, SLOT(setViewportCenter(int)));
this, SLOT(setViewportCenter(int)));
- connect(&sequence_browser, SIGNAL(viewportChanged()),
+ connect(sequence_browser, SIGNAL(viewportChanged()),
this, SLOT(updateScrollBar()));
setLayout(layout);
this, SLOT(updateScrollBar()));
setLayout(layout);
updateScrollBar();
// enble keyboard input
updateScrollBar();
// enble keyboard input
- viewportBar.setFocusPolicy(Qt::StrongFocus);
+ viewportBar->setFocusPolicy(Qt::StrongFocus);
}
void ScrollableSequenceBrowser::updateScrollBar()
{
}
void ScrollableSequenceBrowser::updateScrollBar()
{
- thumb = (int)sequence_browser.viewportCenter();
- viewportBar.setRange((int)sequence_browser.left(),
- (int)sequence_browser.right());
- viewportBar.setValue(thumb);
- viewportBar.setPageStep(static_cast<int>(sequence_browser.viewportWidth()));
- int step_size = static_cast<int>(sequence_browser.zoom());
+ thumb = (int)sequence_browser->viewportCenter();
+ viewportBar->setRange((int)sequence_browser->left(),
+ (int)sequence_browser->right());
+ viewportBar->setValue(thumb);
+ viewportBar->setPageStep(static_cast<int>(sequence_browser->viewportWidth()));
+ int step_size = static_cast<int>(sequence_browser->zoom());
step_size = step_size > 1 ? step_size : 1;
step_size = step_size > 1 ? step_size : 1;
- viewportBar.setSingleStep(static_cast<int>( step_size ));
+ viewportBar->setSingleStep(static_cast<int>( step_size ));
}
void ScrollableSequenceBrowser::setViewportCenter(int x)
{
if (x != thumb) {
thumb = x;
}
void ScrollableSequenceBrowser::setViewportCenter(int x)
{
if (x != thumb) {
thumb = x;
- sequence_browser.setViewportCenter(thumb);
+ sequence_browser->setViewportCenter(thumb);
+}
\ No newline at end of file
public:
ScrollableSequenceBrowser(QWidget *parent=0);
public:
ScrollableSequenceBrowser(QWidget *parent=0);
- SequenceBrowser sequence_browser;
+ SequenceBrowser *sequence_browser;
- SequenceBrowser& browser() { return sequence_browser; }
- const SequenceBrowser& browser() const { return sequence_browser; }
+ SequenceBrowser& browser() { return *sequence_browser; }
+ const SequenceBrowser& browser() const { return *sequence_browser; }
public slots:
//! update the scrollbar with current viewport information
void updateScrollBar();
public slots:
//! update the scrollbar with current viewport information
void updateScrollBar();
void setViewportCenter(int x);
private:
void setViewportCenter(int x);
private:
- QScrollBar viewportBar;
+ QScrollBar *viewportBar;
SequenceBrowser::SequenceBrowser(QWidget *parent)
: QGLWidget(parent),
rubberBand(0),
SequenceBrowser::SequenceBrowser(QWidget *parent)
: QGLWidget(parent),
rubberBand(0),
- popupMenu(new QMenu(this)),
- copySelectedSequenceAsFastaAction(new QAction(tr("&Copy as Fasta"), this)),
- copySelectedSequenceAsStringAction(new QAction(tr("&Copy Sequence"), this)),
- editSequencePropertiesAction(new QAction(tr("Sequence &Properties"), this))
+ popupMenu(0),
+ copySelectedSequenceAsFastaAction(0),
+ copySelectedSequenceAsStringAction(0),
+ editSequencePropertiesAction(0)
+ popupMenu = new QMenu(this);
+ copySelectedSequenceAsFastaAction = new QAction(tr("&Copy as Fasta"), this);
+ copySelectedSequenceAsStringAction = new QAction(tr("&Copy Sequence"), this);
+ editSequencePropertiesAction = new QAction(tr("Sequence &Properties"), this);
+
connect(copySelectedSequenceAsFastaAction, SIGNAL(triggered()),
this, SLOT(copySelectedSequenceAsFasta()));
popupMenu->addAction(copySelectedSequenceAsFastaAction);
connect(copySelectedSequenceAsFastaAction, SIGNAL(triggered()),
this, SLOT(copySelectedSequenceAsFasta()));
popupMenu->addAction(copySelectedSequenceAsFastaAction);
QWidget *parent
)
: QScrollArea(parent),
QWidget *parent
)
: QScrollArea(parent),
- default_dir(default_dir_),
- left_sidebar(new SequenceBrowserSidebar),
- scrollable_browser(new ScrollableSequenceBrowser),
- right_sidebar(new SequenceBrowserSidebar),
- layout(new QHBoxLayout),
- layout_container(new QWidget(this))
+ left_sidebar(0),
+ scrollable_browser(0),
+ right_sidebar(0),
+ layout(0),
+ layout_container(0)
+ default_dir = default_dir_;
+
+ layout_container = new QWidget(this);
+ layout = new QHBoxLayout(layout_container);
+ left_sidebar = new SequenceBrowserSidebar(layout_container);
+ scrollable_browser = new ScrollableSequenceBrowser(layout_container);
+ right_sidebar = new SequenceBrowserSidebar(layout_container);
+
layout->addWidget(left_sidebar, 0);
layout->addWidget(scrollable_browser, 1);
layout->addWidget(right_sidebar, 0);
layout->addWidget(left_sidebar, 0);
layout->addWidget(scrollable_browser, 1);
layout->addWidget(right_sidebar, 0);