Skip to content

Commit

Permalink
Merge 24bb4b3 into 2ba68b8
Browse files Browse the repository at this point in the history
  • Loading branch information
AzulRadio authored Jul 14, 2022
2 parents 2ba68b8 + 24bb4b3 commit 15f131a
Show file tree
Hide file tree
Showing 23 changed files with 1,252 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/ci/after_make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export IGN_CONFIG_PATH=/usr/local/share/ignition
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH

# For rendering / window tests
Xvfb :1 -screen 0 1280x1024x24 &
Xvfb :1 -ac -noreset -core -screen 0 1280x1024x24 &
export DISPLAY=:1.0
export RENDER_ENGINE_VALUES=ogre2
export MESA_GL_VERSION_OVERRIDE=3.3
58 changes: 58 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,64 @@

## Ignition Gui 3

### Ignition Gui 3.10.0 (2022-07-13)

1. Add common widget for vector3
* [Pull request #427](https://github.com/gazebosim/gz-gui/pull/427)

1. Allow Dialogs to have a MainWindow independent config
* [Pull request #418](https://github.com/gazebosim/gz-gui/pull/418)

1. Add common widget for pose
* [Pull request #424](https://github.com/gazebosim/gz-gui/pull/424)
* [Pull request #431](https://github.com/gazebosim/gz-gui/pull/431)

1. Example running a dialog before the main window
* [Pull request #407](https://github.com/gazebosim/gz-gui/pull/407)

1. Common widget GzColor
* [Pull request #410](https://github.com/gazebosim/gz-gui/pull/410)

1. Fix ign_TEST
* [Pull request #420](https://github.com/gazebosim/gz-gui/pull/420)

1. Make display tests more robust
* [Pull request #419](https://github.com/gazebosim/gz-gui/pull/419)

1. Bash completion for flags
* [Pull request #392](https://github.com/gazebosim/gz-gui/pull/392)

1. Disable failing test on Citadel
* [Pull request #416](https://github.com/gazebosim/gz-gui/pull/416)

1. Search menu keyboard control
* [Pull request #403](https://github.com/gazebosim/gz-gui/pull/403)
* [Pull request #405](https://github.com/gazebosim/gz-gui/pull/405)

1. Add config relative path environment variable
* [Pull request #386](https://github.com/gazebosim/gz-gui/pull/386)

1. Sort plugin list in alphabetical order (including when filtering)
* [Pull request #387](https://github.com/gazebosim/gz-gui/pull/387)

1. Added array to snackbar qml
* [Pull request #370](https://github.com/gazebosim/gz-gui/pull/370)

1. Fix some Qt warnings
* [Pull request #376](https://github.com/gazebosim/gz-gui/pull/376)

1. Added Snackbar qtquick object
* [Pull request #369](https://github.com/gazebosim/gz-gui/pull/369)

1. Fix menu scrolling when a new plugin is added
* [Pull request #368](https://github.com/gazebosim/gz-gui/pull/368)

1. Improve KeyPublisher's usability
* [Pull request #362](https://github.com/gazebosim/gz-gui/pull/362)

1. Backport GridConfig improvements to Citadel's Grid3D
* [Pull request #363](https://github.com/gazebosim/gz-gui/pull/363)

### Ignition Gui 3.9.0 (2022-01-14)

1. Added a button that allows shutting down both the client and server.
Expand Down
25 changes: 25 additions & 0 deletions examples/standalone/start_dialog/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

project(gz-gui-start-dialog)

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

set(CMAKE_AUTOMOC ON)

find_package(ignition-gui6 REQUIRED)
set(GZ_GUI_VER ${ignition-gui6_VERSION_MAJOR})

set(EXEC_NAME "start_dialog")

QT5_ADD_RESOURCES(resources_RCC ${EXEC_NAME}.qrc)

add_executable(${EXEC_NAME}
${EXEC_NAME}.cc
${resources_RCC}
)
target_link_libraries(${EXEC_NAME}
ignition-gui${GZ_GUI_VER}::ignition-gui${GZ_GUI_VER}
)

16 changes: 16 additions & 0 deletions examples/standalone/start_dialog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Example for how to run a start dialog before the main window.

## Build

cd <this directory>
mkdir build
cd build
cmake ..
make

## Run

cd <this directory>/build
./start_dialog

First the dialog shows up, and after that's closed, the main window shows up.
90 changes: 90 additions & 0 deletions examples/standalone/start_dialog/start_dialog.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include <iostream>

#include <ignition/gui/qt.h>
#include <ignition/gui/Application.hh>
#include <ignition/gui/Dialog.hh>
#include <ignition/gui/MainWindow.hh>

//////////////////////////////////////////////////
int main(int _argc, char **_argv)
{
// Increase verboosity so we see all messages
ignition::common::Console::SetVerbosity(4);

// Create app
ignition::gui::Application app(_argc, _argv, ignition::gui::WindowType::kDialog);

igndbg << "Open dialog" << std::endl;

// Add and display a dialog
auto dialog = new ignition::gui::Dialog();
dialog->QuickWindow();

std::string qmlFile(":start_dialog/start_dialog.qml");
if (!QFile(QString::fromStdString(qmlFile)).exists())
{
ignerr << "Can't find [" << qmlFile
<< "]. Are you sure it was added to the .qrc file?" << std::endl;
return -1;
}

QQmlComponent dialogComponent(ignition::gui::App()->Engine(),
QString(QString::fromStdString(qmlFile)));
if (dialogComponent.isError())
{
std::stringstream errors;
errors << "Failed to instantiate QML file [" << qmlFile << "]."
<< std::endl;
for (auto error : dialogComponent.errors())
{
errors << "* " << error.toString().toStdString() << std::endl;
}
ignerr << errors.str();
return -1;
}

auto dialogItem = qobject_cast<QQuickItem *>(dialogComponent.create());
if (!dialogItem)
{
ignerr << "Failed to instantiate QML file [" << qmlFile << "]." << std::endl
<< "Are you sure the file is valid QML? "
<< "You can check with the `qmlscene` tool" << std::endl;
return -1;
}

dialogItem->setParentItem(dialog->RootItem());

// Execute start dialog
app.exec();

// After dialog is shut, display the main window
igndbg << "Dialog closed, open main window" << std::endl;

// Create main window
app.CreateMainWindow();

// Run main window
app.exec();

igndbg << "Main window closed" << std::endl;

return 0;
}

26 changes: 26 additions & 0 deletions examples/standalone/start_dialog/start_dialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import QtQuick 2.0
import QtQuick.Controls 2.0
Rectangle {
color: "green"
anchors.fill: parent
Text {
text: qsTr("Start\ndialog!")
font.pointSize: 30
}
}
5 changes: 5 additions & 0 deletions examples/standalone/start_dialog/start_dialog.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="start_dialog/">
<file>start_dialog.qml</file>
</qresource>
</RCC>
10 changes: 9 additions & 1 deletion include/ignition/gui/Application.hh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ namespace ignition
/// plugins
kMainWindow = 0,

/// \brief One independent dialog per plugin
/// \brief One independent dialog per plugin. Also useful to open a
/// startup dialog before the main window.
kDialog = 1
};

Expand Down Expand Up @@ -96,6 +97,7 @@ namespace ignition
/// and plugins. This function doesn't instantiate the plugins, it just
/// keeps them in memory and they can be applied later by either
/// instantiating a window or several dialogs.
/// and plugins.
/// \param[in] _path Full path to configuration file.
/// \return True if successful
/// \sa InitializeMainWindow
Expand Down Expand Up @@ -155,6 +157,7 @@ namespace ignition
/// \return True if successful
public: bool RemovePlugin(const std::string &_pluginName);


/// \brief Get a plugin by its unique name.
/// \param[in] _pluginName Plugn instance's unique name. This is the
/// plugin card's object name.
Expand All @@ -169,6 +172,11 @@ namespace ignition
/// \brief Callback when user requests to close a plugin
public slots: void OnPluginClose();

/// \brief Create a main window. Just calls InitializeMainWindow.
/// \return True if successful
/// \sa InitializeMainWindow
public: bool CreateMainWindow();

/// \brief Create a main window, populate with previously loaded plugins
/// and apply previously loaded configuration.
/// An empty window will be created if no plugins have been loaded.
Expand Down
23 changes: 23 additions & 0 deletions include/ignition/gui/Dialog.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define IGNITION_GUI_DIALOG_HH_

#include <memory>
#include <string>

#include "ignition/gui/qt.h"
#include "ignition/gui/Export.hh"
Expand Down Expand Up @@ -55,6 +56,28 @@ namespace ignition
/// \return Pointer to the item
public: QQuickItem *RootItem() const;

/// \brief Store dialog default config
/// \param[in] _config XML config as string
public: void SetDefaultConfig(const std::string &_config);

/// \brief Write dialog config
/// \param[in] _path config path
/// \param[in] _attribute XMLElement attribute name
/// \param[in] _value XMLElement attribute value
/// \return true if written to config file
public: bool UpdateConfigAttribute(
const std::string &_path, const std::string &_attribute,
const bool _value) const;

/// \brief Gets a config attribute value, if not found in config
/// write the default in the config and get it.
/// creates config file if it doesn't exist.
/// \param[in] _path config path
/// \param[in] _attribute attribute name
/// \return attribute value as string
public: std::string ReadConfigAttribute(const std::string &_path,
const std::string &_attribute) const;

/// \internal
/// \brief Private data pointer
private: std::unique_ptr<DialogPrivate> dataPtr;
Expand Down
1 change: 1 addition & 0 deletions include/ignition/gui/MainWindow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ namespace ignition

/// \brief Concatenation of all plugin configurations.
std::string plugins{""};

};
}
}
Expand Down
74 changes: 74 additions & 0 deletions include/ignition/gui/qml/GzColor.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import QtQuick 2.9
import QtQuick.Controls 2.1
import QtQuick.Dialogs 1.0
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.1


// RGBA using range 0 - 1.0
Item {
id: gzColorRoot

implicitWidth: 40
implicitHeight: 40

property double r: 1.0
property double g: 0.0
property double b: 0.0
property double a: 1.0

signal gzColorSet()

Button {
id: gzColorButton
Layout.leftMargin: 5
ToolTip.text: "Open color dialog"
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
background: Rectangle {
implicitWidth: 40
implicitHeight: 40
radius: 5
border.color: (Material.theme === Material.Light) ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
border.width: 2
color: Qt.rgba(r,g,b,a)
}
onClicked: gzColorDialog.open()
}

ColorDialog {
id: gzColorDialog
title: "Choose a color"
visible: false
showAlphaChannel: true
modality: Qt.ApplicationModal
onAccepted: {
r = gzColorDialog.color.r
g = gzColorDialog.color.g
b = gzColorDialog.color.b
a = gzColorDialog.color.a
gzColorRoot.gzColorSet()
gzColorDialog.close()
}
onRejected: {
gzColorDialog.close()
}
}
}

Loading

0 comments on commit 15f131a

Please sign in to comment.