diff options
author | Andrew <forkk@forkk.net> | 2013-02-25 13:31:37 -0600 |
---|---|---|
committer | Andrew <forkk@forkk.net> | 2013-02-25 13:31:37 -0600 |
commit | 23474da17500b35bf4fb2a754021175361baab00 (patch) | |
tree | db2dda426ec4a91982f5f5539b08cc7c3bb1fd35 /data/minecraftprocess.h | |
parent | 498225debdb22d83e591635dbd172cca12476279 (diff) | |
parent | 4fd5bdb01b27c99f16c9acf3c7ac13c7ea719800 (diff) | |
download | MultiMC-23474da17500b35bf4fb2a754021175361baab00.tar MultiMC-23474da17500b35bf4fb2a754021175361baab00.tar.gz MultiMC-23474da17500b35bf4fb2a754021175361baab00.tar.lz MultiMC-23474da17500b35bf4fb2a754021175361baab00.tar.xz MultiMC-23474da17500b35bf4fb2a754021175361baab00.zip |
Merge branch 'master' of git://github.com/peterix/MultiMC5
Conflicts:
CMakeLists.txt
main.cpp
Diffstat (limited to 'data/minecraftprocess.h')
-rw-r--r-- | data/minecraftprocess.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/data/minecraftprocess.h b/data/minecraftprocess.h new file mode 100644 index 00000000..bede9486 --- /dev/null +++ b/data/minecraftprocess.h @@ -0,0 +1,98 @@ +/* Copyright 2013 MultiMC Contributors + * + * Authors: Orochimarufan <orochimarufan.x3@gmail.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINECRAFTPROCESS_H +#define MINECRAFTPROCESS_H + +#include <QProcess> + +#include "gui/consolewindow.h" + +#include "instance.h" + +/** + * @file data/minecraftprocess.h + * @brief The MinecraftProcess class + */ +class MinecraftProcess : public QProcess +{ + Q_OBJECT +public: + /** + * @brief MinecraftProcess constructor + * @param inst the Instance pointer to launch + * @param user the minecraft username + * @param session the minecraft session id + * @param console the instance console window + */ + MinecraftProcess(InstancePtr inst, QString user, QString session, ConsoleWindow *console); + + /** + * @brief launch minecraft + */ + void launch(); + + /** + * @brief extract the instance icon + * @param inst the instance + * @param destination the destination path + */ + static inline void extractIcon(InstancePtr inst, QString destination); + + /** + * @brief extract the MultiMC launcher.jar + * @param destination the destination path + */ + static inline void extractLauncher(QString destination); + + /** + * @brief prepare the launch by extracting icon and launcher + * @param inst the instance + */ + static void prepare(InstancePtr inst); + + /** + * @brief split a string into argv items like a shell would do + * @param args the argument string + * @return a QStringList containing all arguments + */ + static QStringList splitArgs(QString args); + +signals: + /** + * @brief emitted when mc has finished and the PostLaunchCommand was run + */ + void ended(); + +protected: + ConsoleWindow *m_console; + InstancePtr m_instance; + QString m_user; + QString m_session; + QProcess m_prepostlaunchprocess; + QStringList m_arguments; + + void genArgs(); + void log(QString text); + +protected slots: + void finish(int, QProcess::ExitStatus status); + void on_stdErr(); + void on_stdOut(); + +}; + +#endif // MINECRAFTPROCESS_H |