Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Nov 10, 2023
1 parent 364fbca commit 2726159
Show file tree
Hide file tree
Showing 27 changed files with 304 additions and 357 deletions.
19 changes: 17 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,31 @@ set(GZ_TOOLS_VER 2)

#--------------------------------------
# Find QT
gz_find_package (Qt5
gz_find_package (Qt6
COMPONENTS
Core
Quick
QuickControls2
Widgets
REQUIRED
PKGCONFIG "Qt5Core Qt5Quick Qt5QuickControls2 Qt5Widgets"
PKGCONFIG "Qt6Core Qt6Quick Qt6QuickControls2 Qt6Widgets"
)

if (BUILD_TESTING)
gz_find_package (Qt6
COMPONENTS
Test
REQUIRED
PKGCONFIG "Qt6Test"
)
endif()

if(POLICY CMP0100)
cmake_policy(SET CMP0100 NEW)
endif()

qt_standard_project_setup()

set(GZ_GUI_PLUGIN_RELATIVE_INSTALL_DIR
${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins
)
Expand Down
43 changes: 0 additions & 43 deletions examples/config/scene3d.config
Original file line number Diff line number Diff line change
Expand Up @@ -72,46 +72,3 @@
<property key="showTitleBar" type="bool">false</property>
</gz-gui>
</plugin>
<plugin filename="WorldControl">
<gz-gui>
<title>Controls</title>
<property type="bool" key="showTitleBar">false</property>
<property type="bool" key="resizable">false</property>
<property type="double" key="height">72</property>
<property type="double" key="width">121</property>
<property type="double" key="z">1</property>

<property type="string" key="state">floating</property>
<anchors target="View 1">
<line own="left" target="left"/>
<line own="bottom" target="bottom"/>
</anchors>
</gz-gui>
<play_pause>true</play_pause>
<step>true</step>
<start_paused>false</start_paused>
<service>/world_control</service>
<stats_topic>/world_stats</stats_topic>
</plugin>

<plugin filename="WorldStats">
<gz-gui>
<title>Stats</title>
<property type="bool" key="showTitleBar">false</property>
<property type="bool" key="resizable">false</property>
<property type="double" key="height">110</property>
<property type="double" key="width">290</property>
<property type="double" key="z">1</property>

<property type="string" key="state">floating</property>
<anchors target="View 1">
<line own="right" target="right"/>
<line own="bottom" target="bottom"/>
</anchors>
</gz-gui>
<sim_time>true</sim_time>
<real_time>true</real_time>
<real_time_factor>true</real_time_factor>
<iterations>true</iterations>
<topic>/world_stats</topic>
</plugin>
32 changes: 7 additions & 25 deletions include/gz/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
include_directories(
${Qt5Core_INCLUDE_DIRS}
${tinyxml_INCLUDE_DIRS}
${Qt5Qml_INCLUDE_DIRS}
${Qt5Quick_INCLUDE_DIRS}
${Qt5QuickControls2_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
)

if(POLICY CMP0100)
cmake_policy(SET CMP0100 NEW)
endif()

set (CMAKE_AUTOMOC ON)

add_definitions(
${Qt5Core_DEFINITIONS}
${Qt5Qml_DEFINITIONS}
${Qt5Quick_DEFINITIONS}
${Qt5QuickControls2_DEFINITIONS}
${Qt5Widgets_DEFINITIONS}
)

set (qt_headers
Application.hh
Dialog.hh
Expand All @@ -42,8 +25,8 @@ set (headers

set (resources resources.qrc)

QT5_WRAP_CPP(headers_MOC ${qt_headers})
QT5_ADD_RESOURCES(resources_RCC ${resources})
QT_WRAP_CPP(headers_MOC ${qt_headers})
QT_ADD_RESOURCES(resources_RCC ${resources})

gz_create_core_library(SOURCES
${sources}
Expand All @@ -67,13 +50,12 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
gz-msgs${GZ_MSGS_VER}::gz-msgs${GZ_MSGS_VER}
gz-plugin${GZ_PLUGIN_VER}::loader
gz-transport${GZ_TRANSPORT_VER}::gz-transport${GZ_TRANSPORT_VER}
${Qt5Core_LIBRARIES}
${Qt5Qml_LIBRARIES}
${Qt5Quick_LIBRARIES}
${Qt5QuickControls2_LIBRARIES}
${Qt5Widgets_LIBRARIES}
Qt::Core
Qt::Qml
Qt::Quick
Qt::QuickControls2
Qt::Widgets
TINYXML2::TINYXML2
)

gz_install_all_headers()

1 change: 0 additions & 1 deletion include/gz/gui/qml/GzCard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*
*/
import QtQuick 2.9
import QtQuick.Controls 1.4 as QQC1
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
Expand Down
23 changes: 12 additions & 11 deletions include/gz/gui/qml/GzCardSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.0
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Dialogs
import "qrc:/qml"

Dialog {
Expand Down Expand Up @@ -135,7 +135,7 @@ Dialog {

GzSpinBox {
visible: !cardPane.anchored
maximumValue: cardPane.parent ? cardPane.parent.width - cardPane.width : minSize
to: cardPane.parent ? cardPane.parent.width - cardPane.width : from
onVisibleChanged: value = cardPane.x
onValueChanged: {
cardPane.x = value;
Expand All @@ -147,7 +147,7 @@ Dialog {
}
GzSpinBox {
visible: !cardPane.anchored
maximumValue: cardPane.parent ? cardPane.parent.height - cardPane.height : minSize
to: cardPane.parent ? cardPane.parent.height - cardPane.height : from
onVisibleChanged: value = cardPane.y
onValueChanged: {
cardPane.y = value;
Expand All @@ -159,7 +159,7 @@ Dialog {
}
GzSpinBox {
visible: !cardPane.anchored
maximumValue: 10000
to: 10000
onVisibleChanged: value = cardPane.z
onValueChanged: {
cardPane.z = value;
Expand All @@ -177,7 +177,7 @@ Dialog {
text: ""
}
GzSpinBox {
maximumValue: cardPane.parent ? cardPane.parent.width : minSize
to: cardPane.parent ? cardPane.parent.width : from
onVisibleChanged: {
if (cardPane)
value = cardPane.width
Expand All @@ -190,7 +190,8 @@ Dialog {
text: "Width"
}
GzSpinBox {
maximumValue: cardPane.parent ? cardPane.parent.height : minSize
to: cardPane.parent ? cardPane.parent.height : from

onVisibleChanged: {
if (cardPane)
value = cardPane.height
Expand All @@ -208,7 +209,7 @@ Dialog {
ColorDialog {
id: colorDialog
title: "Please choose a color"
showAlphaChannel : true
options: [ColorDialog.ShowAlphaChannel]
onAccepted: {
content.color = colorDialog.color
bgColor.color = colorDialog.color
Expand Down
9 changes: 1 addition & 8 deletions include/gz/gui/qml/GzSnackBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
*
*/

import QtGraphicalEffects 1.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtQuick.Dialogs 1.0
import QtQuick.Dialogs
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2

Expand Down Expand Up @@ -70,12 +69,6 @@ Popup {
background: Rectangle {
color: Material.background
layer.enabled: true
layer.effect: DropShadow {
color: "#aa000000"
samples: 9
spread: 0
radius: 8.0
}
}

// this function is called when notify() or notifyWithDuration() are called
Expand Down
15 changes: 6 additions & 9 deletions include/gz/gui/qml/GzSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
* limitations under the License.
*
*/
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick
import QtQuick.Controls

SpinBox {
style: SpinBoxStyle{
background: Rectangle {
implicitWidth: 70
implicitHeight: 40
border.color: "gray"
}
background: Rectangle {
implicitWidth: 70
implicitHeight: 40
border.color: "gray"
}
}
4 changes: 1 addition & 3 deletions include/gz/gui/qml/GzSplit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
*
*/
import QtQuick 2.9
import QtQuick.Controls 1.1
import QtQuick.Controls 2.2
import QtQuick.Controls
import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3

Expand Down Expand Up @@ -382,4 +381,3 @@ SplitView {
}
}
}

8 changes: 1 addition & 7 deletions include/gz/gui/qml/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.1
import QtQuick.Dialogs 1.0
import QtQuick.Dialogs
import QtQuick.Layouts 1.3
import ExitAction 1.0
import "qrc:/qml"
Expand Down Expand Up @@ -295,10 +295,7 @@ ApplicationWindow
FileDialog {
id: loadFileDialog
title: "Load configuration"
folder: shortcuts.home
nameFilters: [ "Config files (*.config)" ]
selectMultiple: false
selectExisting: true
onAccepted: {
MainWindow.OnLoadConfig(fileUrl)
}
Expand All @@ -310,10 +307,7 @@ ApplicationWindow
FileDialog {
id: saveFileDialog
title: "Save configuration"
folder: shortcuts.home
nameFilters: [ "Config files (*.config)" ]
selectMultiple: false
selectExisting: false
onAccepted: {
var selected = fileUrl.toString();

Expand Down
23 changes: 1 addition & 22 deletions include/gz/gui/qml/StyleDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.1
import QtQuick.Dialogs 1.0
import QtQuick.Dialogs

/**
* Style dialog
Expand Down Expand Up @@ -309,9 +309,6 @@ Dialog {
text: modelData
width: parent.width
}
onCurrentTextChanged: {
updateTheme();
}
}

Label {
Expand All @@ -322,15 +319,6 @@ Dialog {
id: materialPrimaryDialog
title: "Primary color"
// options: ColorDialog.NoButtons
onCurrentColorChanged: {

// Avoiding pure black because for some reason it is set to that as the
// dialog opens
if (currentColor == "#000000")
return;

updatePrimary(colorToHex(currentColor))
}
}

Row {
Expand Down Expand Up @@ -368,15 +356,6 @@ Dialog {
id: materialAccentDialog
title: "Accent color"
// options: ColorDialog.NoButtons
onCurrentColorChanged: {

// Avoiding pure black because for some reason it is set to that as the
// dialog opens
if (currentColor == "#000000")
return;

updateAccent(colorToHex(currentColor))
}
}

Row {
Expand Down
Loading

0 comments on commit 2726159

Please sign in to comment.