close view when closing last sub-view unless this view is the last view

loadfix
Marc Zinnschlag 10 years ago
parent a9f5632afd
commit aad13e6bff

@ -35,3 +35,8 @@ void CSVDoc::SubView::closeEvent (QCloseEvent *event)
if(mParent)
mParent->updateSubViewIndicies(this);
}
void CSVDoc::SubView::closeRequest()
{
emit closeRequest (this);
}

@ -57,6 +57,12 @@ namespace CSVDoc
void focusId (const CSMWorld::UniversalId& universalId, const std::string& hint);
void closeRequest (SubView *subView);
protected slots:
void closeRequest();
public slots:
virtual void updateUserSetting
(const QString &, const QStringList &);

@ -323,7 +323,7 @@ void CSVDoc::View::updateSubViewIndicies(SubView *view)
if(view && mSubViews.contains(view))
mSubViews.removeOne(view);
if(mSubViews.size() == 1)
if (mSubViews.size() == 1)
{
if(!mSubViews.at(0)->isFloating())
{
@ -518,6 +518,8 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
view,
SLOT (updateUserSetting (const QString &, const QStringList &)));
connect (view, SIGNAL (closeRequest (SubView *)), this, SLOT (closeRequest (SubView *)));
view->show();
}
@ -761,3 +763,11 @@ void CSVDoc::View::stop()
{
mDocument->stopRunning();
}
void CSVDoc::View::closeRequest (SubView *subView)
{
if (mSubViews.size()>1 || mViewTotal<=1)
subView->deleteLater();
else if (mViewManager.closeRequest (this))
mViewManager.removeDocAndView (mDocument);
}

@ -222,6 +222,8 @@ namespace CSVDoc
void run (const std::string& profile, const std::string& startupInstruction = "");
void stop();
void closeRequest (SubView *subView);
};
}

@ -52,11 +52,6 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
void CSVWorld::PreviewSubView::setEditLock (bool locked) {}
void CSVWorld::PreviewSubView::closeRequest()
{
deleteLater();
}
void CSVWorld::PreviewSubView::referenceableIdChanged (const std::string& id)
{
if (id.empty())

@ -29,8 +29,6 @@ namespace CSVWorld
private slots:
void closeRequest();
void referenceableIdChanged (const std::string& id);
};
}

@ -150,11 +150,6 @@ void CSVWorld::SceneSubView::useHint (const std::string& hint)
mScene->useViewHint (hint);
}
void CSVWorld::SceneSubView::closeRequest()
{
deleteLater();
}
void CSVWorld::SceneSubView::cellSelectionChanged (const CSMWorld::UniversalId& id)
{
setUniversalId(id);

@ -75,8 +75,6 @@ namespace CSVWorld
private slots:
void closeRequest();
void cellSelectionChanged (const CSMWorld::CellSelection& selection);
void cellSelectionChanged (const CSMWorld::UniversalId& id);

@ -81,6 +81,6 @@ void CSVWorld::ScriptSubView::rowsAboutToBeRemoved (const QModelIndex& parent, i
QModelIndex index = mModel->getModelIndex (getUniversalId().getId(), mColumn);
if (!parent.isValid() && index.row()>=start && index.row()<=end)
deleteLater();
emit closeRequest();
}

@ -153,7 +153,3 @@ bool CSVWorld::TableSubView::eventFilter (QObject* object, QEvent* event)
return false;
}
void CSVWorld::TableSubView::closeRequest()
{
deleteLater();
}

@ -63,8 +63,6 @@ namespace CSVWorld
void cloneRequest (const CSMWorld::UniversalId& toClone);
void createFilterRequest(std::vector< CSMWorld::UniversalId >& types,
Qt::DropAction action);
void closeRequest();
};
}

Loading…
Cancel
Save