forked from qt-creator/qt-creator
Autotest: Use new construction pattern for project panel factory
Change-Id: I09abb1d5dbb07a700053077b03e65a3dce4b3f1f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -9,25 +9,45 @@
|
||||
#include "testprojectsettings.h"
|
||||
#include "testtreemodel.h"
|
||||
|
||||
#include <projectexplorer/projectpanelfactory.h>
|
||||
#include <projectexplorer/projectsettingswidget.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QTimer>
|
||||
#include <QTreeWidget>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Autotest::Internal {
|
||||
|
||||
enum ItemDataRole {
|
||||
BaseIdRole = Qt::UserRole + 1,
|
||||
BaseTypeRole
|
||||
};
|
||||
|
||||
ProjectTestSettingsWidget::ProjectTestSettingsWidget(ProjectExplorer::Project *project,
|
||||
QWidget *parent)
|
||||
: ProjectExplorer::ProjectSettingsWidget(parent)
|
||||
, m_projectSettings(AutotestPlugin::projectSettings(project))
|
||||
class ProjectTestSettingsWidget : public ProjectSettingsWidget
|
||||
{
|
||||
public:
|
||||
explicit ProjectTestSettingsWidget(Project *project);
|
||||
|
||||
private:
|
||||
void populateFrameworks(const QHash<Autotest::ITestFramework *, bool> &frameworks,
|
||||
const QHash<Autotest::ITestTool *, bool> &testTools);
|
||||
void onActiveFrameworkChanged(QTreeWidgetItem *item, int column);
|
||||
TestProjectSettings *m_projectSettings;
|
||||
QComboBox *m_useGlobalSettings = nullptr;
|
||||
QTreeWidget *m_activeFrameworks = nullptr;
|
||||
QComboBox *m_runAfterBuild = nullptr;
|
||||
QTimer m_syncTimer;
|
||||
int m_syncType = 0;
|
||||
};
|
||||
|
||||
ProjectTestSettingsWidget::ProjectTestSettingsWidget(Project *project)
|
||||
: m_projectSettings(AutotestPlugin::projectSettings(project))
|
||||
{
|
||||
setGlobalSettingsId(Constants::AUTOTEST_SETTINGS_ID);
|
||||
|
||||
@@ -131,5 +151,24 @@ void ProjectTestSettingsWidget::onActiveFrameworkChanged(QTreeWidgetItem *item,
|
||||
m_syncType |= type;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
class AutotestProjectPanelFactory final : public ProjectPanelFactory
|
||||
{
|
||||
public:
|
||||
AutotestProjectPanelFactory()
|
||||
{
|
||||
setPriority(666);
|
||||
// setIcon(); // TODO ?
|
||||
setDisplayName(Tr::tr("Testing"));
|
||||
setCreateWidgetFunction([](Project *project) {
|
||||
return new ProjectTestSettingsWidget(project);
|
||||
});
|
||||
ProjectPanelFactory::registerFactory(this);
|
||||
}
|
||||
};
|
||||
|
||||
void setupAutotestProjectPanel()
|
||||
{
|
||||
static AutotestProjectPanelFactory theAutotestProjectPanelFactory;
|
||||
}
|
||||
|
||||
} // Autotest::Internal
|
||||
|
||||
Reference in New Issue
Block a user