set content files when running OpenMW from OpenCS

This commit is contained in:
Marc Zinnschlag 2014-09-06 12:24:09 +02:00
parent cf05d3c69f
commit 64cf0870c6
3 changed files with 20 additions and 2 deletions

View file

@ -2375,7 +2375,13 @@ bool CSMDoc::Document::isBlacklisted (const CSMWorld::UniversalId& id)
void CSMDoc::Document::startRunning (const std::string& profile, void CSMDoc::Document::startRunning (const std::string& profile,
const std::string& startupInstruction) const std::string& startupInstruction)
{ {
mRunner.configure (getData().getDebugProfiles().getRecord (profile).get(), std::vector<std::string> contentFiles;
for (std::vector<boost::filesystem::path>::const_iterator iter (mContentFiles.begin());
iter!=mContentFiles.end(); ++iter)
contentFiles.push_back (iter->filename().string());
mRunner.configure (getData().getDebugProfiles().getRecord (profile).get(), contentFiles,
startupInstruction); startupInstruction);
int state = getState(); int state = getState();

View file

@ -75,6 +75,12 @@ void CSMDoc::Runner::start (bool delayed)
arguments << ("--script-run="+mStartup->fileName()); arguments << ("--script-run="+mStartup->fileName());
for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
iter!=mContentFiles.end(); ++iter)
{
arguments << QString::fromUtf8 (("--content="+*iter).c_str());
}
mProcess.start (path, arguments); mProcess.start (path, arguments);
} }
@ -102,9 +108,10 @@ bool CSMDoc::Runner::isRunning() const
} }
void CSMDoc::Runner::configure (const ESM::DebugProfile& profile, void CSMDoc::Runner::configure (const ESM::DebugProfile& profile,
const std::string& startupInstruction) const std::vector<std::string>& contentFiles, const std::string& startupInstruction)
{ {
mProfile = profile; mProfile = profile;
mContentFiles = contentFiles;
mStartupInstruction = startupInstruction; mStartupInstruction = startupInstruction;
} }

View file

@ -1,6 +1,9 @@
#ifndef CSM_DOC_RUNNER_H #ifndef CSM_DOC_RUNNER_H
#define CSM_DOC_RUNNER_H #define CSM_DOC_RUNNER_H
#include <vector>
#include <string>
#include <QObject> #include <QObject>
#include <QProcess> #include <QProcess>
#include <QTextDocument> #include <QTextDocument>
@ -18,6 +21,7 @@ namespace CSMDoc
QProcess mProcess; QProcess mProcess;
bool mRunning; bool mRunning;
ESM::DebugProfile mProfile; ESM::DebugProfile mProfile;
std::vector<std::string> mContentFiles;
std::string mStartupInstruction; std::string mStartupInstruction;
QTemporaryFile *mStartup; QTemporaryFile *mStartup;
QTextDocument mLog; QTextDocument mLog;
@ -39,6 +43,7 @@ namespace CSMDoc
bool isRunning() const; bool isRunning() const;
void configure (const ESM::DebugProfile& profile, void configure (const ESM::DebugProfile& profile,
const std::vector<std::string>& contentFiles,
const std::string& startupInstruction); const std::string& startupInstruction);
QTextDocument *getLog(); QTextDocument *getLog();