GridFSFileEditorWidgetController.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::gui-plugins::GridFSFileEditorWidgetController
19  * @author Mirko Waechter (waechter at kit dot edu)
20  * @date 2014
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
28 
31 
32 #include <MemoryX/gui-plugins/GridFSFileEditor/ui_GridFSFileEditorWidget.h>
33 #include <MemoryX/interface/components/LongtermMemoryInterface.h>
34 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
35 
36 namespace armarx
37 {
38  /**
39  \page MemoryX-GuiPlugins-GridFSFileEditor GridFS FileEditor
40  \brief This widget allows viewing files that are referenced in the prior knowledge database.
41  \image html GridFSFileEditorGui.png
42 
43  For details on GridFS see the \ref MemoryX-GridFilesystem "GridFS description"
44 
45  GridFS Editor API Documentation \ref GridFSFileEditorWidgetControlle
46  \see GridFSFileEditorGuiPlugin
47  */
48 
49  /**
50  * \class GridFSFileEditorWidgetController
51  * \brief This widget allows viewing files that are referenced in the prior knowledge database.
52  * \see GridFSFileEditorGuiPlugin
53  */
55  public ArmarXComponentWidgetControllerTemplate<GridFSFileEditorWidgetController>
56  {
57  Q_OBJECT
58 
59  public:
60  /**
61  * Controller Constructor
62  */
64 
65  /**
66  * Controller destructor
67  */
69 
70  /**
71  * \see ArmarXWidgetController::loadSettings()
72  */
73  void loadSettings(QSettings* settings) override;
74 
75  /**
76  * \see ArmarXWidgetController::saveSettings()
77  */
78  void saveSettings(QSettings* settings) override;
79 
80  /**
81  * Returns the Widget name displayed in the ArmarXGui to create an
82  * instance of this class.
83  */
84  static QString
86  {
87  return "MemoryX.GridFSFileEditor";
88  }
89 
90  static QIcon
92  {
93  return QIcon{"://icons/server.svg"};
94  }
95 
96  /**
97  * \see armarx::Component::onInitComponent()
98  *
99  * Initializes waiting for proxies of LongtermMemory and WorkingMemory.
100  */
101  void onInitComponent() override;
102 
103  /**
104  * \see armarx::Component::onConnectComponent()
105  *
106  * Fetches proxies and the list of all available snapshots.
107  * Enables the main widget.
108  */
109  void onConnectComponent() override;
110 
111  /**
112  * \see armarx::Component::onDisconnectComponent()
113  *
114  * Disables the main widget if the connection has been lost.
115  */
116  void onDisconnectComponent() override;
117 
118  public slots:
119  /* QT slot declarations */
120 
121  void loadFileNames(QString dbName = "");
122  void loadFileContent(const QString& fileName);
123  void saveContentToFile();
124  void deleteUnreferencedFiles();
125 
126  private slots:
127  signals:
128  /* QT signal declarations */
129  void connected();
130 
131  private:
132  /**
133  * \brief connectSlots does the initial wiring of signals to slots
134  */
135  void connectSlots();
136 
137  void replaceFileDocID(QString fileId, const QString& newId);
138 
139  std::string whereQuery(std::string fileId) const;
140  /**
141  * Widget Form
142  */
143  Ui::GridFSFileEditorWidget widget;
144 
145  /**
146  * \brief commonStoragePrx proxy to CommonStorage
147  */
148  memoryx::CommonStorageInterfacePrx commonStoragePrx;
149  std::string dbName;
150  QString currentId;
151  };
152 } // namespace armarx
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
ArmarXGuiPlugin.h
newId
auto newId
Definition: GraspingManager.cpp:76
ArmarXComponentWidgetController.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::GridFSFileEditorWidgetController::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: GridFSFileEditorWidgetController.h:91
armarx::GridFSFileEditorWidgetController
This widget allows viewing files that are referenced in the prior knowledge database.
Definition: GridFSFileEditorWidgetController.h:54
armarx::GridFSFileEditorWidgetController::GetWidgetName
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
Definition: GridFSFileEditorWidgetController.h:85
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
ImportExportComponent.h