include_directories(${eVaf_INCLUDE})
# Required eVaf libraries
-set(eVaf_LIBRARIES CommonLib PluginsLib SdiWindow)
+set(eVaf_LIBRARIES CommonLib PluginsLib)
# Source files
set(SRCS
# Header files for the meta-object compiler
set(MOC_HDRS
factory.h
- isdiwindow.h
sdiwindow.h
)
#include "libsdiwindow.h"
-#include <QObject>
#include <QString>
+#include <QtPlugin>
class QWidget;
class QLayout;
* The iSdiWindow interface provides access to the SDI main window. The SDI main window is
* an empty window that the application can fill with widgets.
*/
-class SDIWINDOW_EXPORT iSdiWindow : public QObject
+struct SDIWINDOW_EXPORT iSdiWindow
{
- Q_OBJECT
-
-public:
-
- /// Interface constructor
- iSdiWindow() : QObject() {}
-
- /// Empty virtual destructor
- virtual ~iSdiWindow() {}
-
/**
* Returns the iSdiWindow interface instance
* @return The iSdiWindow interface or zero if not available
} // namespace eVaf::SdiWindow
} // namespace eVaf
+Q_DECLARE_INTERFACE(eVaf::SdiWindow::iSdiWindow, "eVaf.SdiWindow.iSdiWindow/1.0")
+
#endif // isdiwindow.h
MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags)
: QWidget(parent, flags)
+ , mReady(false)
{
setObjectName(QString("%1-%2").arg(VER_MODULE_NAME_STR).arg(__FUNCTION__));
mLayout = new QVBoxLayout;
setLayout(mLayout);
+ mSdiWindow = this;
+
EVAF_INFO("%s created", qPrintable(objectName()));
}
MainWindow::~MainWindow()
{
+ mSdiWindow = 0;
+
// Save geometry
saveSettings();
EVAF_INFO("%s destroyed", qPrintable(objectName()));
}
-bool MainWindow::init()
+bool MainWindow::init(QString const & args)
{
+ Q_UNUSED(args);
+
+ Common::iRegistry::instance()->registerInterface("iSdiWindow", this);
+
setWindowTitle(Common::iApp::instance()->name());
show();
+ mReady = true;
+
EVAF_INFO("%s initialized", qPrintable(objectName()));
return true;
void MainWindow::done()
{
+ mReady = false;
+
close();
// Delete all the items added to the main window
}
-//-------------------------------------------------------------------
-
-SdiWindowImpl::SdiWindowImpl()
- : iSdiWindow()
- , mReady(false)
-{
- setObjectName(QString("%1.iSdiWindow").arg(VER_MODULE_NAME_STR));
-
- mSdiWindow = this;
-
- wWindow = new MainWindow;
-
- Common::iRegistry::instance()->registerInterface("iSdiWindow", this);
-
- EVAF_INFO("%s created", qPrintable(objectName()));
-}
-
-SdiWindowImpl::~SdiWindowImpl()
-{
- delete wWindow;
-
- mSdiWindow = 0;
-
- EVAF_INFO("%s destroyed", qPrintable(objectName()));
-}
-
-bool SdiWindowImpl::init(const QString & args)
-{
- Q_UNUSED(args);
-
- if (!wWindow->init())
- return false;
-
- mReady = true;
-
- EVAF_INFO("%s initialized", qPrintable(objectName()));
-
- return true;
-}
-
-void SdiWindowImpl::done()
-{
- mReady = false;
-
- wWindow->done();
-
- EVAF_INFO("%s finalized", qPrintable(objectName()));
-}
-
-
//-------------------------------------------------------------------
SdiWindowPlugin::SdiWindowPlugin()
{
setObjectName(VER_MODULE_NAME_STR);
- mWindow = new SdiWindowImpl;
+ mWindow = new MainWindow;
EVAF_INFO("%s created", qPrintable(objectName()));
}
namespace Internal {
/**
- * Main window widget
+ * Main window widget implementing the iSdiWindow interface
*/
-class MainWindow : public QWidget
+class MainWindow : public QWidget, public iSdiWindow
{
Q_OBJECT
+ Q_INTERFACES(eVaf::SdiWindow::iSdiWindow)
public:
virtual ~MainWindow();
- bool init();
+ virtual bool init(QString const & args);
- void done();
+ virtual void done();
+
+ virtual bool isReady() { return mReady; }
- void addWidget(QWidget * widget);
+ virtual void addWidget(QWidget * widget);
- void addLayout(QLayout * layout);
+ virtual void addLayout(QLayout * layout);
private: // Methods
private: // Members
+ /// Ready flag
+ bool mReady;
+
/// The layout of the window
QVBoxLayout * mLayout;
};
-/**
- * iSdiWindow interface implementation
- */
-class SdiWindowImpl : public iSdiWindow
-{
- Q_OBJECT
-
-public:
-
- SdiWindowImpl();
-
- virtual ~SdiWindowImpl();
-
- bool init(const QString & args);
-
- void done();
-
- bool isReady() const { return mReady; }
-
- virtual void addWidget(QWidget * widget) { wWindow->addWidget(widget); }
-
- virtual void addLayout(QLayout * layout) { wWindow->addLayout(layout); }
-
-
-private: // Members
-
- /// Ready flag
- bool mReady;
-
- /// The main window widget
- MainWindow * wWindow;
-};
-
/**
* SdiWindow module's implementation
*/
private:
/// iSdiWindow interface implementation
- SdiWindowImpl * mWindow;
+ MainWindow * mWindow;
};
} // namespace eVaf::SdiWindow::Internal
/**
* Module/library version number in the form major,minor,release,build
*/
-#define VER_FILE_VERSION 0,2,3,4
+#define VER_FILE_VERSION 0,2,4,5
/**
* Module/library version number in the string format (shall end with \0)
*/
-#define VER_FILE_VERSION_STR "0.2.3.4\0"
+#define VER_FILE_VERSION_STR "0.2.4.5\0"
/**
* Module/library name (shall end with \0)