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
29
30namespace armarx
31{
32
33 QString
35 {
36 return "ArMem.MemoryViewer";
37 }
38
39 QIcon
41 {
42 return QIcon(":icons/memory-128.png");
43 }
44
46 {
47 widget.setupUi(getWidget());
48
50 {
51 .periodicUpdateViewLayout = widget.updateWidgetLayout,
52 .memoryGroupBox = widget.memoryGroupBox,
53 .memoryGroupBoxParentLayout = widget.treesLayout,
54 .instanceGroupBox = widget.instanceGroupBox,
55 .instanceGroupBoxParentLayout = widget.treesLayout,
56 .diskIOViewLayout = widget.diskControlWidgetLayout,
57 .statusLabel = widget.statusLabel
58 };
59
60
61 viewer = std::make_unique<MemoryViewer>(uiContext);
62 viewer->setLogTag("ArMem Memory Viewer");
63
64 armarx::gui::useSplitter(widget.treesLayout);
65
66 armarx::gui::connectLifecycle(&lifecycleServer, viewer.get());
67 }
68
72
73 void
75 {
76 emit lifecycleServer.initialized(this);
77 }
78
79 void
81 {
82 emit lifecycleServer.connected(this);
83 }
84
85 void
87 {
88 emit lifecycleServer.disconnected(this);
89 }
90
91 void
93 {
94 viewer->loadSettings(settings);
95 }
96
97 void
99 {
100 viewer->saveSettings(settings);
101 }
102
103 QPointer<QDialog>
105 {
106 if (!configDialog)
107 {
108 configDialog = new SimpleConfigDialog(parent);
109 viewer->writeConfigDialog(configDialog.data());
110 }
111 return qobject_cast<QDialog*>(configDialog);
112 }
113
114 void
116 {
117 if (configDialog)
118 {
119 viewer->readConfigDialog(configDialog.data());
120 }
121 }
122} // namespace armarx
void onInitComponent() override
Pure virtual hook for the subclass.
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void onConnectComponent() override
Pure virtual hook for the subclass.
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
A config-dialog containing one (or multiple) proxy finders.
void connectLifecycle(LifecycleServer *server, LifecycleClient *client)
Definition lifecycle.cpp:99
QSplitter * useSplitter(QLayout *layout)
Let items in layout be children of a splitter.
Definition gui_utils.cpp:44
This file offers overloads of toIce() and fromIce() functions for STL container types.