Pārlūkot izejas kodu

US11 implemented base gui layout, not finished

Cyamond 5 gadi atpakaļ
vecāks
revīzija
ac9ae4f5a2

+ 0 - 0
gui/include/.gitkeep


+ 40 - 0
gui/src/FooterForm.ui.qml

@@ -0,0 +1,40 @@
+import QtQuick 2.4
+import QtQuick.Controls 1.4
+
+Item {
+    width: 1280
+    height: 200
+
+    Rectangle {
+        id: background
+        x: 0
+        y: 0
+        width: 1280
+        height: 200
+        color: "#4a4a4a"
+
+        Text {
+            id: statusText
+            x: 0
+            y: 0
+            width: 1280
+            height: 30
+            color: "#ffffff"
+            text: qsTr("Status: Connected to foobar")
+            font.pixelSize: 23
+        }
+    }
+
+    TextArea {
+        id: logText
+        x: 0
+        y: 30
+        width: 1280
+        height: 170
+        backgroundVisible: false
+        readOnly: true
+        text: qsTr("Log goes here\nNew Line works as well")
+        font.pointSize: 15
+        textColor: "#ffffff"
+    }
+}

+ 8 - 0
gui/src/HelpForm.ui.qml

@@ -0,0 +1,8 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Dialogs 1.0
+
+Page {
+    width: 1280
+    height: 470
+}

+ 62 - 0
gui/src/IpPopupForm.ui.qml

@@ -0,0 +1,62 @@
+import QtQuick 2.4
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+import QtQuick.Controls.Styles 1.4
+
+Popup {
+    id: popup
+    height: 200
+    dim: true
+    clip: false
+    width: 400
+    modal: true
+    focus: true
+    closePolicy: Popup.NoAutoClose
+
+    ColumnLayout {
+        anchors.fill: parent
+
+        Text {
+            Layout.alignment: Qt.AlignCenter
+            id: popupText
+            color: "#ffffff"
+            text: qsTr("Enter the IP to connect:")
+            horizontalAlignment: Text.AlignHCenter
+            verticalAlignment: Text.AlignVCenter
+            font.pixelSize: 20
+        }
+
+        TextField {
+            Layout.alignment: Qt.AlignCenter
+            id: popupIpInput
+            text: qsTr("")
+            placeholderText: "Enter IP"
+            horizontalAlignment: Text.AlignHCenter
+        }
+
+        Text {
+            id: popupStatusText
+            color: "#df3f3f"
+            text: qsTr("")
+            horizontalAlignment: Text.AlignHCenter
+            verticalAlignment: Text.AlignVCenter
+            Layout.alignment: Qt.AlignCenter
+            font.pixelSize: 20
+        }
+
+        Button {
+            Layout.alignment: Qt.AlignCenter
+            id: popupConnectButton
+            text: qsTr("Connect")
+            enabled: popupIpInput.acceptableInput
+            font.pointSize: 16
+            // @disable-check M223
+            onClicked: {
+                // @disable-check M222
+                _qmlHandler.onEnterIp(popupIpInput.text)
+                // @disable-check M222
+                popup.close()
+            }
+        }
+    }
+}

+ 8 - 0
gui/src/MessagesForm.ui.qml

@@ -0,0 +1,8 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Dialogs 1.0
+
+Page {
+    width: 1280
+    height: 470
+}

+ 1 - 1
gui/src/ReceivingForm.ui.qml

@@ -3,7 +3,7 @@ import QtQuick.Controls 2.5
 
 Page {
     width: 1280
-    height: 670
+    height: 470
     title: "Receiving"
 
     Label {

+ 44 - 17
gui/src/SendingForm.ui.qml

@@ -4,47 +4,74 @@ import QtQuick.Dialogs 1.0
 
 Page {
     width: 1280
-    height: 670
+    height: 470
+    font.capitalization: Font.MixedCase
 
     title: qsTr("Sending")
 
     Connections {
-      target: _qmlHandler
-      onSetFileUrlText: {
-        fileUrlText.text = signalText
-      }
+        target: _qmlHandler
+        onSetFileUrlText: {
+            fileUrlText.text = signalText
+        }
+    }
+
+    Button {
+        id: clearFileButton
+        x: 900
+        y: 40
+        width: 260
+        height: 90
+        text: qsTr("Clear Selection")
+        font.pointSize: 16
     }
 
     Button {
         id: selectFileButton
-        x: 510
-        y: 291
+        x: 120
+        y: 40
         width: 260
-        height: 89
+        height: 90
         text: qsTr("Select File")
         font.pointSize: 16
-        onClicked: {fileDialog.open()}
+        // @disable-check M223
+        onClicked: {
+            // @disable-check M222
+            fileDialog.open()
+        }
     }
 
     Text {
         id: fileUrlText
         x: 54
-        y: 427
+        y: 186
         width: 1172
         height: 52
         color: "#ffffff"
-        text: qsTr("")
+        text: qsTr("Selected File: None")
         verticalAlignment: Text.AlignVCenter
         horizontalAlignment: Text.AlignHCenter
         font.pixelSize: 23
     }
 
     FileDialog {
-      id: fileDialog
-      title: "Please choose a file"
-      folder: shortcuts.home
-      onAccepted: {
-        _qmlHandler.onSelectFile(fileDialog.fileUrl)
-      }
+        id: fileDialog
+        title: "Please choose a file"
+        folder: shortcuts.home
+        // @disable-check M223
+        onAccepted: {
+            // @disable-check M222
+            _qmlHandler.onSelectFile(fileDialog.fileUrl)
+        }
+    }
+
+    Button {
+        id: sendFileButton
+        x: 510
+        y: 304
+        width: 260
+        height: 90
+        text: qsTr("Send File")
+        font.pointSize: 16
     }
 }

+ 8 - 0
gui/src/SettingsForm.ui.qml

@@ -0,0 +1,8 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Dialogs 1.0
+
+Page {
+    width: 1280
+    height: 470
+}

+ 1 - 1
gui/src/main.cpp

@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
 
     // Set the path to the CLI - pass argument h (help) for now
     // TODO: Change hardcoded path
-    execl("../../cli/build/ccats-cli", "ccats-cli", "c", "127.0.0.1",
+    execl("../../cli/build/ccats-cli", "ccats-cli", "127.0.0.1", "--machine",
           (char *)NULL);
 
     exit(1);

+ 51 - 34
gui/src/main.qml

@@ -8,50 +8,67 @@ ApplicationWindow {
     height: 720
     title: qsTr("Covert Channel - Control Panel")
 
-    header: ToolBar {
-        contentHeight: 50
+    SwipeView {
+        id: swipeView
+        anchors.fill: parent
+        currentIndex: header.currentIndex
+
+        SendingForm {
 
-        ToolButton {
-            id: toolButton
-            text: stackView.depth > 1 ? "\u25C0" : "\u2630"
-            font.pixelSize: Qt.application.font.pixelSize * 1.6
-            onClicked: {
-                if (stackView.depth > 1) {
-                    stackView.pop()
-                } else {
-                    drawer.open()
-                }
-            }
         }
 
-        Label {
-            text: stackView.currentItem.title
-            anchors.centerIn: parent
+        ReceivingForm {
+
+        }
+
+        MessagesForm {
+
+        }
+
+        SettingsForm {
+
+        }
+
+        HelpForm {
+
         }
     }
 
-    Drawer {
-        id: drawer
-        width: window.width * 0.66
-        height: 50
+    header: TabBar {
+        id: header
+        currentIndex: swipeView.currentIndex
+        contentHeight: 50
+
+        TabButton {
+            text: qsTr("Sending")
+        }
 
-        Column {
-            anchors.fill: parent
+        TabButton {
+            text: qsTr("Receiving")
+        }
 
-            ItemDelegate {
-                text: qsTr("Receiving")
-                width: parent.width
-                onClicked: {
-                    stackView.push("ReceivingForm.ui.qml")
-                    drawer.close()
-                }
-            }
+        TabButton {
+            text: qsTr("Messages")
+        }
+
+        TabButton {
+            text: qsTr("Settings")
+        }
+
+        TabButton {
+            text: qsTr("Help")
         }
     }
 
-    StackView {
-        id: stackView
-        initialItem: "SendingForm.ui.qml"
-        anchors.fill: parent
+    footer: FooterForm {
+
     }
+
+    IpPopupForm {
+        id: ipDialog
+        x: Math.round((parent.width - width) / 2)
+        y: Math.round((parent.height - height) / 2)
+    }
+
+    Component.onCompleted: ipDialog.open()
 }

+ 5 - 0
gui/src/qml.qrc

@@ -3,6 +3,11 @@
         <file>main.qml</file>
         <file>SendingForm.ui.qml</file>
         <file>ReceivingForm.ui.qml</file>
+        <file>SettingsForm.ui.qml</file>
+        <file>MessagesForm.ui.qml</file>
         <file>qtquickcontrols2.conf</file>
+        <file>IpPopupForm.ui.qml</file>
+        <file>HelpForm.ui.qml</file>
+        <file>FooterForm.ui.qml</file>
     </qresource>
 </RCC>

+ 5 - 8
gui/src/qmlhandler.cpp

@@ -1,15 +1,12 @@
 #include "qmlhandler.h"
-#include <string>
-
-using namespace std;
-
-string fileUrl;
 
 QMLHandler::QMLHandler(QObject *parent) : QObject(parent) {}
 
 void QMLHandler::onSelectFile(QUrl url) {
-  qInfo() << "File Selected: " << url.toString();
-  emit setFileUrlText("Selected File: " + url.toString());
+    qInfo() << "File Selected: " << url.toString();
+    emit setFileUrlText("Selected File: " + url.toString());
+}
 
-  fileUrl = url.toString().toStdString();
+void QMLHandler::onEnterIp(QString ip) {
+    qInfo() << ip;
 }

+ 5 - 3
gui/src/qmlhandler.h

@@ -1,5 +1,6 @@
-#ifndef CCATS_GUI_QMLHANDLER_H
-#define CCATS_GUI_QMLHANDLER_H
+#ifndef QMLHANDLER_H
+#define QMLHANDLER_H
+
 
 #include <QDebug>
 #include <QObject>
@@ -16,6 +17,7 @@ signals:
 
 public slots:
   void onSelectFile(QUrl url);
+  void onEnterIp(QString ip);
 };
 
-#endif // CCATS_GUI_QMLHANDLER_H
+#endif // QMLHANDLER_H

+ 1 - 4
gui/src/qtquickcontrols2.conf

@@ -7,7 +7,4 @@ Style=Material
 
 [Material]
 Theme=Dark
-;Accent=BlueGrey
-;Primary=BlueGray
-;Foreground=Brown
-;Background=Grey
+Accent=Blue