forked from qt-creator/qt-creator
The Recents should store presets, rather than normal project items, while the rest of tabs are to store normal project (i.e. wizard) items but with the default screen size written under the wizard name. In this patch I also did a few renames: e.g. the Presets view now uses a PresetModel rather than ProjectModel, because we now store presets. A Preset is a higher level concept than Project / Wizard item: it can be a project/wizard item with pre-defined configurations; and now we can have multiple presets using the same Wizard factory. Renamed struct ProjectCategory to WizardCategory, because the items are grouped by the category of the wizard (i.e. the "category" property of IWizardFactory) I extracted a class, PresetData, to hold the data that is being shared by the PresetModel (items in the view) and the PresetCategoryModel (header/tab items). It stored both information on normal presets and on recent presets. Made changes to JsonWizardFactory so that I could extract the list of screen sizes without requiring to build a wizard object first. This is important, because multiple JsonWizard objects cannot be created at the same time and I need to show the screen sizes of multiple presets / wizards as the Presets view is opened. This also required class WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory -- since "screen sizes" are a particularity of the json wizards, not of all kinds of wizards. Also, fixed a TODO in WizardHandler::reset() method. Also, added a few utilities I had need of, in algorithm.h. Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
53 lines
1.9 KiB
C++
53 lines
1.9 KiB
C++
/****************************************************************************
|
|
**
|
|
** Copyright (C) 2021 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 "test-utilities.h"
|
|
|
|
#include <utils/temporarydirectory.h>
|
|
|
|
class Environment : public testing::Environment
|
|
{
|
|
public:
|
|
void SetUp() override
|
|
{
|
|
const QString temporayDirectoryPath = QDir::tempPath() + "/QtCreator-UnitTests-XXXXXX";
|
|
Utils::TemporaryDirectory::setMasterTemporaryDirectory(temporayDirectoryPath);
|
|
qputenv("TMPDIR", Utils::TemporaryDirectory::masterDirectoryPath().toUtf8());
|
|
qputenv("TEMP", Utils::TemporaryDirectory::masterDirectoryPath().toUtf8());
|
|
}
|
|
|
|
void TearDown() override {}
|
|
};
|
|
|
|
int main(int argc, char **argv) {
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
auto environment = std::make_unique<Environment>();
|
|
testing::AddGlobalTestEnvironment(environment.release());
|
|
|
|
return RUN_ALL_TESTS();
|
|
}
|
|
|