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 
27 #include <MemoryX/gui-plugins/GridFSFileEditor/ui_GridFSFileEditorWidget.h>
28 
30 
33 
34 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
35 #include <MemoryX/interface/components/LongtermMemoryInterface.h>
36 
37 namespace armarx
38 {
39  /**
40  \page MemoryX-GuiPlugins-GridFSFileEditor GridFS FileEditor
41  \brief This widget allows viewing files that are referenced in the prior knowledge database.
42  \image html GridFSFileEditorGui.png
43 
44  For details on GridFS see the \ref MemoryX-GridFilesystem "GridFS description"
45 
46  GridFS Editor API Documentation \ref GridFSFileEditorWidgetControlle
47  \see GridFSFileEditorGuiPlugin
48  */
49 
50  /**
51  * \class GridFSFileEditorWidgetController
52  * \brief This widget allows viewing files that are referenced in the prior knowledge database.
53  * \see GridFSFileEditorGuiPlugin
54  */
57  public ArmarXComponentWidgetControllerTemplate<GridFSFileEditorWidgetController>
58  {
59  Q_OBJECT
60 
61  public:
62  /**
63  * Controller Constructor
64  */
66 
67  /**
68  * Controller destructor
69  */
71 
72  /**
73  * \see ArmarXWidgetController::loadSettings()
74  */
75  void loadSettings(QSettings* settings) override;
76 
77  /**
78  * \see ArmarXWidgetController::saveSettings()
79  */
80  void saveSettings(QSettings* settings) override;
81 
82  /**
83  * Returns the Widget name displayed in the ArmarXGui to create an
84  * instance of this class.
85  */
86  static QString GetWidgetName()
87  {
88  return "MemoryX.GridFSFileEditor";
89  }
90  static QIcon GetWidgetIcon()
91  {
92  return QIcon {"://icons/server.svg"};
93  }
94 
95  /**
96  * \see armarx::Component::onInitComponent()
97  *
98  * Initializes waiting for proxies of LongtermMemory and WorkingMemory.
99  */
100  void onInitComponent() override;
101 
102  /**
103  * \see armarx::Component::onConnectComponent()
104  *
105  * Fetches proxies and the list of all available snapshots.
106  * Enables the main widget.
107  */
108  void onConnectComponent() override;
109 
110  /**
111  * \see armarx::Component::onDisconnectComponent()
112  *
113  * Disables the main widget if the connection has been lost.
114  */
115  void onDisconnectComponent() override;
116 
117  public slots:
118  /* QT slot declarations */
119 
120  void loadFileNames(QString dbName = "");
121  void loadFileContent(const QString& fileName);
122  void saveContentToFile();
123  void deleteUnreferencedFiles();
124 
125  private slots:
126  signals:
127  /* QT signal declarations */
128  void connected();
129  private:
130  /**
131  * \brief connectSlots does the initial wiring of signals to slots
132  */
133  void connectSlots();
134 
135  void replaceFileDocID(QString fileId, const QString& newId);
136 
137  std::string whereQuery(std::string fileId) const;
138  /**
139  * Widget Form
140  */
141  Ui::GridFSFileEditorWidget widget;
142 
143  /**
144  * \brief commonStoragePrx proxy to CommonStorage
145  */
146  memoryx::CommonStorageInterfacePrx commonStoragePrx;
147  std::string dbName;
148  QString currentId;
149  };
150 }
151 
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
ArmarXGuiPlugin.h
newId
auto newId
Definition: GraspingManager.cpp:90
ArmarXComponentWidgetController.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::GridFSFileEditorWidgetController::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: GridFSFileEditorWidgetController.h:90
armarx::GridFSFileEditorWidgetController
This widget allows viewing files that are referenced in the prior knowledge database.
Definition: GridFSFileEditorWidgetController.h:55
armarx::GridFSFileEditorWidgetController::GetWidgetName
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
Definition: GridFSFileEditorWidgetController.h:86
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h