Skip to content

Commit

Permalink
Shell: Immediately update log history when receiving entries
Browse files Browse the repository at this point in the history
Things like autocompletions are better printed sooner rather than
later for better UX.
  • Loading branch information
skyjake committed Mar 20, 2014
1 parent 758c0f7 commit fd6d31f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions doomsday/tools/shell/shell-gui/src/linkwindow.cpp
Expand Up @@ -90,6 +90,7 @@ DENG2_PIMPL(LinkWindow)
{
// Configure the log buffer.
logBuffer.setMaxEntryCount(50); // buffered here rather than appBuffer
logBuffer.setAutoFlushInterval(0.1);
}

~Instance()
Expand Down
2 changes: 2 additions & 0 deletions doomsday/tools/shell/shell-gui/src/qtguiapp.cpp
Expand Up @@ -35,6 +35,8 @@ DENG2_PIMPL(QtGuiApp)
LogBuffer::setAppBuffer(logBuffer);
Clock::setAppClock(&clock);
Animation::setClock(&clock);

logBuffer.setAutoFlushInterval(0.1);
}

~Instance()
Expand Down
16 changes: 15 additions & 1 deletion doomsday/tools/shell/shell-gui/src/qtrootwidget.cpp
Expand Up @@ -29,7 +29,8 @@
using namespace de;
using namespace de::shell;

const int BLINK_INTERVAL = 500; // ms
static int const REFRESH_INTERVAL = 1000 / 30; // ms
static int const BLINK_INTERVAL = 500; // ms

#ifdef MACOSX
# define CONTROL_MOD Qt::MetaModifier
Expand Down Expand Up @@ -94,6 +95,11 @@ QtRootWidget::QtRootWidget(QWidget *parent)
{
setFocusPolicy(Qt::StrongFocus);

// Continually check for need to update.
QTimer *refresh = new QTimer(this);
connect(refresh, SIGNAL(timeout()), this, SLOT(updateIfRequested()));
refresh->start(REFRESH_INTERVAL);

// Blinking timers.
d->blinkTimer = new QTimer(this);
connect(d->blinkTimer, SIGNAL(timeout()), this, SLOT(blink()));
Expand Down Expand Up @@ -256,6 +262,14 @@ void QtRootWidget::paintEvent(QPaintEvent *)
}
}

void QtRootWidget::updateIfRequested()
{
if(d->root.drawWasRequested())
{
update();
}
}

void QtRootWidget::blink()
{
d->blinkVisible = !d->blinkVisible;
Expand Down
1 change: 1 addition & 0 deletions doomsday/tools/shell/shell-gui/src/qtrootwidget.h
Expand Up @@ -56,6 +56,7 @@ class QtRootWidget : public QWidget
void paintEvent(QPaintEvent *ev);

protected slots:
void updateIfRequested();
void blink();
void cursorBlink();

Expand Down
1 change: 1 addition & 0 deletions doomsday/tools/shell/shell-text/src/cursesapp.cpp
Expand Up @@ -88,6 +88,7 @@ DENG2_PIMPL(CursesApp)
Instance(Public &i) : Base(i), unicodeContinuation(0), rootWidget(0)
{
logBuffer.enableStandardOutput(false);
logBuffer.setAutoFlushInterval(0.1);

de::LogBuffer::setAppBuffer(logBuffer);
de::Animation::setClock(&clock);
Expand Down
1 change: 1 addition & 0 deletions doomsday/tools/shell/shell-text/src/shellapp.cpp
Expand Up @@ -142,6 +142,7 @@ ShellApp::ShellApp(int &argc, char **argv)
// Configure the log buffer.
LogBuffer &buf = LogBuffer::appBuffer();
buf.setMaxEntryCount(50); // buffered here rather than appBuffer
buf.enableFlushing();
buf.addSink(d->log->logSink());

QStringList args = arguments();
Expand Down

0 comments on commit fd6d31f

Please sign in to comment.