forked from qt-creator/qt-creator
Utils: Clean up {namevalue,environment}dialog.h
Change-Id: I84b959e4b78a39dfa421bc0f9cedcf33bc358984 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -7,18 +7,16 @@
|
||||
|
||||
#include "environmentfwd.h"
|
||||
#include "namevaluesdialog.h"
|
||||
#include <thread>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT EnvironmentDialog : public NameValuesDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static std::optional<EnvironmentItems> getEnvironmentItems(QWidget *parent = nullptr,
|
||||
const EnvironmentItems &initial = {},
|
||||
const QString &placeholderText = {},
|
||||
Polisher polish = {});
|
||||
const EnvironmentItems &initial = {},
|
||||
const QString &placeholderText = {},
|
||||
Polisher polish = {});
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
static EnvironmentItems cleanUp(const EnvironmentItems &items)
|
||||
@@ -35,6 +34,20 @@ static EnvironmentItems cleanUp(const EnvironmentItems &items)
|
||||
return uniqueItems;
|
||||
}
|
||||
|
||||
class NameValueItemsWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit NameValueItemsWidget(QWidget *parent = nullptr);
|
||||
|
||||
void setEnvironmentItems(const EnvironmentItems &items);
|
||||
EnvironmentItems environmentItems() const;
|
||||
|
||||
void setPlaceholderText(const QString &text);
|
||||
|
||||
private:
|
||||
QPlainTextEdit *m_editor;
|
||||
};
|
||||
|
||||
NameValueItemsWidget::NameValueItemsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
@@ -63,6 +76,7 @@ void NameValueItemsWidget::setPlaceholderText(const QString &text)
|
||||
{
|
||||
m_editor->setPlaceholderText(text);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
NameValuesDialog::NameValuesDialog(const QString &windowTitle, const QString &helpText, QWidget *parent)
|
||||
|
@@ -13,32 +13,14 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPlainTextEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
|
||||
namespace Internal {
|
||||
class NameValueItemsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NameValueItemsWidget(QWidget *parent = nullptr);
|
||||
|
||||
void setEnvironmentItems(const EnvironmentItems &items);
|
||||
EnvironmentItems environmentItems() const;
|
||||
|
||||
void setPlaceholderText(const QString &text);
|
||||
|
||||
private:
|
||||
QPlainTextEdit *m_editor;
|
||||
};
|
||||
} // namespace Internal
|
||||
namespace Internal { class NameValueItemsWidget; }
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT NameValuesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void setNameValueItems(const NameValueItems &items);
|
||||
NameValueItems nameValueItems() const;
|
||||
@@ -52,7 +34,6 @@ public:
|
||||
Polisher polish = {},
|
||||
const QString &windowTitle = {},
|
||||
const QString &helpText = {});
|
||||
|
||||
protected:
|
||||
explicit NameValuesDialog(const QString &windowTitle,
|
||||
const QString &helpText,
|
||||
|
Reference in New Issue
Block a user