+ merge project on app level

This commit is contained in:
wmayer
2014-12-13 16:15:21 +01:00
parent 9691873133
commit 4b29119eb7
4 changed files with 31 additions and 1 deletions

View File

@@ -25,6 +25,9 @@
# include <stack>
# include <boost/bind.hpp>
#endif
#include <QCoreApplication>
#include "MergeDocuments.h"
#include <Base/Console.h>
#include <Base/Reader.h>
@@ -94,12 +97,17 @@ private:
};
}
MergeDocuments::MergeDocuments(App::Document* doc) : appdoc(doc)
MergeDocuments::MergeDocuments(App::Document* doc) : guiup(false), appdoc(doc)
{
connectExport = doc->signalExportObjects.connect
(boost::bind(&MergeDocuments::exportObject, this, _1, _2));
connectImport = doc->signalImportObjects.connect
(boost::bind(&MergeDocuments::importObject, this, _1, _2));
QCoreApplication* app = QCoreApplication::instance();
if (app && app->inherits("QApplication")) {
guiup = true;
}
}
MergeDocuments::~MergeDocuments()
@@ -143,19 +151,27 @@ void MergeDocuments::exportObject(const std::vector<App::DocumentObject*>& o, Ba
void MergeDocuments::Save (Base::Writer & w) const
{
// Save view provider stuff
if (guiup) {
w.addFile("GuiDocument.xml", this);
}
}
void MergeDocuments::Restore(Base::XMLReader &r)
{
// Restore view provider stuff
if (guiup) {
r.addFile("GuiDocument.xml", this);
}
}
void MergeDocuments::SaveDocFile (Base::Writer & w) const
{
// Save view provider stuff
appdoc->signalExportViewObjects(this->objects, w);
}
void MergeDocuments::RestoreDocFile(Base::Reader & r)
{
// Restore view provider stuff
appdoc->signalImportViewObjects(this->objects, r, this->nameMap);
}