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 "environmentfwd.h"
|
||||||
#include "namevaluesdialog.h"
|
#include "namevaluesdialog.h"
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT EnvironmentDialog : public NameValuesDialog
|
class QTCREATOR_UTILS_EXPORT EnvironmentDialog : public NameValuesDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
static std::optional<EnvironmentItems> getEnvironmentItems(QWidget *parent = nullptr,
|
static std::optional<EnvironmentItems> getEnvironmentItems(QWidget *parent = nullptr,
|
||||||
const EnvironmentItems &initial = {},
|
const EnvironmentItems &initial = {},
|
||||||
const QString &placeholderText = {},
|
const QString &placeholderText = {},
|
||||||
Polisher polish = {});
|
Polisher polish = {});
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static EnvironmentItems cleanUp(const EnvironmentItems &items)
|
static EnvironmentItems cleanUp(const EnvironmentItems &items)
|
||||||
@@ -35,6 +34,20 @@ static EnvironmentItems cleanUp(const EnvironmentItems &items)
|
|||||||
return uniqueItems;
|
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)
|
NameValueItemsWidget::NameValueItemsWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
@@ -63,6 +76,7 @@ void NameValueItemsWidget::setPlaceholderText(const QString &text)
|
|||||||
{
|
{
|
||||||
m_editor->setPlaceholderText(text);
|
m_editor->setPlaceholderText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
NameValuesDialog::NameValuesDialog(const QString &windowTitle, const QString &helpText, QWidget *parent)
|
NameValuesDialog::NameValuesDialog(const QString &windowTitle, const QString &helpText, QWidget *parent)
|
||||||
|
@@ -13,32 +13,14 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QPlainTextEdit;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal { class NameValueItemsWidget; }
|
||||||
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
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT NameValuesDialog : public QDialog
|
class QTCREATOR_UTILS_EXPORT NameValuesDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setNameValueItems(const NameValueItems &items);
|
void setNameValueItems(const NameValueItems &items);
|
||||||
NameValueItems nameValueItems() const;
|
NameValueItems nameValueItems() const;
|
||||||
@@ -52,7 +34,6 @@ public:
|
|||||||
Polisher polish = {},
|
Polisher polish = {},
|
||||||
const QString &windowTitle = {},
|
const QString &windowTitle = {},
|
||||||
const QString &helpText = {});
|
const QString &helpText = {});
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit NameValuesDialog(const QString &windowTitle,
|
explicit NameValuesDialog(const QString &windowTitle,
|
||||||
const QString &helpText,
|
const QString &helpText,
|
||||||
|
Reference in New Issue
Block a user