summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-02-15 18:15:41 +0100
committerJan Dalheimer <jan@dalheimer.de>2014-02-15 18:15:41 +0100
commitc0e58fbfb213c05f0259dab9bf5b7aabd6f373cf (patch)
treee143457111f52b7627a8092943fd3698c758e4f7 /logic
parent6f6d912d07901efebf5f399ee94c458acdc1369b (diff)
downloadMultiMC-c0e58fbfb213c05f0259dab9bf5b7aabd6f373cf.tar
MultiMC-c0e58fbfb213c05f0259dab9bf5b7aabd6f373cf.tar.gz
MultiMC-c0e58fbfb213c05f0259dab9bf5b7aabd6f373cf.tar.lz
MultiMC-c0e58fbfb213c05f0259dab9bf5b7aabd6f373cf.tar.xz
MultiMC-c0e58fbfb213c05f0259dab9bf5b7aabd6f373cf.zip
Try to be cross-platform
Diffstat (limited to 'logic')
-rw-r--r--logic/profiler/BaseProfiler.cpp11
-rw-r--r--logic/profiler/BaseProfiler.h3
-rw-r--r--logic/profiler/JProfiler.cpp2
3 files changed, 15 insertions, 1 deletions
diff --git a/logic/profiler/BaseProfiler.cpp b/logic/profiler/BaseProfiler.cpp
index 788e9614..7934f6b4 100644
--- a/logic/profiler/BaseProfiler.cpp
+++ b/logic/profiler/BaseProfiler.cpp
@@ -1,5 +1,7 @@
#include "BaseProfiler.h"
+#include <QProcess>
+
BaseProfiler::BaseProfiler(OneSixInstance *instance, QObject *parent)
: QObject(parent), m_instance(instance)
{
@@ -14,6 +16,15 @@ void BaseProfiler::beginProfiling(MinecraftProcess *process)
beginProfilingImpl(process);
}
+qint64 BaseProfiler::pid(QProcess *process)
+{
+#ifdef Q_OS_UNIX
+ return process->pid();
+#else
+ return (qint64)process->pid();
+#endif
+}
+
BaseProfilerFactory::~BaseProfilerFactory()
{
}
diff --git a/logic/profiler/BaseProfiler.h b/logic/profiler/BaseProfiler.h
index 2986c8e1..e7bc4c2d 100644
--- a/logic/profiler/BaseProfiler.h
+++ b/logic/profiler/BaseProfiler.h
@@ -5,6 +5,7 @@
class OneSixInstance;
class SettingsObject;
class MinecraftProcess;
+class QProcess;
class BaseProfiler : public QObject
{
@@ -22,6 +23,8 @@ protected:
virtual void beginProfilingImpl(MinecraftProcess *process) = 0;
+ qint64 pid(QProcess *process);
+
signals:
void readyToLaunch(const QString &message);
};
diff --git a/logic/profiler/JProfiler.cpp b/logic/profiler/JProfiler.cpp
index aa6a866a..eddf46d9 100644
--- a/logic/profiler/JProfiler.cpp
+++ b/logic/profiler/JProfiler.cpp
@@ -16,7 +16,7 @@ void JProfiler::beginProfilingImpl(MinecraftProcess *process)
{
int port = MMC->settings()->get("JProfilerPort").toInt();
QProcess *profiler = new QProcess(this);
- profiler->setArguments(QStringList() << "-d" << QString::number(process->pid()) << "--gui"
+ profiler->setArguments(QStringList() << "-d" << QString::number(pid(process)) << "--gui"
<< "-p" << QString::number(port));
profiler->setProgram(QDir(MMC->settings()->get("JProfilerPath").toString())
.absoluteFilePath("bin/jpenable"));