diff --git a/src/plugins/autotest/CMakeLists.txt b/src/plugins/autotest/CMakeLists.txt index dfcbdda19d1..fedb6b7fe73 100644 --- a/src/plugins/autotest/CMakeLists.txt +++ b/src/plugins/autotest/CMakeLists.txt @@ -16,7 +16,6 @@ add_qtc_plugin(AutoTest boost/boosttestparser.cpp boost/boosttestparser.h boost/boosttestresult.cpp boost/boosttestresult.h boost/boosttestsettings.cpp boost/boosttestsettings.h - boost/boosttestsettingspage.cpp boost/boosttestsettingspage.h boost/boosttestsettingspage.ui boost/boosttesttreeitem.cpp boost/boosttesttreeitem.h catch/catchcodeparser.cpp catch/catchcodeparser.h catch/catchconfiguration.cpp catch/catchconfiguration.h diff --git a/src/plugins/autotest/autotest.pro b/src/plugins/autotest/autotest.pro index 70041f1fc0a..bd7535658f1 100644 --- a/src/plugins/autotest/autotest.pro +++ b/src/plugins/autotest/autotest.pro @@ -72,8 +72,7 @@ SOURCES += \ boost/boosttestconfiguration.cpp \ boost/boosttestoutputreader.cpp \ boost/boosttestresult.cpp \ - boost/boosttestsettings.cpp \ - boost/boosttestsettingspage.cpp + boost/boosttestsettings.cpp HEADERS += \ autotest_global.h \ @@ -150,7 +149,6 @@ HEADERS += \ boost/boosttestconfiguration.h \ boost/boosttestoutputreader.h \ boost/boosttestresult.h \ - boost/boosttestsettingspage.h \ boost/boosttestsettings.h RESOURCES += \ @@ -158,7 +156,6 @@ RESOURCES += \ FORMS += \ testsettingspage.ui \ - boost/boosttestsettingspage.ui \ gtest/gtestsettingspage.ui equals(TEST, 1) { diff --git a/src/plugins/autotest/boost/boosttestframework.h b/src/plugins/autotest/boost/boosttestframework.h index f91e06e6f84..2ca7b608699 100644 --- a/src/plugins/autotest/boost/boosttestframework.h +++ b/src/plugins/autotest/boost/boosttestframework.h @@ -28,7 +28,6 @@ #include "../itestframework.h" #include "boosttestsettings.h" -#include "boosttestsettingspage.h" namespace Autotest { namespace Internal { diff --git a/src/plugins/autotest/boost/boosttestsettings.cpp b/src/plugins/autotest/boost/boosttestsettings.cpp index 4b6d7e0374b..910b955ccb1 100644 --- a/src/plugins/autotest/boost/boosttestsettings.cpp +++ b/src/plugins/autotest/boost/boosttestsettings.cpp @@ -25,6 +25,14 @@ #include "boosttestsettings.h" +#include "boosttestconstants.h" + +#include "../autotestconstants.h" + +#include + +using namespace Utils; + namespace Autotest { namespace Internal { @@ -35,27 +43,90 @@ BoostTestSettings::BoostTestSettings() registerAspect(&logLevel); logLevel.setSettingsKey("LogLevel"); + logLevel.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox); + logLevel.addOption("All"); + logLevel.addOption("Success"); + logLevel.addOption("Test Suite"); + logLevel.addOption("Unit Scope"); + logLevel.addOption("Message"); + logLevel.addOption("Warning"); + logLevel.addOption("Error"); + logLevel.addOption("C++ Exception"); + logLevel.addOption("System Error"); + logLevel.addOption("Fatal Error"); + logLevel.addOption("Nothing"); logLevel.setDefaultValue(int(LogLevel::Warning)); + logLevel.setLabelText(tr("Log format:")); registerAspect(&reportLevel); reportLevel.setSettingsKey("ReportLevel"); + reportLevel.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox); + reportLevel.addOption("Confirm"); + reportLevel.addOption("Short"); + reportLevel.addOption("Detailed"); + reportLevel.addOption("No"); reportLevel.setDefaultValue(int(ReportLevel::Confirm)); + reportLevel.setLabelText(tr("Report level:")); registerAspect(&seed); seed.setSettingsKey("Seed"); + seed.setEnabled(false); + seed.setLabelText(tr("Seed:")); + seed.setToolTip(tr("A seed of 0 means no randomization. A value of 1 uses the current " + "time, any other value is used as random seed generator.")); registerAspect(&randomize); randomize.setSettingsKey("Randomize"); + randomize.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); + randomize.setLabelText(tr("Randomize")); + randomize.setToolTip(tr("Randomize execution order.")); registerAspect(&systemErrors); systemErrors.setSettingsKey("SystemErrors"); + systemErrors.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); + systemErrors.setLabelText(tr("Catch system errors")); + systemErrors.setToolTip(tr("Catch or ignore system errors.")); registerAspect(&fpExceptions); fpExceptions.setSettingsKey("FPExceptions"); + fpExceptions.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); + fpExceptions.setLabelText(tr("Floating point exceptions")); + fpExceptions.setToolTip(tr("Enable floating point exception traps.")); registerAspect(&memLeaks); memLeaks.setSettingsKey("MemoryLeaks"); + memLeaks.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); memLeaks.setDefaultValue(true); + memLeaks.setLabelText(tr("Detect memory leaks")); + memLeaks.setToolTip(tr("Enable memory leak detection.")); + + QObject::connect(&randomize, &BoolAspect::volatileValueChanged, &seed, &BaseAspect::setEnabled); +} + +BoostTestSettingsPage::BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId) +{ + setId(settingsId); + setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY); + setDisplayName(QCoreApplication::translate("BoostTestFramework", + BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY)); + setSettings(settings); + + setLayouter([settings](QWidget *widget) { + BoostTestSettings &s = *settings; + using namespace Layouting; + const Break nl; + + Grid grid { + s.logLevel, nl, + s.reportLevel, nl, + s.randomize, Row { s.seed }, nl, + s.systemErrors, nl, + s.fpExceptions, nl, + s.memLeaks, + }; + + Column { Row { Column { grid, Stretch() }, Stretch() } }.attachTo(widget); + }); } QString BoostTestSettings::logLevelToOption(const LogLevel logLevel) diff --git a/src/plugins/autotest/boost/boosttestsettings.h b/src/plugins/autotest/boost/boosttestsettings.h index cb01db0b664..15f55483a2d 100644 --- a/src/plugins/autotest/boost/boosttestsettings.h +++ b/src/plugins/autotest/boost/boosttestsettings.h @@ -25,6 +25,8 @@ #pragma once +#include + #include namespace Autotest { @@ -55,6 +57,8 @@ enum class ReportLevel class BoostTestSettings : public Utils::AspectContainer { + Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::BoostTestSettings) + public: BoostTestSettings(); @@ -70,6 +74,13 @@ public: Utils::BoolAspect memLeaks; }; + +class BoostTestSettingsPage final : public Core::IOptionsPage +{ +public: + BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId); +}; + } // namespace Internal } // namespace Autotest diff --git a/src/plugins/autotest/boost/boosttestsettingspage.cpp b/src/plugins/autotest/boost/boosttestsettingspage.cpp deleted file mode 100644 index 17721d15089..00000000000 --- a/src/plugins/autotest/boost/boosttestsettingspage.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "boosttestsettingspage.h" -#include "boosttestconstants.h" -#include "boosttestsettings.h" -#include "../testframeworkmanager.h" -#include "../autotestconstants.h" -#include "ui_boosttestsettingspage.h" - -#include - -namespace Autotest { -namespace Internal { - -class BoostTestSettingsWidget : public Core::IOptionsPageWidget -{ - Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::BoostTestSettingsWidget) - -public: - explicit BoostTestSettingsWidget(BoostTestSettings *settings); - - void apply() final; - - void setSettings(const BoostTestSettings &settings); - BoostTestSettings settings() const; - -private: - void fillComboBoxes(); - Ui::BoostSettingsPage m_ui; - BoostTestSettings *m_settings; -}; - -BoostTestSettingsWidget::BoostTestSettingsWidget(BoostTestSettings *settings) - : m_settings(settings) -{ - m_ui.setupUi(this); - fillComboBoxes(); - connect(m_ui.randomizeCB, &QCheckBox::toggled, m_ui.seedSB, &QSpinBox::setEnabled); - - m_ui.logFormatCB->setCurrentIndex(m_settings->logLevel.value()); - m_ui.reportLevelCB->setCurrentIndex(m_settings->reportLevel.value()); - m_ui.randomizeCB->setChecked(m_settings->randomize.value()); - m_ui.seedSB->setValue(m_settings->seed.value()); - m_ui.systemErrorCB->setChecked(m_settings->systemErrors.value()); - m_ui.fpExceptions->setChecked(m_settings->fpExceptions.value()); - m_ui.memoryLeakCB->setChecked(m_settings->memLeaks.value()); -} - -void BoostTestSettingsWidget::apply() -{ - m_settings->logLevel.setValue(m_ui.logFormatCB->currentData().toInt()); - m_settings->reportLevel.setValue(m_ui.reportLevelCB->currentData().toInt()); - m_settings->randomize.setValue(m_ui.randomizeCB->isChecked()); - m_settings->seed.setValue(m_ui.seedSB->value()); - m_settings->systemErrors.setValue(m_ui.systemErrorCB->isChecked()); - m_settings->fpExceptions.setValue(m_ui.fpExceptions->isChecked()); - m_settings->memLeaks.setValue(m_ui.memoryLeakCB->isChecked()); - - m_settings->writeSettings(Core::ICore::settings()); -} - -void BoostTestSettingsWidget::fillComboBoxes() -{ - m_ui.logFormatCB->addItem("All", QVariant::fromValue(LogLevel::All)); - m_ui.logFormatCB->addItem("Success", QVariant::fromValue(LogLevel::Success)); - m_ui.logFormatCB->addItem("Test Suite", QVariant::fromValue(LogLevel::TestSuite)); - m_ui.logFormatCB->addItem("Unit Scope", QVariant::fromValue(LogLevel::UnitScope)); - m_ui.logFormatCB->addItem("Message", QVariant::fromValue(LogLevel::Message)); - m_ui.logFormatCB->addItem("Warning", QVariant::fromValue(LogLevel::Warning)); - m_ui.logFormatCB->addItem("Error", QVariant::fromValue(LogLevel::Error)); - m_ui.logFormatCB->addItem("C++ Exception", QVariant::fromValue(LogLevel::CppException)); - m_ui.logFormatCB->addItem("System Error", QVariant::fromValue(LogLevel::SystemError)); - m_ui.logFormatCB->addItem("Fatal Error", QVariant::fromValue(LogLevel::FatalError)); - m_ui.logFormatCB->addItem("Nothing", QVariant::fromValue(LogLevel::Nothing)); - - m_ui.reportLevelCB->addItem("Confirm", QVariant::fromValue(ReportLevel::Confirm)); - m_ui.reportLevelCB->addItem("Short", QVariant::fromValue(ReportLevel::Short)); - m_ui.reportLevelCB->addItem("Detailed", QVariant::fromValue(ReportLevel::Detailed)); - m_ui.reportLevelCB->addItem("No", QVariant::fromValue(ReportLevel::No)); -} - -BoostTestSettingsPage::BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId) -{ - setId(settingsId); - setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY); - setDisplayName(QCoreApplication::translate("BoostTestFramework", - BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY)); - setWidgetCreator([settings] { return new BoostTestSettingsWidget(settings); }); -} - -} // Internal -} // Autotest diff --git a/src/plugins/autotest/boost/boosttestsettingspage.h b/src/plugins/autotest/boost/boosttestsettingspage.h deleted file mode 100644 index 92601652d58..00000000000 --- a/src/plugins/autotest/boost/boosttestsettingspage.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace Autotest { -namespace Internal { - -class BoostTestSettings; - -class BoostTestSettingsPage final : public Core::IOptionsPage -{ -public: - BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId); -}; - -} // Internal -} // Autotest diff --git a/src/plugins/autotest/boost/boosttestsettingspage.ui b/src/plugins/autotest/boost/boosttestsettingspage.ui deleted file mode 100644 index 22ddef51f64..00000000000 --- a/src/plugins/autotest/boost/boosttestsettingspage.ui +++ /dev/null @@ -1,160 +0,0 @@ - - - BoostSettingsPage - - - - 0 - 0 - 309 - 284 - - - - - - - - - - - - - Log format: - - - - - - - - - - - - - - Report level: - - - - - - - - - - - - - - Randomize execution order. - - - Randomize - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Seed: - - - - - - - false - - - A seed of 0 means no randomization. A value of 1 uses the current time any other value is used as random seed generator. - - - 65535 - - - - - - - - - Catch or ignore system errors. - - - Catch system errors - - - - - - - Enable floating point exception traps. - - - Floating point exceptions - - - - - - - Enable memory leak detection. - - - Detect memory leaks - - - true - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 84 - - - - - - - - -