Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into gl2-model
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 20, 2014
2 parents 4124e6f + fd6d31f commit 8364af9
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 3 deletions.
7 changes: 7 additions & 0 deletions doomsday/libdeng2/include/de/core/logbuffer.h
Expand Up @@ -150,6 +150,13 @@ class DENG2_PUBLIC LogBuffer : public QObject, public Lockable, DENG2_OBSERVES(F
*/
void enableFlushing(bool yes = true);

/**
* Sets the interval for autoflushing. Also automatically enables flushing.
*
* @param interval Interval for autoflushing.
*/
void setAutoFlushInterval(TimeDelta const &interval);

enum OutputChangeBehavior {
FlushFirstToOldOutputs,
DontFlush
Expand Down
9 changes: 8 additions & 1 deletion doomsday/libdeng2/src/core/logbuffer.cpp
Expand Up @@ -105,7 +105,7 @@ DENG2_PIMPL_NOREF(LogBuffer)
if(!autoFlushTimer->isActive())
{
// Every now and then the buffer will be flushed.
autoFlushTimer->start(FLUSH_INTERVAL * 1000);
autoFlushTimer->start(FLUSH_INTERVAL.asMilliSeconds());
}
}
else
Expand Down Expand Up @@ -233,6 +233,13 @@ void LogBuffer::enableFlushing(bool yes)
d->enableAutoFlush(true);
}

void LogBuffer::setAutoFlushInterval(TimeDelta const &interval)
{
enableFlushing();

d->autoFlushTimer->setInterval(interval.asMilliSeconds());
}

void LogBuffer::setOutputFile(String const &path, OutputChangeBehavior behavior)
{
DENG2_GUARD(this);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libshell/src/serverfinder.cpp
Expand Up @@ -87,7 +87,7 @@ ServerFinder::ServerFinder() : d(new Instance)
connect(&d->beacon, SIGNAL(found(de::Address, de::Block)), this, SLOT(found(de::Address, de::Block)));
QTimer::singleShot(1000, this, SLOT(expire()));

if(App::appExists() && !App::commandLine().has("-nodiscovery"))
if(!App::appExists() || !App::commandLine().has("-nodiscovery"))
{
d->beacon.discover(0 /* no timeout */, 2);
}
Expand Down
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 8364af9

Please sign in to comment.