[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevplatform/plugins/standardoutputview
From: Hamish Rodda <rodda () kde ! org>
Date: 2008-07-14 6:23:44
Message-ID: 1216016624.266570.10111.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 832130 by rodda:
I couldn't stand the terrible performance of the standard output view any longer.
Change the scrolling to bottom feature to use a delay (100ms chosen to start with)
Alleviates the worst of the lockups (eg, 20s lockup on my quad core2 machine) during \
output view spamming, but makes it look a bit strange.
Definitive solution still required.
M +22 -1 outputwidget.cpp
M +4 -0 outputwidget.h
--- trunk/KDE/kdevplatform/plugins/standardoutputview/outputwidget.cpp #832129:832130
@@ -24,6 +24,7 @@
#include "standardoutputview.h"
#include <QtCore/QSignalMapper>
+#include <QtCore/QTimer>
#include <QtGui/QAbstractItemDelegate>
#include <QtGui/QItemSelectionModel>
#include <QtGui/QListView>
@@ -42,11 +43,12 @@
#include "toolviewdata.h"
OutputWidget::OutputWidget(QWidget* parent, ToolViewData* tvdata)
- : QWidget( parent ), tabwidget(0), data(tvdata), scrollModelViewMapper(new \
QSignalMapper(this)) + : QWidget( parent ), tabwidget(0), data(tvdata), \
scrollModelViewMapper(new QSignalMapper(this)), scrollModelViewMapper2(new \
QSignalMapper(this)) {
setWindowTitle(i18n("Output View"));
setWindowIcon(tvdata->icon);
connect(scrollModelViewMapper, SIGNAL(mapped(int)), this, \
SLOT(scrollToBottom(int))); + connect(scrollModelViewMapper2, SIGNAL(mapped(int)), \
this, SLOT(doScrollToBottom(int))); QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
if( data->type & KDevelop::IOutputView::MultipleView )
@@ -407,6 +409,25 @@
{
if( views.contains( id ) && views.value( id )->verticalScrollBar()->value() == \
views.value( id )->verticalScrollBar()->maximum() ) {
+ kDebug() << "starting auto-scroll timer";
+ if (!scrollTimers.contains(id)) {
+ QTimer* timer = new QTimer(this);
+ timer->setSingleShot( true );
+ scrollTimers[id] = timer;
+ scrollModelViewMapper2->setMapping(timer, id);
+ connect(timer, SIGNAL(timeout()), scrollModelViewMapper2, SLOT(map()));
+ }
+
+ if (!scrollTimers[id]->isActive())
+ // 100ms delay in scrolling, for performance reasons
+ scrollTimers[id]->start(100);
+ }
+}
+
+void OutputWidget::doScrollToBottom( int id )
+{
+ if( views.contains( id ) )
+ {
kDebug() << "doing auto-scroll";
views.value( id )->scrollToBottom();
}
--- trunk/KDE/kdevplatform/plugins/standardoutputview/outputwidget.h #832129:832130
@@ -60,6 +60,8 @@
void nextOutput();
void previousOutput();
void scrollToBottom( int );
+ void doScrollToBottom( int );
+
private:
QListView* createListView(int id);
void setCurrentWidget( QListView* view );
@@ -67,6 +69,7 @@
void enableActions();
QMap<int, QListView*> views;
+ QMap<int, QTimer*> scrollTimers;
KTabWidget* tabwidget;
QStackedWidget* stackwidget;
ToolViewData* data;
@@ -74,6 +77,7 @@
KAction* nextAction;
KAction* previousAction;
QSignalMapper* scrollModelViewMapper;
+ QSignalMapper* scrollModelViewMapper2;
KToggleAction* activateOnSelect;
KToggleAction* focusOnSelect;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic