ArMemMemoryViewerWidgetController.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * \package RobotAPI::gui-plugins::ArMemMemoryViewerWidgetController
17  * \author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * \date 2020
19  * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
24 
25 #include <string>
26 
28 
29 namespace armarx
30 {
31 
32  QString
34  {
35  return "ArMem.MemoryViewer";
36  }
37 
38  QIcon
40  {
41  return QIcon(":icons/memory-128.png");
42  }
43 
45  {
46  widget.setupUi(getWidget());
47 
48  viewer = std::make_unique<MemoryViewer>(
49 
50  widget.updateWidgetLayout,
51 
52  widget.memoryGroupBox,
53  widget.treesLayout,
54 
55  widget.instanceGroupBox,
56  widget.treesLayout,
57 
58  widget.diskControlWidgetLayout,
59 
60  widget.statusLabel);
61  viewer->setLogTag("ArMem Memory Viewer");
62 
63  armarx::gui::useSplitter(widget.treesLayout);
64 
65  armarx::gui::connectLifecycle(&lifecycleServer, viewer.get());
66  }
67 
69  {
70  }
71 
72  void
74  {
75  emit lifecycleServer.initialized(this);
76  }
77 
78  void
80  {
81  emit lifecycleServer.connected(this);
82  }
83 
84  void
86  {
87  emit lifecycleServer.disconnected(this);
88  }
89 
90  void
92  {
93  viewer->loadSettings(settings);
94  }
95 
96  void
98  {
99  viewer->saveSettings(settings);
100  }
101 
102  QPointer<QDialog>
104  {
105  if (!configDialog)
106  {
107  configDialog = new SimpleConfigDialog(parent);
108  viewer->writeConfigDialog(configDialog.data());
109  }
110  return qobject_cast<QDialog*>(configDialog);
111  }
112 
113  void
115  {
116  if (configDialog)
117  {
118  viewer->readConfigDialog(configDialog.data());
119  }
120  }
121 } // namespace armarx
armarx::gui::LifecycleServer::initialized
void initialized(ManagedIceObject *component)
armarx::ArMemMemoryViewerWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: ArMemMemoryViewerWidgetController.cpp:97
armarx::ArMemMemoryViewerWidgetController::ArMemMemoryViewerWidgetController
ArMemMemoryViewerWidgetController()
Definition: ArMemMemoryViewerWidgetController.cpp:44
armarx::ArMemMemoryViewerWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: ArMemMemoryViewerWidgetController.cpp:114
armarx::ArMemMemoryViewerWidgetController::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: ArMemMemoryViewerWidgetController.cpp:39
armarx::ArMemMemoryViewerWidgetController::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: ArMemMemoryViewerWidgetController.cpp:79
armarx::ArMemMemoryViewerWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: ArMemMemoryViewerWidgetController.cpp:103
armarx::ArMemMemoryViewerWidgetController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: ArMemMemoryViewerWidgetController.cpp:85
armarx::ArMemMemoryViewerWidgetController::GetWidgetName
static QString GetWidgetName()
Definition: ArMemMemoryViewerWidgetController.cpp:33
armarx::gui::connectLifecycle
void connectLifecycle(LifecycleServer *server, LifecycleClient *client)
Definition: lifecycle.cpp:90
armarx::ArMemMemoryViewerWidgetController::~ArMemMemoryViewerWidgetController
virtual ~ArMemMemoryViewerWidgetController() override
Definition: ArMemMemoryViewerWidgetController.cpp:68
ArMemMemoryViewerWidgetController.h
armarx::gui::LifecycleServer::disconnected
void disconnected(ManagedIceObject *component)
armarx::ArmarXWidgetController::getWidget
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
Definition: ArmarXWidgetController.cpp:54
armarx::ArMemMemoryViewerWidgetController::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: ArMemMemoryViewerWidgetController.cpp:73
armarx::gui::LifecycleServer::connected
void connected(ManagedIceObject *component)
armarx::ArMemMemoryViewerWidgetController::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: ArMemMemoryViewerWidgetController.cpp:91
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::gui::useSplitter
QSplitter * useSplitter(QLayout *layout)
Let items in layout be children of a splitter.
Definition: gui_utils.cpp:43
gui_utils.h
armarx::SimpleConfigDialog
A config-dialog containing one (or multiple) proxy finders.
Definition: SimpleConfigDialog.h:84