forked from qt-creator/qt-creator
Docker: use PathListEditor for mounts
Change-Id: I5ed0ebf5ecdad17c1800f15906063d3413307da3 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -130,6 +130,7 @@ PathListEditor::PathListEditor(QWidget *parent) :
|
|||||||
});
|
});
|
||||||
addButton(tr("Delete Line"), this, [this] { deletePathAtCursor(); });
|
addButton(tr("Delete Line"), this, [this] { deletePathAtCursor(); });
|
||||||
addButton(tr("Clear"), this, [this] { d->edit->clear(); });
|
addButton(tr("Clear"), this, [this] { d->edit->clear(); });
|
||||||
|
connect(d->edit, &QPlainTextEdit::textChanged, this, &PathListEditor::changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
PathListEditor::~PathListEditor()
|
PathListEditor::~PathListEditor()
|
||||||
|
@@ -58,6 +58,9 @@ public:
|
|||||||
void setPathList(const QString &pathString);
|
void setPathList(const QString &pathString);
|
||||||
void setFileDialogTitle(const QString &l);
|
void setFileDialogTitle(const QString &l);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void changed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Index after which to insert further "Add" buttons
|
// Index after which to insert further "Add" buttons
|
||||||
static const int lastInsertButtonIndex;
|
static const int lastInsertButtonIndex;
|
||||||
|
@@ -49,17 +49,18 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/basetreeview.h>
|
#include <utils/basetreeview.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/utilsicons.h>
|
|
||||||
#include <utils/layoutbuilder.h>
|
#include <utils/layoutbuilder.h>
|
||||||
#include <utils/overridecursor.h>
|
#include <utils/overridecursor.h>
|
||||||
|
#include <utils/pathlisteditor.h>
|
||||||
#include <utils/port.h>
|
#include <utils/port.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/temporaryfile.h>
|
#include <utils/temporaryfile.h>
|
||||||
#include <utils/treemodel.h>
|
#include <utils/treemodel.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
@@ -394,15 +395,13 @@ public:
|
|||||||
dockerDevice->tryCreateLocalFileAccess();
|
dockerDevice->tryCreateLocalFileAccess();
|
||||||
});
|
});
|
||||||
|
|
||||||
m_pathsLineEdit = new QLineEdit;
|
m_pathsListEdit = new PathListEditor;
|
||||||
m_pathsLineEdit->setText(data.repo);
|
m_pathsListEdit->setToolTip(tr("Paths in this list will be mapped one-to-one into the "
|
||||||
m_pathsLineEdit->setToolTip(tr("Paths in this semi-colon separated list will be "
|
"Docker container."));
|
||||||
"mapped one-to-one into the Docker container."));
|
m_pathsListEdit->setPathList(data.mounts);
|
||||||
m_pathsLineEdit->setText(data.mounts.join(';'));
|
|
||||||
m_pathsLineEdit->setPlaceholderText(tr("List project source directories here"));
|
|
||||||
|
|
||||||
connect(m_pathsLineEdit, &QLineEdit::textChanged, this, [dockerDevice](const QString &text) {
|
connect(m_pathsListEdit, &PathListEditor::changed, this, [dockerDevice, this]() {
|
||||||
dockerDevice->setMounts(text.split(';', Qt::SkipEmptyParts));
|
dockerDevice->setMounts(m_pathsListEdit->pathList());
|
||||||
});
|
});
|
||||||
|
|
||||||
auto logView = new QTextBrowser;
|
auto logView = new QTextBrowser;
|
||||||
@@ -443,7 +442,10 @@ public:
|
|||||||
daemonStateLabel, m_daemonReset, m_daemonState, Break(),
|
daemonStateLabel, m_daemonReset, m_daemonState, Break(),
|
||||||
m_runAsOutsideUser, Break(),
|
m_runAsOutsideUser, Break(),
|
||||||
m_usePathMapping, Break(),
|
m_usePathMapping, Break(),
|
||||||
tr("Paths to mount:"), m_pathsLineEdit, Break(),
|
Column {
|
||||||
|
new QLabel(tr("Paths to mount:")),
|
||||||
|
m_pathsListEdit,
|
||||||
|
}, Break(),
|
||||||
Column {
|
Column {
|
||||||
Space(20),
|
Space(20),
|
||||||
Row { autoDetectButton, undoAutoDetectButton, listAutoDetectedButton, Stretch() },
|
Row { autoDetectButton, undoAutoDetectButton, listAutoDetectedButton, Stretch() },
|
||||||
@@ -463,7 +465,7 @@ private:
|
|||||||
QLabel *m_daemonState;
|
QLabel *m_daemonState;
|
||||||
QCheckBox *m_runAsOutsideUser;
|
QCheckBox *m_runAsOutsideUser;
|
||||||
QCheckBox *m_usePathMapping;
|
QCheckBox *m_usePathMapping;
|
||||||
QLineEdit *m_pathsLineEdit;
|
Utils::PathListEditor *m_pathsListEdit;
|
||||||
|
|
||||||
KitDetector m_kitItemDetector;
|
KitDetector m_kitItemDetector;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user