Basic 1.6 mod management (no jar mods)
This commit is contained in:
parent
aa8766581e
commit
5ff6fbf464
@ -152,7 +152,6 @@ AppVersion.h
|
|||||||
AppSettings.h
|
AppSettings.h
|
||||||
|
|
||||||
gui/mainwindow.h
|
gui/mainwindow.h
|
||||||
gui/modeditdialog.h
|
|
||||||
gui/settingsdialog.h
|
gui/settingsdialog.h
|
||||||
gui/newinstancedialog.h
|
gui/newinstancedialog.h
|
||||||
gui/logindialog.h
|
gui/logindialog.h
|
||||||
@ -165,6 +164,8 @@ gui/lwjglselectdialog.h
|
|||||||
gui/instancesettings.h
|
gui/instancesettings.h
|
||||||
gui/IconPickerDialog.h
|
gui/IconPickerDialog.h
|
||||||
gui/LegacyModEditDialog.h
|
gui/LegacyModEditDialog.h
|
||||||
|
gui/OneSixModEditDialog.h
|
||||||
|
gui/ModEditDialogCommon.h
|
||||||
gui/ModListView.h
|
gui/ModListView.h
|
||||||
gui/LabeledToolButton.h
|
gui/LabeledToolButton.h
|
||||||
gui/EditNotesDialog.h
|
gui/EditNotesDialog.h
|
||||||
@ -222,7 +223,6 @@ AppVersion.cpp
|
|||||||
AppSettings.cpp
|
AppSettings.cpp
|
||||||
|
|
||||||
gui/mainwindow.cpp
|
gui/mainwindow.cpp
|
||||||
gui/modeditdialog.cpp
|
|
||||||
gui/settingsdialog.cpp
|
gui/settingsdialog.cpp
|
||||||
gui/newinstancedialog.cpp
|
gui/newinstancedialog.cpp
|
||||||
gui/logindialog.cpp
|
gui/logindialog.cpp
|
||||||
@ -235,6 +235,8 @@ gui/lwjglselectdialog.cpp
|
|||||||
gui/instancesettings.cpp
|
gui/instancesettings.cpp
|
||||||
gui/IconPickerDialog.cpp
|
gui/IconPickerDialog.cpp
|
||||||
gui/LegacyModEditDialog.cpp
|
gui/LegacyModEditDialog.cpp
|
||||||
|
gui/OneSixModEditDialog.cpp
|
||||||
|
gui/ModEditDialogCommon.cpp
|
||||||
gui/ModListView.cpp
|
gui/ModListView.cpp
|
||||||
gui/LabeledToolButton.cpp
|
gui/LabeledToolButton.cpp
|
||||||
gui/EditNotesDialog.cpp
|
gui/EditNotesDialog.cpp
|
||||||
@ -282,7 +284,6 @@ logic/tasks/LoginTask.cpp
|
|||||||
######## UIs ########
|
######## UIs ########
|
||||||
SET(MULTIMC_UIS
|
SET(MULTIMC_UIS
|
||||||
gui/mainwindow.ui
|
gui/mainwindow.ui
|
||||||
gui/modeditdialog.ui
|
|
||||||
gui/settingsdialog.ui
|
gui/settingsdialog.ui
|
||||||
gui/newinstancedialog.ui
|
gui/newinstancedialog.ui
|
||||||
gui/logindialog.ui
|
gui/logindialog.ui
|
||||||
@ -294,6 +295,7 @@ gui/lwjglselectdialog.ui
|
|||||||
gui/instancesettings.ui
|
gui/instancesettings.ui
|
||||||
gui/IconPickerDialog.ui
|
gui/IconPickerDialog.ui
|
||||||
gui/LegacyModEditDialog.ui
|
gui/LegacyModEditDialog.ui
|
||||||
|
gui/OneSixModEditDialog.ui
|
||||||
gui/EditNotesDialog.ui
|
gui/EditNotesDialog.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LegacyModEditDialog.h"
|
#include "LegacyModEditDialog.h"
|
||||||
|
#include "ModEditDialogCommon.h"
|
||||||
#include "ui_LegacyModEditDialog.h"
|
#include "ui_LegacyModEditDialog.h"
|
||||||
#include <logic/ModList.h>
|
#include <logic/ModList.h>
|
||||||
#include <pathutils.h>
|
#include <pathutils.h>
|
||||||
@ -57,12 +58,13 @@ LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent
|
|||||||
{
|
{
|
||||||
ensureFolderPathExists(m_inst->loaderModsDir());
|
ensureFolderPathExists(m_inst->loaderModsDir());
|
||||||
m_mods = m_inst->loaderModList();
|
m_mods = m_inst->loaderModList();
|
||||||
ui->mlModTreeView->setModel(m_mods.data());
|
ui->loaderModTreeView->setModel(m_mods.data());
|
||||||
ui->mlModTreeView->installEventFilter( this );
|
ui->loaderModTreeView->installEventFilter( this );
|
||||||
m_mods->startWatching();
|
m_mods->startWatching();
|
||||||
}
|
}
|
||||||
// texture packs
|
// texture packs
|
||||||
{
|
{
|
||||||
|
ensureFolderPathExists(m_inst->texturePacksDir());
|
||||||
m_texturepacks = m_inst->texturePackList();
|
m_texturepacks = m_inst->texturePackList();
|
||||||
ui->texPackTreeView->setModel(m_texturepacks.data());
|
ui->texPackTreeView->setModel(m_texturepacks.data());
|
||||||
ui->texPackTreeView->installEventFilter( this );
|
ui->texPackTreeView->installEventFilter( this );
|
||||||
@ -142,7 +144,7 @@ bool LegacyModEditDialog::loaderListFilter ( QKeyEvent* keyEvent )
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return QDialog::eventFilter( ui->mlModTreeView, keyEvent );
|
return QDialog::eventFilter( ui->loaderModTreeView, keyEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LegacyModEditDialog::texturePackListFilter ( QKeyEvent* keyEvent )
|
bool LegacyModEditDialog::texturePackListFilter ( QKeyEvent* keyEvent )
|
||||||
@ -173,10 +175,10 @@ bool LegacyModEditDialog::eventFilter ( QObject* obj, QEvent* ev )
|
|||||||
return jarListFilter(keyEvent);
|
return jarListFilter(keyEvent);
|
||||||
if(obj == ui->coreModsTreeView)
|
if(obj == ui->coreModsTreeView)
|
||||||
return coreListFilter(keyEvent);
|
return coreListFilter(keyEvent);
|
||||||
if(obj == ui->mlModTreeView)
|
if(obj == ui->loaderModTreeView)
|
||||||
return loaderListFilter(keyEvent);
|
return loaderListFilter(keyEvent);
|
||||||
if(obj == ui->texPackTreeView)
|
if(obj == ui->texPackTreeView)
|
||||||
return loaderListFilter(keyEvent);
|
return texturePackListFilter(keyEvent);
|
||||||
return QDialog::eventFilter( obj, ev );
|
return QDialog::eventFilter( obj, ev );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,22 +228,6 @@ void LegacyModEditDialog::on_addTexPackBtn_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lastfirst (QModelIndexList & list, int & first, int & last)
|
|
||||||
{
|
|
||||||
if(!list.size())
|
|
||||||
return false;
|
|
||||||
first = last = list[0].row();
|
|
||||||
for(auto item: list)
|
|
||||||
{
|
|
||||||
int row = item.row();
|
|
||||||
if(row < first)
|
|
||||||
first = row;
|
|
||||||
if(row > last)
|
|
||||||
last = row;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LegacyModEditDialog::on_moveJarDownBtn_clicked()
|
void LegacyModEditDialog::on_moveJarDownBtn_clicked()
|
||||||
{
|
{
|
||||||
int first, last;
|
int first, last;
|
||||||
@ -286,7 +272,7 @@ void LegacyModEditDialog::on_rmJarBtn_clicked()
|
|||||||
void LegacyModEditDialog::on_rmModBtn_clicked()
|
void LegacyModEditDialog::on_rmModBtn_clicked()
|
||||||
{
|
{
|
||||||
int first, last;
|
int first, last;
|
||||||
auto list = ui->mlModTreeView->selectionModel()->selectedRows();
|
auto list = ui->loaderModTreeView->selectionModel()->selectedRows();
|
||||||
|
|
||||||
if(!lastfirst(list, first, last))
|
if(!lastfirst(list, first, last))
|
||||||
return;
|
return;
|
||||||
@ -315,7 +301,7 @@ void LegacyModEditDialog::on_viewModBtn_clicked()
|
|||||||
}
|
}
|
||||||
void LegacyModEditDialog::on_viewTexPackBtn_clicked()
|
void LegacyModEditDialog::on_viewTexPackBtn_clicked()
|
||||||
{
|
{
|
||||||
openDirInDefaultProgram(m_inst->texturePackDir(), true);
|
openDirInDefaultProgram(m_inst->texturePacksDir(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,11 +145,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="modTab">
|
<widget class="QWidget" name="modTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Mods</string>
|
<string>Loader Mods</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="ModListView" name="mlModTreeView">
|
<widget class="ModListView" name="loaderModTreeView">
|
||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
17
gui/ModEditDialogCommon.cpp
Normal file
17
gui/ModEditDialogCommon.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "ModEditDialogCommon.h"
|
||||||
|
|
||||||
|
bool lastfirst (QModelIndexList & list, int & first, int & last)
|
||||||
|
{
|
||||||
|
if(!list.size())
|
||||||
|
return false;
|
||||||
|
first = last = list[0].row();
|
||||||
|
for(auto item: list)
|
||||||
|
{
|
||||||
|
int row = item.row();
|
||||||
|
if(row < first)
|
||||||
|
first = row;
|
||||||
|
if(row > last)
|
||||||
|
last = row;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
4
gui/ModEditDialogCommon.h
Normal file
4
gui/ModEditDialogCommon.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
|
bool lastfirst (QModelIndexList & list, int & first, int & last);
|
165
gui/OneSixModEditDialog.cpp
Normal file
165
gui/OneSixModEditDialog.cpp
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
/* 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 "OneSixModEditDialog.h"
|
||||||
|
#include "ModEditDialogCommon.h"
|
||||||
|
#include "ui_OneSixModEditDialog.h"
|
||||||
|
#include <logic/ModList.h>
|
||||||
|
#include <pathutils.h>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent):
|
||||||
|
m_inst(inst),
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::OneSixModEditDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
//TODO: libraries!
|
||||||
|
{
|
||||||
|
// yeah... here be the real dragons.
|
||||||
|
}
|
||||||
|
// Loader mods
|
||||||
|
{
|
||||||
|
ensureFolderPathExists(m_inst->loaderModsDir());
|
||||||
|
m_mods = m_inst->loaderModList();
|
||||||
|
ui->loaderModTreeView->setModel(m_mods.data());
|
||||||
|
ui->loaderModTreeView->installEventFilter( this );
|
||||||
|
m_mods->startWatching();
|
||||||
|
}
|
||||||
|
// resource packs
|
||||||
|
{
|
||||||
|
ensureFolderPathExists(m_inst->resourcePacksDir());
|
||||||
|
m_resourcepacks = m_inst->resourcePackList();
|
||||||
|
ui->resPackTreeView->setModel(m_resourcepacks.data());
|
||||||
|
ui->resPackTreeView->installEventFilter( this );
|
||||||
|
m_resourcepacks->startWatching();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OneSixModEditDialog::~OneSixModEditDialog()
|
||||||
|
{
|
||||||
|
m_mods->stopWatching();
|
||||||
|
m_resourcepacks->stopWatching();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OneSixModEditDialog::loaderListFilter ( QKeyEvent* keyEvent )
|
||||||
|
{
|
||||||
|
switch(keyEvent->key())
|
||||||
|
{
|
||||||
|
case Qt::Key_Delete:
|
||||||
|
on_rmModBtn_clicked();
|
||||||
|
return true;
|
||||||
|
case Qt::Key_Plus:
|
||||||
|
on_addModBtn_clicked();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QDialog::eventFilter( ui->loaderModTreeView, keyEvent );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OneSixModEditDialog::resourcePackListFilter ( QKeyEvent* keyEvent )
|
||||||
|
{
|
||||||
|
switch(keyEvent->key())
|
||||||
|
{
|
||||||
|
case Qt::Key_Delete:
|
||||||
|
on_rmResPackBtn_clicked();
|
||||||
|
return true;
|
||||||
|
case Qt::Key_Plus:
|
||||||
|
on_addResPackBtn_clicked();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QDialog::eventFilter( ui->resPackTreeView, keyEvent );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool OneSixModEditDialog::eventFilter ( QObject* obj, QEvent* ev )
|
||||||
|
{
|
||||||
|
if (ev->type() != QEvent::KeyPress)
|
||||||
|
{
|
||||||
|
return QDialog::eventFilter( obj, ev );
|
||||||
|
}
|
||||||
|
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(ev);
|
||||||
|
if(obj == ui->loaderModTreeView)
|
||||||
|
return loaderListFilter(keyEvent);
|
||||||
|
if(obj == ui->resPackTreeView)
|
||||||
|
return resourcePackListFilter(keyEvent);
|
||||||
|
return QDialog::eventFilter( obj, ev );
|
||||||
|
}
|
||||||
|
|
||||||
|
void OneSixModEditDialog::on_buttonBox_rejected()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OneSixModEditDialog::on_addModBtn_clicked()
|
||||||
|
{
|
||||||
|
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Loader Mods");
|
||||||
|
for(auto filename:fileNames)
|
||||||
|
{
|
||||||
|
m_mods->stopWatching();
|
||||||
|
m_mods->installMod(QFileInfo(filename));
|
||||||
|
m_mods->startWatching();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void OneSixModEditDialog::on_rmModBtn_clicked()
|
||||||
|
{
|
||||||
|
int first, last;
|
||||||
|
auto list = ui->loaderModTreeView->selectionModel()->selectedRows();
|
||||||
|
|
||||||
|
if(!lastfirst(list, first, last))
|
||||||
|
return;
|
||||||
|
m_mods->stopWatching();
|
||||||
|
m_mods->deleteMods(first, last);
|
||||||
|
m_mods->startWatching();
|
||||||
|
}
|
||||||
|
void OneSixModEditDialog::on_viewModBtn_clicked()
|
||||||
|
{
|
||||||
|
openDirInDefaultProgram(m_inst->loaderModsDir(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OneSixModEditDialog::on_addResPackBtn_clicked()
|
||||||
|
{
|
||||||
|
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Resource Packs");
|
||||||
|
for(auto filename:fileNames)
|
||||||
|
{
|
||||||
|
m_resourcepacks->stopWatching();
|
||||||
|
m_resourcepacks->installMod(QFileInfo(filename));
|
||||||
|
m_resourcepacks->startWatching();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void OneSixModEditDialog::on_rmResPackBtn_clicked()
|
||||||
|
{
|
||||||
|
int first, last;
|
||||||
|
auto list = ui->resPackTreeView->selectionModel()->selectedRows();
|
||||||
|
|
||||||
|
if(!lastfirst(list, first, last))
|
||||||
|
return;
|
||||||
|
m_resourcepacks->stopWatching();
|
||||||
|
m_resourcepacks->deleteMods(first, last);
|
||||||
|
m_resourcepacks->startWatching();
|
||||||
|
}
|
||||||
|
void OneSixModEditDialog::on_viewResPackBtn_clicked()
|
||||||
|
{
|
||||||
|
openDirInDefaultProgram(m_inst->resourcePacksDir(), true);
|
||||||
|
}
|
||||||
|
|
@ -13,27 +13,24 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MODEDITDIALOG_H
|
#pragma once
|
||||||
#define MODEDITDIALOG_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "logic/BaseInstance.h"
|
#include <logic/OneSixInstance.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ModEditDialog;
|
class OneSixModEditDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ModEditDialog : public QDialog
|
class OneSixModEditDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ModEditDialog(QWidget *parent = 0, BaseInstance* m_inst = 0);
|
explicit OneSixModEditDialog(OneSixInstance* inst, QWidget *parent = 0);
|
||||||
~ModEditDialog();
|
virtual ~OneSixModEditDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/* Mapped for implementation
|
|
||||||
void on_addModBtn_clicked();
|
void on_addModBtn_clicked();
|
||||||
void on_rmModBtn_clicked();
|
void on_rmModBtn_clicked();
|
||||||
void on_viewModBtn_clicked();
|
void on_viewModBtn_clicked();
|
||||||
@ -41,12 +38,15 @@ private slots:
|
|||||||
void on_addResPackBtn_clicked();
|
void on_addResPackBtn_clicked();
|
||||||
void on_rmResPackBtn_clicked();
|
void on_rmResPackBtn_clicked();
|
||||||
void on_viewResPackBtn_clicked();
|
void on_viewResPackBtn_clicked();
|
||||||
*/
|
|
||||||
// Questionable: SettingsDialog doesn't need this for some reason?
|
// Questionable: SettingsDialog doesn't need this for some reason?
|
||||||
void on_buttonBox_rejected();
|
void on_buttonBox_rejected();
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
|
bool loaderListFilter( QKeyEvent* ev );
|
||||||
|
bool resourcePackListFilter( QKeyEvent* ev );
|
||||||
private:
|
private:
|
||||||
Ui::ModEditDialog *ui;
|
Ui::OneSixModEditDialog *ui;
|
||||||
|
QSharedPointer<ModList> m_mods;
|
||||||
|
QSharedPointer<ModList> m_resourcepacks;
|
||||||
|
OneSixInstance * m_inst;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODEDITDIALOG_H
|
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ModEditDialog</class>
|
<class>OneSixModEditDialog</class>
|
||||||
<widget class="QDialog" name="ModEditDialog">
|
<widget class="QDialog" name="OneSixModEditDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -40,20 +40,30 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="treeView"/>
|
<widget class="ModListView" name="jarModsTreeView">
|
||||||
|
<property name="verticalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="modTab">
|
<widget class="QWidget" name="modTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Mods</string>
|
<string>Loader Mods</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListView" name="listView">
|
<widget class="ModListView" name="loaderModTreeView">
|
||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="dragDropMode">
|
||||||
|
<enum>QAbstractItemView::DropOnly</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -98,14 +108,17 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="resPackTab">
|
<widget class="QWidget" name="resPackTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Resource Pack</string>
|
<string>Resource Packs</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListView" name="listView_2">
|
<widget class="ModListView" name="resPackTreeView">
|
||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="dragDropMode">
|
||||||
|
<enum>QAbstractItemView::DropOnly</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -118,7 +131,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="rmRedPackBtn">
|
<widget class="QPushButton" name="rmResPackBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Remove</string>
|
<string>&Remove</string>
|
||||||
</property>
|
</property>
|
||||||
@ -162,6 +175,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ModListView</class>
|
||||||
|
<extends>QTreeView</extends>
|
||||||
|
<header>gui/ModListView.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
@ -1,35 +0,0 @@
|
|||||||
/* 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 "modeditdialog.h"
|
|
||||||
#include "ui_modeditdialog.h"
|
|
||||||
#include "logic/BaseInstance.h"
|
|
||||||
|
|
||||||
ModEditDialog::ModEditDialog(QWidget *parent, BaseInstance* m_inst) :
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::ModEditDialog)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ModEditDialog::~ModEditDialog()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModEditDialog::on_buttonBox_rejected()
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
/* 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 "modeditwindow.h"
|
|
||||||
#include "ui_modeditwindow.h"
|
|
||||||
#include "BaseInstance.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
ModEditWindow::ModEditWindow(QWidget *parent, BaseInstance* m_inst) :
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::ModEditWindow)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ModEditWindow::~ModEditWindow()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModEditWindow::on_buttonBox_rejected()
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
@ -1,241 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ModEditWindow</class>
|
|
||||||
<widget class="QDialog" name="ModEditWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>540</width>
|
|
||||||
<height>420</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Dialog</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="jarModsTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Jar Mods</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="jarModsListView"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="jarModsButtonBox">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addJarModButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="delJarModButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Remove</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="mcforgeButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>MCForge</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="jarModsButtonSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="jarModMoveUpButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Move &Up</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="jarModMoveDownButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Move &Down</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="coreModsTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Core Mods</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="coreModsListView"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="coreModsButtonBox">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addCoreModButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="delCoreModButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Remove</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="coreModsButtonSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="viewCoreModFolderButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&View Folder</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="mlModsTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Mods</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="mlModListView"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="mlModsButtonBox">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addMlModButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="delMlModButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Remove</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="mlModsButtonSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="viewMlModFolderButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&View Folder</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="texturePacksTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Texture Packs</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="texturePackListView"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="texturePacksButtonBox">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addTPackButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="delTPackButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Remove</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="texturePacksButtonSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="viewTPackFolderButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&View Folder</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Close</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -87,6 +87,11 @@ MinecraftProcess* LegacyInstance::prepareForLaunch(QString user, QString session
|
|||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LegacyInstance::cleanupAfterRun()
|
||||||
|
{
|
||||||
|
//FIXME: delete the launcher and icons and whatnot.
|
||||||
|
}
|
||||||
|
|
||||||
QSharedPointer< ModList > LegacyInstance::coreModList()
|
QSharedPointer< ModList > LegacyInstance::coreModList()
|
||||||
{
|
{
|
||||||
I_D(LegacyInstance);
|
I_D(LegacyInstance);
|
||||||
@ -136,7 +141,7 @@ QSharedPointer< ModList > LegacyInstance::texturePackList()
|
|||||||
I_D(LegacyInstance);
|
I_D(LegacyInstance);
|
||||||
if(!d->texture_pack_list)
|
if(!d->texture_pack_list)
|
||||||
{
|
{
|
||||||
d->texture_pack_list.reset(new ModList(texturePackDir()));
|
d->texture_pack_list.reset(new ModList(texturePacksDir()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
d->texture_pack_list->update();
|
d->texture_pack_list->update();
|
||||||
@ -150,12 +155,6 @@ QDialog * LegacyInstance::createModEditDialog ( QWidget* parent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LegacyInstance::cleanupAfterRun()
|
|
||||||
{
|
|
||||||
//FIXME: delete the launcher and icons and whatnot.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString LegacyInstance::jarModsDir() const
|
QString LegacyInstance::jarModsDir() const
|
||||||
{
|
{
|
||||||
return PathCombine(instanceRoot(), "instMods");
|
return PathCombine(instanceRoot(), "instMods");
|
||||||
@ -185,7 +184,7 @@ QString LegacyInstance::resourceDir() const
|
|||||||
{
|
{
|
||||||
return PathCombine(minecraftRoot(), "resources");
|
return PathCombine(minecraftRoot(), "resources");
|
||||||
}
|
}
|
||||||
QString LegacyInstance::texturePackDir() const
|
QString LegacyInstance::texturePacksDir() const
|
||||||
{
|
{
|
||||||
return PathCombine(minecraftRoot(), "texturepacks");
|
return PathCombine(minecraftRoot(), "texturepacks");
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
////// Directories //////
|
////// Directories //////
|
||||||
QString savesDir() const;
|
QString savesDir() const;
|
||||||
QString texturePackDir() const;
|
QString texturePacksDir() const;
|
||||||
QString jarModsDir() const;
|
QString jarModsDir() const;
|
||||||
QString binDir() const;
|
QString binDir() const;
|
||||||
QString loaderModsDir() const;
|
QString loaderModsDir() const;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <pathutils.h>
|
#include <pathutils.h>
|
||||||
#include <cmdutils.h>
|
#include <cmdutils.h>
|
||||||
#include <JlCompress.h>
|
#include <JlCompress.h>
|
||||||
|
#include <gui/OneSixModEditDialog.h>
|
||||||
|
|
||||||
OneSixInstance::OneSixInstance ( const QString& rootDir, SettingsObject* setting_obj, QObject* parent )
|
OneSixInstance::OneSixInstance ( const QString& rootDir, SettingsObject* setting_obj, QObject* parent )
|
||||||
: BaseInstance ( new OneSixInstancePrivate(), rootDir, setting_obj, parent )
|
: BaseInstance ( new OneSixInstancePrivate(), rootDir, setting_obj, parent )
|
||||||
@ -155,12 +156,35 @@ void OneSixInstance::cleanupAfterRun()
|
|||||||
dir.removeRecursively();
|
dir.removeRecursively();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog * OneSixInstance::createModEditDialog ( QWidget* parent )
|
QSharedPointer< ModList > OneSixInstance::loaderModList()
|
||||||
{
|
{
|
||||||
return nullptr;
|
I_D(OneSixInstance);
|
||||||
|
if(!d->loader_mod_list)
|
||||||
|
{
|
||||||
|
d->loader_mod_list.reset(new ModList(loaderModsDir()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
d->loader_mod_list->update();
|
||||||
|
return d->loader_mod_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSharedPointer< ModList > OneSixInstance::resourcePackList()
|
||||||
|
{
|
||||||
|
I_D(OneSixInstance);
|
||||||
|
if(!d->resource_pack_list)
|
||||||
|
{
|
||||||
|
d->resource_pack_list.reset(new ModList(resourcePacksDir()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
d->resource_pack_list->update();
|
||||||
|
return d->resource_pack_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QDialog * OneSixInstance::createModEditDialog ( QWidget* parent )
|
||||||
|
{
|
||||||
|
return new OneSixModEditDialog(this, parent);
|
||||||
|
}
|
||||||
|
|
||||||
bool OneSixInstance::setIntendedVersionId ( QString version )
|
bool OneSixInstance::setIntendedVersionId ( QString version )
|
||||||
{
|
{
|
||||||
@ -215,7 +239,7 @@ bool OneSixInstance::reloadFullVersion()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer< FullVersion > OneSixInstance::getFullVersion()
|
QSharedPointer< OneSixVersion > OneSixInstance::getFullVersion()
|
||||||
{
|
{
|
||||||
I_D(OneSixInstance);
|
I_D(OneSixInstance);
|
||||||
return d->version;
|
return d->version;
|
||||||
@ -235,8 +259,6 @@ bool OneSixInstance::menuActionEnabled ( QString action_name ) const
|
|||||||
{
|
{
|
||||||
if(action_name == "actionChangeInstLWJGLVersion")
|
if(action_name == "actionChangeInstLWJGLVersion")
|
||||||
return false;
|
return false;
|
||||||
if(action_name == "actionEditInstMods")
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,6 +267,16 @@ QString OneSixInstance::getStatusbarDescription()
|
|||||||
return "One Six : " + intendedVersionId();
|
return "One Six : " + intendedVersionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString OneSixInstance::loaderModsDir() const
|
||||||
|
{
|
||||||
|
return PathCombine(minecraftRoot(), "mods");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString OneSixInstance::resourcePacksDir() const
|
||||||
|
{
|
||||||
|
return PathCombine(minecraftRoot(), "resourcepacks");
|
||||||
|
}
|
||||||
|
|
||||||
QString OneSixInstance::instanceConfigFolder() const
|
QString OneSixInstance::instanceConfigFolder() const
|
||||||
{
|
{
|
||||||
return PathCombine(minecraftRoot(), "config");
|
return PathCombine(minecraftRoot(), "config");
|
||||||
|
@ -2,14 +2,26 @@
|
|||||||
|
|
||||||
#include "BaseInstance.h"
|
#include "BaseInstance.h"
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
class FullVersion;
|
class OneSixVersion;
|
||||||
class BaseUpdate;
|
class BaseUpdate;
|
||||||
|
class ModList;
|
||||||
|
|
||||||
class OneSixInstance : public BaseInstance
|
class OneSixInstance : public BaseInstance
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit OneSixInstance(const QString &rootDir, SettingsObject * settings, QObject *parent = 0);
|
explicit OneSixInstance(const QString &rootDir, SettingsObject * settings, QObject *parent = 0);
|
||||||
|
|
||||||
|
|
||||||
|
////// Mod Lists //////
|
||||||
|
QSharedPointer<ModList> loaderModList();
|
||||||
|
QSharedPointer<ModList> resourcePackList();
|
||||||
|
|
||||||
|
////// Directories //////
|
||||||
|
QString resourcePacksDir() const;
|
||||||
|
QString loaderModsDir() const;
|
||||||
|
virtual QString instanceConfigFolder() const;
|
||||||
|
|
||||||
virtual BaseUpdate* doUpdate();
|
virtual BaseUpdate* doUpdate();
|
||||||
virtual MinecraftProcess* prepareForLaunch ( QString user, QString session );
|
virtual MinecraftProcess* prepareForLaunch ( QString user, QString session );
|
||||||
virtual void cleanupAfterRun();
|
virtual void cleanupAfterRun();
|
||||||
@ -28,15 +40,13 @@ public:
|
|||||||
/// reload the full version json file. return true on success!
|
/// reload the full version json file. return true on success!
|
||||||
bool reloadFullVersion();
|
bool reloadFullVersion();
|
||||||
/// get the current full version info
|
/// get the current full version info
|
||||||
QSharedPointer<FullVersion> getFullVersion();
|
QSharedPointer<OneSixVersion> getFullVersion();
|
||||||
|
|
||||||
virtual QString defaultBaseJar() const;
|
virtual QString defaultBaseJar() const;
|
||||||
virtual QString defaultCustomBaseJar() const;
|
virtual QString defaultCustomBaseJar() const;
|
||||||
|
|
||||||
virtual bool menuActionEnabled ( QString action_name ) const;
|
virtual bool menuActionEnabled ( QString action_name ) const;
|
||||||
virtual QString getStatusbarDescription();
|
virtual QString getStatusbarDescription();
|
||||||
virtual QString instanceConfigFolder() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList processMinecraftArgs( QString user, QString session );
|
QStringList processMinecraftArgs( QString user, QString session );
|
||||||
};
|
};
|
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
#include "BaseInstance_p.h"
|
#include "BaseInstance_p.h"
|
||||||
#include "OneSixVersion.h"
|
#include "OneSixVersion.h"
|
||||||
|
#include "ModList.h"
|
||||||
|
|
||||||
struct OneSixInstancePrivate: public BaseInstancePrivate
|
struct OneSixInstancePrivate: public BaseInstancePrivate
|
||||||
{
|
{
|
||||||
QSharedPointer<FullVersion> version;
|
QSharedPointer<OneSixVersion> version;
|
||||||
|
QSharedPointer<ModList> loader_mod_list;
|
||||||
|
QSharedPointer<ModList> resource_pack_list;
|
||||||
};
|
};
|
@ -129,7 +129,7 @@ void OneSixUpdate::jarlibStart()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<FullVersion> version = inst->getFullVersion();
|
QSharedPointer<OneSixVersion> version = inst->getFullVersion();
|
||||||
|
|
||||||
// download the right jar, save it in versions/$version/$version.jar
|
// download the right jar, save it in versions/$version/$version.jar
|
||||||
QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/");
|
QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/");
|
||||||
|
@ -103,7 +103,7 @@ QString Library::storagePath()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<QSharedPointer<Library> > FullVersion::getActiveNormalLibs()
|
QList<QSharedPointer<Library> > OneSixVersion::getActiveNormalLibs()
|
||||||
{
|
{
|
||||||
QList<QSharedPointer<Library> > output;
|
QList<QSharedPointer<Library> > output;
|
||||||
for ( auto lib: libraries )
|
for ( auto lib: libraries )
|
||||||
@ -116,7 +116,7 @@ QList<QSharedPointer<Library> > FullVersion::getActiveNormalLibs()
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QSharedPointer<Library> > FullVersion::getActiveNativeLibs()
|
QList<QSharedPointer<Library> > OneSixVersion::getActiveNativeLibs()
|
||||||
{
|
{
|
||||||
QList<QSharedPointer<Library> > output;
|
QList<QSharedPointer<Library> > output;
|
||||||
for ( auto lib: libraries )
|
for ( auto lib: libraries )
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class FullVersion
|
class OneSixVersion
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// the ID - determines which jar to use! ACTUALLY IMPORTANT!
|
/// the ID - determines which jar to use! ACTUALLY IMPORTANT!
|
||||||
@ -203,7 +203,7 @@ public:
|
|||||||
// QList<Rule> rules;
|
// QList<Rule> rules;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FullVersion()
|
OneSixVersion()
|
||||||
{
|
{
|
||||||
minimumLauncherVersion = 0xDEADBEEF;
|
minimumLauncherVersion = 0xDEADBEEF;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ QList<QSharedPointer<Rule> > FullVersionFactory::parse4rules(QJsonObject & baseO
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QSharedPointer<FullVersion> FullVersionFactory::parse4(QJsonObject root, QSharedPointer<FullVersion> fullVersion)
|
QSharedPointer<OneSixVersion> FullVersionFactory::parse4(QJsonObject root, QSharedPointer<OneSixVersion> fullVersion)
|
||||||
{
|
{
|
||||||
fullVersion->id = root.value("id").toString();
|
fullVersion->id = root.value("id").toString();
|
||||||
|
|
||||||
@ -154,9 +154,9 @@ QSharedPointer<FullVersion> FullVersionFactory::parse4(QJsonObject root, QShared
|
|||||||
return fullVersion;
|
return fullVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<FullVersion> FullVersionFactory::parse(QByteArray data)
|
QSharedPointer<OneSixVersion> FullVersionFactory::parse(QByteArray data)
|
||||||
{
|
{
|
||||||
QSharedPointer<FullVersion> readVersion(new FullVersion());
|
QSharedPointer<OneSixVersion> readVersion(new OneSixVersion());
|
||||||
|
|
||||||
QJsonParseError jsonError;
|
QJsonParseError jsonError;
|
||||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError);
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError);
|
||||||
@ -165,14 +165,14 @@ QSharedPointer<FullVersion> FullVersionFactory::parse(QByteArray data)
|
|||||||
{
|
{
|
||||||
error_string = QString( "Error reading version file :") + " " + jsonError.errorString();
|
error_string = QString( "Error reading version file :") + " " + jsonError.errorString();
|
||||||
m_error = FullVersionFactory::ParseError;
|
m_error = FullVersionFactory::ParseError;
|
||||||
return QSharedPointer<FullVersion>();
|
return QSharedPointer<OneSixVersion>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!jsonDoc.isObject())
|
if(!jsonDoc.isObject())
|
||||||
{
|
{
|
||||||
error_string = "Error reading version file.";
|
error_string = "Error reading version file.";
|
||||||
m_error = FullVersionFactory::ParseError;
|
m_error = FullVersionFactory::ParseError;
|
||||||
return QSharedPointer<FullVersion>();
|
return QSharedPointer<OneSixVersion>();
|
||||||
}
|
}
|
||||||
QJsonObject root = jsonDoc.object();
|
QJsonObject root = jsonDoc.object();
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ QSharedPointer<FullVersion> FullVersionFactory::parse(QByteArray data)
|
|||||||
{
|
{
|
||||||
error_string = "Version file was for an unrecognized launcher version. RIP";
|
error_string = "Version file was for an unrecognized launcher version. RIP";
|
||||||
m_error = FullVersionFactory::UnsupportedVersion;
|
m_error = FullVersionFactory::UnsupportedVersion;
|
||||||
return QSharedPointer<FullVersion>();
|
return QSharedPointer<OneSixVersion>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
struct FullVersion;
|
struct OneSixVersion;
|
||||||
class Rule;
|
class Rule;
|
||||||
|
|
||||||
class FullVersionFactory
|
class FullVersionFactory
|
||||||
@ -17,8 +17,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FullVersionFactory();
|
FullVersionFactory();
|
||||||
QSharedPointer<FullVersion> parse(QByteArray data);
|
QSharedPointer<OneSixVersion> parse(QByteArray data);
|
||||||
private:
|
private:
|
||||||
QSharedPointer<FullVersion> parse4(QJsonObject root, QSharedPointer<FullVersion> product);
|
QSharedPointer<OneSixVersion> parse4(QJsonObject root, QSharedPointer<OneSixVersion> product);
|
||||||
QList<QSharedPointer<Rule> > parse4rules(QJsonObject & baseObj);
|
QList<QSharedPointer<Rule> > parse4rules(QJsonObject & baseObj);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user