From 7253fb5794bd06f7227eacf9df9c3ca9f8108a07 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 6 Mar 2015 05:15:46 +1100 Subject: Commenced UI overhaul for Heimdall Frontend 2.0 --- CMakeLists.txt | 4 +- OSX/README.txt | 2 +- Win32/README.txt | 2 +- heimdall-frontend/CMakeLists.txt | 26 ++++-- heimdall-frontend/mainwindow.qrc | 4 - heimdall-frontend/source/main.cpp | 7 +- heimdall-frontend/source/qml/DropFiles.qml | 7 ++ heimdall-frontend/source/qml/DropFilesForm.ui.qml | 60 +++++++++++++ heimdall-frontend/source/qml/Root.qml | 7 ++ heimdall-frontend/source/qml/RootForm.ui.qml | 73 ++++++++++++++++ heimdall-frontend/source/qml/drop_zone.svg | 101 ++++++++++++++++++++++ heimdall-frontend/source/qml/main.qml | 63 ++++++++++++++ heimdall-frontend/source/qml/qml.qrc | 9 ++ heimdall-frontend/source/qml/resources.qrc | 5 ++ heimdall/CMakeLists.txt | 2 +- 15 files changed, 355 insertions(+), 17 deletions(-) delete mode 100644 heimdall-frontend/mainwindow.qrc create mode 100644 heimdall-frontend/source/qml/DropFiles.qml create mode 100644 heimdall-frontend/source/qml/DropFilesForm.ui.qml create mode 100644 heimdall-frontend/source/qml/Root.qml create mode 100644 heimdall-frontend/source/qml/RootForm.ui.qml create mode 100644 heimdall-frontend/source/qml/drop_zone.svg create mode 100644 heimdall-frontend/source/qml/main.qml create mode 100644 heimdall-frontend/source/qml/qml.qrc create mode 100644 heimdall-frontend/source/qml/resources.qrc diff --git a/CMakeLists.txt b/CMakeLists.txt index a4f694d..258fcb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.11) + +set(Qt5Quick_DIR "/usr/local/Cellar/qt5/5.4.0/lib/cmake/Qt5Quick" CACHE FILEPATH "Qt5Quick path" FORCE) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake diff --git a/OSX/README.txt b/OSX/README.txt index 8c368b5..de71fa5 100644 --- a/OSX/README.txt +++ b/OSX/README.txt @@ -487,5 +487,5 @@ Appendix B - Installing Heimdall Suite from Source mkdir build cd build - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DQt5Widgets_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Widgets .. + cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DQt5Qml_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Qml -DQt5Quick_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Quick .. make diff --git a/Win32/README.txt b/Win32/README.txt index 362d06e..3e68918 100644 --- a/Win32/README.txt +++ b/Win32/README.txt @@ -543,5 +543,5 @@ Appendix B - Installing Heimdall Suite from Source mkdir build cd build - cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DQt5Widgets_DIR=/c/msys64/mingw64/qt5-static/lib/cmake/Qt5Widgets .. + cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DQt5Qml_DIR=/c/msys64/mingw64/qt5-static/lib/cmake/Qt5Qml -DQt5Quick_DIR=/c/msys64/mingw64/qt5-static/lib/cmake/Qt5Quick .. make diff --git a/heimdall-frontend/CMakeLists.txt b/heimdall-frontend/CMakeLists.txt index 95889b3..7cf87fe 100644 --- a/heimdall-frontend/CMakeLists.txt +++ b/heimdall-frontend/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.11) project(heimdall-frontend) @@ -8,6 +8,8 @@ set(LIBPIT_INCLUDE_DIRS set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) # moc files are generated in build (current) directory +find_package(Qt5Qml REQUIRED) +find_package(Qt5Quick REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(ZLIB REQUIRED) @@ -28,17 +30,26 @@ set(HEIMDALL_FRONTEND_SOURCE_FILES source/PackageData.cpp source/Packaging.cpp) +set(HEIMDALL_FRONTEND_QML_FILES + source/qml/main.qml + source/qml/Root.qml + source/qml/RootForm.ui.qml + source/qml/DropFiles.qml + source/qml/DropFilesForm.ui.qml) + qt5_wrap_ui(HEIMDALL_FRONTEND_FORMS mainwindow.ui aboutform.ui) qt5_add_resources(HEIMDALL_FRONTEND_RESOURCES - mainwindow.qrc) + source/qml/qml.qrc + source/qml/resources.qrc) add_executable(heimdall-frontend WIN32 MACOSX_BUNDLE ${HEIMDALL_FRONTEND_SOURCE_FILES} - ${HEIMDALL_FRONTEND_FORMS} + ${HEIMDALL_FRONTEND_FORMS} # So IDEs know about forms + ${HEIMDALL_FRONTEND_QML_FILES} # So IDEs know about QML ${HEIMDALL_FRONTEND_RESOURCES}) include(LargeFiles) @@ -47,6 +58,9 @@ use_large_files(heimdall-frontend YES) set_property(TARGET heimdall-frontend APPEND PROPERTY COMPILE_DEFINITIONS "QT_LARGEFILE_SUPPORT") -target_link_libraries(heimdall-frontend pit) -target_link_libraries(heimdall-frontend Qt5::Widgets) -target_link_libraries(heimdall-frontend z) +target_link_libraries(heimdall-frontend + pit + Qt5::Qml + Qt5::Quick + Qt5::Widgets + z) diff --git a/heimdall-frontend/mainwindow.qrc b/heimdall-frontend/mainwindow.qrc deleted file mode 100644 index 4479bd9..0000000 --- a/heimdall-frontend/mainwindow.qrc +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/heimdall-frontend/source/main.cpp b/heimdall-frontend/source/main.cpp index 5d70e28..6373006 100644 --- a/heimdall-frontend/source/main.cpp +++ b/heimdall-frontend/source/main.cpp @@ -20,12 +20,13 @@ // Qt #include -#include +#include // Heimdall Frontend #include "mainwindow.h" #if defined(QT_STATIC) +#include Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin); #endif @@ -35,8 +36,8 @@ int main(int argc, char *argv[]) { QApplication application(argc, argv); - MainWindow window; - window.show(); + QQmlApplicationEngine engine; + engine.load(QUrl(QString("qrc:/main.qml"))); return (application.exec()); } diff --git a/heimdall-frontend/source/qml/DropFiles.qml b/heimdall-frontend/source/qml/DropFiles.qml new file mode 100644 index 0000000..ac5c7a7 --- /dev/null +++ b/heimdall-frontend/source/qml/DropFiles.qml @@ -0,0 +1,7 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +DropFilesForm { + signal nextPressed(var files) +} diff --git a/heimdall-frontend/source/qml/DropFilesForm.ui.qml b/heimdall-frontend/source/qml/DropFilesForm.ui.qml new file mode 100644 index 0000000..3c9dd00 --- /dev/null +++ b/heimdall-frontend/source/qml/DropFilesForm.ui.qml @@ -0,0 +1,60 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +Rectangle { + Layout.preferredWidth: 420 + Layout.preferredHeight: 440 + color: "#eeeeee" + + DropArea { + id: dropFilesArea + } + + Column { + id: dropFilesColumn + spacing: 12 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + + Text { + id: dragFilesText + text: qsTr("Drop firmware files here") + opacity: 1 + anchors.horizontalCenter: parent.horizontalCenter + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + font.pixelSize: 18 + } + + Image { + id: image1 + width: 100 + height: 100 + opacity: 1 + anchors.horizontalCenter: parent.horizontalCenter + source: "drop_zone.svg" + } + + Button { + id: browseButton + text: qsTr("Browse") + isDefault: true + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Button { + id: flashButton + x: 556 + y: 606 + text: qsTr("Next") + visible: false + enabled: true + isDefault: true + anchors.bottom: parent.bottom + anchors.bottomMargin: 8 + anchors.right: parent.right + anchors.rightMargin: 8 + } +} diff --git a/heimdall-frontend/source/qml/Root.qml b/heimdall-frontend/source/qml/Root.qml new file mode 100644 index 0000000..9dae2f6 --- /dev/null +++ b/heimdall-frontend/source/qml/Root.qml @@ -0,0 +1,7 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +RootForm { + signal commenceFlash (var files) +} diff --git a/heimdall-frontend/source/qml/RootForm.ui.qml b/heimdall-frontend/source/qml/RootForm.ui.qml new file mode 100644 index 0000000..bc97a58 --- /dev/null +++ b/heimdall-frontend/source/qml/RootForm.ui.qml @@ -0,0 +1,73 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +Rectangle { + id: rectangle1 + width: 620 + height: 460 + color: "#eeeeee" + + RowLayout { + id: rowLayout1 + anchors.fill: parent + + Rectangle { + id: rectangle6 + color: "#222222" + width: 180 + anchors.top: parent.top + anchors.topMargin: 0 + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + + ListView { + id: listView1 + anchors.fill: parent + delegate: Item { + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + height: 40 + Row { + spacing: 8 + + Rectangle { + width: 40 + height: 40 + color: colorCode + } + + Text { + text: name + color: '#eeeeee' + anchors.verticalCenter: parent.verticalCenter + } + } + } + model: ListModel { + ListElement { + name: "Load Firmware" + colorCode: "red" + } + + ListElement { + name: "Utilities" + colorCode: "blue" + } + + ListElement { + name: "Configuration" + colorCode: "green" + } + } + } + } + DropFiles { + id: dropFiles1 + Layout.fillWidth: true + } + } + +} diff --git a/heimdall-frontend/source/qml/drop_zone.svg b/heimdall-frontend/source/qml/drop_zone.svg new file mode 100644 index 0000000..6e92752 --- /dev/null +++ b/heimdall-frontend/source/qml/drop_zone.svg @@ -0,0 +1,101 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/heimdall-frontend/source/qml/main.qml b/heimdall-frontend/source/qml/main.qml new file mode 100644 index 0000000..a6bb483 --- /dev/null +++ b/heimdall-frontend/source/qml/main.qml @@ -0,0 +1,63 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 + +ApplicationWindow { + title: qsTr("Heimdall Frontend") + minimumWidth: 620 + minimumHeight: 460 + width: 640 + height: 480 + visible: true + + menuBar: MenuBar { + Menu { + title: qsTr("&File") + MenuItem { + text: qsTr("&Open") + onTriggered: messageDialog.show(qsTr("Open action triggered")); + } + MenuItem { + text: qsTr("E&xit") + onTriggered: Qt.quit(); + } + } + } + + StackView { + id: stack + initialItem: root + anchors.fill: parent + + Root { + id: root + anchors.fill: parent + } + + function transitionFinished(properties) + { + properties.exitItem.x = 0 + } + + delegate: StackViewDelegate { + pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: target.width + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: target.width + duration: 300 + } + } + } + } +} diff --git a/heimdall-frontend/source/qml/qml.qrc b/heimdall-frontend/source/qml/qml.qrc new file mode 100644 index 0000000..5dbe3d0 --- /dev/null +++ b/heimdall-frontend/source/qml/qml.qrc @@ -0,0 +1,9 @@ + + + main.qml + Root.qml + RootForm.ui.qml + DropFiles.qml + DropFilesForm.ui.qml + + \ No newline at end of file diff --git a/heimdall-frontend/source/qml/resources.qrc b/heimdall-frontend/source/qml/resources.qrc new file mode 100644 index 0000000..4d9d39e --- /dev/null +++ b/heimdall-frontend/source/qml/resources.qrc @@ -0,0 +1,5 @@ + + + drop_zone.svg + + \ No newline at end of file diff --git a/heimdall/CMakeLists.txt b/heimdall/CMakeLists.txt index 58ff83b..9786b8c 100644 --- a/heimdall/CMakeLists.txt +++ b/heimdall/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.11) project(heimdall) -- cgit v1.2.3