diff options
author | Pierre Rossi <pierre.rossi@nokia.com> | 2009-12-08 21:13:58 +0100 |
---|---|---|
committer | Pierre Rossi <pierre.rossi@nokia.com> | 2009-12-09 12:58:22 +0100 |
commit | cdf2f70c60daa6c5ab8f6719c5de9d51a14ded84 (patch) | |
tree | c3420c63911896ba3bad1a2cb110ca81f93d4608 /src | |
parent | fdc246397130b73457237feaa01dfdb3b099a152 (diff) | |
download | qt-creator-cdf2f70c60daa6c5ab8f6719c5de9d51a14ded84.tar.gz |
"Grayout" the background of the output window on re-run configuration
Maybe we'll need to add an option to toggle that on, or tweak the
blending (50:50 at the moment)
Reviewed-by: dt
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/projectexplorer/outputwindow.cpp | 28 | ||||
-rw-r--r-- | src/plugins/projectexplorer/outputwindow.h | 1 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index 45bdbad743..7bacf49336 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -200,7 +200,8 @@ void OutputPane::createNewOutputWindow(RunControl *rc) delete old; m_outputWindows.remove(old); OutputWindow *ow = static_cast<OutputWindow *>(m_tabWidget->widget(i)); - ow->appendOutput("");//New line + ow->grayOutOldContent(); + ow->verticalScrollBar()->setValue(ow->verticalScrollBar()->maximum()); m_outputWindows.insert(rc, ow); found = true; break; @@ -243,9 +244,14 @@ void OutputPane::insertLine() void OutputPane::reRunRunControl() { - RunControl *rc = runControlForTab(m_tabWidget->currentIndex()); - if (rc->runConfiguration()->project() != 0) + int index = m_tabWidget->currentIndex(); + RunControl *rc = runControlForTab(index); + if (rc->runConfiguration() && rc->runConfiguration()->project() != 0) { + OutputWindow *ow = static_cast<OutputWindow *>(m_tabWidget->widget(index)); + ow->grayOutOldContent(); + ow->verticalScrollBar()->setValue(ow->verticalScrollBar()->maximum()); rc->start(); + } } void OutputPane::stopRunControl() @@ -458,6 +464,22 @@ void OutputWindow::insertLine() enableUndoRedo(); } +void OutputWindow::grayOutOldContent() +{ + QTextCursor cursor = textCursor(); + cursor.select(QTextCursor::Document); + QTextBlockFormat tbf; + const QColor bkgColor = palette().window().color(); + const QColor fgdColor = palette().windowText().color(); + tbf.setBackground(QColor((0.5 * bkgColor.red() + 0.5* fgdColor.red()),\ + (0.5 * bkgColor.green() + 0.5* fgdColor.green()),\ + (0.5 * bkgColor.blue() + 0.5* fgdColor.blue()) )); + cursor.mergeBlockFormat(tbf); + + cursor.movePosition(QTextCursor::End); + cursor.insertBlock(QTextBlockFormat()); +} + void OutputWindow::enableUndoRedo() { setMaximumBlockCount(0); diff --git a/src/plugins/projectexplorer/outputwindow.h b/src/plugins/projectexplorer/outputwindow.h index ce81025bdb..e2175deaa5 100644 --- a/src/plugins/projectexplorer/outputwindow.h +++ b/src/plugins/projectexplorer/outputwindow.h @@ -125,6 +125,7 @@ public: void appendOutput(const QString &out); void appendOutputInline(const QString &out); void insertLine(); + void grayOutOldContent(); void showEvent(QShowEvent *); |