GammaRay  2.3.0
tooluifactory.h
1 /*
2  This file is part of GammaRay, the Qt application inspection and
3  manipulation tool.
4 
5  Copyright (C) 2010-2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
6  Author: Volker Krause <volker.krause@kdab.com>
7 
8  Licensees holding valid commercial KDAB GammaRay licenses may use this file in
9  accordance with GammaRay Commercial License Agreement provided with the Software.
10 
11  Contact info@kdab.com if any conditions of this licensing are not clear to you.
12 
13  This program is free software; you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 2 of the License, or
16  (at your option) any later version.
17 
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with this program. If not, see <http://www.gnu.org/licenses/>.
25 */
26 
27 #ifndef GAMMARAY_TOOLUIFACTORY_H
28 #define GAMMARAY_TOOLUIFACTORY_H
29 
30 #include <QMetaType>
31 #include <QStringList>
32 #include <QtPlugin>
33 
34 namespace GammaRay {
35 
44 {
45  public:
46  virtual inline ~ToolUiFactory()
47  {
48  }
49 
54  virtual QString id() const = 0;
55 
59  virtual bool remotingSupported() const = 0;
60 
66  virtual QWidget *createWidget(QWidget *parentWidget) = 0;
67 
73  virtual void initUi() {}
74 };
75 
79 template <typename ToolUi>
81 {
82 public:
83  virtual inline QString id() const
84  {
85  return QString(); // TODO is this a problem??
86  }
87 
88  virtual inline QWidget *createWidget(QWidget *parentWidget)
89  {
90  return new ToolUi(parentWidget);
91  }
92 
93  virtual bool remotingSupported() const
94  {
95  return true;
96  }
97 };
98 
99 }
100 
101 Q_DECLARE_INTERFACE(GammaRay::ToolUiFactory, "com.kdab.GammaRay.ToolUiFactory/1.0")
102 Q_DECLARE_METATYPE(GammaRay::ToolUiFactory *)
103 
104 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
105 #define Q_PLUGIN_METADATA(x)
106 #endif
107 
108 #endif
virtual void initUi()
Definition: tooluifactory.h:73
virtual QWidget * createWidget(QWidget *parentWidget)
Definition: tooluifactory.h:88
virtual QWidget * createWidget(QWidget *parentWidget)=0
Definition: endpoint.h:41
virtual bool remotingSupported() const
Definition: tooluifactory.h:93
An abstract interface for creating the UI parts of probe tools.
Definition: tooluifactory.h:43
virtual QString id() const =0
virtual QString id() const
Definition: tooluifactory.h:83
virtual bool remotingSupported() const =0
A templated convenience ToolUiFactory applicable for most use-cases.
Definition: tooluifactory.h:80

Klarälvdalens Datakonsult AB (KDAB)
"The Qt Experts"
http://www.kdab.com/
GammaRay
Qt-application inspection and manipulation tool
http://www.kdab.com/kdab-products/gammaray/