LibEngsas
eobject.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 #ifndef EOBJECT_H
21 #define EOBJECT_H
22 
23 #include "eglobal.h"
24 #include <QObject>
25 
26 class ESettingsWidget;
27 
28 #include <QStringList>
29 #include <QPointer>
30 
31 class QFile;
32 class QMenu;
33 class QAction;
34 class QToolBar;
35 class QDockWidget;
36 
42 class E_CORE_EXPORT EObject : public QObject
43 {
44  Q_OBJECT
45  public:
46  inline EObject ( QObject *parent = 0 ) : QObject(parent){}
47  virtual ~EObject();
53  void connectByPass(QObject *object){ EObject::connectByPass(this, object); }
64  static void connectByPass ( QObject *parent, QObject *child );
65 
66  public slots:
81  virtual inline void reloadSettings(){ emit doReloadSettings(); }
82 
83  protected slots:
90  virtual inline void errorByPass(const QString &message){ emit error(message); }
96  virtual inline void warningByPass(const QString &message){ emit warning(message); }
102  virtual inline void informationByPass(const QString &message){ emit information(message); }
106  virtual inline void reloadEnableActionsByPass(){ emit reloadEnableActions(); }
112  virtual inline void addMenuByPass(QMenu* newMenu, const QString &parent, QString before = QString()){ emit addMenu(newMenu, parent, before); }
118  virtual inline void addActionByPass(QAction* newAction, const QString &parent, QString before = QString()){ emit addAction(newAction, parent, before); }
124  virtual inline void addToolBarByPass(QToolBar* newToolBar, Qt::ToolBarArea area = Qt::TopToolBarArea){ emit addToolBar(newToolBar, area); }
130  virtual inline void addNewDockWidgetByPass(QDockWidget *widget, const Qt::DockWidgetArea &area){ emit addNewDockWidget(widget, area); }
136  virtual inline void setCentralWidgetByPass(QWidget *centralWidget){ emit setCentralWidget(centralWidget); }
142  virtual inline void showSettingsByPass(){ emit showSettings(); }
148  virtual inline void showHelpByPass(const QString &page){ emit showHelp(page); }
154  virtual inline void showStatusWidgetByPass(QWidget* widget){ emit showStatusWidget(widget); }
161  virtual inline void reloadSettingsRequestByPass(){ emit reloadSettingsRequest(); }
162 
163  protected:
173  void addManagedDockWidget(QDockWidget *widget, const Qt::DockWidgetArea &area,
174  QString actionLabel = QString(), QString actionParent = QString());
175 
176  private:
177  QList<QPointer<QDockWidget> > dockWidgets;
178  QList<QPointer<QAction> > dockActions;
179 
180  signals:
196  void error(const QString &message);
205  void warning(const QString &message);
214  void information(const QString &message);
218  void reloadEnableActions();
230  void addMenu(QMenu* newMenu, const QString &parent, QString before = QString());
242  void addAction(QAction* newAction, const QString &parent, QString before = QString());
251  void addToolBar(QToolBar* newToolBar, Qt::ToolBarArea area = Qt::TopToolBarArea);
261  void addNewDockWidget(QDockWidget *widget, const Qt::DockWidgetArea &area);
270  void setCentralWidget(QWidget *centralWidget);
277  void showSettings();
284  void showHelp(const QString &page);
291  void showStatusWidget(QWidget* widget);
303  void reloadSettingsRequest();
311  void doReloadSettings();
312 };
313 
314 #endif // EOBJECT_H