2014-12-04 14:05:19 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** This file is part of Qt Creator.
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
2014-12-04 14:05:19 +01:00
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "testsettings.h"
|
2016-10-05 12:39:23 +02:00
|
|
|
#include "autotestconstants.h"
|
2016-06-06 15:35:00 +02:00
|
|
|
#include "testframeworkmanager.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/id.h>
|
2014-12-04 14:05:19 +01:00
|
|
|
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
static const char timeoutKey[] = "Timeout";
|
|
|
|
|
static const char omitInternalKey[] = "OmitInternal";
|
|
|
|
|
static const char omitRunConfigWarnKey[] = "OmitRCWarnings";
|
|
|
|
|
static const char limitResultOutputKey[] = "LimitResultOutput";
|
|
|
|
|
static const char autoScrollKey[] = "AutoScrollResults";
|
2017-09-01 14:59:39 +02:00
|
|
|
static const char processArgsKey[] = "ProcessArgs";
|
2019-02-01 12:24:56 +01:00
|
|
|
static const char displayApplicationKey[] = "DisplayApp";
|
2019-03-13 11:05:22 +01:00
|
|
|
static const char popupOnStartKey[] = "PopupOnStart";
|
|
|
|
|
static const char popupOnFinishKey[] = "PopupOnFinish";
|
|
|
|
|
static const char popupOnFailKey[] = "PopupOnFail";
|
2019-08-08 09:57:42 +02:00
|
|
|
static const char runAfterBuildKey[] = "RunAfterBuild";
|
2017-12-06 08:45:36 +01:00
|
|
|
static const char groupSuffix[] = ".group";
|
2016-06-06 15:35:00 +02:00
|
|
|
|
2018-07-11 15:44:51 +02:00
|
|
|
constexpr int defaultTimeout = 60000;
|
2014-12-04 14:05:19 +01:00
|
|
|
|
|
|
|
|
TestSettings::TestSettings()
|
2016-09-13 09:30:59 +02:00
|
|
|
: timeout(defaultTimeout)
|
2014-12-04 14:05:19 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TestSettings::toSettings(QSettings *s) const
|
|
|
|
|
{
|
2016-10-05 12:39:23 +02:00
|
|
|
s->beginGroup(Constants::SETTINGSGROUP);
|
2016-09-29 12:15:43 +02:00
|
|
|
s->setValue(timeoutKey, timeout);
|
|
|
|
|
s->setValue(omitInternalKey, omitInternalMssg);
|
|
|
|
|
s->setValue(omitRunConfigWarnKey, omitRunConfigWarn);
|
|
|
|
|
s->setValue(limitResultOutputKey, limitResultOutput);
|
|
|
|
|
s->setValue(autoScrollKey, autoScroll);
|
2017-09-01 14:59:39 +02:00
|
|
|
s->setValue(processArgsKey, processArgs);
|
2019-02-01 12:24:56 +01:00
|
|
|
s->setValue(displayApplicationKey, displayApplication);
|
2019-03-13 11:05:22 +01:00
|
|
|
s->setValue(popupOnStartKey, popupOnStart);
|
|
|
|
|
s->setValue(popupOnFinishKey, popupOnFinish);
|
|
|
|
|
s->setValue(popupOnFailKey, popupOnFail);
|
2019-08-08 09:57:42 +02:00
|
|
|
s->setValue(runAfterBuildKey, runAfterBuild);
|
2017-12-06 08:45:36 +01:00
|
|
|
// store frameworks and their current active and grouping state
|
|
|
|
|
for (const Core::Id &id : frameworks.keys()) {
|
2016-06-06 15:35:00 +02:00
|
|
|
s->setValue(QLatin1String(id.name()), frameworks.value(id));
|
2017-12-06 08:45:36 +01:00
|
|
|
s->setValue(QLatin1String(id.name().append(groupSuffix)), frameworksGrouping.value(id));
|
|
|
|
|
}
|
2016-09-13 09:30:59 +02:00
|
|
|
s->endGroup();
|
2014-12-04 14:05:19 +01:00
|
|
|
}
|
|
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
void TestSettings::fromSettings(QSettings *s)
|
2014-12-04 14:05:19 +01:00
|
|
|
{
|
2016-10-05 12:39:23 +02:00
|
|
|
s->beginGroup(Constants::SETTINGSGROUP);
|
2016-09-29 12:15:43 +02:00
|
|
|
timeout = s->value(timeoutKey, defaultTimeout).toInt();
|
|
|
|
|
omitInternalMssg = s->value(omitInternalKey, true).toBool();
|
|
|
|
|
omitRunConfigWarn = s->value(omitRunConfigWarnKey, false).toBool();
|
|
|
|
|
limitResultOutput = s->value(limitResultOutputKey, true).toBool();
|
|
|
|
|
autoScroll = s->value(autoScrollKey, true).toBool();
|
2017-09-01 14:59:39 +02:00
|
|
|
processArgs = s->value(processArgsKey, false).toBool();
|
2019-02-01 12:24:56 +01:00
|
|
|
displayApplication = s->value(displayApplicationKey, false).toBool();
|
2019-03-13 11:05:22 +01:00
|
|
|
popupOnStart = s->value(popupOnStartKey, true).toBool();
|
|
|
|
|
popupOnFinish = s->value(popupOnFinishKey, true).toBool();
|
|
|
|
|
popupOnFail = s->value(popupOnFailKey, false).toBool();
|
2019-08-08 09:57:42 +02:00
|
|
|
runAfterBuild = s->value(runAfterBuildKey, false).toBool();
|
2016-06-06 15:35:00 +02:00
|
|
|
// try to get settings for registered frameworks
|
|
|
|
|
TestFrameworkManager *frameworkManager = TestFrameworkManager::instance();
|
|
|
|
|
const QList<Core::Id> ®istered = frameworkManager->registeredFrameworkIds();
|
|
|
|
|
frameworks.clear();
|
2017-12-06 08:45:36 +01:00
|
|
|
frameworksGrouping.clear();
|
2016-06-06 15:35:00 +02:00
|
|
|
for (const Core::Id &id : registered) {
|
2017-12-06 08:45:36 +01:00
|
|
|
// get their active state
|
2016-09-13 09:30:59 +02:00
|
|
|
frameworks.insert(id, s->value(QLatin1String(id.name()),
|
2016-06-06 15:35:00 +02:00
|
|
|
frameworkManager->isActive(id)).toBool());
|
2017-12-06 08:45:36 +01:00
|
|
|
// and whether grouping is enabled
|
|
|
|
|
frameworksGrouping.insert(id, s->value(QLatin1String(id.name().append(groupSuffix)),
|
|
|
|
|
frameworkManager->groupingEnabled(id)).toBool());
|
2016-06-06 15:35:00 +02:00
|
|
|
}
|
2016-09-13 09:30:59 +02:00
|
|
|
s->endGroup();
|
2014-12-04 14:05:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|