--- /dev/null
+pragma Singleton
+import QtQuick 2.10
+
+Item {
+ FontLoader {
+ id: fontAwesomeLoader
+ source: "qrc:/assets/fontawesome.ttf"
+ }
+
+ readonly property color colourBackground: "#f4c842"
+ readonly property color colourNavigationBarBackground: "#000000"
+ readonly property color colourNavigationBarFont: "#ffffff"
+ readonly property int pixelSizeNavigationBarIcon: 42
+ readonly property int pixelSizeNavigationBarText: 22
+
+ readonly property real widthNavigationButtonIcon: 80
+ readonly property real heightNavigationButtonIcon: widthNavigationButtonIcon
+ readonly property real widthNavigationButtonDescription: 160
+ readonly property real heightNavigationButtonDescription: heightNavigationButtonIcon
+ readonly property real widthNavigationButton: widthNavigationButtonIcon + widthNavigationButtonDescription
+ readonly property real heightNavigationButton: Math.max(heightNavigationButtonIcon, heightNavigationButtonDescription)
+ readonly property real widthNavigationBarCollapsed: widthNavigationButtonIcon
+ readonly property real widthNavigationBarExpanded: widthNavigationButton
+
+ property alias fontAwesome: fontAwesomeLoader.name
+}
--- /dev/null
+module assets
+singleton Style 1.0 Style.qml
--- /dev/null
+<RCC>
+ <qresource prefix="/assets">
+ <file alias="qmldir">assets/qmldir</file>
+ <file alias="Style.qml">assets/Style.qml</file>
+ <file alias="fontawesome.ttf">assets/fa-solid-900.ttf</file>
+ </qresource>
+</RCC>
SOURCES += src/main.cpp
-RESOURCES += views.qrc
+RESOURCES += views.qrc \
+ asstes.qrc \
+ components.qrc
LIBS += -L$$PWD/../binaries/$$DESTINATION_PATH -lcm-lib
# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH = $$PWD
+QML_IMPORT_PATH += $$PWD
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
--- /dev/null
+<RCC>
+ <qresource prefix="/components">
+ <file alias="qmldir">components/qmldir</file>
+ <file alias="NavigationButton.qml">components/NavigationButton.qml</file>
+ <file alias="NavigationBar.qml">components/NavigationBar.qml</file>
+ </qresource>
+</RCC>
--- /dev/null
+import QtQuick 2.10
+
+import assets 1.0
+
+Item {
+ property bool isCollapsed: true
+ width: isCollapsed ? Style.widthNavigationBarCollapsed : Style.widthNavigationBarExpanded
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ left: parent.left
+ }
+ Rectangle {
+ id: navigationBar
+ color: Style.colourNavigationBarBackground
+ anchors.fill: parent
+ Column {
+ width: parent.width
+
+ NavigationButton {
+ iconHeight: Style.heightNavigationButtonIcon
+ iconWidth: Style.widthNavigationButtonIcon
+ descriptionHeight: Style.heightNavigationButtonDescription
+ descriptionWidth: Style.widthNavigationButtonDescription
+ color: Style.colourNavigationBarFont
+ background: Style.colourNavigationBarBackground
+ hoverColor: "#993333"
+ iconCharacter: "\uf0c9"
+ description: ""
+ onNavigationButtonClicked: isCollapsed = !isCollapsed
+ }
+
+ NavigationButton {
+ iconHeight: Style.heightNavigationButtonIcon
+ iconWidth: Style.widthNavigationButtonIcon
+ descriptionHeight: Style.heightNavigationButtonDescription
+ descriptionWidth: Style.widthNavigationButtonDescription
+ color: Style.colourNavigationBarFont
+ background: Style.colourNavigationBarBackground
+ hoverColor: "#dc8a00"
+ iconCharacter: "\uf015"
+ description: "Dashboard"
+ onNavigationButtonClicked: masterController.ui_navigationController.goDashboardView()
+ }
+
+ NavigationButton {
+ iconHeight: Style.heightNavigationButtonIcon
+ iconWidth: Style.widthNavigationButtonIcon
+ descriptionHeight: Style.heightNavigationButtonDescription
+ descriptionWidth: Style.widthNavigationButtonDescription
+ color: Style.colourNavigationBarFont
+ background: Style.colourNavigationBarBackground
+ hoverColor: "#dccd00"
+ iconCharacter: "\uf234"
+ description:"New Client"
+ onNavigationButtonClicked: masterController.ui_navigationController.goCreateClientView()
+ }
+
+ NavigationButton {
+ iconHeight: Style.heightNavigationButtonIcon
+ iconWidth: Style.widthNavigationButtonIcon
+ descriptionHeight: Style.heightNavigationButtonDescription
+ descriptionWidth: Style.widthNavigationButtonDescription
+ color: Style.colourNavigationBarFont
+ background: Style.colourNavigationBarBackground
+ hoverColor: "#8aef63"
+ iconCharacter: "\uf002"
+ description: "Find Client"
+ onNavigationButtonClicked: masterController.ui_navigationController.goFindClientView()
+ }
+
+ }
+ }
+}
--- /dev/null
+import QtQuick 2.10
+import QtQuick.Window 2.10
+import QtQuick.Controls 2.2
+
+import assets 1.0
+
+Item {
+ id: top
+ property alias iconCharacter: textIcon.text
+ property alias description: textDescription.text
+ property color color: "#ff0000"
+ property color background: "#00ff00"
+ property color hoverColor: "#0000ff"
+ property real iconWidth: 0
+ property real descriptionWidth: 0
+ property real iconHeight: 0
+ property real descriptionHeight: 0
+ height: Math.max(iconHeight, descriptionHeight)
+ width: parent.width
+
+ signal navigationButtonClicked()
+
+ Rectangle {
+ id: backgroundRect
+ anchors.fill: parent
+ color: top.background
+ states: [
+ State {
+ name: "hover"
+ PropertyChanges {
+ target: backgroundRect
+ color: hoverColor
+ }
+ }
+ ]
+
+ Row {
+ Text {
+ id: textIcon
+ width: top.iconWidth
+ height: top.height
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ font {
+ family: Style.fontAwesome
+ pixelSize: Style.pixelSizeNavigationBarIcon
+ }
+ color: top.color
+ text: "\uf11a"
+ }
+ Text {
+ id: textDescription
+ width: top.descriptionWidth
+ height: top.height
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: Style.pixelSizeNavigationBarText
+ color: top.color
+ text: "SET ME!!"
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ hoverEnabled: true
+ onEntered: backgroundRect.state = "hover"
+ onExited: backgroundRect.state = ""
+ onClicked: navigationButtonClicked()
+ }
+ }
+}
--- /dev/null
+module components
+NavigationButton 1.0 NavigationButton.qml
+NavigationBar 1.0 NavigationBar.qml
cm::controllers::MasterController masterController;
QQmlApplicationEngine engine;
+ engine.addImportPath("qrc:/");
engine.rootContext()->setContextProperty("masterController", &masterController);
engine.load(QUrl(QStringLiteral("qrc:/views/MasterView.qml")));
if (engine.rootObjects().isEmpty())
import QtQuick 2.10
+import assets 1.0
+
Item {
Rectangle {
anchors.fill: parent
- color: "#f4c842"
+ color: Style.colourBackground
Text {
anchors.centerIn: parent
import QtQuick 2.10
+import assets 1.0
+
Item {
Rectangle {
anchors.fill: parent
- color: "#208010"
+ color: Style.colourBackground
Text {
anchors.centerIn: parent
import QtQuick 2.10
+import assets 1.0
+
Item {
Rectangle {
anchors.fill: parent
- color: "#f4c842"
+ color: Style.colourBackground
Text {
anchors.centerIn: parent
import QtQuick 2.10
+import assets 1.0
+
Item {
Rectangle {
anchors.fill: parent
- color: "#f4c842"
+ color: Style.colourBackground
Text {
anchors.centerIn: parent
import QtQuick.Window 2.10
import QtQuick.Controls 2.2
+import assets 1.0
+import components 1.0
+
Window {
visible: true
width: 640
onGoFindClientView: contentFrame.replace(Qt.resolvedUrl("qrc:/views/FindClientView.qml"))
}
- Rectangle {
+ NavigationBar {
id: navigationBar
- anchors {
- top: parent.top
- bottom: parent.bottom
- left: parent.left
- }
- width: 100
- color:"#000000"
- Column {
-
- Button {
- text: "Dashboard"
- onClicked: masterController.ui_navigationController.goDashboardView()
- }
-
- Button {
- text: "New Client"
- onClicked: masterController.ui_navigationController.goCreateClientView()
- }
-
- Button {
- text: "Find Client"
- onClicked: masterController.ui_navigationController.goFindClientView()
- }
-
- }
}
StackView {
import QtQuick 2.10
+import assets 1.0
+
Item {
Rectangle {
anchors.fill: parent
- color: "#f4c842"
+ color: Style.colourBackground
Text {
anchors.centerIn: parent