forked from mirror/openmw-tes3mp
Implements switch (--help and --resources), and copying defaultfilters.omwaddon.project. Seems to work.
This commit is contained in:
parent
3000386443
commit
a7002e8a09
6 changed files with 23 additions and 27 deletions
|
@ -6,8 +6,6 @@
|
|||
#include <QLocalSocket>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <boost/iostreams/concepts.hpp>
|
||||
|
||||
#include "model/doc/document.hpp"
|
||||
#include "model/world/data.hpp"
|
||||
|
||||
|
@ -59,7 +57,7 @@ void CS::Editor::setupDataFiles()
|
|||
if (!variables["data"].empty()) {
|
||||
dataDirs = Files::PathContainer(variables["data"].as<Files::PathContainer>());
|
||||
}
|
||||
|
||||
|
||||
std::string local = variables["data-local"].as<std::string>();
|
||||
if (!local.empty()) {
|
||||
dataLocal.push_back(Files::PathContainer::value_type(local));
|
||||
|
@ -231,9 +229,8 @@ bool CS::Editor::parseOptions (int argc, char** argv)
|
|||
{
|
||||
// Create a local alias for brevity
|
||||
namespace bpo = boost::program_options;
|
||||
typedef std::vector<std::string> StringsVector;
|
||||
|
||||
bpo::options_description desc("Syntax: openmw <options>\nAllowed options");
|
||||
bpo::options_description desc("Syntax: opencs <options>\nAllowed options");
|
||||
|
||||
desc.add_options()
|
||||
("help", "print help message")
|
||||
|
@ -248,7 +245,7 @@ bool CS::Editor::parseOptions (int argc, char** argv)
|
|||
bpo::store(valid_opts, variables);
|
||||
bpo::notify(variables);
|
||||
|
||||
// cfgMgr.readConfiguration(variables, desc);
|
||||
mCfgMgr.readConfiguration(variables, desc);
|
||||
|
||||
bool run = true;
|
||||
|
||||
|
@ -261,13 +258,7 @@ bool CS::Editor::parseOptions (int argc, char** argv)
|
|||
if (!run)
|
||||
return false;
|
||||
|
||||
setResourceDir(variables["resources"].as<std::string>());
|
||||
mDocumentManager.setResourceDir(variables["resources"].as<std::string>());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set resource dir
|
||||
void CS::Editor::setResourceDir (const boost::filesystem::path& parResDir)
|
||||
{
|
||||
mResDir = boost::filesystem::system_complete(parResDir);
|
||||
}
|
|
@ -67,14 +67,12 @@ namespace CS
|
|||
|
||||
void showSettings();
|
||||
bool parseOptions (int argc, char** argv);
|
||||
void setResourceDir (const boost::filesystem::path& parResDir);
|
||||
|
||||
private:
|
||||
|
||||
QString mIpcServerName;
|
||||
QLocalServer *mServer;
|
||||
QLocalSocket *mClientSocket;
|
||||
boost::filesystem::path mResDir;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2146,10 +2146,8 @@ void CSMDoc::Document::createBase()
|
|||
}
|
||||
}
|
||||
|
||||
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
||||
const std::vector<boost::filesystem::path>& files,
|
||||
const boost::filesystem::path& savePath, bool new_)
|
||||
: mSavePath (savePath), mContentFiles (files), mTools (mData),
|
||||
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_)
|
||||
: mSavePath (savePath), mContentFiles (files), mTools (mData), mResDir(resDir),
|
||||
mProjectPath ((configuration.getUserPath() / "projects") /
|
||||
(savePath.filename().string() + ".project")),
|
||||
mSaving (*this, mProjectPath)
|
||||
|
@ -2183,7 +2181,9 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||
}
|
||||
else
|
||||
{
|
||||
/// \todo create new project file with default filters
|
||||
boost::filesystem::path filters = mResDir;
|
||||
filters /= "defaultfilters.omwaddon.project";
|
||||
boost::filesystem::copy_file(mResDir, mProjectPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,13 +43,14 @@ namespace CSMDoc
|
|||
CSMTools::Tools mTools;
|
||||
boost::filesystem::path mProjectPath;
|
||||
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
|
||||
// using other member variables. Unfortunately this connection is cut only in the QObject destructor, which is way too late.
|
||||
QUndoStack mUndoStack;
|
||||
|
||||
// not implemented
|
||||
Document (const Document&);
|
||||
Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, bool new_);
|
||||
Document& operator= (const Document&);
|
||||
|
||||
void load (const std::vector<boost::filesystem::path>::const_iterator& begin,
|
||||
|
@ -70,9 +71,7 @@ namespace CSMDoc
|
|||
|
||||
public:
|
||||
|
||||
Document (const Files::ConfigurationManager& configuration,
|
||||
const std::vector<boost::filesystem::path>& files,
|
||||
const boost::filesystem::path& savePath, bool new_);
|
||||
Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, bool new_);
|
||||
|
||||
~Document();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ CSMDoc::DocumentManager::~DocumentManager()
|
|||
CSMDoc::Document *CSMDoc::DocumentManager::addDocument (const std::vector<boost::filesystem::path>& files, const boost::filesystem::path& savePath,
|
||||
bool new_)
|
||||
{
|
||||
Document *document = new Document (mConfiguration, files, savePath, new_);
|
||||
Document *document = new Document (mConfiguration, files, savePath, mResDir, new_);
|
||||
|
||||
mDocuments.push_back (document);
|
||||
|
||||
|
@ -48,4 +48,9 @@ bool CSMDoc::DocumentManager::removeDocument (Document *document)
|
|||
delete document;
|
||||
|
||||
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();
|
||||
|
||||
Document *addDocument (const std::vector<boost::filesystem::path>& files,
|
||||
const boost::filesystem::path& savePath, bool new_);
|
||||
Document *addDocument (const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, bool new_);
|
||||
///< 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
|
||||
|
@ -38,6 +37,10 @@ namespace CSMDoc
|
|||
|
||||
bool removeDocument (Document *document);
|
||||
///< \return last document removed?
|
||||
void setResourceDir (const boost::filesystem::path& parResDir);
|
||||
|
||||
private:
|
||||
boost::filesystem::path mResDir;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue