Implement some bits and pieces, disable dead buttons.
This commit is contained in:
parent
d9195bff3a
commit
27b1de0d6d
@ -64,7 +64,8 @@
|
|||||||
|
|
||||||
// Opens the given file in the default application.
|
// Opens the given file in the default application.
|
||||||
// TODO: Move this somewhere.
|
// TODO: Move this somewhere.
|
||||||
void openInDefaultProgram ( QString filename );
|
void openFileInDefaultProgram ( QString filename );
|
||||||
|
void openDirInDefaultProgram ( QString dirpath, bool ensureExists = false );
|
||||||
|
|
||||||
MainWindow::MainWindow ( QWidget *parent ) :
|
MainWindow::MainWindow ( QWidget *parent ) :
|
||||||
QMainWindow ( parent ),
|
QMainWindow ( parent ),
|
||||||
@ -224,16 +225,22 @@ void MainWindow::on_actionChangeInstGroup_triggered()
|
|||||||
Instance* inst = selectedInstance();
|
Instance* inst = selectedInstance();
|
||||||
if(inst)
|
if(inst)
|
||||||
{
|
{
|
||||||
|
bool ok = false;
|
||||||
QString name ( inst->group() );
|
QString name ( inst->group() );
|
||||||
name = QInputDialog::getText ( this, tr ( "Group name" ), tr ( "Enter a new group name." ), QLineEdit::Normal, name );
|
QInputDialog dlg(this);
|
||||||
inst->setGroup(name);
|
dlg.result();
|
||||||
|
name = QInputDialog::getText ( this, tr ( "Group name" ), tr ( "Enter a new group name." ),
|
||||||
|
QLineEdit::Normal, name, &ok );
|
||||||
|
if(ok)
|
||||||
|
inst->setGroup(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_actionViewInstanceFolder_triggered()
|
void MainWindow::on_actionViewInstanceFolder_triggered()
|
||||||
{
|
{
|
||||||
openInDefaultProgram ( globalSettings->get ( "InstanceDir" ).toString() );
|
QString str = globalSettings->get ( "InstanceDir" ).toString();
|
||||||
|
openDirInDefaultProgram ( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionRefresh_triggered()
|
void MainWindow::on_actionRefresh_triggered()
|
||||||
@ -243,7 +250,7 @@ void MainWindow::on_actionRefresh_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionViewCentralModsFolder_triggered()
|
void MainWindow::on_actionViewCentralModsFolder_triggered()
|
||||||
{
|
{
|
||||||
openInDefaultProgram ( globalSettings->get ( "CentralModsDir" ).toString() );
|
openDirInDefaultProgram ( globalSettings->get ( "CentralModsDir" ).toString() , true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionCheckUpdate_triggered()
|
void MainWindow::on_actionCheckUpdate_triggered()
|
||||||
@ -282,6 +289,37 @@ void MainWindow::on_mainToolBar_visibilityChanged ( bool )
|
|||||||
ui->mainToolBar->setVisible ( true );
|
ui->mainToolBar->setVisible ( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionDeleteInstance_triggered()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionRenameInstance_triggered()
|
||||||
|
{
|
||||||
|
Instance* inst = selectedInstance();
|
||||||
|
if(inst)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
QString name ( inst->name() );
|
||||||
|
name = QInputDialog::getText ( this, tr ( "Instance name" ), tr ( "Enter a new instance name." ),
|
||||||
|
QLineEdit::Normal, name, &ok );
|
||||||
|
//FIXME: dialog should do the validation!!!
|
||||||
|
if(ok && name.length() && name.length() <= 25)
|
||||||
|
inst->setName(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionViewSelectedInstFolder_triggered()
|
||||||
|
{
|
||||||
|
Instance* inst = selectedInstance();
|
||||||
|
if(inst)
|
||||||
|
{
|
||||||
|
QString str = inst->rootDir();
|
||||||
|
openDirInDefaultProgram ( QDir(str).absolutePath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::closeEvent ( QCloseEvent *event )
|
void MainWindow::closeEvent ( QCloseEvent *event )
|
||||||
{
|
{
|
||||||
// Save the window state and geometry.
|
// Save the window state and geometry.
|
||||||
@ -449,7 +487,18 @@ void MainWindow::openWebPage ( QUrl url )
|
|||||||
browser->exec();
|
browser->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void openInDefaultProgram ( QString filename )
|
void openDirInDefaultProgram ( QString path, bool ensureExists )
|
||||||
|
{
|
||||||
|
QDir parentPath;
|
||||||
|
QDir dir( path );
|
||||||
|
if(!dir.exists())
|
||||||
|
{
|
||||||
|
parentPath.mkpath(dir.absolutePath());
|
||||||
|
}
|
||||||
|
QDesktopServices::openUrl ( "file:///" + dir.absolutePath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void openFileInDefaultProgram ( QString filename )
|
||||||
{
|
{
|
||||||
QDesktopServices::openUrl ( "file:///" + QFileInfo ( filename ).absolutePath() );
|
QDesktopServices::openUrl ( "file:///" + QFileInfo ( filename ).absolutePath() );
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,8 @@ private slots:
|
|||||||
void on_actionChangeInstGroup_triggered();
|
void on_actionChangeInstGroup_triggered();
|
||||||
|
|
||||||
void on_actionViewInstanceFolder_triggered();
|
void on_actionViewInstanceFolder_triggered();
|
||||||
|
|
||||||
|
void on_actionViewSelectedInstFolder_triggered();
|
||||||
|
|
||||||
void on_actionRefresh_triggered();
|
void on_actionRefresh_triggered();
|
||||||
|
|
||||||
@ -82,8 +84,11 @@ private slots:
|
|||||||
|
|
||||||
void on_actionLaunchInstance_triggered();
|
void on_actionLaunchInstance_triggered();
|
||||||
|
|
||||||
|
void on_actionDeleteInstance_triggered();
|
||||||
void on_actionMakeDesktopShortcut_triggered();
|
|
||||||
|
void on_actionRenameInstance_triggered();
|
||||||
|
|
||||||
|
void on_actionMakeDesktopShortcut_triggered();
|
||||||
|
|
||||||
void on_actionChangeInstMCVersion_triggered();
|
void on_actionChangeInstMCVersion_triggered();
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>692</width>
|
||||||
<height>400</height>
|
<height>596</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -271,6 +271,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionChangeInstIcon">
|
<action name="actionChangeInstIcon">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Change Icon</string>
|
<string>Change Icon</string>
|
||||||
</property>
|
</property>
|
||||||
@ -282,6 +285,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionEditInstNotes">
|
<action name="actionEditInstNotes">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Edit Notes</string>
|
<string>Edit Notes</string>
|
||||||
</property>
|
</property>
|
||||||
@ -293,6 +299,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionInstanceSettings">
|
<action name="actionInstanceSettings">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
@ -304,6 +313,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionMakeDesktopShortcut">
|
<action name="actionMakeDesktopShortcut">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Make Shortcut</string>
|
<string>Make Shortcut</string>
|
||||||
</property>
|
</property>
|
||||||
@ -315,6 +327,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionManageInstSaves">
|
<action name="actionManageInstSaves">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Manage Saves</string>
|
<string>Manage Saves</string>
|
||||||
</property>
|
</property>
|
||||||
@ -326,6 +341,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionEditInstMods">
|
<action name="actionEditInstMods">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Edit Mods</string>
|
<string>Edit Mods</string>
|
||||||
</property>
|
</property>
|
||||||
@ -359,6 +377,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionRebuildInstJar">
|
<action name="actionRebuildInstJar">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Rebuild Jar</string>
|
<string>Rebuild Jar</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -45,8 +45,6 @@ public slots:
|
|||||||
void changeStatus(const QString& status);
|
void changeStatus(const QString& status);
|
||||||
void changeProgress(int progress);
|
void changeProgress(int progress);
|
||||||
|
|
||||||
void test() { qDebug("Lol"); }
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,18 +49,6 @@ class LIBMULTIMC_EXPORT InstVersion : public QObject
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(QString typeName READ typeName)
|
Q_PROPERTY(QString typeName READ typeName)
|
||||||
|
|
||||||
/*!
|
|
||||||
* Whether or not this is a meta version.
|
|
||||||
* Meta versions are not real versions, merely versions that act as aliases
|
|
||||||
* for other versions.
|
|
||||||
* For example: There could be a meta version called "Latest" that always
|
|
||||||
* points to the latest version. The user would pick this version and when
|
|
||||||
* a new version came out, it would point to the new one and update the instance
|
|
||||||
* automatically.
|
|
||||||
*/
|
|
||||||
Q_PROPERTY(bool isMeta READ isMeta)
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Gets the version's timestamp.
|
* Gets the version's timestamp.
|
||||||
* This is primarily used for sorting versions in a list.
|
* This is primarily used for sorting versions in a list.
|
||||||
@ -93,7 +81,6 @@ public:
|
|||||||
virtual QString name() const;
|
virtual QString name() const;
|
||||||
virtual QString typeName() const = 0;
|
virtual QString typeName() const = 0;
|
||||||
virtual qint64 timestamp() const;
|
virtual qint64 timestamp() const;
|
||||||
virtual bool isMeta() const;
|
|
||||||
|
|
||||||
virtual InstVersionList *versionList() const;
|
virtual InstVersionList *versionList() const;
|
||||||
|
|
||||||
|
@ -29,6 +29,11 @@ class LIBMULTIMC_EXPORT MinecraftVersion : public InstVersion
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(VersionType versionType READ versionType WRITE setVersionType)
|
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.
|
* The URL that this version will be downloaded from.
|
||||||
*/
|
*/
|
||||||
@ -39,10 +44,6 @@ class LIBMULTIMC_EXPORT MinecraftVersion : public InstVersion
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(QString etag READ etag)
|
Q_PROPERTY(QString etag READ etag)
|
||||||
|
|
||||||
/*!
|
|
||||||
* True if this is a version from the new Minecraft launcher's version list.
|
|
||||||
*/
|
|
||||||
Q_PROPERTY(bool isForNewLauncher READ isForNewLauncher WRITE setIsForNewLauncher)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MinecraftVersion(QString descriptor,
|
explicit MinecraftVersion(QString descriptor,
|
||||||
@ -52,15 +53,6 @@ public:
|
|||||||
QString etag,
|
QString etag,
|
||||||
InstVersionList *parent = 0);
|
InstVersionList *parent = 0);
|
||||||
|
|
||||||
/*!
|
|
||||||
* Creates a meta version that links to the given version.
|
|
||||||
* This is *NOT* a copy constructor.
|
|
||||||
* \param linkedVersion the version that the meta version will link to.
|
|
||||||
*/
|
|
||||||
explicit MinecraftVersion(const MinecraftVersion *linkedVersion);
|
|
||||||
|
|
||||||
MinecraftVersion(const MinecraftVersion &other, QObject *parent);
|
|
||||||
|
|
||||||
static InstVersion *mcnVersion(QString rawName, QString niceName);
|
static InstVersion *mcnVersion(QString rawName, QString niceName);
|
||||||
|
|
||||||
enum VersionType
|
enum VersionType
|
||||||
@ -69,10 +61,14 @@ public:
|
|||||||
Stable,
|
Stable,
|
||||||
CurrentStable,
|
CurrentStable,
|
||||||
Snapshot,
|
Snapshot,
|
||||||
MCNostalgia,
|
MCNostalgia
|
||||||
MetaCustom,
|
};
|
||||||
MetaLatestSnapshot,
|
|
||||||
MetaLatestStable
|
enum LauncherVersion
|
||||||
|
{
|
||||||
|
Unknown = -1,
|
||||||
|
Legacy = 0, // the legacy launcher that's been around since ... forever
|
||||||
|
Launcher16 = 1, // current launcher as of 26/06/2013
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual QString descriptor() const;
|
virtual QString descriptor() const;
|
||||||
@ -80,24 +76,22 @@ public:
|
|||||||
virtual QString typeName() const;
|
virtual QString typeName() const;
|
||||||
virtual qint64 timestamp() const;
|
virtual qint64 timestamp() const;
|
||||||
|
|
||||||
virtual bool isForNewLauncher() const;
|
|
||||||
virtual void setIsForNewLauncher(bool val);
|
|
||||||
|
|
||||||
virtual VersionType versionType() const;
|
virtual VersionType versionType() const;
|
||||||
virtual void setVersionType(VersionType typeName);
|
virtual void setVersionType(VersionType typeName);
|
||||||
|
|
||||||
|
virtual LauncherVersion launcherVersion() const;
|
||||||
|
virtual void setLauncherVersion(LauncherVersion launcherVersion);
|
||||||
|
|
||||||
virtual QString downloadURL() const;
|
virtual QString downloadURL() const;
|
||||||
virtual QString etag() const;
|
virtual QString etag() const;
|
||||||
virtual bool isMeta() const;
|
|
||||||
|
|
||||||
virtual InstVersion *copyVersion(InstVersionList *newParent) const;
|
virtual InstVersion *copyVersion(InstVersionList *newParent) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InstVersion *m_linkedVersion;
|
|
||||||
|
|
||||||
QString m_dlUrl;
|
QString m_dlUrl;
|
||||||
QString m_etag;
|
QString m_etag;
|
||||||
VersionType m_type;
|
VersionType m_type;
|
||||||
|
LauncherVersion m_launcherVersion;
|
||||||
|
|
||||||
bool m_isNewLauncherVersion;
|
bool m_isNewLauncherVersion;
|
||||||
};
|
};
|
||||||
|
@ -73,7 +73,8 @@ void GameUpdateTask::executeTask()
|
|||||||
// we're downloading from.
|
// we're downloading from.
|
||||||
QString jarFilename = "minecraft";
|
QString jarFilename = "minecraft";
|
||||||
|
|
||||||
if (targetVersion->isForNewLauncher())
|
// FIXME: this is NOT enough
|
||||||
|
if (targetVersion->launcherVersion() == MinecraftVersion::Launcher16)
|
||||||
jarFilename = targetVersion->descriptor();
|
jarFilename = targetVersion->descriptor();
|
||||||
|
|
||||||
QUrl mcJarURL = targetVersion->downloadURL() + jarFilename + ".jar";
|
QUrl mcJarURL = targetVersion->downloadURL() + jarFilename + ".jar";
|
||||||
|
@ -51,12 +51,6 @@ bool InstVersion::isGreaterThan(const InstVersion &other) const
|
|||||||
return timestamp() > other.timestamp();
|
return timestamp() > other.timestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InstVersion::isMeta() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString InstVersion::descriptor() const
|
QString InstVersion::descriptor() const
|
||||||
{
|
{
|
||||||
return m_descriptor;
|
return m_descriptor;
|
||||||
|
@ -23,29 +23,9 @@ MinecraftVersion::MinecraftVersion(QString descriptor,
|
|||||||
InstVersionList *parent) :
|
InstVersionList *parent) :
|
||||||
InstVersion(descriptor, name, timestamp, parent), m_dlUrl(dlUrl), m_etag(etag)
|
InstVersion(descriptor, name, timestamp, parent), m_dlUrl(dlUrl), m_etag(etag)
|
||||||
{
|
{
|
||||||
m_linkedVersion = NULL;
|
|
||||||
m_isNewLauncherVersion = false;
|
m_isNewLauncherVersion = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MinecraftVersion::MinecraftVersion(const MinecraftVersion *linkedVersion) :
|
|
||||||
InstVersion(linkedVersion->descriptor(), linkedVersion->name(), linkedVersion->timestamp(),
|
|
||||||
linkedVersion->versionList())
|
|
||||||
{
|
|
||||||
m_linkedVersion = (MinecraftVersion *)linkedVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
MinecraftVersion::MinecraftVersion(const MinecraftVersion &other, QObject *parent) :
|
|
||||||
InstVersion(other, parent)
|
|
||||||
{
|
|
||||||
if (other.m_linkedVersion)
|
|
||||||
m_linkedVersion = other.m_linkedVersion;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_dlUrl = other.downloadURL();
|
|
||||||
m_etag = other.etag();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MinecraftVersion::descriptor() const
|
QString MinecraftVersion::descriptor() const
|
||||||
{
|
{
|
||||||
return m_descriptor;
|
return m_descriptor;
|
||||||
@ -58,9 +38,6 @@ QString MinecraftVersion::name() const
|
|||||||
|
|
||||||
QString MinecraftVersion::typeName() const
|
QString MinecraftVersion::typeName() const
|
||||||
{
|
{
|
||||||
if (m_linkedVersion)
|
|
||||||
return m_linkedVersion->typeName();
|
|
||||||
|
|
||||||
switch (versionType())
|
switch (versionType())
|
||||||
{
|
{
|
||||||
case OldSnapshot:
|
case OldSnapshot:
|
||||||
@ -78,17 +55,6 @@ QString MinecraftVersion::typeName() const
|
|||||||
case MCNostalgia:
|
case MCNostalgia:
|
||||||
return "MCNostalgia";
|
return "MCNostalgia";
|
||||||
|
|
||||||
case MetaCustom:
|
|
||||||
// Not really sure what this does, but it was in the code for v4,
|
|
||||||
// so it must be important... Right?
|
|
||||||
return "Custom Meta Version";
|
|
||||||
|
|
||||||
case MetaLatestSnapshot:
|
|
||||||
return "Latest Snapshot";
|
|
||||||
|
|
||||||
case MetaLatestStable:
|
|
||||||
return "Latest Stable";
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QString("Unknown Type %1").arg(versionType());
|
return QString("Unknown Type %1").arg(versionType());
|
||||||
}
|
}
|
||||||
@ -99,16 +65,6 @@ qint64 MinecraftVersion::timestamp() const
|
|||||||
return m_timestamp;
|
return m_timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MinecraftVersion::isForNewLauncher() const
|
|
||||||
{
|
|
||||||
return m_isNewLauncherVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinecraftVersion::setIsForNewLauncher(bool val)
|
|
||||||
{
|
|
||||||
m_isNewLauncherVersion = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
MinecraftVersion::VersionType MinecraftVersion::versionType() const
|
MinecraftVersion::VersionType MinecraftVersion::versionType() const
|
||||||
{
|
{
|
||||||
return m_type;
|
return m_type;
|
||||||
@ -129,26 +85,21 @@ QString MinecraftVersion::etag() const
|
|||||||
return m_etag;
|
return m_etag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MinecraftVersion::isMeta() const
|
MinecraftVersion::LauncherVersion MinecraftVersion::launcherVersion() const
|
||||||
{
|
{
|
||||||
return versionType() == MetaCustom ||
|
return m_launcherVersion;
|
||||||
versionType() == MetaLatestSnapshot ||
|
};
|
||||||
versionType() == MetaLatestStable;
|
|
||||||
|
void MinecraftVersion::setLauncherVersion(LauncherVersion launcherVersion)
|
||||||
|
{
|
||||||
|
m_launcherVersion = launcherVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
InstVersion *MinecraftVersion::copyVersion(InstVersionList *newParent) const
|
InstVersion *MinecraftVersion::copyVersion(InstVersionList *newParent) const
|
||||||
{
|
{
|
||||||
if (isMeta())
|
MinecraftVersion *version = new MinecraftVersion(
|
||||||
{
|
descriptor(), name(), timestamp(), downloadURL(), etag(), newParent);
|
||||||
MinecraftVersion *version = new MinecraftVersion((MinecraftVersion *)m_linkedVersion);
|
version->setVersionType(versionType());
|
||||||
return version;
|
version->setLauncherVersion(launcherVersion());
|
||||||
}
|
return version;
|
||||||
else
|
|
||||||
{
|
|
||||||
MinecraftVersion *version = new MinecraftVersion(
|
|
||||||
descriptor(), name(), timestamp(), downloadURL(), etag(), newParent);
|
|
||||||
version->setVersionType(versionType());
|
|
||||||
version->setIsForNewLauncher(isForNewLauncher());
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,7 @@ void MCVListLoadTask::setSubStatus(const QString msg)
|
|||||||
setStatus("Loading instance version list: " + msg);
|
setStatus("Loading instance version list: " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: we should have a local cache of the version list and a local cache of version data
|
||||||
bool MCVListLoadTask::loadFromVList()
|
bool MCVListLoadTask::loadFromVList()
|
||||||
{
|
{
|
||||||
QNetworkReply *vlistReply = netMgr->get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) +
|
QNetworkReply *vlistReply = netMgr->get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) +
|
||||||
@ -276,10 +277,15 @@ bool MCVListLoadTask::loadFromVList()
|
|||||||
else
|
else
|
||||||
versionType = MinecraftVersion::Stable;
|
versionType = MinecraftVersion::Stable;
|
||||||
}
|
}
|
||||||
else
|
else if(versionTypeStr == "snapshot")
|
||||||
{
|
{
|
||||||
versionType = MinecraftVersion::Snapshot;
|
versionType = MinecraftVersion::Snapshot;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we don't know what to do with this...
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the download URL.
|
// Get the download URL.
|
||||||
QString dlUrl = QString(MCVLIST_URLBASE) + versionID + "/";
|
QString dlUrl = QString(MCVLIST_URLBASE) + versionID + "/";
|
||||||
@ -289,7 +295,7 @@ bool MCVListLoadTask::loadFromVList()
|
|||||||
MinecraftVersion *mcVersion = new MinecraftVersion(
|
MinecraftVersion *mcVersion = new MinecraftVersion(
|
||||||
versionID, versionID, versionTime.toMSecsSinceEpoch(),
|
versionID, versionID, versionTime.toMSecsSinceEpoch(),
|
||||||
dlUrl, "");
|
dlUrl, "");
|
||||||
mcVersion->setIsForNewLauncher(true);
|
mcVersion->setLauncherVersion(MinecraftVersion::Launcher16);
|
||||||
mcVersion->setVersionType(versionType);
|
mcVersion->setVersionType(versionType);
|
||||||
tempList.append(mcVersion);
|
tempList.append(mcVersion);
|
||||||
}
|
}
|
||||||
@ -340,7 +346,7 @@ bool MCVListLoadTask::loadFromAssets()
|
|||||||
QDomNodeList contents = doc.elementsByTagName("Contents");
|
QDomNodeList contents = doc.elementsByTagName("Contents");
|
||||||
|
|
||||||
QRegExp mcRegex("/minecraft.jar$");
|
QRegExp mcRegex("/minecraft.jar$");
|
||||||
QRegExp snapshotRegex("[0-9][0-9]w[0-9][0-9][a-z]|pre|rc");
|
QRegExp snapshotRegex("[0-9][0-9]w[0-9][0-9][a-z]?|pre|rc");
|
||||||
|
|
||||||
for (int i = 0; i < contents.length(); i++)
|
for (int i = 0; i < contents.length(); i++)
|
||||||
{
|
{
|
||||||
@ -443,6 +449,8 @@ bool MCVListLoadTask::loadMCNostalgia()
|
|||||||
{
|
{
|
||||||
QNetworkReply *mcnReply = netMgr->get(QNetworkRequest(QUrl(QString(MCN_URLBASE) + "?pversion=1&list=True")));
|
QNetworkReply *mcnReply = netMgr->get(QNetworkRequest(QUrl(QString(MCN_URLBASE) + "?pversion=1&list=True")));
|
||||||
NetUtils::waitForNetRequest(mcnReply);
|
NetUtils::waitForNetRequest(mcnReply);
|
||||||
|
processedMCNReply = true;
|
||||||
|
updateStuff();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user