Skip to content

Commit

Permalink
Shell|GUI: Log local messages in the active connection window
Browse files Browse the repository at this point in the history
For instance, the possible completions from the command line.
  • Loading branch information
skyjake committed Aug 6, 2013
1 parent c08f555 commit 9133cb2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions doomsday/tools/shell/shell-gui/src/linkwindow.cpp
Expand Up @@ -95,6 +95,12 @@ DENG2_PIMPL(LinkWindow)
#endif
}

~Instance()
{
// Make sure the local sink is removed.
LogBuffer::appBuffer().removeSink(console->log().logSink());
}

void updateStyle()
{
if(self.isConnected())
Expand Down Expand Up @@ -291,6 +297,22 @@ bool LinkWindow::isConnected() const
return d->link && d->link->status() != Link::Disconnected;
}

void LinkWindow::changeEvent(QEvent *ev)
{
if(ev->type() == QEvent::ActivationChange)
{
if(isActiveWindow())
{
// Log local messages here.
LogBuffer::appBuffer().addSink(d->console->log().logSink());
}
else
{
LogBuffer::appBuffer().removeSink(d->console->log().logSink());
}
}
}

void LinkWindow::closeEvent(QCloseEvent *event)
{
/*
Expand Down
1 change: 1 addition & 0 deletions doomsday/tools/shell/shell-gui/src/linkwindow.h
Expand Up @@ -38,6 +38,7 @@ class LinkWindow : public QMainWindow
bool isConnected() const;

// Qt events.
void changeEvent(QEvent *);
void closeEvent(QCloseEvent *);

signals:
Expand Down

0 comments on commit 9133cb2

Please sign in to comment.