1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "configpropertywidget.h"
6#include "common/common.h"
7#include "configureprojpane.h"
8
9#include <QListWidget>
10#include <QSplitter>
11#include <QVBoxLayout>
12#include <QGroupBox>
13#include <QPushButton>
14#include <QStyleFactory>
15#include <QStackedWidget>
16
17class ConfigPropertyWidgetPrivate
18{
19 friend class ConfigPropertyWidget;
20 QStackedWidget *stackedWidget{nullptr};
21 ConfigureWidget *configureProjWidget{nullptr};
22 ConfigureProjPane *configureProjPane{nullptr};
23};
24
25ConfigPropertyWidget::ConfigPropertyWidget(const QString &language,
26 const QString &workspace,
27 QDialog *parent)
28 : QDialog (parent)
29 , d(new ConfigPropertyWidgetPrivate())
30{
31 setWindowTitle(tr("Config"));
32 // Initialize stackedWidget.
33 d->stackedWidget = new QStackedWidget(this);
34
35 // Initialize configure project widget.
36 d->configureProjWidget = new ConfigureWidget(d->stackedWidget);
37 d->configureProjPane = new ConfigureProjPane(language, workspace, d->configureProjWidget);
38 QObject::connect(d->configureProjPane, &ConfigureProjPane::configureDone, [this](const dpfservice::ProjectInfo &info){
39 closeWidget();
40 });
41 d->configureProjWidget->addWidget(d->configureProjPane);
42
43 d->stackedWidget->addWidget(d->configureProjWidget);
44
45 QVBoxLayout *layout = new QVBoxLayout();
46 layout->addWidget(d->stackedWidget);
47 setLayout(layout);
48 close();
49}
50
51ConfigPropertyWidget::~ConfigPropertyWidget()
52{
53 if (d)
54 delete d;
55}
56
57void ConfigPropertyWidget::closeWidget()
58{
59 close();
60}
61