forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'sirherrbatka/filters' into saving
This commit is contained in:
commit
fdba029566
7 changed files with 45 additions and 22 deletions
|
@ -320,6 +320,9 @@ configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
|
||||||
configure_file(${OpenMW_SOURCE_DIR}/files/opencs.cfg
|
configure_file(${OpenMW_SOURCE_DIR}/files/opencs.cfg
|
||||||
"${OpenMW_BINARY_DIR}/opencs.cfg")
|
"${OpenMW_BINARY_DIR}/opencs.cfg")
|
||||||
|
|
||||||
|
configure_file(${OpenMW_SOURCE_DIR}/files/opencs/defaultfilters
|
||||||
|
"${OpenMW_BINARY_DIR}/resources/defaultfilters" COPYONLY)
|
||||||
|
|
||||||
if (NOT WIN32 AND NOT APPLE)
|
if (NOT WIN32 AND NOT APPLE)
|
||||||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop
|
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop
|
||||||
"${OpenMW_BINARY_DIR}/openmw.desktop")
|
"${OpenMW_BINARY_DIR}/openmw.desktop")
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "model/doc/document.hpp"
|
#include "model/doc/document.hpp"
|
||||||
#include "model/world/data.hpp"
|
#include "model/world/data.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
CS::Editor::Editor()
|
CS::Editor::Editor()
|
||||||
|
@ -41,13 +42,14 @@ CS::Editor::Editor()
|
||||||
void CS::Editor::setupDataFiles()
|
void CS::Editor::setupDataFiles()
|
||||||
{
|
{
|
||||||
boost::program_options::variables_map variables;
|
boost::program_options::variables_map variables;
|
||||||
boost::program_options::options_description desc;
|
boost::program_options::options_description desc("Syntax: opencs <options>\nAllowed options");
|
||||||
|
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
("data", boost::program_options::value<Files::PathContainer>()->default_value(Files::PathContainer(), "data")->multitoken())
|
("data", boost::program_options::value<Files::PathContainer>()->default_value(Files::PathContainer(), "data")->multitoken())
|
||||||
("data-local", boost::program_options::value<std::string>()->default_value(""))
|
("data-local", boost::program_options::value<std::string>()->default_value(""))
|
||||||
("fs-strict", boost::program_options::value<bool>()->implicit_value(true)->default_value(false))
|
("fs-strict", boost::program_options::value<bool>()->implicit_value(true)->default_value(false))
|
||||||
("encoding", boost::program_options::value<std::string>()->default_value("win1252"));
|
("encoding", boost::program_options::value<std::string>()->default_value("win1252"))
|
||||||
|
("resources", boost::program_options::value<std::string>()->default_value("resources"));
|
||||||
|
|
||||||
boost::program_options::notify(variables);
|
boost::program_options::notify(variables);
|
||||||
|
|
||||||
|
@ -87,6 +89,8 @@ void CS::Editor::setupDataFiles()
|
||||||
|
|
||||||
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
||||||
|
|
||||||
|
mDocumentManager.setResourceDir(mCfgMgr.getGlobalDataPath());
|
||||||
|
|
||||||
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
||||||
{
|
{
|
||||||
QString path = QString::fromStdString(iter->string());
|
QString path = QString::fromStdString(iter->string());
|
||||||
|
|
|
@ -2219,10 +2219,8 @@ void CSMDoc::Document::createBase()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, bool new_)
|
||||||
const std::vector<boost::filesystem::path>& files,
|
: mSavePath (savePath), mContentFiles (files), mTools (mData), mResDir(resDir),
|
||||||
const boost::filesystem::path& savePath, bool new_)
|
|
||||||
: mSavePath (savePath), mContentFiles (files), mTools (mData),
|
|
||||||
mProjectPath ((configuration.getUserPath() / "projects") /
|
mProjectPath ((configuration.getUserPath() / "projects") /
|
||||||
(savePath.filename().string() + ".project")),
|
(savePath.filename().string() + ".project")),
|
||||||
mSaving (*this, mProjectPath)
|
mSaving (*this, mProjectPath)
|
||||||
|
@ -2256,7 +2254,17 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/// \todo create new project file with default filters
|
boost::filesystem::path locCustomFiltersPath (configuration.getUserPath());
|
||||||
|
locCustomFiltersPath /= "defaultfilters";
|
||||||
|
if (boost::filesystem::exists(locCustomFiltersPath))
|
||||||
|
{
|
||||||
|
boost::filesystem::copy(locCustomFiltersPath, mProjectPath);
|
||||||
|
} else {
|
||||||
|
boost::filesystem::path filters(mResDir);
|
||||||
|
filters /= "defaultfilters";
|
||||||
|
boost::filesystem::copy_file(filters, mProjectPath);
|
||||||
|
}
|
||||||
|
getData().loadFile (mProjectPath, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace CSMDoc
|
||||||
CSMTools::Tools mTools;
|
CSMTools::Tools mTools;
|
||||||
boost::filesystem::path mProjectPath;
|
boost::filesystem::path mProjectPath;
|
||||||
Saving mSaving;
|
Saving mSaving;
|
||||||
|
boost::filesystem::path mResDir;
|
||||||
|
|
||||||
// It is important that the undo stack is declared last, because on desctruction it fires a signal, that is connected to a slot, that is
|
// It is important that the undo stack is declared last, because on desctruction it fires a signal, that is connected to a slot, that is
|
||||||
// using other member variables. Unfortunately this connection is cut only in the QObject destructor, which is way too late.
|
// using other member variables. Unfortunately this connection is cut only in the QObject destructor, which is way too late.
|
||||||
|
@ -70,9 +71,7 @@ namespace CSMDoc
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Document (const Files::ConfigurationManager& configuration,
|
Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, bool new_);
|
||||||
const std::vector<boost::filesystem::path>& files,
|
|
||||||
const boost::filesystem::path& savePath, bool new_);
|
|
||||||
|
|
||||||
~Document();
|
~Document();
|
||||||
|
|
||||||
|
@ -120,3 +119,4 @@ namespace CSMDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ CSMDoc::DocumentManager::~DocumentManager()
|
||||||
CSMDoc::Document *CSMDoc::DocumentManager::addDocument (const std::vector<boost::filesystem::path>& files, const boost::filesystem::path& savePath,
|
CSMDoc::Document *CSMDoc::DocumentManager::addDocument (const std::vector<boost::filesystem::path>& files, const boost::filesystem::path& savePath,
|
||||||
bool new_)
|
bool new_)
|
||||||
{
|
{
|
||||||
Document *document = new Document (mConfiguration, files, savePath, new_);
|
Document *document = new Document (mConfiguration, files, savePath, mResDir, new_);
|
||||||
|
|
||||||
mDocuments.push_back (document);
|
mDocuments.push_back (document);
|
||||||
|
|
||||||
|
@ -49,3 +49,8 @@ bool CSMDoc::DocumentManager::removeDocument (Document *document)
|
||||||
|
|
||||||
return mDocuments.empty();
|
return mDocuments.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMDoc::DocumentManager::setResourceDir (const boost::filesystem::path& parResDir)
|
||||||
|
{
|
||||||
|
mResDir = boost::filesystem::system_complete(parResDir);
|
||||||
|
}
|
|
@ -29,8 +29,7 @@ namespace CSMDoc
|
||||||
|
|
||||||
~DocumentManager();
|
~DocumentManager();
|
||||||
|
|
||||||
Document *addDocument (const std::vector<boost::filesystem::path>& files,
|
Document *addDocument (const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, bool new_);
|
||||||
const boost::filesystem::path& savePath, bool new_);
|
|
||||||
///< The ownership of the returned document is not transferred to the caller.
|
///< The ownership of the returned document is not transferred to the caller.
|
||||||
///
|
///
|
||||||
/// \param new_ Do not load the last content file in \a files and instead create in an
|
/// \param new_ Do not load the last content file in \a files and instead create in an
|
||||||
|
@ -38,6 +37,10 @@ namespace CSMDoc
|
||||||
|
|
||||||
bool removeDocument (Document *document);
|
bool removeDocument (Document *document);
|
||||||
///< \return last document removed?
|
///< \return last document removed?
|
||||||
|
void setResourceDir (const boost::filesystem::path& parResDir);
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::filesystem::path mResDir;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
files/opencs/defaultfilters
Normal file
BIN
files/opencs/defaultfilters
Normal file
Binary file not shown.
Loading…
Reference in a new issue