SMILX  1.01
milxQtPluginInterface.h
1 /*=========================================================================
2  The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO)
3  ABN 41 687 119 230.
4  All rights reserved.
5 
6  Licensed under the CSIRO BSD 3-Clause License
7  You may not use this file except in compliance with the License.
8  You may obtain a copy of the License in the file LICENSE.md or at
9 
10  https://stash.csiro.au/projects/SMILI/repos/smili/browse/license.txt
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 =========================================================================*/
18 #ifndef MILXQTPLUGININTERFACE_H
19 #define MILXQTPLUGININTERFACE_H
20 
21 #include <QThread>
22 #include <QMenu>
23 #include <QDockWidget>
24 //VTK
25 #include <vtkPolyDataCollection.h>
26 
27 #include "milxQtAliases.h"
28 #include "milxQtRenderWindow.h"
29 #include "milxQtImage.h"
30 #include "milxQtModel.h"
31 
46 class MILXQT_EXPORT milxQtPluginInterface : public QThread
47 {
48  Q_OBJECT
49 
50 public:
55  milxQtPluginInterface(QObject *theParent = 0) : QThread(theParent) {};
56  virtual ~milxQtPluginInterface() {};
57 
62  virtual QString name() = 0;
69  inline void setFileName(const QString filename)
70  {
71  dataName = filename;
72  }
79  inline void setConsole(milxQtConsole *con)
80  {
81  console = con;
82  }
83 
88  virtual bool hasOpenSupport() = 0;
93  virtual QString openFileSupport() = 0;
98  virtual QStringList openExtensions() = 0;
103  virtual bool hasSaveSupport() = 0;
108  virtual QString saveFileSupport() = 0;
113  virtual QStringList saveExtensions() = 0;
114 
119  virtual bool hasCollectionSupport() = 0;
124  virtual void SetInputCollection(vtkPolyDataCollection* collection, QStringList &filenames) = 0;
125 
130  virtual void open(QString filename) = 0;
135  virtual void save(QString filename) = 0;
136 
141  virtual milxQtRenderWindow* genericResult() = 0;
146  virtual milxQtModel* modelResult() = 0;
151  virtual milxQtImage* imageResult() = 0;
156  virtual QDockWidget* dockWidget() = 0;
157 
162  virtual Qt::DockWidgetArea dockDefaultArea() = 0;
163 
168  virtual bool isPluginWindow(QWidget *window) = 0;
169 
174  inline bool isThreaded()
175  {
176  return threaded;
177  }
182  inline bool isDockable()
183  {
184  return dockable;
185  }
190  inline bool isConsole()
191  {
192  return consoleWindow;
193  }
198  inline bool isExtension()
199  {
200  return extension;
201  }
202 
207  inline QList<QAction*> addToFileMenu()
208  {
209  return fileMenuEntries;
210  }
215  inline QList<QMenu*> addToMenuBar()
216  {
217  return menuToAdd;
218  }
219 
220 public slots:
225  virtual void loadExtension() = 0;
233  virtual void update() = 0;
238  virtual void preStartTasks() = 0;
243  virtual void postStartTasks() = 0;
244 
245 signals:
250  void resultAvailable(milxQtRenderWindow*);
255  void resultAvailable(milxQtModel*);
260  void resultAvailable(milxQtImage*);
265  void resultAvailable(vtkPolyDataCollection*, QStringList&);
266 
271  void working(int value);
276  void done(int value);
277 
278 protected:
279  QString pluginName;
280  QString dataName;
281  bool threaded;
282  bool dockable;
284  bool extension;
285 
286  QMutex mutex;
287 
288  QList<QAction*> fileMenuEntries;
289  QList<QMenu*> menuToAdd;
290 
292 
293 private:
294 
295 };
296 
298 {
299 public:
300  virtual ~milxQtPluginFactory() {}
301  virtual milxQtPluginInterface* newPlugin(QObject *theParent = 0) = 0;
302 };
303 
304 Q_DECLARE_INTERFACE(milxQtPluginFactory, "milxQt.Plugins.milxQtPluginFactory/1.0");
305 
306 #endif // MILXQTPLUGININTERFACE_H
bool threaded
Threaded plugin?
This file defines all the defines, aliases and frequently used functions and variables.
This class represents the MILX Qt Render Window Display object using QVTK.
bool consoleWindow
console window?
This class represents the MILX Qt Image Display object using VTK.
Definition: milxQtImage.h:118
bool isExtension()
Is the plugin an extension? [Don&#39;t Reimplement this].
bool extension
Extension rather than a plugin?
void setConsole(milxQtConsole *con)
Set console to be used by plugins for output.
virtual QString name()=0
Get the Name of the plugin. [Implement this in your plugin].
This class represents the MILX Qt Model/Mesh Display object using VTK.
Definition: milxQtModel.h:115
QList< QMenu * > addToMenuBar()
Menus to add to the menu bar. [Don&#39;t Reimplement this].
void setFileName(const QString filename)
Set the Name of the data. [Don&#39;t Reimplement this].
bool dockable
Dockable plugin?
#define MILXQT_EXPORT
Define Windows DLL importing.
Definition: milxQtAliases.h:80
milxQtConsole * console
console for logging
QList< QAction * > addToFileMenu()
Actions to add to the file or context menu. [Don&#39;t Reimplement this].
The interface for any plugins that can be made for milxQtMain.
bool isThreaded()
Is the plugin threaded? [Don&#39;t Reimplement this].
milxQtPluginInterface(QObject *theParent=0)
Default destructor.
A console (tabbed) widget class for displaying information such as logs, terminals and consoles...
Definition: milxQtConsole.h:34
bool isDockable()
Is the plugin a dock window? [Don&#39;t Reimplement this].
bool isConsole()
Is the plugin a console dock window? If so, it will be added to the console dock window. [Don&#39;t Reimplement this].