Skip to content

Commit

Permalink
mainwindow: removed status bar ready flag
Browse files Browse the repository at this point in the history
the status bar create function was modified where the signal connection
from the edit box instance was moved to where the rest of the edit box
to main window signals/slots are connected; this allowed the status bar
create function to be called before creating the edit box instance, and
the status bar ready flag was no longer needed to block the update of
the status bar in the program load function, so the flag was removed
  • Loading branch information
thunder422 committed Jan 3, 2014
1 parent 8d6e570 commit ac67892
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
17 changes: 6 additions & 11 deletions mainwindow.cpp
Expand Up @@ -59,6 +59,8 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(programOpen(const QString)));
settingsRestore();

statusBarCreate();

// TODO settings will eventually have info about edit boxes that were open
// TODO that will need to be restored, for now there is a single edit box

Expand All @@ -69,7 +71,6 @@ MainWindow::MainWindow(QWidget *parent) :
// create the starting program edit box
m_editBox = new EditBox(m_program.unit(), this);
setCentralWidget(m_editBox);
m_statusReady = false;

connect(m_editBox->document(), SIGNAL(modificationChanged(bool)),
this, SLOT(setWindowModified(bool)));
Expand All @@ -92,6 +93,9 @@ MainWindow::MainWindow(QWidget *parent) :
connect(m_editBox, SIGNAL(errorsAvailable(bool)),
ui->actionGoPrevError, SLOT(setEnabled(bool)));

connect(m_editBox, SIGNAL(cursorChanged(QString)),
this, SLOT(statusBarUpdate(QString)));

// create actions for edit box context menu
QList<QAction *> actions;
actions.append(ui->actionUndo);
Expand Down Expand Up @@ -148,7 +152,6 @@ MainWindow::MainWindow(QWidget *parent) :
setCurProgram(""); // clear program path that was restored/set
// TODO should an warning message be issued here?
}
statusBarCreate();

m_guiActive = true;
statusBarUpdate("");
Expand Down Expand Up @@ -191,11 +194,6 @@ void MainWindow::statusBarCreate(void)

statusBar()->addWidget(m_statusPositionLabel);
statusBar()->addWidget(m_statusMessageLabel, 1);

connect(m_editBox, SIGNAL(cursorChanged(QString)),
this, SLOT(statusBarUpdate(QString)));

m_statusReady = true;
}


Expand Down Expand Up @@ -481,10 +479,7 @@ bool MainWindow::programLoad(const QString &programPath)
setWindowModified(false);

setCurProgram(programPath);
if (m_statusReady)
{
statusBar()->showMessage(tr("Program loaded"), 2000);
}
statusBar()->showMessage(tr("Program loaded"), 2000);
return true;
}

Expand Down
1 change: 0 additions & 1 deletion mainwindow.h
Expand Up @@ -103,7 +103,6 @@ private slots:
RecentFiles *m_recentPrograms;
QString m_curDirectory;
ProgramLineDelegate *m_programLineDelegate;
bool m_statusReady;
QLabel *m_statusPositionLabel;
QLabel *m_statusMessageLabel;
};
Expand Down

0 comments on commit ac67892

Please sign in to comment.