X-Git-Url: https://vaikene.ee/gitweb/pswgen09.html?a=blobdiff_plain;ds=sidebyside;f=src%2Fplugins%2FSdiWindow%2Fsdiwindow.cpp;h=aba9ce2041502ac51fed5f2a5aa04d9cc4be01bf;hb=ad70660919cd7b0e821e35548b6d1f5efa181c4c;hp=d0294d8c83c1e18fddee8cc105170a9020de20eb;hpb=f443e47f50a5d12f592aaae6a4e553e4a125ee1c;p=evaf
diff --git a/src/plugins/SdiWindow/sdiwindow.cpp b/src/plugins/SdiWindow/sdiwindow.cpp
index d0294d8..aba9ce2 100644
--- a/src/plugins/SdiWindow/sdiwindow.cpp
+++ b/src/plugins/SdiWindow/sdiwindow.cpp
@@ -54,6 +54,7 @@ using namespace eVaf::SdiWindow::Internal;
MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags)
: QWidget(parent, flags)
+ , mReady(false)
{
setObjectName(QString("%1-%2").arg(VER_MODULE_NAME_STR).arg(__FUNCTION__));
@@ -67,23 +68,33 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags)
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;
@@ -91,12 +102,14 @@ bool MainWindow::init()
void MainWindow::done()
{
+ mReady = false;
+
close();
// Delete all the items added to the main window
while (mItemsAdded.count() > 0) {
- QPointer item = mItemsAdded.takeAt(0);
- if (item)
+ QWeakPointer item = mItemsAdded.takeAt(0);
+ if (!item.isNull())
delete item.data();
}
@@ -178,56 +191,6 @@ void MainWindow::setWindowSize()
}
-//-------------------------------------------------------------------
-
-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()
@@ -235,7 +198,7 @@ SdiWindowPlugin::SdiWindowPlugin()
{
setObjectName(VER_MODULE_NAME_STR);
- mWindow = new SdiWindowImpl;
+ mWindow = new MainWindow;
EVAF_INFO("%s created", qPrintable(objectName()));
}