Massive renaming in the backend folder, all around restructure in the same.
This commit is contained in:
parent
8808a8b108
commit
2e0cbf393a
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "appsettings.h"
|
||||
#include "AppSettings.h"
|
||||
|
||||
#include <setting.h>
|
||||
|
@ -13,20 +13,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APPSETTINGS_H
|
||||
#define APPSETTINGS_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <inisettingsobject.h>
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
class LIBMULTIMC_EXPORT AppSettings : public INISettingsObject
|
||||
class AppSettings : public INISettingsObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AppSettings(QObject *parent = 0);
|
||||
};
|
||||
|
||||
#endif // APPSETTINGS_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "version.h"
|
||||
#include "AppVersion.h"
|
||||
|
||||
#include "config.h"
|
||||
|
@ -13,17 +13,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
/*!
|
||||
* \brief The Version class represents a MultiMC version number.
|
||||
*/
|
||||
class LIBMULTIMC_EXPORT Version : public QObject
|
||||
class Version : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -66,4 +63,3 @@ public:
|
||||
static Version current;
|
||||
};
|
||||
|
||||
#endif // VERSION_H
|
@ -28,9 +28,6 @@ ENDIF()
|
||||
|
||||
################################ INCLUDE LIBRARIES ################################
|
||||
|
||||
# First, include header overrides
|
||||
include_directories(hacks)
|
||||
|
||||
######## 3rd Party Libs ########
|
||||
|
||||
# Find the required Qt parts
|
||||
@ -68,7 +65,7 @@ add_subdirectory(libsettings)
|
||||
include_directories(${LIBSETTINGS_INCLUDE_DIR})
|
||||
|
||||
# Add the instance library.
|
||||
add_subdirectory(libmultimc)
|
||||
add_subdirectory(backend)
|
||||
include_directories(${LIBMULTIMC_INCLUDE_DIR})
|
||||
|
||||
# Add the group view library.
|
||||
@ -161,6 +158,10 @@ ADD_DEFINITIONS(-DQUAZIP_STATIC)
|
||||
|
||||
######## Headers ########
|
||||
SET(MULTIMC_HEADERS
|
||||
multimc_pragma.h
|
||||
AppVersion.h
|
||||
AppSettings.h
|
||||
|
||||
gui/mainwindow.h
|
||||
gui/modeditdialog.h
|
||||
gui/legacymodeditdialog.h
|
||||
@ -178,8 +179,6 @@ gui/lwjglselectdialog.h
|
||||
gui/iconcache.h
|
||||
gui/instancesettings.h
|
||||
|
||||
multimc_pragma.h
|
||||
|
||||
java/annotations.h
|
||||
java/classfile.h
|
||||
java/constants.h
|
||||
@ -193,6 +192,8 @@ java/membuffer.h
|
||||
######## Sources ########
|
||||
SET(MULTIMC_SOURCES
|
||||
main.cpp
|
||||
AppVersion.cpp
|
||||
AppSettings.cpp
|
||||
|
||||
gui/mainwindow.cpp
|
||||
gui/modeditdialog.cpp
|
||||
@ -270,9 +271,9 @@ ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32
|
||||
# Link
|
||||
QT5_USE_MODULES(MultiMC Widgets Network WebKitWidgets)
|
||||
TARGET_LINK_LIBRARIES(MultiMC quazip patchlib
|
||||
libUtil libSettings libMultiMC libGroupView
|
||||
libUtil libSettings backend libGroupView
|
||||
${MultiMC_LINK_ADDITIONAL_LIBS})
|
||||
ADD_DEPENDENCIES(MultiMC MultiMCLauncher libUtil libSettings libMultiMC libGroupView)
|
||||
ADD_DEPENDENCIES(MultiMC MultiMCLauncher libUtil libSettings backend libGroupView)
|
||||
|
||||
|
||||
option(BUILD_KEYRING_TEST "Build the simple keyring test binary" OFF)
|
||||
@ -288,7 +289,7 @@ IF(BUILD_ASSET_TEST)
|
||||
# test.cpp
|
||||
ADD_EXECUTABLE(AssetTest asset_test.cpp)
|
||||
QT5_USE_MODULES(AssetTest Core Network)
|
||||
TARGET_LINK_LIBRARIES(AssetTest libUtil libMultiMC libSettings)
|
||||
TARGET_LINK_LIBRARIES(AssetTest libUtil backend libSettings)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "include/instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
@ -22,19 +22,18 @@
|
||||
#include "overridesetting.h"
|
||||
|
||||
#include "pathutils.h"
|
||||
#include <minecraftversionlist.h>
|
||||
#include <lists/MinecraftVersionList.h>
|
||||
|
||||
Instance::Instance(const QString &rootDir, QObject *parent) :
|
||||
BaseInstance::BaseInstance(const QString &rootDir, QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
m_rootDir = rootDir;
|
||||
m_settings = new INISettingsObject(configFile(), this);
|
||||
m_settings = new INISettingsObject(PathCombine(rootDir, "instance.cfg"), this);
|
||||
|
||||
settings().registerSetting(new Setting("name", "Unnamed Instance"));
|
||||
settings().registerSetting(new Setting("iconKey", "default"));
|
||||
settings().registerSetting(new Setting("notes", ""));
|
||||
settings().registerSetting(new Setting("NeedsRebuild", true));
|
||||
settings().registerSetting(new Setting("IsForNewLauncher", false));
|
||||
settings().registerSetting(new Setting("ShouldUpdate", false));
|
||||
settings().registerSetting(new Setting("JarVersion", "Unknown"));
|
||||
settings().registerSetting(new Setting("LwjglVersion", "2.9.0"));
|
||||
@ -77,17 +76,17 @@ Instance::Instance(const QString &rootDir, QObject *parent) :
|
||||
settings().registerSetting(new Setting("OverrideCommands", false));
|
||||
}
|
||||
|
||||
QString Instance::id() const
|
||||
QString BaseInstance::id() const
|
||||
{
|
||||
return QFileInfo(rootDir()).fileName();
|
||||
}
|
||||
|
||||
QString Instance::rootDir() const
|
||||
QString BaseInstance::rootDir() const
|
||||
{
|
||||
return m_rootDir;
|
||||
}
|
||||
|
||||
InstanceList *Instance::instList() const
|
||||
InstanceList *BaseInstance::instList() const
|
||||
{
|
||||
if (parent()->inherits("InstanceList"))
|
||||
return (InstanceList *)parent();
|
||||
@ -95,7 +94,7 @@ InstanceList *Instance::instList() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QString Instance::minecraftDir() const
|
||||
QString BaseInstance::minecraftDir() const
|
||||
{
|
||||
QFileInfo mcDir(PathCombine(rootDir(), "minecraft"));
|
||||
QFileInfo dotMCDir(PathCombine(rootDir(), ".minecraft"));
|
||||
@ -106,78 +105,73 @@ QString Instance::minecraftDir() const
|
||||
return mcDir.filePath();
|
||||
}
|
||||
|
||||
QString Instance::instModsDir() const
|
||||
QString BaseInstance::instModsDir() const
|
||||
{
|
||||
return PathCombine(rootDir(), "instMods");
|
||||
}
|
||||
|
||||
QString Instance::binDir() const
|
||||
QString BaseInstance::binDir() const
|
||||
{
|
||||
return PathCombine(minecraftDir(), "bin");
|
||||
}
|
||||
|
||||
QString Instance::savesDir() const
|
||||
QString BaseInstance::savesDir() const
|
||||
{
|
||||
return PathCombine(minecraftDir(), "saves");
|
||||
}
|
||||
|
||||
QString Instance::mlModsDir() const
|
||||
QString BaseInstance::mlModsDir() const
|
||||
{
|
||||
return PathCombine(minecraftDir(), "mods");
|
||||
}
|
||||
|
||||
QString Instance::coreModsDir() const
|
||||
QString BaseInstance::coreModsDir() const
|
||||
{
|
||||
return PathCombine(minecraftDir(), "coremods");
|
||||
}
|
||||
|
||||
QString Instance::resourceDir() const
|
||||
QString BaseInstance::resourceDir() const
|
||||
{
|
||||
return PathCombine(minecraftDir(), "resources");
|
||||
}
|
||||
|
||||
QString Instance::screenshotsDir() const
|
||||
QString BaseInstance::screenshotsDir() const
|
||||
{
|
||||
return PathCombine(minecraftDir(), "screenshots");
|
||||
}
|
||||
|
||||
QString Instance::texturePacksDir() const
|
||||
QString BaseInstance::texturePacksDir() const
|
||||
{
|
||||
return PathCombine(minecraftDir(), "texturepacks");
|
||||
}
|
||||
|
||||
QString Instance::mcJar() const
|
||||
QString BaseInstance::mcJar() const
|
||||
{
|
||||
return PathCombine(binDir(), "minecraft.jar");
|
||||
}
|
||||
|
||||
QString Instance::mcBackup() const
|
||||
QString BaseInstance::mcBackup() const
|
||||
{
|
||||
return PathCombine(binDir(), "mcbackup.jar");
|
||||
}
|
||||
|
||||
QString Instance::configFile() const
|
||||
{
|
||||
return PathCombine(rootDir(), "instance.cfg");
|
||||
}
|
||||
|
||||
QString Instance::modListFile() const
|
||||
QString BaseInstance::modListFile() const
|
||||
{
|
||||
return PathCombine(rootDir(), "modlist");
|
||||
}
|
||||
|
||||
InstVersionList *Instance::versionList() const
|
||||
InstVersionList *BaseInstance::versionList() const
|
||||
{
|
||||
return &MinecraftVersionList::getMainList();
|
||||
}
|
||||
|
||||
bool Instance::shouldUpdateCurrentVersion() const
|
||||
bool BaseInstance::shouldUpdateCurrentVersion() const
|
||||
{
|
||||
QFileInfo jar(mcJar());
|
||||
return jar.lastModified().toUTC().toMSecsSinceEpoch() != lastCurrentVersionUpdate();
|
||||
}
|
||||
|
||||
void Instance::updateCurrentVersion(bool keepCurrent)
|
||||
void BaseInstance::updateCurrentVersion(bool keepCurrent)
|
||||
{
|
||||
QFileInfo jar(mcJar());
|
||||
|
||||
@ -199,7 +193,7 @@ void Instance::updateCurrentVersion(bool keepCurrent)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsObject &Instance::settings() const
|
||||
SettingsObject &BaseInstance::settings() const
|
||||
{
|
||||
return *m_settings;
|
||||
}
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INSTANCE_H
|
||||
#define INSTANCE_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
@ -22,7 +21,7 @@
|
||||
#include <settingsobject.h>
|
||||
|
||||
#include "inifile.h"
|
||||
#include "instversionlist.h"
|
||||
#include "lists/InstVersionList.h"
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
@ -36,7 +35,7 @@ class InstanceList;
|
||||
* To create a new instance type, create a new class inheriting from this class
|
||||
* and implement the pure virtual functions.
|
||||
*/
|
||||
class LIBMULTIMC_EXPORT Instance : public QObject
|
||||
class LIBMULTIMC_EXPORT BaseInstance : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -67,6 +66,14 @@ class LIBMULTIMC_EXPORT Instance : public QObject
|
||||
//! The instance's group.
|
||||
Q_PROPERTY(QString group READ group WRITE setGroup)
|
||||
|
||||
/*!
|
||||
* Gets the time that the instance was last launched.
|
||||
* Stored in milliseconds since epoch.
|
||||
* This value is usually used for things like sorting instances by the time
|
||||
* they were last launched.
|
||||
*/
|
||||
Q_PROPERTY(qint64 lastLaunch READ lastLaunch WRITE setLastLaunch)
|
||||
|
||||
/*!
|
||||
* Whether or not the instance's minecraft.jar needs to be rebuilt.
|
||||
* If this is true, when the instance launches, its jar mods will be
|
||||
@ -100,14 +107,6 @@ class LIBMULTIMC_EXPORT Instance : public QObject
|
||||
Q_PROPERTY(QString lwjglVersion READ lwjglVersion WRITE setLWJGLVersion)
|
||||
|
||||
|
||||
/*!
|
||||
* Gets the time that the instance was last launched.
|
||||
* Stored in milliseconds since epoch.
|
||||
* This value is usually used for things like sorting instances by the time
|
||||
* they were last launched.
|
||||
*/
|
||||
Q_PROPERTY(qint64 lastLaunch READ lastLaunch WRITE setLastLaunch)
|
||||
|
||||
/*!
|
||||
* Gets the last time that the current version was checked.
|
||||
* This is checked against the last modified time on the jar file to see if
|
||||
@ -115,11 +114,6 @@ class LIBMULTIMC_EXPORT Instance : public QObject
|
||||
*/
|
||||
Q_PROPERTY(qint64 lastCurrentVersionUpdate READ lastCurrentVersionUpdate WRITE setLastCurrentVersionUpdate)
|
||||
|
||||
/*!
|
||||
* Is the instance a new launcher instance? Get/Set
|
||||
*/
|
||||
Q_PROPERTY(bool isForNewLauncher READ isForNewLauncher WRITE setIsForNewLauncher)
|
||||
|
||||
// Dirs
|
||||
//! Path to the instance's .minecraft folder.
|
||||
Q_PROPERTY(QString minecraftDir READ minecraftDir STORED false)
|
||||
@ -156,22 +150,11 @@ class LIBMULTIMC_EXPORT Instance : public QObject
|
||||
//! Path to the instance's mcbackup.jar
|
||||
Q_PROPERTY(QString mcBackup READ mcBackup STORED false)
|
||||
|
||||
//! Path to the instance's config file.
|
||||
Q_PROPERTY(QString configFile READ configFile STORED false)
|
||||
|
||||
//! Path to the instance's modlist file.
|
||||
Q_PROPERTY(QString modListFile READ modListFile STORED false)
|
||||
|
||||
public:
|
||||
explicit Instance(const QString &rootDir, QObject *parent = 0);
|
||||
|
||||
// Please, for the sake of my (and everyone else's) sanity, at least keep this shit
|
||||
// *somewhat* organized. Also, documentation is semi-important here. Please don't
|
||||
// leave undocumented stuff behind.
|
||||
// As a side-note, doxygen processes comments for accessor functions and
|
||||
// properties separately, so please document properties in the massive block of
|
||||
// Q_PROPERTY declarations above rather than documenting their accessors.
|
||||
|
||||
explicit BaseInstance(const QString &rootDir, QObject *parent = 0);
|
||||
|
||||
//////// STUFF ////////
|
||||
virtual QString id() const;
|
||||
@ -252,16 +235,6 @@ public:
|
||||
virtual qint64 lastCurrentVersionUpdate() const { return settings().get("lastVersionUpdate").value<qint64>(); }
|
||||
virtual void setLastCurrentVersionUpdate(qint64 val) { settings().set("lastVersionUpdate", val); }
|
||||
|
||||
virtual bool isForNewLauncher()
|
||||
{
|
||||
return settings().get("IsForNewLauncher").value<bool>();
|
||||
}
|
||||
|
||||
virtual void setIsForNewLauncher(bool value = true)
|
||||
{
|
||||
settings().set("IsForNewLauncher", value);
|
||||
}
|
||||
|
||||
////// Directories //////
|
||||
QString minecraftDir() const;
|
||||
QString instModsDir() const;
|
||||
@ -277,7 +250,6 @@ public:
|
||||
////// Files //////
|
||||
QString mcJar() const;
|
||||
QString mcBackup() const;
|
||||
QString configFile() const;
|
||||
QString modListFile() const;
|
||||
|
||||
|
||||
@ -328,7 +300,7 @@ signals:
|
||||
/*!
|
||||
* \brief Signal emitted when properties relevant to the instance view change
|
||||
*/
|
||||
void propertiesChanged(Instance * inst);
|
||||
void propertiesChanged(BaseInstance * inst);
|
||||
|
||||
private:
|
||||
QString m_rootDir;
|
||||
@ -337,6 +309,5 @@ private:
|
||||
};
|
||||
|
||||
// pointer for lazy people
|
||||
typedef QSharedPointer<Instance> InstancePtr;
|
||||
typedef QSharedPointer<BaseInstance> InstancePtr;
|
||||
|
||||
#endif // INSTANCE_H
|
91
backend/CMakeLists.txt
Normal file
91
backend/CMakeLists.txt
Normal file
@ -0,0 +1,91 @@
|
||||
project(libMultiMC)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# Find Qt
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Xml REQUIRED)
|
||||
|
||||
# Include Qt headers.
|
||||
include_directories(${Qt5Base_INCLUDE_DIRS})
|
||||
include_directories(${Qt5Network_INCLUDE_DIRS})
|
||||
|
||||
# Include utility library.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/libutil/include)
|
||||
|
||||
# Include settings library.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/libsettings/include)
|
||||
|
||||
SET(LIBINST_HEADERS
|
||||
libmmc_config.h
|
||||
|
||||
# Instance Stuff
|
||||
BaseInstance.h
|
||||
LegacyInstance.h
|
||||
OneSixInstance.h
|
||||
InstanceFactory.h
|
||||
|
||||
# Versions
|
||||
InstanceVersion.h
|
||||
MinecraftVersion.h
|
||||
OneSixVersion.h
|
||||
VersionFactory.h
|
||||
|
||||
# Lists
|
||||
lists/InstanceList.h
|
||||
lists/InstVersionList.h
|
||||
lists/MinecraftVersionList.h
|
||||
lists/LwjglVersionList.h
|
||||
|
||||
# Tasks
|
||||
tasks/Task.h
|
||||
tasks/LoginTask.h
|
||||
tasks/LoginResponse.h
|
||||
tasks/UserInfo.h
|
||||
tasks/GameUpdateTask.h
|
||||
|
||||
MinecraftProcess.h
|
||||
)
|
||||
|
||||
SET(LIBINST_SOURCES
|
||||
# Instance Stuff
|
||||
BaseInstance.cpp
|
||||
LegacyInstance.cpp
|
||||
OneSixInstance.cpp
|
||||
InstanceFactory.cpp
|
||||
|
||||
# Versions
|
||||
InstanceVersion.cpp
|
||||
MinecraftVersion.cpp
|
||||
OneSixVersion.cpp
|
||||
VersionFactory.cpp
|
||||
|
||||
# Lists
|
||||
lists/InstanceList.cpp
|
||||
lists/InstVersionList.cpp
|
||||
lists/MinecraftVersionList.cpp
|
||||
lists/LwjglVersionList.cpp
|
||||
|
||||
# Tasks
|
||||
tasks/Task.cpp
|
||||
tasks/LoginTask.cpp
|
||||
tasks/GameUpdateTask.cpp
|
||||
tasks/UserInfo.cpp
|
||||
tasks/LoginResponse.cpp
|
||||
|
||||
MinecraftProcess.cpp
|
||||
)
|
||||
|
||||
# Set the include dir path.
|
||||
SET(LIBMULTIMC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE)
|
||||
|
||||
# Include self.
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(${CMAKE_BINARY_DIR}/include)
|
||||
|
||||
add_definitions(-DLIBMULTIMC_LIBRARY)
|
||||
|
||||
add_library(backend SHARED ${LIBINST_SOURCES} ${LIBINST_HEADERS})
|
||||
qt5_use_modules(backend Core Network Xml)
|
||||
target_link_libraries(backend libUtil libSettings)
|
@ -13,28 +13,28 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "include/instanceloader.h"
|
||||
#include "InstanceFactory.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "include/instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
#include "inifile.h"
|
||||
|
||||
#include "pathutils.h"
|
||||
|
||||
InstanceLoader InstanceLoader::loader;
|
||||
InstanceFactory InstanceFactory::loader;
|
||||
|
||||
InstanceLoader::InstanceLoader() :
|
||||
InstanceFactory::InstanceFactory() :
|
||||
QObject(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
InstanceLoader::InstLoadError InstanceLoader::loadInstance(Instance *&inst, const QString &instDir)
|
||||
InstanceFactory::InstLoadError InstanceFactory::loadInstance(BaseInstance *&inst, const QString &instDir)
|
||||
{
|
||||
Instance *loadedInst = new Instance(instDir, this);
|
||||
BaseInstance *loadedInst = new BaseInstance(instDir, this);
|
||||
|
||||
// TODO: Sanity checks to verify that the instance is valid.
|
||||
|
||||
@ -44,18 +44,18 @@ InstanceLoader::InstLoadError InstanceLoader::loadInstance(Instance *&inst, cons
|
||||
}
|
||||
|
||||
|
||||
InstanceLoader::InstCreateError InstanceLoader::createInstance(Instance *&inst, const QString &instDir)
|
||||
InstanceFactory::InstCreateError InstanceFactory::createInstance(BaseInstance *&inst, const QString &instDir)
|
||||
{
|
||||
QDir rootDir(instDir);
|
||||
|
||||
qDebug(instDir.toUtf8());
|
||||
if (!rootDir.exists() && !rootDir.mkpath("."))
|
||||
{
|
||||
return InstanceLoader::CantCreateDir;
|
||||
return InstanceFactory::CantCreateDir;
|
||||
}
|
||||
|
||||
inst = new Instance(instDir, this);
|
||||
inst = new BaseInstance(instDir, this);
|
||||
|
||||
//FIXME: really, how do you even know?
|
||||
return InstanceLoader::NoCreateError;
|
||||
return InstanceFactory::NoCreateError;
|
||||
}
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INSTANCELOADER_H
|
||||
#define INSTANCELOADER_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
@ -22,19 +21,19 @@
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
class Instance;
|
||||
class BaseInstance;
|
||||
|
||||
/*!
|
||||
* The InstanceLoader is a singleton that manages loading and creating instances.
|
||||
* The \bInstanceFactory\b is a singleton that manages loading and creating instances.
|
||||
*/
|
||||
class LIBMULTIMC_EXPORT InstanceLoader : public QObject
|
||||
class LIBMULTIMC_EXPORT InstanceFactory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/*!
|
||||
* \brief Gets a reference to the instance loader.
|
||||
*/
|
||||
static InstanceLoader &get() { return loader; }
|
||||
static InstanceFactory &get() { return loader; }
|
||||
|
||||
enum InstLoadError
|
||||
{
|
||||
@ -61,7 +60,7 @@ public:
|
||||
* - InstExists if the given instance directory is already an instance.
|
||||
* - CantCreateDir if the given instance directory cannot be created.
|
||||
*/
|
||||
InstCreateError createInstance(Instance *&inst, const QString &instDir);
|
||||
InstCreateError createInstance(BaseInstance *&inst, const QString &instDir);
|
||||
|
||||
/*!
|
||||
* \brief Loads an instance from the given directory.
|
||||
@ -71,12 +70,10 @@ public:
|
||||
* \return An InstLoadError error code.
|
||||
* - NotAnInstance if the given instance directory isn't a valid instance.
|
||||
*/
|
||||
InstLoadError loadInstance(Instance *&inst, const QString &instDir);
|
||||
InstLoadError loadInstance(BaseInstance *&inst, const QString &instDir);
|
||||
|
||||
private:
|
||||
InstanceLoader();
|
||||
InstanceFactory();
|
||||
|
||||
static InstanceLoader loader;
|
||||
static InstanceFactory loader;
|
||||
};
|
||||
|
||||
#endif // INSTANCELOADER_H
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "include/instversion.h"
|
||||
#include "include/instversionlist.h"
|
||||
#include "InstanceVersion.h"
|
||||
#include "lists/InstVersionList.h"
|
||||
|
||||
InstVersion::InstVersion(const QString &descriptor,
|
||||
const QString &name,
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INSTVERSION_H
|
||||
#define INSTVERSION_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -120,5 +119,3 @@ protected:
|
||||
QString m_name;
|
||||
qint64 m_timestamp;
|
||||
};
|
||||
|
||||
#endif // INSTVERSION_H
|
0
backend/LegacyInstance.cpp
Normal file
0
backend/LegacyInstance.cpp
Normal file
1
backend/LegacyInstance.h
Normal file
1
backend/LegacyInstance.h
Normal file
@ -0,0 +1 @@
|
||||
#pragma once
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "minecraftprocess.h"
|
||||
#include "MinecraftProcess.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QFile>
|
||||
@ -23,57 +23,17 @@
|
||||
//#include <QImage>
|
||||
#include <QProcessEnvironment>
|
||||
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
#include "osutils.h"
|
||||
#include "pathutils.h"
|
||||
#include "cmdutils.h"
|
||||
|
||||
#define LAUNCHER_FILE "MultiMCLauncher.jar"
|
||||
#define IBUS "@im=ibus"
|
||||
|
||||
// commandline splitter
|
||||
QStringList MinecraftProcess::splitArgs(QString args)
|
||||
{
|
||||
QStringList argv;
|
||||
QString current;
|
||||
bool escape = false;
|
||||
QChar inquotes;
|
||||
for (int i=0; i<args.length(); i++)
|
||||
{
|
||||
QChar cchar = args.at(i);
|
||||
|
||||
// \ escaped
|
||||
if (escape) {
|
||||
current += cchar;
|
||||
escape = false;
|
||||
// in "quotes"
|
||||
} else if (!inquotes.isNull()) {
|
||||
if (cchar == 0x5C)
|
||||
escape = true;
|
||||
else if (cchar == inquotes)
|
||||
inquotes = 0;
|
||||
else
|
||||
current += cchar;
|
||||
// otherwise
|
||||
} else {
|
||||
if (cchar == 0x20) {
|
||||
if (!current.isEmpty()) {
|
||||
argv << current;
|
||||
current.clear();
|
||||
}
|
||||
} else if (cchar == 0x22 || cchar == 0x27)
|
||||
inquotes = cchar;
|
||||
else
|
||||
current += cchar;
|
||||
}
|
||||
}
|
||||
if (!current.isEmpty())
|
||||
argv << current;
|
||||
return argv;
|
||||
}
|
||||
|
||||
// prepare tools
|
||||
inline void MinecraftProcess::extractIcon(Instance *inst, QString destination)
|
||||
inline void MinecraftProcess::extractIcon(BaseInstance *inst, QString destination)
|
||||
{
|
||||
// QImage(":/icons/instances/" + inst->iconKey()).save(destination);
|
||||
}
|
||||
@ -83,14 +43,14 @@ inline void MinecraftProcess::extractLauncher(QString destination)
|
||||
QFile(":/launcher/launcher.jar").copy(destination);
|
||||
}
|
||||
|
||||
void MinecraftProcess::prepare(Instance *inst)
|
||||
void MinecraftProcess::prepare(BaseInstance *inst)
|
||||
{
|
||||
extractLauncher(PathCombine(inst->minecraftDir(), LAUNCHER_FILE));
|
||||
extractIcon(inst, PathCombine(inst->minecraftDir(), "icon.png"));
|
||||
}
|
||||
|
||||
// constructor
|
||||
MinecraftProcess::MinecraftProcess(Instance *inst, QString user, QString session) :
|
||||
MinecraftProcess::MinecraftProcess(BaseInstance *inst, QString user, QString session) :
|
||||
m_instance(inst), m_user(user), m_session(session)
|
||||
{
|
||||
connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(finish(int, QProcess::ExitStatus)));
|
||||
@ -245,7 +205,7 @@ void MinecraftProcess::genArgs()
|
||||
windowTitle.append("MultiMC: ").append(m_instance->name());
|
||||
|
||||
// Java arguments
|
||||
m_arguments.append(splitArgs(m_instance->settings().get("JvmArgs").toString()));
|
||||
m_arguments.append(Util::Commandline::splitArgs(m_instance->settings().get("JvmArgs").toString()));
|
||||
|
||||
#ifdef OSX
|
||||
// OSX dock icon and name
|
@ -14,12 +14,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MINECRAFTPROCESS_H
|
||||
#define MINECRAFTPROCESS_H
|
||||
#pragma once
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
@ -54,7 +53,7 @@ public:
|
||||
* @param session the minecraft session id
|
||||
* @param console the instance console window
|
||||
*/
|
||||
MinecraftProcess(Instance *inst, QString user, QString session);
|
||||
MinecraftProcess(BaseInstance *inst, QString user, QString session);
|
||||
|
||||
/**
|
||||
* @brief launch minecraft
|
||||
@ -66,7 +65,7 @@ public:
|
||||
* @param inst the instance
|
||||
* @param destination the destination path
|
||||
*/
|
||||
static inline void extractIcon(Instance *inst, QString destination);
|
||||
static inline void extractIcon(BaseInstance *inst, QString destination);
|
||||
|
||||
/**
|
||||
* @brief extract the MultiMC launcher.jar
|
||||
@ -78,14 +77,7 @@ public:
|
||||
* @brief prepare the launch by extracting icon and launcher
|
||||
* @param inst the instance
|
||||
*/
|
||||
static void prepare(Instance *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);
|
||||
static void prepare(BaseInstance *inst);
|
||||
|
||||
signals:
|
||||
/**
|
||||
@ -101,7 +93,7 @@ signals:
|
||||
void log(QString text, MessageLevel::Enum level=MessageLevel::MultiMC);
|
||||
|
||||
protected:
|
||||
Instance *m_instance;
|
||||
BaseInstance *m_instance;
|
||||
QString m_user;
|
||||
QString m_session;
|
||||
QString m_err_leftover;
|
||||
@ -117,5 +109,3 @@ protected slots:
|
||||
void on_stdOut();
|
||||
|
||||
};
|
||||
|
||||
#endif // MINECRAFTPROCESS_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "minecraftversion.h"
|
||||
#include "MinecraftVersion.h"
|
||||
|
||||
MinecraftVersion::MinecraftVersion(QString descriptor,
|
||||
QString name,
|
||||
@ -23,7 +23,6 @@ MinecraftVersion::MinecraftVersion(QString descriptor,
|
||||
InstVersionList *parent) :
|
||||
InstVersion(descriptor, name, timestamp, parent), m_dlUrl(dlUrl), m_etag(etag)
|
||||
{
|
||||
m_isNewLauncherVersion = false;
|
||||
}
|
||||
|
||||
QString MinecraftVersion::descriptor() const
|
||||
@ -85,14 +84,14 @@ QString MinecraftVersion::etag() const
|
||||
return m_etag;
|
||||
}
|
||||
|
||||
MinecraftVersion::LauncherVersion MinecraftVersion::launcherVersion() const
|
||||
MinecraftVersion::VersionSource MinecraftVersion::versionSource() const
|
||||
{
|
||||
return m_launcherVersion;
|
||||
return m_versionSource;
|
||||
};
|
||||
|
||||
void MinecraftVersion::setLauncherVersion(LauncherVersion launcherVersion)
|
||||
void MinecraftVersion::setVersionSource(VersionSource launcherVersion)
|
||||
{
|
||||
m_launcherVersion = launcherVersion;
|
||||
m_versionSource = launcherVersion;
|
||||
}
|
||||
|
||||
InstVersion *MinecraftVersion::copyVersion(InstVersionList *newParent) const
|
||||
@ -100,6 +99,6 @@ InstVersion *MinecraftVersion::copyVersion(InstVersionList *newParent) const
|
||||
MinecraftVersion *version = new MinecraftVersion(
|
||||
descriptor(), name(), timestamp(), downloadURL(), etag(), newParent);
|
||||
version->setVersionType(versionType());
|
||||
version->setLauncherVersion(launcherVersion());
|
||||
version->setVersionSource(VersionSource());
|
||||
return version;
|
||||
}
|
@ -13,38 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MINECRAFTVERSION_H
|
||||
#define MINECRAFTVERSION_H
|
||||
#pragma once
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
#include "instversion.h"
|
||||
#include "InstanceVersion.h"
|
||||
|
||||
class LIBMULTIMC_EXPORT MinecraftVersion : public InstVersion
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/*!
|
||||
* This version's type. Used internally to identify what kind of version this is.
|
||||
*/
|
||||
Q_PROPERTY(VersionType versionType READ versionType WRITE setVersionType)
|
||||
|
||||
/*!
|
||||
* This version's launcher. Used to identify the launcher version this is intended for.
|
||||
*/
|
||||
Q_PROPERTY(LauncherVersion versionType READ launcherVersion WRITE setLauncherVersion)
|
||||
|
||||
/*!
|
||||
* The URL that this version will be downloaded from.
|
||||
*/
|
||||
Q_PROPERTY(QString downloadURL READ downloadURL)
|
||||
|
||||
/*!
|
||||
* ETag/MD5 Used to verify the integrity of the downloaded minecraft.jar.
|
||||
*/
|
||||
Q_PROPERTY(QString etag READ etag)
|
||||
|
||||
|
||||
public:
|
||||
explicit MinecraftVersion(QString descriptor,
|
||||
QString name,
|
||||
@ -64,7 +42,7 @@ public:
|
||||
MCNostalgia
|
||||
};
|
||||
|
||||
enum LauncherVersion
|
||||
enum VersionSource
|
||||
{
|
||||
Unknown = -1,
|
||||
Legacy = 0, // the legacy launcher that's been around since ... forever
|
||||
@ -79,8 +57,8 @@ public:
|
||||
virtual VersionType versionType() const;
|
||||
virtual void setVersionType(VersionType typeName);
|
||||
|
||||
virtual LauncherVersion launcherVersion() const;
|
||||
virtual void setLauncherVersion(LauncherVersion launcherVersion);
|
||||
virtual VersionSource versionSource() const;
|
||||
virtual void setVersionSource(VersionSource launcherVersion);
|
||||
|
||||
virtual QString downloadURL() const;
|
||||
virtual QString etag() const;
|
||||
@ -88,12 +66,15 @@ public:
|
||||
virtual InstVersion *copyVersion(InstVersionList *newParent) const;
|
||||
|
||||
private:
|
||||
/// The URL that this version will be downloaded from. maybe.
|
||||
QString m_dlUrl;
|
||||
|
||||
/// ETag/MD5 Used to verify the integrity of the downloaded minecraft.jar.
|
||||
QString m_etag;
|
||||
|
||||
/// This version's type. Used internally to identify what kind of version this is.
|
||||
VersionType m_type;
|
||||
LauncherVersion m_launcherVersion;
|
||||
|
||||
bool m_isNewLauncherVersion;
|
||||
/// Whete to get the full version info (or, where did we get this version from originally)
|
||||
VersionSource m_versionSource;
|
||||
};
|
||||
|
||||
#endif // MINECRAFTVERSION_H
|
0
backend/OneSixInstance.cpp
Normal file
0
backend/OneSixInstance.cpp
Normal file
1
backend/OneSixInstance.h
Normal file
1
backend/OneSixInstance.h
Normal file
@ -0,0 +1 @@
|
||||
#pragma once
|
@ -1,19 +1,4 @@
|
||||
/* Copyright 2013 MultiMC Contributors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "include/library.h"
|
||||
#include "OneSixVersion.h"
|
||||
|
||||
RuleAction RuleAction_fromString(QString name)
|
||||
{
|
||||
@ -78,4 +63,29 @@ void Library::finalize()
|
||||
m_is_active = m_is_active && m_native_suffixes.contains ( currentSystem );
|
||||
}
|
||||
}
|
||||
// default url for lib:
|
||||
|
||||
QList<QSharedPointer<Library> > FullVersion::getActiveNormalLibs()
|
||||
{
|
||||
QList<QSharedPointer<Library> > output;
|
||||
for ( auto lib: libraries )
|
||||
{
|
||||
if (lib->getIsActive() && !lib->getIsNative())
|
||||
{
|
||||
output.append(lib);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<Library> > FullVersion::getActiveNativeLibs()
|
||||
{
|
||||
QList<QSharedPointer<Library> > output;
|
||||
for ( auto lib: libraries )
|
||||
{
|
||||
if (lib->getIsActive() && lib->getIsNative())
|
||||
{
|
||||
output.append(lib);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
@ -1,20 +1,4 @@
|
||||
/* Copyright 2013 MultiMC Contributors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
class Library;
|
||||
@ -206,3 +190,76 @@ public:
|
||||
return m_is_native;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class FullVersion
|
||||
{
|
||||
public:
|
||||
/// the ID - determines which jar to use! ACTUALLY IMPORTANT!
|
||||
QString id;
|
||||
/// Last updated time - as a string
|
||||
QString time;
|
||||
/// Release time - as a string
|
||||
QString releaseTime;
|
||||
/// Release type - "release" or "snapshot"
|
||||
QString type;
|
||||
/**
|
||||
* DEPRECATED: Old versions of the new vanilla launcher used this
|
||||
* ex: "username_session_version"
|
||||
*/
|
||||
QString processArguments;
|
||||
/**
|
||||
* arguments that should be used for launching minecraft
|
||||
*
|
||||
* ex: "--username ${auth_player_name} --session ${auth_session}
|
||||
* --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}"
|
||||
*/
|
||||
QString minecraftArguments;
|
||||
/**
|
||||
* the minimum launcher version required by this version ... current is 4 (at point of writing)
|
||||
*/
|
||||
int minimumLauncherVersion;
|
||||
/**
|
||||
* The main class to load first
|
||||
*/
|
||||
QString mainClass;
|
||||
|
||||
/// the list of libs - both active and inactive, native and java
|
||||
QList<QSharedPointer<Library> > libraries;
|
||||
|
||||
/**
|
||||
* is this actually a legacy version? if so, none of the other stuff here will be ever used.
|
||||
* added by FullVersionFactory
|
||||
*/
|
||||
bool isLegacy;
|
||||
|
||||
/*
|
||||
FIXME: add support for those rules here? Looks like a pile of quick hacks to me though.
|
||||
|
||||
"rules": [
|
||||
{
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"action": "disallow",
|
||||
"os": {
|
||||
"name": "osx",
|
||||
"version": "^10\\.5\\.\\d$"
|
||||
}
|
||||
}
|
||||
],
|
||||
"incompatibilityReason": "There is a bug in LWJGL which makes it incompatible with OSX 10.5.8. Please go to New Profile and use 1.5.2 for now. Sorry!"
|
||||
}
|
||||
*/
|
||||
// QList<Rule> rules;
|
||||
|
||||
public:
|
||||
FullVersion()
|
||||
{
|
||||
minimumLauncherVersion = 0xDEADBEEF;
|
||||
isLegacy = false;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<Library> > getActiveNormalLibs();
|
||||
QList<QSharedPointer<Library> > getActiveNativeLibs();
|
||||
};
|
@ -1,17 +1,5 @@
|
||||
#include "fullversionfactory.h"
|
||||
#include "fullversion.h"
|
||||
#include <library.h>
|
||||
|
||||
class LibraryFinalizer
|
||||
{
|
||||
public:
|
||||
LibraryFinalizer(QSharedPointer<Library> library)
|
||||
{
|
||||
m_library = library;
|
||||
}
|
||||
|
||||
QSharedPointer<Library> m_library;
|
||||
};
|
||||
#include "VersionFactory.h"
|
||||
#include "OneSixVersion.h"
|
||||
|
||||
// Library rules (if any)
|
||||
QList<QSharedPointer<Rule> > FullVersionFactory::parse4rules(QJsonObject & baseObj)
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#ifndef LIBINSTANCE_CONFIG_H
|
||||
//#define LIBINSTANCE_CONFIG_H
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
@ -23,5 +22,3 @@
|
||||
#else
|
||||
# define LIBMULTIMC_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
//#endif // LIBINSTANCE_CONFIG_H
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "instversionlist.h"
|
||||
#include "instversion.h"
|
||||
#include "InstVersionList.h"
|
||||
#include "InstanceVersion.h"
|
||||
|
||||
InstVersionList::InstVersionList(QObject *parent) :
|
||||
QAbstractListModel(parent)
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INSTVERSIONLIST_H
|
||||
#define INSTVERSIONLIST_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
@ -120,5 +119,3 @@ protected slots:
|
||||
*/
|
||||
virtual void updateListData(QList<InstVersion *> versions) = 0;
|
||||
};
|
||||
|
||||
#endif // INSTVERSIONLIST_H
|
@ -13,8 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "include/instancelist.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QDirIterator>
|
||||
@ -24,8 +22,9 @@
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include "include/instance.h"
|
||||
#include "include/instanceloader.h"
|
||||
#include "lists/InstanceList.h"
|
||||
#include "BaseInstance.h"
|
||||
#include "InstanceFactory.h"
|
||||
|
||||
#include "pathutils.h"
|
||||
|
||||
@ -139,20 +138,20 @@ InstanceList::InstListError InstanceList::loadList()
|
||||
if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists())
|
||||
continue;
|
||||
|
||||
Instance *instPtr = NULL;
|
||||
auto &loader = InstanceLoader::get();
|
||||
BaseInstance *instPtr = NULL;
|
||||
auto &loader = InstanceFactory::get();
|
||||
auto error = loader.loadInstance(instPtr, subDir);
|
||||
|
||||
switch(error)
|
||||
{
|
||||
case InstanceLoader::NoLoadError:
|
||||
case InstanceFactory::NoLoadError:
|
||||
break;
|
||||
case InstanceLoader::NotAnInstance:
|
||||
case InstanceFactory::NotAnInstance:
|
||||
break;
|
||||
}
|
||||
|
||||
if (error != InstanceLoader::NoLoadError &&
|
||||
error != InstanceLoader::NotAnInstance)
|
||||
if (error != InstanceFactory::NoLoadError &&
|
||||
error != InstanceFactory::NotAnInstance)
|
||||
{
|
||||
QString errorMsg = QString("Failed to load instance %1: ").
|
||||
arg(QFileInfo(subDir).baseName()).toUtf8();
|
||||
@ -173,7 +172,7 @@ InstanceList::InstListError InstanceList::loadList()
|
||||
}
|
||||
else
|
||||
{
|
||||
QSharedPointer<Instance> inst(instPtr);
|
||||
QSharedPointer<BaseInstance> inst(instPtr);
|
||||
auto iter = groupMap.find(inst->id());
|
||||
if(iter != groupMap.end())
|
||||
{
|
||||
@ -182,7 +181,7 @@ InstanceList::InstListError InstanceList::loadList()
|
||||
qDebug(QString("Loaded instance %1").arg(inst->name()).toUtf8());
|
||||
inst->setParent(this);
|
||||
m_instances.append(inst);
|
||||
connect(instPtr, SIGNAL(propertiesChanged(Instance*)),this, SLOT(propertiesChanged(Instance*)));
|
||||
connect(instPtr, SIGNAL(propertiesChanged(BaseInstance*)),this, SLOT(propertiesChanged(BaseInstance*)));
|
||||
}
|
||||
}
|
||||
emit invalidated();
|
||||
@ -220,7 +219,7 @@ InstancePtr InstanceList::getInstanceById(QString instId)
|
||||
return iter.peekPrevious();
|
||||
}
|
||||
|
||||
void InstanceList::propertiesChanged(Instance * inst)
|
||||
void InstanceList::propertiesChanged(BaseInstance * inst)
|
||||
{
|
||||
for(int i = 0; i < m_instances.count(); i++)
|
||||
{
|
@ -13,16 +13,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INSTANCELIST_H
|
||||
#define INSTANCELIST_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
#include "libmmc_config.h"
|
||||
|
||||
class Instance;
|
||||
class BaseInstance;
|
||||
|
||||
class LIBMULTIMC_EXPORT InstanceList : public QObject
|
||||
{
|
||||
@ -85,11 +84,9 @@ signals:
|
||||
void invalidated();
|
||||
|
||||
private slots:
|
||||
void propertiesChanged(Instance * inst);
|
||||
void propertiesChanged(BaseInstance * inst);
|
||||
|
||||
protected:
|
||||
QString m_instDir;
|
||||
QList< InstancePtr > m_instances;
|
||||
};
|
||||
|
||||
#endif // INSTANCELIST_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "include/lwjglversionlist.h"
|
||||
#include "LwjglVersionList.h"
|
||||
|
||||
#include <QtNetwork>
|
||||
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef LWJGLVERSIONLIST_H
|
||||
#define LWJGLVERSIONLIST_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractListModel>
|
||||
@ -131,4 +130,3 @@ private slots:
|
||||
virtual void netRequestComplete();
|
||||
};
|
||||
|
||||
#endif // LWJGLVERSIONLIST_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "include/minecraftversionlist.h"
|
||||
#include "MinecraftVersionList.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -295,7 +295,7 @@ bool MCVListLoadTask::loadFromVList()
|
||||
MinecraftVersion *mcVersion = new MinecraftVersion(
|
||||
versionID, versionID, versionTime.toMSecsSinceEpoch(),
|
||||
dlUrl, "");
|
||||
mcVersion->setLauncherVersion(MinecraftVersion::Launcher16);
|
||||
mcVersion->setVersionSource(MinecraftVersion::Launcher16);
|
||||
mcVersion->setVersionType(versionType);
|
||||
tempList.append(mcVersion);
|
||||
}
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MINECRAFTVERSIONLIST_H
|
||||
#define MINECRAFTVERSIONLIST_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -22,11 +21,11 @@
|
||||
|
||||
#include <QList>
|
||||
|
||||
#include "instversionlist.h"
|
||||
#include "InstVersionList.h"
|
||||
|
||||
#include "task.h"
|
||||
#include "tasks/Task.h"
|
||||
|
||||
#include "minecraftversion.h"
|
||||
#include "MinecraftVersion.h"
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
@ -105,5 +104,3 @@ protected:
|
||||
bool processedMCNReply;
|
||||
};
|
||||
|
||||
|
||||
#endif // MINECRAFTVERSIONLIST_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "gameupdatetask.h"
|
||||
#include "GameUpdateTask.h"
|
||||
|
||||
#include <QtNetwork>
|
||||
|
||||
@ -24,14 +24,14 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "minecraftversionlist.h"
|
||||
#include "fullversionfactory.h"
|
||||
#include <fullversion.h>
|
||||
#include "lists/MinecraftVersionList.h"
|
||||
#include "VersionFactory.h"
|
||||
#include "OneSixVersion.h"
|
||||
|
||||
#include "pathutils.h"
|
||||
|
||||
|
||||
GameUpdateTask::GameUpdateTask(const LoginResponse &response, Instance *inst, QObject *parent) :
|
||||
GameUpdateTask::GameUpdateTask(const LoginResponse &response, BaseInstance *inst, QObject *parent) :
|
||||
Task(parent), m_response(response)
|
||||
{
|
||||
m_inst = inst;
|
||||
@ -60,7 +60,7 @@ void GameUpdateTask::executeTask()
|
||||
|
||||
setState(StateDetermineURLs);
|
||||
|
||||
if (targetVersion->launcherVersion() == MinecraftVersion::Launcher16)
|
||||
if (targetVersion->versionSource() == MinecraftVersion::Launcher16)
|
||||
{
|
||||
determineNewVersion();
|
||||
}
|
||||
@ -141,7 +141,7 @@ void GameUpdateTask::jarlibFinished()
|
||||
{
|
||||
m_inst->setCurrentVersion(targetVersion->descriptor());
|
||||
m_inst->setShouldUpdate(false);
|
||||
m_inst->setIsForNewLauncher(true);
|
||||
// m_inst->setIsForNewLauncher(true);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ void GameUpdateTask::getLegacyJar()
|
||||
// This will be either 'minecraft' or the version number, depending on where
|
||||
// we're downloading from.
|
||||
QString jarFilename = "minecraft";
|
||||
if (targetVersion->launcherVersion() == MinecraftVersion::Launcher16)
|
||||
if (targetVersion->versionSource() == MinecraftVersion::Launcher16)
|
||||
{
|
||||
jarFilename = targetVersion->descriptor();
|
||||
}
|
||||
@ -196,7 +196,7 @@ void GameUpdateTask::legacyJarFinished()
|
||||
{
|
||||
setState(StateFinished);
|
||||
emit gameUpdateComplete(m_response);
|
||||
m_inst->setIsForNewLauncher(true);
|
||||
// m_inst->setIsForNewLauncher(true);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef GAMEUPDATETASK_H
|
||||
#define GAMEUPDATETASK_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -24,9 +23,9 @@
|
||||
#include <QUrl>
|
||||
#include "dlqueue.h"
|
||||
|
||||
#include "task.h"
|
||||
#include "loginresponse.h"
|
||||
#include "instance.h"
|
||||
#include "Task.h"
|
||||
#include "tasks/LoginResponse.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
||||
@ -51,7 +50,7 @@ class LIBMULTIMC_EXPORT GameUpdateTask : public Task
|
||||
*/
|
||||
Q_PROPERTY(QString subStatus READ subStatus WRITE setSubStatus)
|
||||
public:
|
||||
explicit GameUpdateTask(const LoginResponse &response, Instance *inst, QObject *parent = 0);
|
||||
explicit GameUpdateTask(const LoginResponse &response, BaseInstance *inst, QObject *parent = 0);
|
||||
|
||||
|
||||
/////////////////////////
|
||||
@ -119,7 +118,7 @@ private:
|
||||
// STUFF //
|
||||
///////////
|
||||
|
||||
Instance *m_inst;
|
||||
BaseInstance *m_inst;
|
||||
LoginResponse m_response;
|
||||
|
||||
////////////////////////////
|
||||
@ -156,4 +155,3 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif // GAMEUPDATETASK_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "loginresponse.h"
|
||||
#include "tasks/LoginResponse.h"
|
||||
|
||||
LoginResponse::LoginResponse(const QString& username, const QString& sessionID,
|
||||
qint64 latestVersion, QObject *parent) :
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef LOGINRESPONSE_H
|
||||
#define LOGINRESPONSE_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -93,4 +92,3 @@ private:
|
||||
|
||||
Q_DECLARE_METATYPE(LoginResponse)
|
||||
|
||||
#endif // LOGINRESPONSE_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "logintask.h"
|
||||
#include "LoginTask.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
@ -16,10 +16,10 @@
|
||||
#ifndef LOGINTASK_H
|
||||
#define LOGINTASK_H
|
||||
|
||||
#include "task.h"
|
||||
#include "Task.h"
|
||||
|
||||
#include "userinfo.h"
|
||||
#include "loginresponse.h"
|
||||
#include "UserInfo.h"
|
||||
#include "tasks/LoginResponse.h"
|
||||
|
||||
#include "libmmc_config.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "task.h"
|
||||
#include "Task.h"
|
||||
|
||||
Task::Task(QObject *parent) :
|
||||
QThread(parent)
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "userinfo.h"
|
||||
#include "UserInfo.h"
|
||||
|
||||
UserInfo::UserInfo(const QString &username, const QString &password, QObject *parent) :
|
||||
QObject(parent)
|
@ -2,7 +2,7 @@
|
||||
#define CONSOLEWINDOW_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "minecraftprocess.h"
|
||||
#include "MinecraftProcess.h"
|
||||
|
||||
namespace Ui {
|
||||
class ConsoleWindow;
|
||||
|
@ -53,7 +53,7 @@ QVariant InstanceModel::data ( const QModelIndex& index, int role ) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
Instance *pdata = static_cast<Instance*> ( index.internalPointer() );
|
||||
BaseInstance *pdata = static_cast<BaseInstance*> ( index.internalPointer() );
|
||||
switch ( role )
|
||||
{
|
||||
case InstancePointerRole:
|
||||
@ -114,8 +114,8 @@ InstanceProxyModel::InstanceProxyModel ( QObject *parent )
|
||||
bool InstanceProxyModel::subSortLessThan (
|
||||
const QModelIndex& left, const QModelIndex& right ) const
|
||||
{
|
||||
Instance *pdataLeft = static_cast<Instance*> ( left.internalPointer() );
|
||||
Instance *pdataRight = static_cast<Instance*> ( right.internalPointer() );
|
||||
BaseInstance *pdataLeft = static_cast<BaseInstance*> ( left.internalPointer() );
|
||||
BaseInstance *pdataRight = static_cast<BaseInstance*> ( right.internalPointer() );
|
||||
//kDebug() << *pdataLeft << *pdataRight;
|
||||
return QString::localeAwareCompare(pdataLeft->name(), pdataRight->name()) < 0;
|
||||
//return pdataLeft->name() < pdataRight->name();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include "kcategorizedsortfilterproxymodel.h"
|
||||
#include "instancelist.h"
|
||||
#include "lists/InstanceList.h"
|
||||
#include <QIcon>
|
||||
|
||||
class InstanceModel : public QAbstractListModel
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
#include "legacymodeditdialog.h"
|
||||
#include "ui_legacymodeditdialog.h"
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
LegacyModEditDialog::LegacyModEditDialog(QWidget *parent, Instance* m_inst) :
|
||||
LegacyModEditDialog::LegacyModEditDialog(QWidget *parent, BaseInstance* m_inst) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LegacyModEditDialog)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
class LegacyModEditDialog;
|
||||
@ -29,7 +29,7 @@ class LegacyModEditDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LegacyModEditDialog(QWidget *parent = 0, Instance* m_inst = 0);
|
||||
explicit LegacyModEditDialog(QWidget *parent = 0, BaseInstance* m_inst = 0);
|
||||
~LegacyModEditDialog();
|
||||
|
||||
private slots:
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "lwjglselectdialog.h"
|
||||
#include "ui_lwjglselectdialog.h"
|
||||
|
||||
#include "lwjglversionlist.h"
|
||||
#include "lists/LwjglVersionList.h"
|
||||
|
||||
LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -48,22 +48,22 @@
|
||||
#include "kcategorizedview.h"
|
||||
#include "kcategorydrawer.h"
|
||||
|
||||
#include "instancelist.h"
|
||||
#include "appsettings.h"
|
||||
#include "version.h"
|
||||
#include "lists/InstanceList.h"
|
||||
#include "AppSettings.h"
|
||||
#include "AppVersion.h"
|
||||
|
||||
#include "logintask.h"
|
||||
#include "gameupdatetask.h"
|
||||
#include "tasks/LoginTask.h"
|
||||
#include "tasks/GameUpdateTask.h"
|
||||
|
||||
#include "instance.h"
|
||||
#include "instanceloader.h"
|
||||
#include "minecraftprocess.h"
|
||||
#include "BaseInstance.h"
|
||||
#include "InstanceFactory.h"
|
||||
#include "MinecraftProcess.h"
|
||||
|
||||
#include "instancemodel.h"
|
||||
#include "instancedelegate.h"
|
||||
|
||||
#include "minecraftversionlist.h"
|
||||
#include "lwjglversionlist.h"
|
||||
#include "lists/MinecraftVersionList.h"
|
||||
#include "lists/LwjglVersionList.h"
|
||||
|
||||
// Opens the given file in the default application.
|
||||
// TODO: Move this somewhere.
|
||||
@ -89,16 +89,16 @@ MainWindow::MainWindow ( QWidget *parent ) :
|
||||
view->setPalette(pal);
|
||||
*/
|
||||
|
||||
// view->setStyleSheet(
|
||||
// "QListView\
|
||||
// {\
|
||||
// background-image: url(:/backgrounds/kitteh);\
|
||||
// background-attachment: fixed;\
|
||||
// background-clip: padding;\
|
||||
// background-position: top right;\
|
||||
// background-repeat: none;\
|
||||
// background-color:palette(base);\
|
||||
// }");
|
||||
view->setStyleSheet(
|
||||
"QListView\
|
||||
{\
|
||||
background-image: url(:/backgrounds/kitteh);\
|
||||
background-attachment: fixed;\
|
||||
background-clip: padding;\
|
||||
background-position: top right;\
|
||||
background-repeat: none;\
|
||||
background-color:palette(base);\
|
||||
}");
|
||||
|
||||
view->setSelectionMode ( QAbstractItemView::SingleSelection );
|
||||
//view->setSpacing( KDialog::spacingHint() );
|
||||
@ -168,7 +168,7 @@ void MainWindow::instanceActivated ( QModelIndex index )
|
||||
{
|
||||
if(!index.isValid())
|
||||
return;
|
||||
Instance * inst = (Instance *) index.data(InstanceModel::InstancePointerRole).value<void *>();
|
||||
BaseInstance * inst = (BaseInstance *) index.data(InstanceModel::InstancePointerRole).value<void *>();
|
||||
doLogin();
|
||||
}
|
||||
|
||||
@ -186,29 +186,29 @@ void MainWindow::on_actionAddInstance_triggered()
|
||||
if (!newInstDlg->exec())
|
||||
return;
|
||||
|
||||
Instance *newInstance = NULL;
|
||||
BaseInstance *newInstance = NULL;
|
||||
|
||||
QString instDirName = DirNameFromString(newInstDlg->instName());
|
||||
QString instDir = PathCombine(globalSettings->get("InstanceDir").toString(), instDirName);
|
||||
|
||||
auto &loader = InstanceLoader::get();
|
||||
auto &loader = InstanceFactory::get();
|
||||
auto error = loader.createInstance(newInstance, instDir);
|
||||
QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName);
|
||||
|
||||
switch (error)
|
||||
{
|
||||
case InstanceLoader::NoCreateError:
|
||||
case InstanceFactory::NoCreateError:
|
||||
newInstance->setName(newInstDlg->instName());
|
||||
newInstance->setIntendedVersion(newInstDlg->selectedVersion()->descriptor());
|
||||
instList.add(InstancePtr(newInstance));
|
||||
return;
|
||||
|
||||
case InstanceLoader::InstExists:
|
||||
case InstanceFactory::InstExists:
|
||||
errorMsg += "An instance with the given directory name already exists.";
|
||||
QMessageBox::warning(this, "Error", errorMsg);
|
||||
break;
|
||||
|
||||
case InstanceLoader::CantCreateDir:
|
||||
case InstanceFactory::CantCreateDir:
|
||||
errorMsg += "Failed to create the instance directory.";
|
||||
QMessageBox::warning(this, "Error", errorMsg);
|
||||
break;
|
||||
@ -222,7 +222,7 @@ void MainWindow::on_actionAddInstance_triggered()
|
||||
|
||||
void MainWindow::on_actionChangeInstGroup_triggered()
|
||||
{
|
||||
Instance* inst = selectedInstance();
|
||||
BaseInstance* inst = selectedInstance();
|
||||
if(inst)
|
||||
{
|
||||
bool ok = false;
|
||||
@ -291,7 +291,7 @@ void MainWindow::on_mainToolBar_visibilityChanged ( bool )
|
||||
|
||||
void MainWindow::on_actionDeleteInstance_triggered()
|
||||
{
|
||||
Instance* inst = selectedInstance();
|
||||
BaseInstance* inst = selectedInstance();
|
||||
if (inst)
|
||||
{
|
||||
int response = QMessageBox::question(this, "CAREFUL",
|
||||
@ -306,7 +306,7 @@ void MainWindow::on_actionDeleteInstance_triggered()
|
||||
|
||||
void MainWindow::on_actionRenameInstance_triggered()
|
||||
{
|
||||
Instance* inst = selectedInstance();
|
||||
BaseInstance* inst = selectedInstance();
|
||||
if(inst)
|
||||
{
|
||||
bool ok = false;
|
||||
@ -324,7 +324,7 @@ void MainWindow::on_actionRenameInstance_triggered()
|
||||
|
||||
void MainWindow::on_actionViewSelectedInstFolder_triggered()
|
||||
{
|
||||
Instance* inst = selectedInstance();
|
||||
BaseInstance* inst = selectedInstance();
|
||||
if(inst)
|
||||
{
|
||||
QString str = inst->rootDir();
|
||||
@ -335,7 +335,7 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered()
|
||||
void MainWindow::on_actionEditInstMods_triggered()
|
||||
{
|
||||
//TODO: Needs to do current ModEditDialog too
|
||||
Instance* inst = selectedInstance();
|
||||
BaseInstance* inst = selectedInstance();
|
||||
if (inst)
|
||||
{
|
||||
LegacyModEditDialog dialog ( this, inst );
|
||||
@ -362,7 +362,7 @@ void MainWindow::on_instanceView_customContextMenuRequested ( const QPoint &pos
|
||||
instContextMenu->exec ( view->mapToGlobal ( pos ) );
|
||||
}
|
||||
|
||||
Instance* MainWindow::selectedInstance()
|
||||
BaseInstance* MainWindow::selectedInstance()
|
||||
{
|
||||
QAbstractItemView * iv = view;
|
||||
auto smodel = iv->selectionModel();
|
||||
@ -375,7 +375,7 @@ Instance* MainWindow::selectedInstance()
|
||||
|
||||
if(mindex.isValid())
|
||||
{
|
||||
return (Instance *) mindex.data(InstanceModel::InstancePointerRole).value<void *>();
|
||||
return (BaseInstance *) mindex.data(InstanceModel::InstancePointerRole).value<void *>();
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
@ -384,7 +384,7 @@ Instance* MainWindow::selectedInstance()
|
||||
|
||||
void MainWindow::on_actionLaunchInstance_triggered()
|
||||
{
|
||||
Instance* inst = selectedInstance();
|
||||
BaseInstance* inst = selectedInstance();
|
||||
if(inst)
|
||||
{
|
||||
doLogin();
|
||||
@ -450,12 +450,12 @@ void MainWindow::launchInstance(LoginResponse response)
|
||||
|
||||
void MainWindow::launchInstance(QString instID, LoginResponse response)
|
||||
{
|
||||
Instance *instance = instList.getInstanceById(instID).data();
|
||||
BaseInstance *instance = instList.getInstanceById(instID).data();
|
||||
Q_ASSERT_X(instance != NULL, "launchInstance", "instance ID does not correspond to a valid instance");
|
||||
launchInstance(instance, response);
|
||||
}
|
||||
|
||||
void MainWindow::launchInstance(Instance *instance, LoginResponse response)
|
||||
void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
|
||||
{
|
||||
Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL");
|
||||
|
||||
@ -531,7 +531,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
|
||||
if (view->selectionModel()->selectedIndexes().count() < 1)
|
||||
return;
|
||||
|
||||
Instance *inst = selectedInstance();
|
||||
BaseInstance *inst = selectedInstance();
|
||||
|
||||
VersionSelectDialog *vselect = new VersionSelectDialog(inst->versionList(), this);
|
||||
if (vselect->exec() && vselect->selectedVersion())
|
||||
@ -542,7 +542,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
|
||||
|
||||
void MainWindow::on_actionChangeInstLWJGLVersion_triggered()
|
||||
{
|
||||
Instance *inst = selectedInstance();
|
||||
BaseInstance *inst = selectedInstance();
|
||||
|
||||
if (!inst)
|
||||
return;
|
||||
@ -559,7 +559,7 @@ void MainWindow::on_actionInstanceSettings_triggered()
|
||||
if (view->selectionModel()->selectedIndexes().count() < 1)
|
||||
return;
|
||||
|
||||
Instance *inst = selectedInstance();
|
||||
BaseInstance *inst = selectedInstance();
|
||||
SettingsObject *s;
|
||||
s = &inst->settings();
|
||||
InstanceSettings settings(s, this);
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "instancelist.h"
|
||||
#include "loginresponse.h"
|
||||
#include "instance.h"
|
||||
#include "lists/InstanceList.h"
|
||||
#include "tasks/LoginResponse.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
class InstanceModel;
|
||||
class InstanceProxyModel;
|
||||
@ -41,7 +41,7 @@ class MainWindow : public QMainWindow
|
||||
/*!
|
||||
* The currently selected instance.
|
||||
*/
|
||||
Q_PROPERTY(Instance* selectedInstance READ selectedInstance STORED false)
|
||||
Q_PROPERTY(BaseInstance* selectedInstance READ selectedInstance STORED false)
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
@ -53,7 +53,7 @@ public:
|
||||
void openWebPage(QUrl url);
|
||||
|
||||
|
||||
Instance *selectedInstance();
|
||||
BaseInstance *selectedInstance();
|
||||
|
||||
private slots:
|
||||
void on_actionAbout_triggered();
|
||||
@ -119,7 +119,7 @@ public slots:
|
||||
|
||||
void launchInstance(LoginResponse response);
|
||||
void launchInstance(QString instID, LoginResponse response);
|
||||
void launchInstance(Instance *inst, LoginResponse response);
|
||||
void launchInstance(BaseInstance *inst, LoginResponse response);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
@ -134,7 +134,7 @@ private:
|
||||
// A pointer to the instance we are actively doing stuff with.
|
||||
// This is set when the user launches an instance and is used to refer to that
|
||||
// instance throughout the launching process.
|
||||
Instance *m_activeInst;
|
||||
BaseInstance *m_activeInst;
|
||||
|
||||
Task *m_versionLoadTask;
|
||||
};
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
#include "modeditdialog.h"
|
||||
#include "ui_modeditdialog.h"
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
ModEditDialog::ModEditDialog(QWidget *parent, Instance* m_inst) :
|
||||
ModEditDialog::ModEditDialog(QWidget *parent, BaseInstance* m_inst) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ModEditDialog)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
class ModEditDialog;
|
||||
@ -29,7 +29,7 @@ class ModEditDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ModEditDialog(QWidget *parent = 0, Instance* m_inst = 0);
|
||||
explicit ModEditDialog(QWidget *parent = 0, BaseInstance* m_inst = 0);
|
||||
~ModEditDialog();
|
||||
|
||||
private slots:
|
||||
|
@ -15,11 +15,11 @@
|
||||
|
||||
#include "modeditwindow.h"
|
||||
#include "ui_modeditwindow.h"
|
||||
#include "instance.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
ModEditWindow::ModEditWindow(QWidget *parent, Instance* m_inst) :
|
||||
ModEditWindow::ModEditWindow(QWidget *parent, BaseInstance* m_inst) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ModEditWindow)
|
||||
{
|
||||
|
@ -16,12 +16,12 @@
|
||||
#include "newinstancedialog.h"
|
||||
#include "ui_newinstancedialog.h"
|
||||
|
||||
#include "instanceloader.h"
|
||||
#include "InstanceFactory.h"
|
||||
|
||||
#include "instversionlist.h"
|
||||
#include "instversion.h"
|
||||
#include <lists/MinecraftVersionList.h>
|
||||
#include "InstanceVersion.h"
|
||||
|
||||
#include "task.h"
|
||||
#include "tasks/Task.h"
|
||||
|
||||
#include "versionselectdialog.h"
|
||||
#include "taskdialog.h"
|
||||
@ -29,7 +29,7 @@
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <minecraftversionlist.h>
|
||||
|
||||
|
||||
NewInstanceDialog::NewInstanceDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_settingsdialog.h"
|
||||
|
||||
#include "appsettings.h"
|
||||
#include "AppSettings.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "task.h"
|
||||
#include "tasks/Task.h"
|
||||
|
||||
TaskDialog::TaskDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -22,9 +22,9 @@
|
||||
|
||||
#include <gui/taskdialog.h>
|
||||
|
||||
#include <instversionlist.h>
|
||||
#include <instversion.h>
|
||||
#include <task.h>
|
||||
#include <lists/InstVersionList.h>
|
||||
#include <InstanceVersion.h>
|
||||
#include <tasks/Task.h>
|
||||
|
||||
VersionSelectDialog::VersionSelectDialog(InstVersionList *vlist, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -1,333 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2006 Marcin Kalicinski
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see www.boost.org
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_READ_HPP_INCLUDED
|
||||
#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_READ_HPP_INCLUDED
|
||||
|
||||
//#define BOOST_SPIRIT_DEBUG
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/detail/ptree_utils.hpp>
|
||||
#include <boost/property_tree/detail/json_parser_error.hpp>
|
||||
#include <boost/spirit/include/classic.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <string>
|
||||
#include <locale>
|
||||
#include <istream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost { namespace property_tree { namespace json_parser
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Json parser context
|
||||
|
||||
template<class Ptree>
|
||||
struct context
|
||||
{
|
||||
|
||||
typedef typename Ptree::key_type::value_type Ch;
|
||||
typedef std::basic_string<Ch> Str;
|
||||
typedef typename std::vector<Ch>::iterator It;
|
||||
|
||||
Str string;
|
||||
Str name;
|
||||
Ptree root;
|
||||
std::vector<Ptree *> stack;
|
||||
|
||||
struct a_object_s
|
||||
{
|
||||
context &c;
|
||||
a_object_s(context &c): c(c) { }
|
||||
void operator()(Ch) const
|
||||
{
|
||||
if (c.stack.empty())
|
||||
c.stack.push_back(&c.root);
|
||||
else
|
||||
{
|
||||
Ptree *parent = c.stack.back();
|
||||
Ptree *child = &parent->push_back(std::make_pair(c.name, Ptree()))->second;
|
||||
c.stack.push_back(child);
|
||||
c.name.clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct a_object_e
|
||||
{
|
||||
context &c;
|
||||
a_object_e(context &c): c(c) { }
|
||||
void operator()(Ch) const
|
||||
{
|
||||
BOOST_ASSERT(c.stack.size() >= 1);
|
||||
c.stack.pop_back();
|
||||
}
|
||||
};
|
||||
|
||||
struct a_name
|
||||
{
|
||||
context &c;
|
||||
a_name(context &c): c(c) { }
|
||||
void operator()(It, It) const
|
||||
{
|
||||
c.name.swap(c.string);
|
||||
c.string.clear();
|
||||
}
|
||||
};
|
||||
|
||||
struct a_string_val
|
||||
{
|
||||
context &c;
|
||||
a_string_val(context &c): c(c) { }
|
||||
void operator()(It, It) const
|
||||
{
|
||||
BOOST_ASSERT(c.stack.size() >= 1);
|
||||
c.stack.back()->push_back(std::make_pair(c.name, Ptree(c.string)));
|
||||
c.name.clear();
|
||||
c.string.clear();
|
||||
}
|
||||
};
|
||||
|
||||
struct a_literal_val
|
||||
{
|
||||
context &c;
|
||||
a_literal_val(context &c): c(c) { }
|
||||
void operator()(It b, It e) const
|
||||
{
|
||||
BOOST_ASSERT(c.stack.size() >= 1);
|
||||
c.stack.back()->push_back(std::make_pair(c.name,
|
||||
Ptree(Str(b, e))));
|
||||
c.name.clear();
|
||||
c.string.clear();
|
||||
}
|
||||
};
|
||||
|
||||
struct a_char
|
||||
{
|
||||
context &c;
|
||||
a_char(context &c): c(c) { }
|
||||
void operator()(It b, It e) const
|
||||
{
|
||||
c.string += *b;
|
||||
}
|
||||
};
|
||||
|
||||
struct a_escape
|
||||
{
|
||||
context &c;
|
||||
a_escape(context &c): c(c) { }
|
||||
void operator()(Ch ch) const
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case Ch('\"'): c.string += Ch('\"'); break;
|
||||
case Ch('\\'): c.string += Ch('\\'); break;
|
||||
case Ch('/'): c.string += Ch('/'); break;
|
||||
case Ch('b'): c.string += Ch('\b'); break;
|
||||
case Ch('f'): c.string += Ch('\f'); break;
|
||||
case Ch('n'): c.string += Ch('\n'); break;
|
||||
case Ch('r'): c.string += Ch('\r'); break;
|
||||
case Ch('t'): c.string += Ch('\t'); break;
|
||||
default: BOOST_ASSERT(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct a_unicode
|
||||
{
|
||||
context &c;
|
||||
a_unicode(context &c): c(c) { }
|
||||
void operator()(unsigned long u) const
|
||||
{
|
||||
//u = (std::min)(u, static_cast<unsigned long>((std::numeric_limits<Ch>::max)()));
|
||||
c.string += Ch(u);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Json grammar
|
||||
|
||||
template<class Ptree>
|
||||
struct json_grammar :
|
||||
public boost::spirit::classic::grammar<json_grammar<Ptree> >
|
||||
{
|
||||
|
||||
typedef context<Ptree> Context;
|
||||
typedef typename Ptree::key_type::value_type Ch;
|
||||
|
||||
mutable Context c;
|
||||
|
||||
template<class Scanner>
|
||||
struct definition
|
||||
{
|
||||
|
||||
boost::spirit::classic::rule<Scanner>
|
||||
root, object, member, array, item, value, string, number;
|
||||
boost::spirit::classic::rule<
|
||||
typename boost::spirit::classic::lexeme_scanner<Scanner>::type>
|
||||
character, escape;
|
||||
|
||||
definition(const json_grammar &self)
|
||||
{
|
||||
|
||||
using namespace boost::spirit::classic;
|
||||
// There's a boost::assertion too, so another explicit using
|
||||
// here:
|
||||
using boost::spirit::classic::assertion;
|
||||
|
||||
// Assertions
|
||||
assertion<std::string> expect_root("expected object or array");
|
||||
assertion<std::string> expect_eoi("expected end of input");
|
||||
assertion<std::string> expect_objclose("expected ',' or '}'");
|
||||
assertion<std::string> expect_arrclose("expected ',' or ']'");
|
||||
assertion<std::string> expect_name("expected object name");
|
||||
assertion<std::string> expect_colon("expected ':'");
|
||||
assertion<std::string> expect_value("expected value");
|
||||
assertion<std::string> expect_escape("invalid escape sequence");
|
||||
|
||||
// JSON grammar rules
|
||||
root
|
||||
= expect_root(object | array)
|
||||
>> expect_eoi(end_p)
|
||||
;
|
||||
|
||||
object
|
||||
= ch_p('{')[typename Context::a_object_s(self.c)]
|
||||
>> (ch_p('}')[typename Context::a_object_e(self.c)]
|
||||
| (list_p(member, ch_p(','))
|
||||
>> expect_objclose(ch_p('}')[typename Context::a_object_e(self.c)])
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
member
|
||||
= expect_name(string[typename Context::a_name(self.c)])
|
||||
>> expect_colon(ch_p(':'))
|
||||
>> expect_value(value)
|
||||
;
|
||||
|
||||
array
|
||||
= ch_p('[')[typename Context::a_object_s(self.c)]
|
||||
>> (ch_p(']')[typename Context::a_object_e(self.c)]
|
||||
| (list_p(item, ch_p(','))
|
||||
>> expect_arrclose(ch_p(']')[typename Context::a_object_e(self.c)])
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
item
|
||||
= expect_value(value)
|
||||
;
|
||||
|
||||
value
|
||||
= string[typename Context::a_string_val(self.c)]
|
||||
| (number | str_p("true") | "false" | "null")[typename Context::a_literal_val(self.c)]
|
||||
| object
|
||||
| array
|
||||
;
|
||||
|
||||
number
|
||||
= !ch_p("-") >>
|
||||
(ch_p("0") | (range_p(Ch('1'), Ch('9')) >> *digit_p)) >>
|
||||
!(ch_p(".") >> +digit_p) >>
|
||||
!(chset_p(detail::widen<Ch>("eE").c_str()) >>
|
||||
!chset_p(detail::widen<Ch>("-+").c_str()) >>
|
||||
+digit_p)
|
||||
;
|
||||
|
||||
string
|
||||
= +(lexeme_d[confix_p('\"', *character, '\"')])
|
||||
;
|
||||
|
||||
character
|
||||
= (anychar_p - "\\" - "\"")
|
||||
[typename Context::a_char(self.c)]
|
||||
| ch_p("\\") >> expect_escape(escape)
|
||||
;
|
||||
|
||||
escape
|
||||
= chset_p(detail::widen<Ch>("\"\\/bfnrt").c_str())
|
||||
[typename Context::a_escape(self.c)]
|
||||
| 'u' >> uint_parser<unsigned long, 16, 4, 4>()
|
||||
[typename Context::a_unicode(self.c)]
|
||||
;
|
||||
|
||||
// Debug
|
||||
BOOST_SPIRIT_DEBUG_RULE(root);
|
||||
BOOST_SPIRIT_DEBUG_RULE(object);
|
||||
BOOST_SPIRIT_DEBUG_RULE(member);
|
||||
BOOST_SPIRIT_DEBUG_RULE(array);
|
||||
BOOST_SPIRIT_DEBUG_RULE(item);
|
||||
BOOST_SPIRIT_DEBUG_RULE(value);
|
||||
BOOST_SPIRIT_DEBUG_RULE(string);
|
||||
BOOST_SPIRIT_DEBUG_RULE(number);
|
||||
BOOST_SPIRIT_DEBUG_RULE(escape);
|
||||
BOOST_SPIRIT_DEBUG_RULE(character);
|
||||
|
||||
}
|
||||
|
||||
const boost::spirit::classic::rule<Scanner> &start() const
|
||||
{
|
||||
return root;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
template<class It, class Ch>
|
||||
unsigned long count_lines(It begin, It end)
|
||||
{
|
||||
return static_cast<unsigned long>(std::count(begin, end, Ch('\n')) + 1);
|
||||
}
|
||||
|
||||
template<class Ptree>
|
||||
void read_json_internal(std::basic_istream<typename Ptree::key_type::value_type> &stream,
|
||||
Ptree &pt,
|
||||
const std::string &filename)
|
||||
{
|
||||
|
||||
using namespace boost::spirit::classic;
|
||||
typedef typename Ptree::key_type::value_type Ch;
|
||||
typedef typename std::vector<Ch>::iterator It;
|
||||
|
||||
// Load data into vector
|
||||
std::vector<Ch> v(std::istreambuf_iterator<Ch>(stream.rdbuf()),
|
||||
std::istreambuf_iterator<Ch>());
|
||||
if (!stream.good())
|
||||
BOOST_PROPERTY_TREE_THROW(json_parser_error("read error", filename, 0));
|
||||
|
||||
// Prepare grammar
|
||||
json_grammar<Ptree> g;
|
||||
|
||||
// Parse
|
||||
try
|
||||
{
|
||||
parse_info<It> pi = parse(v.begin(), v.end(), g,
|
||||
space_p | comment_p("//") | comment_p("/*", "*/"));
|
||||
if (!pi.hit || !pi.full)
|
||||
BOOST_PROPERTY_TREE_THROW((parser_error<std::string, It>(v.begin(), "syntax error")));
|
||||
}
|
||||
catch (parser_error<std::string, It> &e)
|
||||
{
|
||||
BOOST_PROPERTY_TREE_THROW(json_parser_error(e.descriptor, filename, count_lines<It, Ch>(v.begin(), e.where)));
|
||||
}
|
||||
|
||||
// Swap grammar context root and pt
|
||||
pt.swap(g.c.root);
|
||||
|
||||
}
|
||||
|
||||
} } }
|
||||
|
||||
#endif
|
||||
|
@ -1,102 +0,0 @@
|
||||
project(libMultiMC)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# Find Qt
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Xml REQUIRED)
|
||||
|
||||
# Include Qt headers.
|
||||
include_directories(${Qt5Base_INCLUDE_DIRS})
|
||||
include_directories(${Qt5Network_INCLUDE_DIRS})
|
||||
|
||||
# Include utility library.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/libutil/include)
|
||||
|
||||
# Include settings library.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/libsettings/include)
|
||||
|
||||
SET(LIBINST_HEADERS
|
||||
include/libmmc_config.h
|
||||
|
||||
|
||||
# Instance Stuff
|
||||
include/instance.h
|
||||
include/instancelist.h
|
||||
include/instanceloader.h
|
||||
|
||||
include/instversion.h
|
||||
include/instversionlist.h
|
||||
|
||||
include/minecraftversion.h
|
||||
include/minecraftversionlist.h
|
||||
|
||||
include/library.h
|
||||
include/fullversion.h
|
||||
include/fullversionfactory.h
|
||||
|
||||
# Tasks
|
||||
include/task.h
|
||||
include/logintask.h
|
||||
include/gameupdatetask.h
|
||||
|
||||
|
||||
# Login Data
|
||||
include/userinfo.h
|
||||
include/loginresponse.h
|
||||
|
||||
|
||||
# Misc Data
|
||||
include/version.h
|
||||
include/appsettings.h
|
||||
include/minecraftprocess.h
|
||||
include/lwjglversionlist.h
|
||||
)
|
||||
|
||||
SET(LIBINST_SOURCES
|
||||
# Instance Stuff
|
||||
src/instance.cpp
|
||||
src/instancelist.cpp
|
||||
src/instanceloader.cpp
|
||||
|
||||
src/instversion.cpp
|
||||
src/instversionlist.cpp
|
||||
|
||||
src/minecraftversion.cpp
|
||||
src/minecraftversionlist.cpp
|
||||
|
||||
src/library.cpp
|
||||
src/fullversion.cpp
|
||||
src/fullversionfactory.cpp
|
||||
|
||||
# Tasks
|
||||
src/task.cpp
|
||||
src/logintask.cpp
|
||||
src/gameupdatetask.cpp
|
||||
|
||||
|
||||
# Login Data
|
||||
src/userinfo.cpp
|
||||
src/loginresponse.cpp
|
||||
|
||||
|
||||
# Misc Data
|
||||
src/version.cpp
|
||||
src/appsettings.cpp
|
||||
src/minecraftprocess.cpp
|
||||
src/lwjglversionlist.cpp
|
||||
)
|
||||
|
||||
# Set the include dir path.
|
||||
SET(LIBMULTIMC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE)
|
||||
|
||||
# Include self.
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
include_directories(${CMAKE_BINARY_DIR}/include)
|
||||
|
||||
add_definitions(-DLIBMULTIMC_LIBRARY)
|
||||
|
||||
add_library(libMultiMC SHARED ${LIBINST_SOURCES} ${LIBINST_HEADERS})
|
||||
qt5_use_modules(libMultiMC Core Network Xml)
|
||||
target_link_libraries(libMultiMC libUtil libSettings)
|
@ -1,76 +0,0 @@
|
||||
#pragma once
|
||||
#include <QString>
|
||||
|
||||
class Library;
|
||||
|
||||
class FullVersion
|
||||
{
|
||||
public:
|
||||
/// the ID - determines which jar to use! ACTUALLY IMPORTANT!
|
||||
QString id;
|
||||
/// Last updated time - as a string
|
||||
QString time;
|
||||
/// Release time - as a string
|
||||
QString releaseTime;
|
||||
/// Release type - "release" or "snapshot"
|
||||
QString type;
|
||||
/**
|
||||
* DEPRECATED: Old versions of the new vanilla launcher used this
|
||||
* ex: "username_session_version"
|
||||
*/
|
||||
QString processArguments;
|
||||
/**
|
||||
* arguments that should be used for launching minecraft
|
||||
*
|
||||
* ex: "--username ${auth_player_name} --session ${auth_session}
|
||||
* --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}"
|
||||
*/
|
||||
QString minecraftArguments;
|
||||
/**
|
||||
* the minimum launcher version required by this version ... current is 4 (at point of writing)
|
||||
*/
|
||||
int minimumLauncherVersion;
|
||||
/**
|
||||
* The main class to load first
|
||||
*/
|
||||
QString mainClass;
|
||||
|
||||
/// the list of libs - both active and inactive, native and java
|
||||
QList<QSharedPointer<Library> > libraries;
|
||||
|
||||
/**
|
||||
* is this actually a legacy version? if so, none of the other stuff here will be ever used.
|
||||
* added by FullVersionFactory
|
||||
*/
|
||||
bool isLegacy;
|
||||
|
||||
/*
|
||||
FIXME: add support for those rules here? Looks like a pile of quick hacks to me though.
|
||||
|
||||
"rules": [
|
||||
{
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"action": "disallow",
|
||||
"os": {
|
||||
"name": "osx",
|
||||
"version": "^10\\.5\\.\\d$"
|
||||
}
|
||||
}
|
||||
],
|
||||
"incompatibilityReason": "There is a bug in LWJGL which makes it incompatible with OSX 10.5.8. Please go to New Profile and use 1.5.2 for now. Sorry!"
|
||||
}
|
||||
*/
|
||||
// QList<Rule> rules;
|
||||
|
||||
public:
|
||||
FullVersion()
|
||||
{
|
||||
minimumLauncherVersion = 0xDEADBEEF;
|
||||
isLegacy = false;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<Library> > getActiveNormalLibs();
|
||||
QList<QSharedPointer<Library> > getActiveNativeLibs();
|
||||
};
|
@ -1,29 +0,0 @@
|
||||
#include <QtCore>
|
||||
#include "fullversion.h"
|
||||
#include <library.h>
|
||||
|
||||
QList<QSharedPointer<Library> > FullVersion::getActiveNormalLibs()
|
||||
{
|
||||
QList<QSharedPointer<Library> > output;
|
||||
for ( auto lib: libraries )
|
||||
{
|
||||
if (lib->getIsActive() && !lib->getIsNative())
|
||||
{
|
||||
output.append(lib);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<Library> > FullVersion::getActiveNativeLibs()
|
||||
{
|
||||
QList<QSharedPointer<Library> > output;
|
||||
for ( auto lib: libraries )
|
||||
{
|
||||
if (lib->getIsActive() && lib->getIsNative())
|
||||
{
|
||||
output.append(lib);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
@ -51,5 +51,5 @@ SET(LIBUTIL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE)
|
||||
add_definitions(-DLIBUTIL_LIBRARY)
|
||||
|
||||
add_library(libUtil SHARED ${LIBUTIL_SOURCES} ${LIBUTIL_HEADERS})
|
||||
qt5_use_modules(libUtil Core)
|
||||
qt5_use_modules(libUtil Core Network)
|
||||
target_link_libraries(libUtil)
|
||||
|
@ -29,12 +29,19 @@
|
||||
|
||||
/**
|
||||
* @file libutil/include/cmdutils.h
|
||||
* @brief commandline parsing utilities
|
||||
* @brief commandline parsing and processing utilities
|
||||
*/
|
||||
|
||||
namespace Util {
|
||||
namespace Commandline {
|
||||
|
||||
/**
|
||||
* @brief split a string into argv items like a shell would do
|
||||
* @param args the argument string
|
||||
* @return a QStringList containing all arguments
|
||||
*/
|
||||
LIBUTIL_EXPORT QStringList splitArgs(QString args);
|
||||
|
||||
/**
|
||||
* @brief The FlagStyle enum
|
||||
* Specifies how flags are decorated
|
||||
|
@ -24,6 +24,56 @@
|
||||
namespace Util {
|
||||
namespace Commandline {
|
||||
|
||||
// commandline splitter
|
||||
QStringList splitArgs(QString args)
|
||||
{
|
||||
QStringList argv;
|
||||
QString current;
|
||||
bool escape = false;
|
||||
QChar inquotes;
|
||||
for (int i=0; i<args.length(); i++)
|
||||
{
|
||||
QChar cchar = args.at(i);
|
||||
|
||||
// \ escaped
|
||||
if (escape)
|
||||
{
|
||||
current += cchar;
|
||||
escape = false;
|
||||
// in "quotes"
|
||||
}
|
||||
else if (!inquotes.isNull())
|
||||
{
|
||||
if (cchar == 0x5C)
|
||||
escape = true;
|
||||
else if (cchar == inquotes)
|
||||
inquotes = 0;
|
||||
else
|
||||
current += cchar;
|
||||
// otherwise
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cchar == 0x20)
|
||||
{
|
||||
if (!current.isEmpty())
|
||||
{
|
||||
argv << current;
|
||||
current.clear();
|
||||
}
|
||||
}
|
||||
else if (cchar == 0x22 || cchar == 0x27)
|
||||
inquotes = cchar;
|
||||
else
|
||||
current += cchar;
|
||||
}
|
||||
}
|
||||
if (!current.isEmpty())
|
||||
argv << current;
|
||||
return argv;
|
||||
}
|
||||
|
||||
|
||||
Parser::Parser(FlagStyle::Enum flagStyle, ArgumentStyle::Enum argStyle)
|
||||
{
|
||||
m_flagStyle = flagStyle;
|
||||
|
10
main.cpp
10
main.cpp
@ -26,11 +26,11 @@
|
||||
#include "gui/taskdialog.h"
|
||||
#include "gui/consolewindow.h"
|
||||
|
||||
#include "appsettings.h"
|
||||
#include "instancelist.h"
|
||||
#include "loginresponse.h"
|
||||
#include "logintask.h"
|
||||
#include "minecraftprocess.h"
|
||||
#include "AppSettings.h"
|
||||
#include "lists/InstanceList.h"
|
||||
#include "tasks/LoginResponse.h"
|
||||
#include "tasks/LoginTask.h"
|
||||
#include "MinecraftProcess.h"
|
||||
|
||||
#include "pathutils.h"
|
||||
#include "cmdutils.h"
|
||||
|
Loading…
Reference in New Issue
Block a user