forked from mirror/openmw-tes3mp
Merge branch 'master' into NonTableFields
Conflicts: apps/opencs/model/tools/tools.cpp apps/opencs/model/world/columnbase.cpp apps/opencs/model/world/commands.cpp apps/opencs/model/world/commands.hpp apps/opencs/model/world/idtable.hpp apps/opencs/model/world/refidadapter.cpp apps/opencs/model/world/refidadapter.hpp apps/opencs/view/world/dialoguesubview.hpptest
commit
5eefcd862f
@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
#include "operationholder.hpp"
|
||||||
|
|
||||||
|
#include "operation.hpp"
|
||||||
|
|
||||||
|
CSMDoc::OperationHolder::OperationHolder (Operation *operation) : mRunning (false)
|
||||||
|
{
|
||||||
|
if (operation)
|
||||||
|
setOperation (operation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::setOperation (Operation *operation)
|
||||||
|
{
|
||||||
|
mOperation = operation;
|
||||||
|
mOperation->moveToThread (&mThread);
|
||||||
|
|
||||||
|
connect (
|
||||||
|
mOperation, SIGNAL (progress (int, int, int)),
|
||||||
|
this, SIGNAL (progress (int, int, int)));
|
||||||
|
|
||||||
|
connect (
|
||||||
|
mOperation, SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)),
|
||||||
|
this, SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)));
|
||||||
|
|
||||||
|
connect (
|
||||||
|
mOperation, SIGNAL (done (int, bool)),
|
||||||
|
this, SLOT (doneSlot (int, bool)));
|
||||||
|
|
||||||
|
connect (this, SIGNAL (abortSignal()), mOperation, SLOT (abort()));
|
||||||
|
|
||||||
|
connect (&mThread, SIGNAL (started()), mOperation, SLOT (run()));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSMDoc::OperationHolder::isRunning() const
|
||||||
|
{
|
||||||
|
return mRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::start()
|
||||||
|
{
|
||||||
|
mRunning = true;
|
||||||
|
mThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::abort()
|
||||||
|
{
|
||||||
|
mRunning = false;
|
||||||
|
emit abortSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::abortAndWait()
|
||||||
|
{
|
||||||
|
if (mRunning)
|
||||||
|
{
|
||||||
|
mThread.quit();
|
||||||
|
mThread.wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::doneSlot (int type, bool failed)
|
||||||
|
{
|
||||||
|
mRunning = false;
|
||||||
|
mThread.quit();
|
||||||
|
emit done (type, failed);
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
#ifndef CSM_DOC_OPERATIONHOLDER_H
|
||||||
|
#define CSM_DOC_OPERATIONHOLDER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
namespace CSMWorld
|
||||||
|
{
|
||||||
|
class UniversalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace CSMDoc
|
||||||
|
{
|
||||||
|
class Operation;
|
||||||
|
|
||||||
|
class OperationHolder : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
QThread mThread;
|
||||||
|
Operation *mOperation;
|
||||||
|
bool mRunning;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
OperationHolder (Operation *operation = 0);
|
||||||
|
|
||||||
|
void setOperation (Operation *operation);
|
||||||
|
|
||||||
|
bool isRunning() const;
|
||||||
|
|
||||||
|
void start();
|
||||||
|
|
||||||
|
void abort();
|
||||||
|
|
||||||
|
// Abort and wait until thread has finished.
|
||||||
|
void abortAndWait();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void doneSlot (int type, bool failed);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void progress (int current, int max, int type);
|
||||||
|
|
||||||
|
void reportMessage (const CSMWorld::UniversalId& id, const std::string& message,
|
||||||
|
const std::string& hint, int type);
|
||||||
|
|
||||||
|
void done (int type, bool failed);
|
||||||
|
|
||||||
|
void abortSignal();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,18 @@
|
|||||||
|
#include "android_commandLine.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
const char *argvData[15];
|
||||||
|
int argcData;
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env,
|
||||||
|
jobject obj, jint argc, jobjectArray stringArray) {
|
||||||
|
jboolean iscopy;
|
||||||
|
argcData = (int) argc;
|
||||||
|
argvData[0]="openmw";
|
||||||
|
for (int i = 0; i < argcData; i++) {
|
||||||
|
jstring string = (jstring) (*env).GetObjectArrayElement(stringArray, i);
|
||||||
|
argvData[i+1] = (env)->GetStringUTFChars(string, &iscopy);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||||
|
#include <jni.h>
|
||||||
|
#ifndef _Included_ui_activity_GameActivity_commandLine
|
||||||
|
#define _Included_ui_activity_GameActivity_commandLine
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env, jobject obj,jint argcData, jobjectArray stringArray);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue