Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 ➡️ 4 #234

Merged
merged 12 commits into from
Jun 22, 2021
Merged
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

* @chapulina
* @jennuine
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
id: ci
uses: ignition-tooling/action-ignition-ci@bionic
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
codecov-enabled: true
focal-ci:
runs-on: ubuntu-latest
name: Ubuntu Focal CI
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(ignition-gui4 VERSION 4.3.0)
#============================================================================
# Find ignition-cmake
#============================================================================
find_package(ignition-cmake2 2.3 REQUIRED)
find_package(ignition-cmake2 2.8.0 REQUIRED)

#============================================================================
# Configure the project
Expand Down
34 changes: 34 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,40 @@

### Ignition Gui 3.X.X (202X-XX-XX)

### Ignition Gui 3.6.0 (2021-06-17)

1. Update codeowners
* [Pull request #232](https://github.com/ignitionrobotics/ign-gui/pull/232)

1. Confirmation dialog when closing main window
* [Pull request #225](https://github.com/ignitionrobotics/ign-gui/pull/225)

1. Avoid grid3D crash
* [Pull request #227](https://github.com/ignitionrobotics/ign-gui/pull/227)

1. Emit more events from Scene3D
* [Pull request #213](https://github.com/ignitionrobotics/ign-gui/pull/213)

1. Removed duplicated code with rendering::sceneFromFirstRenderEngine
* [Pull request #223](https://github.com/ignitionrobotics/ign-gui/pull/223)

1. Remove `tools/code_check` and update codecov
* [Pull request #222](https://github.com/ignitionrobotics/ign-gui/pull/222)

1. Fixed material specular in `Scene3D`
* [Pull request #218](https://github.com/ignitionrobotics/ign-gui/pull/218)

1. `check_test_ran.py`: remove grep/xsltproc
* [Pull request #203](https://github.com/ignitionrobotics/ign-gui/pull/203)

### Ignition Gui 3.5.1 (2021-03-18)

1. Scene3D: port mesh material fixes from ign-gazebo
* [Pull request #191](https://github.com/ignitionrobotics/ign-gui/pull/191)

1. Improve the height of plugins in the right split
* [Pull request #194](https://github.com/ignitionrobotics/ign-gui/pull/194)

### Ignition Gui 3.5.0 (2021-03-10)

1. Screenshot plugin
Expand Down
1 change: 1 addition & 0 deletions examples/config/layout.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<position_y>230</position_y>
<width>550</width>
<height>551</height>
<dialog_on_exit>true</dialog_on_exit>
</window>
<plugin filename="Publisher">
<title>1</title>
Expand Down
21 changes: 20 additions & 1 deletion include/ignition/gui/MainWindow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace ignition

/// \brief The main window class creates a QQuickWindow and acts as an
/// interface which provides properties and functions which can be called
/// from MainWindow.qml
/// from Main.qml
class IGNITION_GUI_VISIBLE MainWindow : public QObject
{
Q_OBJECT
Expand Down Expand Up @@ -177,6 +177,14 @@ namespace ignition
NOTIFY ShowPluginMenuChanged
)

/// \brief Flag to enable confirmation dialog on exit
Q_PROPERTY(
bool showDialogOnExit
READ ShowDialogOnExit
WRITE SetShowDialogOnExit
NOTIFY ShowDialogOnExitChanged
)

/// \brief Constructor
public: MainWindow();

Expand Down Expand Up @@ -344,6 +352,14 @@ namespace ignition
/// \param[in] _showPluginMenu True to show.
public: Q_INVOKABLE void SetShowPluginMenu(const bool _showPluginMenu);

/// \brief Get the flag to show the plugin menu.
/// \return True to show.
public: Q_INVOKABLE bool ShowDialogOnExit() const;

/// \brief Set the flag to show the confirmation dialog when exiting.
/// \param[in] _showDialogOnExit True to show.
public: Q_INVOKABLE void SetShowDialogOnExit(bool _showDialogOnExit);

/// \brief Callback when load configuration is selected
public slots: void OnLoadConfig(const QString &_path);

Expand Down Expand Up @@ -398,6 +414,9 @@ namespace ignition
/// \brief Notifies when the show menu flag has changed.
signals: void ShowPluginMenuChanged();

/// \brief Notifies when the showDialogOnExit flag has changed.
signals: void ShowDialogOnExitChanged();

/// \brief Notifies when the window config has changed.
signals: void configChanged();

Expand Down
31 changes: 30 additions & 1 deletion include/ignition/gui/qml/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ApplicationWindow
property string pluginToolBarTextColorLight: MainWindow.pluginToolBarTextColorLight
property string pluginToolBarColorDark: MainWindow.pluginToolBarColorDark
property string pluginToolBarTextColorDark: MainWindow.pluginToolBarTextColorDark

property bool showDialogOnExit: MainWindow.showDialogOnExit
/**
* Tool bar background color
*/
Expand All @@ -71,6 +71,14 @@ ApplicationWindow
titleLabel.text = window.title
}

// Handler for window closing
onClosing: {
close.accepted = !showDialogOnExit
if(showDialogOnExit){
confirmationDialogOnExit.open()
}
}

// C++ signals to QML slots
Connections {
target: MainWindow
Expand Down Expand Up @@ -315,4 +323,25 @@ ApplicationWindow
}
}
}

/**
* Confirmation dialog on close button
*/
Dialog {
id: confirmationDialogOnExit
title: "Do you really want to exit?"

modal: true
focus: true
parent: ApplicationWindow.overlay
width: 300
x: (parent.width - width) / 2
y: (parent.height - height) / 2
closePolicy: Popup.CloseOnEscape
standardButtons: Dialog.Ok | Dialog.Cancel

onAccepted: {
Qt.quit()
}
}
}
8 changes: 8 additions & 0 deletions src/Application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ bool Application::LoadConfig(const std::string &_config)
return false;
}
this->dataPtr->windowConfig.MergeFromXML(std::string(printer.CStr()));

// Closing behavior.
if (auto dialogOnExitElem = winElem->FirstChildElement("dialog_on_exit"))
{
bool showDialogOnExit{false};
dialogOnExitElem->QueryBoolText(&showDialogOnExit);
this->dataPtr->mainWin->SetShowDialogOnExit(showDialogOnExit);
}
}

this->ApplyConfig();
Expand Down
16 changes: 16 additions & 0 deletions src/MainWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ namespace ignition
/// \brief Minimum number of paint events to consider the window to be
/// fully initialized.
public: const unsigned int paintCountMin{20};

/// \brief Show the confirmation dialog on exit
public: bool showDialogOnExit{false};
};
}
}
Expand Down Expand Up @@ -843,3 +846,16 @@ void MainWindow::SetShowPluginMenu(const bool _showPluginMenu)
this->dataPtr->windowConfig.showPluginMenu = _showPluginMenu;
this->ShowPluginMenuChanged();
}

/////////////////////////////////////////////////
bool MainWindow::ShowDialogOnExit() const
{
return this->dataPtr->showDialogOnExit;
}

/////////////////////////////////////////////////
void MainWindow::SetShowDialogOnExit(bool _showDialogOnExit)
{
this->dataPtr->showDialogOnExit = _showDialogOnExit;
this->ShowDialogOnExitChanged();
}
2 changes: 1 addition & 1 deletion src/plugins/grid_3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ ign_gui_add_plugin(Grid3D
TEST_SOURCES
# Grid3D_TEST.cc
PUBLIC_LINK_LIBS
${IGNITION-RENDERING_LIBRARIES}
ignition-rendering${IGN_RENDERING_VER}::ignition-rendering${IGN_RENDERING_VER}
)

4 changes: 2 additions & 2 deletions src/plugins/grid_3d/Grid3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ namespace plugins
class Grid3DPrivate
{
/// brief Parent window
public: QQuickWindow *quickWindow;
public: QQuickWindow *quickWindow = nullptr;

/// \brief We keep a pointer to the engine and rely on it not being
/// destroyed, since it is a singleton.
public: rendering::RenderEngine *engine;
public: rendering::RenderEngine *engine = nullptr;

/// \brief We keep the scene name rather than a shared pointer because we
/// don't want to share ownership.
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/scene3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ ign_gui_add_plugin(Scene3D
Scene3D.cc
QT_HEADERS
Scene3D.hh
TEST_SOURCES
# Scene3D_TEST.cc
PUBLIC_LINK_LIBS
${IGNITION-RENDERING_LIBRARIES}
ignition-rendering${IGN_RENDERING_VER}::ignition-rendering${IGN_RENDERING_VER}
)

Loading