Skip to content

Commit

Permalink
Consolidate namespaces: examples
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Oct 30, 2023
1 parent ca27cf9 commit f0b716b
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 119 deletions.
7 changes: 2 additions & 5 deletions examples/plugin/custom_context_menu/CustomContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@

#include "CustomContext.hh"

using namespace gz;
using namespace gui;

/////////////////////////////////////////////////
CustomContext::CustomContext()
: Plugin()
: gz::gui::Plugin()
{
}

Expand All @@ -36,4 +33,4 @@ CustomContext::~CustomContext()

// Register this plugin
GZ_ADD_PLUGIN(gz::gui::CustomContext,
gz::gui::Plugin);
gz::gui::Plugin);
22 changes: 8 additions & 14 deletions examples/plugin/custom_context_menu/CustomContext.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,15 @@
#include <gz/gui/Plugin.hh>
#endif

namespace gz
class CustomContext : public gz::gui::Plugin
{
namespace gui
{
class CustomContext : public Plugin
{
Q_OBJECT
Q_OBJECT

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

/// \brief Destructor
public: virtual ~CustomContext();
};
}
}
/// \brief Destructor
public: virtual ~CustomContext();
};

#endif
#endif // GZ_GUI_CUSTOMCONTEXTPLUGIN_HH_
7 changes: 2 additions & 5 deletions examples/plugin/dialog_from_plugin/DialogFromPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@

#include "DialogFromPlugin.hh"

using namespace gz;
using namespace gui;

/////////////////////////////////////////////////
DialogFromPlugin::DialogFromPlugin()
: Plugin()
: gz::gui::Plugin()
{
}

Expand All @@ -36,4 +33,4 @@ DialogFromPlugin::~DialogFromPlugin()

// Register this plugin
GZ_ADD_PLUGIN(gz::gui::DialogFromPlugin,
gz::gui::Plugin);
gz::gui::Plugin);
22 changes: 8 additions & 14 deletions examples/plugin/dialog_from_plugin/DialogFromPlugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,15 @@
#include <gz/gui/Plugin.hh>
#endif

namespace gz
class DialogFromPlugin : public gz::gui::Plugin
{
namespace gui
{
class DialogFromPlugin : public Plugin
{
Q_OBJECT
Q_OBJECT

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

/// \brief Destructor
public: virtual ~DialogFromPlugin();
};
}
}
/// \brief Destructor
public: virtual ~DialogFromPlugin();
};

#endif
#endif // GZ_GUI_DIALOGFROMPLUGIN_HH_
18 changes: 6 additions & 12 deletions examples/plugin/gz_components/GzComponents.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@

#include <gz/gui/Plugin.hh>

namespace gz
class GzComponents : public gz::gui::Plugin
{
namespace gui
{
class GzComponents : public Plugin
{
Q_OBJECT
Q_OBJECT

/// \brief Constructor
public: GzComponents() = default;
};
}
}
/// \brief Constructor
public: GzComponents() = default;
};

#endif
#endif // GZ_GUI_EXAMPLES_PLUGIN_GZCOMPONENTS_HH_
7 changes: 2 additions & 5 deletions examples/plugin/hello_plugin/HelloPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@

#include "HelloPlugin.hh"

using namespace gz;
using namespace gui;

/////////////////////////////////////////////////
HelloPlugin::HelloPlugin()
: Plugin()
: gz::gui::Plugin()
{
}

Expand Down Expand Up @@ -54,4 +51,4 @@ void HelloPlugin::OnButton()

// Register this plugin
GZ_ADD_PLUGIN(gz::gui::HelloPlugin,
gz::gui::Plugin);
gz::gui::Plugin);
38 changes: 16 additions & 22 deletions examples/plugin/hello_plugin/HelloPlugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,26 @@
#include <gz/gui/qt.h>
#include <gz/gui/Plugin.hh>

namespace gz
class HelloPlugin : public gz::gui::Plugin
{
namespace gui
{
class HelloPlugin : public Plugin
{
Q_OBJECT
Q_OBJECT

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

/// \brief Destructor
public: virtual ~HelloPlugin();
/// \brief Destructor
public: virtual ~HelloPlugin();

/// \brief Called by Gazebo GUI when plugin is instantiated.
/// \param[in] _pluginElem XML configuration for this plugin.
public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem)
override;
/// \brief Called by Gazebo GUI when plugin is instantiated.
/// \param[in] _pluginElem XML configuration for this plugin.
public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem)
override;

/// \brief Callback trigged when the button is pressed.
protected slots: void OnButton();
/// \brief Callback trigged when the button is pressed.
protected slots: void OnButton();

/// \brief Message to be printed when button is pressed.
private: std::string message{"Hello, plugin!"};
};
}
}
/// \brief Message to be printed when button is pressed.
private: std::string message{"Hello, plugin!"};
};

#endif
#endif // GZ_GUI_HELLOPLUGIN_HH_
7 changes: 2 additions & 5 deletions examples/plugin/multiple_qml/MultipleQml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@

#include "MultipleQml.hh"

using namespace gz;
using namespace gui;

/////////////////////////////////////////////////
MultipleQml::MultipleQml()
: Plugin()
: gz::gui::Plugin()
{
}

Expand All @@ -42,4 +39,4 @@ void MultipleQml::OnButton(const QString &_text)

// Register this plugin
GZ_ADD_PLUGIN(gz::gui::MultipleQml,
gz::gui::Plugin);
gz::gui::Plugin);
28 changes: 11 additions & 17 deletions examples/plugin/multiple_qml/MultipleQml.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,19 @@
#include <gz/gui/Plugin.hh>
#endif

namespace gz
class MultipleQml : public gz::gui::Plugin
{
namespace gui
{
class MultipleQml : public Plugin
{
Q_OBJECT
Q_OBJECT

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

/// \brief Destructor
public: virtual ~MultipleQml();
/// \brief Destructor
public: virtual ~MultipleQml();

/// \brief Callback trigged when the button is pressed.
/// \param[in] _text Button text.
protected slots: void OnButton(const QString &_text);
};
}
}
/// \brief Callback trigged when the button is pressed.
/// \param[in] _text Button text.
protected slots: void OnButton(const QString &_text);
};

#endif
#endif // GZ_GUI_EXAMPLES_PLUGINS_MULTIPLEQML_HH_
1 change: 0 additions & 1 deletion examples/standalone/custom_drawer/custom_drawer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ int main(int _argc, char **_argv)

return 0;
}

31 changes: 12 additions & 19 deletions examples/standalone/custom_drawer/custom_drawer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,18 @@
#include <gz/gui/qt.h>
#endif

namespace gz
/// \brief Object holding actions which can be triggered from the custom
/// drawer.
class CustomActions : public QObject
{
namespace gui
{
/// \brief Object holding actions which can be triggered from the custom
/// drawer.
class CustomActions : public QObject
{
Q_OBJECT

/// \brief Demonstrates a C++ function which can be called from the
/// drawer's QML code.
public: Q_INVOKABLE void cppActionFromQml() const
{
std::cout << "C++ action called from QML" << std::endl;
}
};
}
}
Q_OBJECT

#endif
/// \brief Demonstrates a C++ function which can be called from the
/// drawer's QML code.
public: Q_INVOKABLE void cppActionFromQml() const
{
std::cout << "C++ action called from QML" << std::endl;
}
};

#endif //GZ_GUI_EXAMPLES_STANDALONE_CUSTOMDRAWER_HH_

0 comments on commit f0b716b

Please sign in to comment.