Commit 91d971dd authored by Soheil Armin's avatar Soheil Armin
Browse files

basic docker image build call

parent 85ca8584
......@@ -14,6 +14,7 @@ qt_add_executable(appUnixsocketPlayground2
qunixsockettotcpbridge.h qunixsockettotcpbridge.cpp
qhttprequest.h qhttprequest.cpp buildparams.h buildparams.cpp
qml.qrc
resources.qrc
)
qt_add_qml_module(appUnixsocketPlayground2
......
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import HttpRequest
import UnixsocketPlayground2
Item {
id: pageBuilding
ColumnLayout {
property bool isCurrentItem: StackView.visible
Label {
id: title
Layout.fillWidth: true
text: "Building..."
}
Label {
// TODO show details, errors etc
id: details
text: "Everything going great!"
anchors.top: title.bottom
anchors.topMargin: 24
TextArea {
id: logs
Layout.fillWidth: true
Layout.fillHeight: true
readOnly: true
}
BuildParams {
id: buildParams
}
ProgressBar {
id: progressBar
indeterminate: true
width: 500
anchors.top: details.bottom
anchors.left: parent.left
anchors.topMargin: 24
HttpRequest {
id: createImage
url: 'http://localhost:2323/build'
method: 'POST'
requestBody: buildParams.dockerfileTar
running: false
//onFinished: console.log("BUILD FINISHED")
//onResponseBodyChanged: console.log(JSON.stringify(responseBody))
//onError: console.log(httpStatusCode)
onDataChunk: function (data) {
logs.text += data.toString()
logs.cursorPosition = logs.length-1
}
}
onIsCurrentItemChanged: {
if(isCurrentItem)
createImage.running = true
}
}
#include "buildparams.h"
#include <QFile>
#include <QTimer>
BuildParams::BuildParams(QObject *parent)
: QObject{parent}
{
QFile dockerfile(":/docker/docker.tar");
if (dockerfile.open(QFile::ReadOnly)) {
m_dockerfileTar = dockerfile.readAll();
QTimer::singleShot(0,this,&BuildParams::dockerfileTarChanged);
}
}
QByteArray BuildParams::m_dockerfileTar = QByteArray();
void BuildParams::addComponent(const QString &component)
{
if (!m_selectedComponents.contains(component)) {
......
......@@ -7,6 +7,7 @@
class BuildParams : public QObject
{
Q_OBJECT
Q_PROPERTY(QByteArray dockerfileTar MEMBER m_dockerfileTar NOTIFY dockerfileTarChanged)
Q_PROPERTY(QUrl qtDir READ qtDir WRITE setQtDir NOTIFY qtDirChanged)
Q_PROPERTY(QUrl sdkDir READ sdkDir WRITE setSdkDir NOTIFY sdkDirChanged)
Q_PROPERTY(QUrl ndkDir READ ndkDir WRITE setNdkDir NOTIFY ndkDirChanged)
......@@ -43,6 +44,7 @@ private:
QStringList m_selectedSubmodules;
QString m_userName;
QUrl m_keyLocation;
static QByteArray m_dockerfileTar;
signals:
void qtDirChanged();
......@@ -52,6 +54,7 @@ signals:
void selectedSubmodulesChanged();
void userNameChanged();
void keyLocationChanged();
void dockerfileTarChanged();
};
#endif // BUILDPARAMS_H
......@@ -30,6 +30,13 @@ T.CheckBox {
visible: checkBox.checkState !== Qt.Unchecked
// TODO add icon
}
Behavior on color {
ColorAnimation {
duration: 200
easing.type: Easing.OutQuad
}
}
}
contentItem: Text {
......
import QtQuick
import QtQuick.Controls
import QtQuick.Templates as T
import Theme
T.TextArea {
id: textArea
implicitWidth: background.implicitWidth
implicitHeight: background.implicitHeight
color: Theme.colorHighlight
padding: 6
bottomPadding: 3
topPadding: 3
selectByMouse: true
selectionColor: Theme.colorHighlightDark
selectedTextColor: Theme.colorHighlight
verticalAlignment: TextInput.AlignVCenter
font: Theme.font
opacity: enabled ? 1.0 : 0.3
background: Rectangle {
color: "transparent"
border.width: 1
border.color: Theme.colorHighlight
implicitWidth: 400
implicitHeight: 28
radius: 2
}
}
......@@ -5,3 +5,4 @@ CheckBox 1.0 CheckBox.qml
Label 1.0 Label.qml
ProgressBar 1.0 ProgressBar.qml
TextField 1.0 TextField.qml
TextArea 1.0 TextArea.qml
......@@ -18,5 +18,6 @@
<file>PageBuilding.qml</file>
<file>Footer.qml</file>
<file>PageSummary.qml</file>
<file>imports/QtStyle/TextArea.qml</file>
</qresource>
</RCC>
<RCC>
<qresource prefix="/">
<file>docker/build.sh</file>
<file>docker/docker.tar</file>
<file>docker/Dockerfile</file>
</qresource>
</RCC>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment