forked from mirror/openmw-tes3mp
replaced regular function call from SubView to View with signal-slot-connection
This commit is contained in:
parent
1aef9304e9
commit
6f4b753750
4 changed files with 12 additions and 10 deletions
|
@ -3,7 +3,7 @@
|
||||||
#include "view.hpp"
|
#include "view.hpp"
|
||||||
|
|
||||||
CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id)
|
CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id)
|
||||||
: mUniversalId (id), mParent (NULL)
|
: mUniversalId (id)
|
||||||
{
|
{
|
||||||
/// \todo add a button to the title bar that clones this sub view
|
/// \todo add a button to the title bar that clones this sub view
|
||||||
|
|
||||||
|
@ -31,9 +31,7 @@ void CSVDoc::SubView::setUniversalId (const CSMWorld::UniversalId& id)
|
||||||
|
|
||||||
void CSVDoc::SubView::closeEvent (QCloseEvent *event)
|
void CSVDoc::SubView::closeEvent (QCloseEvent *event)
|
||||||
{
|
{
|
||||||
// update title bars of view and subviews
|
emit updateSubViewIndicies (this);
|
||||||
if(mParent)
|
|
||||||
mParent->updateSubViewIndicies(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CSVDoc::SubView::getTitle() const
|
std::string CSVDoc::SubView::getTitle() const
|
||||||
|
|
|
@ -25,12 +25,13 @@ namespace CSVDoc
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
CSMWorld::UniversalId mUniversalId;
|
CSMWorld::UniversalId mUniversalId;
|
||||||
View *mParent;
|
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
SubView (const SubView&);
|
SubView (const SubView&);
|
||||||
SubView& operator= (SubView&);
|
SubView& operator= (SubView&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void setUniversalId(const CSMWorld::UniversalId& id);
|
void setUniversalId(const CSMWorld::UniversalId& id);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -47,8 +48,6 @@ namespace CSVDoc
|
||||||
virtual void useHint (const std::string& hint);
|
virtual void useHint (const std::string& hint);
|
||||||
///< Default implementation: ignored
|
///< Default implementation: ignored
|
||||||
|
|
||||||
void setParent(View *parent) { mParent = parent; }
|
|
||||||
|
|
||||||
virtual std::string getTitle() const;
|
virtual std::string getTitle() const;
|
||||||
|
|
||||||
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
||||||
|
@ -65,6 +64,8 @@ namespace CSVDoc
|
||||||
|
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
|
void updateSubViewIndicies (SubView *view = 0);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void closeRequest();
|
void closeRequest();
|
||||||
|
|
|
@ -524,6 +524,9 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
||||||
|
|
||||||
connect (view, SIGNAL (updateTitle()), this, SLOT (updateTitle()));
|
connect (view, SIGNAL (updateTitle()), this, SLOT (updateTitle()));
|
||||||
|
|
||||||
|
connect (view, SIGNAL (updateSubViewIndicies (SubView *)),
|
||||||
|
this, SLOT (updateSubViewIndicies (SubView *)));
|
||||||
|
|
||||||
view->show();
|
view->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,9 +112,6 @@ namespace CSVDoc
|
||||||
/// Function called by view manager when user preferences are updated
|
/// Function called by view manager when user preferences are updated
|
||||||
void updateEditorSetting (const QString &, const QString &);
|
void updateEditorSetting (const QString &, const QString &);
|
||||||
|
|
||||||
// called when subviews are added or removed
|
|
||||||
void updateSubViewIndicies(SubView *view = 0);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void newGameRequest();
|
void newGameRequest();
|
||||||
|
@ -139,6 +136,9 @@ namespace CSVDoc
|
||||||
|
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
|
// called when subviews are added or removed
|
||||||
|
void updateSubViewIndicies (SubView *view = 0);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void newView();
|
void newView();
|
||||||
|
|
Loading…
Reference in a new issue