summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/autotest/testresultspane.cpp18
-rw-r--r--plugins/autotest/testresultspane.h3
-rw-r--r--plugins/autotest/testsettings.cpp8
-rw-r--r--plugins/autotest/testsettings.h1
-rw-r--r--plugins/autotest/testsettingspage.cpp2
-rw-r--r--plugins/autotest/testsettingspage.ui488
6 files changed, 256 insertions, 264 deletions
diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp
index 0d6b9052b8..9ebb1c09fb 100644
--- a/plugins/autotest/testresultspane.cpp
+++ b/plugins/autotest/testresultspane.cpp
@@ -37,6 +37,7 @@
#include <QDebug>
#include <QHBoxLayout>
#include <QMenu>
+#include <QScrollBar>
#include <QToolButton>
#include <QVBoxLayout>
@@ -46,7 +47,8 @@ namespace Internal {
TestResultsPane::TestResultsPane(QObject *parent) :
Core::IOutputPane(parent),
m_context(new Core::IContext(this)),
- m_wasVisibleBefore(false)
+ m_wasVisibleBefore(false),
+ m_autoScroll(false)
{
m_outputWidget = new QWidget;
QVBoxLayout *outputLayout = new QVBoxLayout;
@@ -144,6 +146,9 @@ TestResultsPane::~TestResultsPane()
void TestResultsPane::addTestResult(const TestResult &result)
{
+ const QScrollBar *scrollBar = m_treeView->verticalScrollBar();
+ m_atEnd = scrollBar ? scrollBar->value() == scrollBar->maximum() : true;
+
m_model->addTestResult(result);
if (!m_treeView->isVisible())
popup(Core::IOutputPane::NoModeSwitch);
@@ -181,6 +186,9 @@ void TestResultsPane::clearContents()
m_filterModel->clearTestResults();
navigateStateChanged();
m_summaryWidget->setVisible(false);
+ m_autoScroll = AutotestPlugin::instance()->settings()->autoScroll;
+ connect(m_treeView->verticalScrollBar(), &QScrollBar::rangeChanged,
+ this, &TestResultsPane::onScrollBarRangeChanged, Qt::UniqueConnection);
}
void TestResultsPane::visibilityChanged(bool visible)
@@ -381,6 +389,14 @@ void TestResultsPane::onTestRunFinished()
updateSummaryLabel();
m_summaryWidget->setVisible(true);
m_model->removeCurrentTestMessage();
+ disconnect(m_treeView->verticalScrollBar(), &QScrollBar::rangeChanged,
+ this, &TestResultsPane::onScrollBarRangeChanged);
+}
+
+void TestResultsPane::onScrollBarRangeChanged(int, int max)
+{
+ if (m_autoScroll && m_atEnd)
+ m_treeView->verticalScrollBar()->setValue(max);
}
void TestResultsPane::onTestTreeModelChanged()
diff --git a/plugins/autotest/testresultspane.h b/plugins/autotest/testresultspane.h
index 0d76c56ff4..37a35eece8 100644
--- a/plugins/autotest/testresultspane.h
+++ b/plugins/autotest/testresultspane.h
@@ -88,6 +88,7 @@ private:
void createToolButtons();
void onTestRunStarted();
void onTestRunFinished();
+ void onScrollBarRangeChanged(int, int max);
void onTestTreeModelChanged();
QWidget *m_outputWidget;
@@ -103,6 +104,8 @@ private:
QToolButton *m_filterButton;
QMenu *m_filterMenu;
bool m_wasVisibleBefore;
+ bool m_autoScroll;
+ bool m_atEnd;
};
} // namespace Internal
diff --git a/plugins/autotest/testsettings.cpp b/plugins/autotest/testsettings.cpp
index 3a11b8c66b..bb5bcd61ec 100644
--- a/plugins/autotest/testsettings.cpp
+++ b/plugins/autotest/testsettings.cpp
@@ -30,11 +30,12 @@ static const char metricsKey[] = "Metrics";
static const char omitInternalKey[] = "OmitInternal";
static const char omitRunConfigWarnKey[] = "OmitRCWarnings";
static const char limitResultOutputKey[] = "LimitResultOutput";
+static const char autoScrollKey[] = "AutoScrollResults";
static const int defaultTimeout = 60000;
TestSettings::TestSettings()
: timeout(defaultTimeout), metrics(Walltime), omitInternalMssg(true), omitRunConfigWarn(false),
- limitResultOutput(true)
+ limitResultOutput(true), autoScroll(true)
{
}
@@ -46,6 +47,7 @@ void TestSettings::toSettings(QSettings *s) const
s->setValue(QLatin1String(omitInternalKey), omitInternalMssg);
s->setValue(QLatin1String(omitRunConfigWarnKey), omitRunConfigWarn);
s->setValue(QLatin1String(limitResultOutputKey), limitResultOutput);
+ s->setValue(QLatin1String(autoScrollKey), autoScroll);
s->endGroup();
}
@@ -75,6 +77,7 @@ void TestSettings::fromSettings(const QSettings *s)
omitInternalMssg = s->value(root + QLatin1String(omitInternalKey), true).toBool();
omitRunConfigWarn = s->value(root + QLatin1String(omitRunConfigWarnKey), false).toBool();
limitResultOutput = s->value(root + QLatin1String(limitResultOutputKey), true).toBool();
+ autoScroll = s->value(root + QLatin1String(autoScrollKey), true).toBool();
}
bool TestSettings::equals(const TestSettings &rhs) const
@@ -82,7 +85,8 @@ bool TestSettings::equals(const TestSettings &rhs) const
return timeout == rhs.timeout && metrics == rhs.metrics
&& omitInternalMssg == rhs.omitInternalMssg
&& omitRunConfigWarn == rhs.omitRunConfigWarn
- && limitResultOutput == rhs.limitResultOutput;
+ && limitResultOutput == rhs.limitResultOutput
+ && autoScroll == rhs.autoScroll;
}
QString TestSettings::metricsTypeToOption(const MetricsType type)
diff --git a/plugins/autotest/testsettings.h b/plugins/autotest/testsettings.h
index 520edde6fc..8ef368e804 100644
--- a/plugins/autotest/testsettings.h
+++ b/plugins/autotest/testsettings.h
@@ -50,6 +50,7 @@ struct TestSettings
bool omitInternalMssg;
bool omitRunConfigWarn;
bool limitResultOutput;
+ bool autoScroll;
};
inline bool operator==(const TestSettings &s1, const TestSettings &s2) { return s1.equals(s2); }
diff --git a/plugins/autotest/testsettingspage.cpp b/plugins/autotest/testsettingspage.cpp
index e65bff754a..cf96ef92b6 100644
--- a/plugins/autotest/testsettingspage.cpp
+++ b/plugins/autotest/testsettingspage.cpp
@@ -42,6 +42,7 @@ void TestSettingsWidget::setSettings(const TestSettings &settings)
m_ui.omitInternalMsgCB->setChecked(settings.omitInternalMssg);
m_ui.omitRunConfigWarnCB->setChecked(settings.omitRunConfigWarn);
m_ui.limitResultOutputCB->setChecked(settings.limitResultOutput);
+ m_ui.autoScrollCB->setChecked(settings.autoScroll);
switch (settings.metrics) {
case MetricsType::Walltime:
@@ -71,6 +72,7 @@ TestSettings TestSettingsWidget::settings() const
result.omitInternalMssg = m_ui.omitInternalMsgCB->isChecked();
result.omitRunConfigWarn = m_ui.omitRunConfigWarnCB->isChecked();
result.limitResultOutput = m_ui.limitResultOutputCB->isChecked();
+ result.autoScroll = m_ui.autoScrollCB->isChecked();
if (m_ui.walltimeRB->isChecked())
result.metrics = MetricsType::Walltime;
diff --git a/plugins/autotest/testsettingspage.ui b/plugins/autotest/testsettingspage.ui
index bc3c6f6b0c..1822cfbbd9 100644
--- a/plugins/autotest/testsettingspage.ui
+++ b/plugins/autotest/testsettingspage.ui
@@ -6,289 +6,255 @@
<rect>
<x>0</x>
<y>0</y>
- <width>463</width>
- <height>338</height>
+ <width>407</width>
+ <height>228</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>9</x>
- <y>10</y>
- <width>435</width>
- <height>307</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="toolTip">
+ <string>Timeout used when executing each test case.</string>
+ </property>
+ <property name="text">
+ <string>Timeout:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="timeoutSpin">
+ <property name="toolTip">
+ <string>Timeout used when executing test cases. This will apply for each test case on its own, not the whole project.</string>
+ </property>
+ <property name="suffix">
+ <string> s</string>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>36000</number>
+ </property>
+ <property name="value">
+ <number>60</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Benchmark Metrics</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="QLabel" name="label">
+ <widget class="QRadioButton" name="walltimeRB">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Uses walltime metrics for executing benchmarks (default).</string>
+ </property>
+ <property name="text">
+ <string>Walltime</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="tickcounterRB">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Uses tick counter when executing benchmarks.</string>
+ </property>
+ <property name="text">
+ <string>Tick counter</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="eventCounterRB">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
- <string>Timeout used when executing each test case.</string>
+ <string>Uses event counter when executing benchmarks.</string>
</property>
<property name="text">
- <string>Timeout:</string>
+ <string>Event counter</string>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="timeoutSpin">
+ <widget class="QRadioButton" name="callgrindRB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
- <string>Timeout used when executing test cases. This will apply for each test case on its own, not the whole project.</string>
+ <string>Uses Valgrind Callgrind when executing benchmarks (it must be installed).</string>
</property>
- <property name="suffix">
- <string> s</string>
+ <property name="text">
+ <string>Callgrind</string>
</property>
- <property name="minimum">
- <number>5</number>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="perfRB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Uses Perf when executing benchmarks (it must be installed).</string>
</property>
- <property name="maximum">
- <number>36000</number>
+ <property name="text">
+ <string>Perf</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>General</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="omitInternalMsgCB">
+ <property name="toolTip">
+ <string>Hides internal messages by default. You can still enable them by using the test results filter.</string>
+ </property>
+ <property name="text">
+ <string>Omit internal messages</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="omitRunConfigWarnCB">
+ <property name="toolTip">
+ <string>Hides warnings related to a guessed run configuration.</string>
+ </property>
+ <property name="text">
+ <string>Omit run configuration warnings</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="limitResultOutputCB">
+ <property name="toolTip">
+ <string>Limit result output to 100000 characters.</string>
+ </property>
+ <property name="text">
+ <string>Limit result output</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="autoScrollCB">
+ <property name="toolTip">
+ <string>Automatically scroll down when new items are added and scrollbar is at bottom.</string>
+ </property>
+ <property name="text">
+ <string>Automatically scroll results</string>
</property>
- <property name="value">
- <number>60</number>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
</layout>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QCheckBox" name="omitInternalMsgCB">
- <property name="toolTip">
- <string>Hides internal messages by default. You can still enable them by using the test results filter.</string>
- </property>
- <property name="text">
- <string>Omit internal messages</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="omitRunConfigWarnCB">
- <property name="toolTip">
- <string>Hides warnings related to a guessed run configuration.</string>
- </property>
- <property name="text">
- <string>Omit run configuration warnings</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="limitResultOutputCB">
- <property name="toolTip">
- <string>Limit result output to 100000 characters.</string>
- </property>
- <property name="text">
- <string>Limit result output</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Benchmark Metrics</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="walltimeRB">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Uses walltime metrics for executing benchmarks (default).</string>
- </property>
- <property name="text">
- <string>Walltime</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="tickcounterRB">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Uses tick counter when executing benchmarks.</string>
- </property>
- <property name="text">
- <string>Tick counter</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="eventCounterRB">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Uses event counter when executing benchmarks.</string>
- </property>
- <property name="text">
- <string>Event counter</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="callgrindRB">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Uses Valgrind Callgrind when executing benchmarks (it must be installed).</string>
- </property>
- <property name="text">
- <string>Callgrind</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="perfRB">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Uses Perf when executing benchmarks (it must be installed).</string>
- </property>
- <property name="text">
- <string>Perf</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
<resources/>
<connections/>