2013-07-28 01:12:32 +05:30
|
|
|
/* 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
|
2013-10-06 04:43:40 +05:30
|
|
|
*
|
2013-07-28 01:12:32 +05:30
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2013-09-18 03:30:35 +05:30
|
|
|
#include "MultiMC.h"
|
2013-08-17 17:10:51 +05:30
|
|
|
#include "LegacyModEditDialog.h"
|
2013-08-28 08:08:29 +05:30
|
|
|
#include "ModEditDialogCommon.h"
|
2013-11-04 07:23:05 +05:30
|
|
|
#include "VersionSelectDialog.h"
|
2013-09-18 03:30:35 +05:30
|
|
|
#include "ProgressDialog.h"
|
2013-08-17 17:10:51 +05:30
|
|
|
#include "ui_LegacyModEditDialog.h"
|
2013-09-18 03:30:35 +05:30
|
|
|
#include "logic/ModList.h"
|
|
|
|
#include "logic/lists/ForgeVersionList.h"
|
2013-11-04 07:23:05 +05:30
|
|
|
#include "gui/Platform.h"
|
2013-09-18 03:30:35 +05:30
|
|
|
|
2013-08-19 00:22:17 +05:30
|
|
|
#include <pathutils.h>
|
|
|
|
#include <QFileDialog>
|
2013-10-08 05:06:11 +05:30
|
|
|
//#include <QMessageBox>
|
2013-08-20 05:59:36 +05:30
|
|
|
#include <QDebug>
|
2013-08-21 04:37:54 +05:30
|
|
|
#include <QEvent>
|
|
|
|
#include <QKeyEvent>
|
2013-07-28 01:12:32 +05:30
|
|
|
|
2013-10-06 04:43:40 +05:30
|
|
|
LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
|
2013-12-01 21:04:51 +05:30
|
|
|
: QDialog(parent), ui(new Ui::LegacyModEditDialog), m_inst(inst)
|
2013-07-28 01:12:32 +05:30
|
|
|
{
|
2013-11-04 07:23:05 +05:30
|
|
|
MultiMCPlatform::fixWM_CLASS(this);
|
2013-07-28 01:12:32 +05:30
|
|
|
ui->setupUi(this);
|
2013-10-06 04:43:40 +05:30
|
|
|
|
2013-08-27 23:59:27 +05:30
|
|
|
// Jar mods
|
|
|
|
{
|
|
|
|
ensureFolderPathExists(m_inst->jarModsDir());
|
|
|
|
m_jarmods = m_inst->jarModList();
|
2013-10-06 04:43:40 +05:30
|
|
|
ui->jarModsTreeView->setModel(m_jarmods.get());
|
2013-08-29 01:22:19 +05:30
|
|
|
#ifndef Q_OS_LINUX
|
2013-08-27 23:59:27 +05:30
|
|
|
// FIXME: internal DnD causes segfaults later
|
|
|
|
ui->jarModsTreeView->setDragDropMode(QAbstractItemView::DragDrop);
|
|
|
|
// FIXME: DnD is glitched with contiguous (we move only first item in selection)
|
|
|
|
ui->jarModsTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
|
2013-08-29 01:22:19 +05:30
|
|
|
#endif
|
2013-10-06 04:43:40 +05:30
|
|
|
ui->jarModsTreeView->installEventFilter(this);
|
2013-08-27 23:59:27 +05:30
|
|
|
m_jarmods->startWatching();
|
2013-10-09 05:33:02 +05:30
|
|
|
auto smodel = ui->jarModsTreeView->selectionModel();
|
|
|
|
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
|
|
|
SLOT(jarCurrent(QModelIndex, QModelIndex)));
|
2013-08-27 23:59:27 +05:30
|
|
|
}
|
|
|
|
// Core mods
|
|
|
|
{
|
|
|
|
ensureFolderPathExists(m_inst->coreModsDir());
|
|
|
|
m_coremods = m_inst->coreModList();
|
2013-10-06 04:43:40 +05:30
|
|
|
ui->coreModsTreeView->setModel(m_coremods.get());
|
|
|
|
ui->coreModsTreeView->installEventFilter(this);
|
2013-08-27 23:59:27 +05:30
|
|
|
m_coremods->startWatching();
|
2013-10-09 05:33:02 +05:30
|
|
|
auto smodel = ui->coreModsTreeView->selectionModel();
|
|
|
|
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
|
|
|
SLOT(coreCurrent(QModelIndex, QModelIndex)));
|
2013-08-27 23:59:27 +05:30
|
|
|
}
|
|
|
|
// Loader mods
|
|
|
|
{
|
|
|
|
ensureFolderPathExists(m_inst->loaderModsDir());
|
|
|
|
m_mods = m_inst->loaderModList();
|
2013-10-06 04:43:40 +05:30
|
|
|
ui->loaderModTreeView->setModel(m_mods.get());
|
|
|
|
ui->loaderModTreeView->installEventFilter(this);
|
2013-08-27 23:59:27 +05:30
|
|
|
m_mods->startWatching();
|
2013-10-09 05:33:02 +05:30
|
|
|
auto smodel = ui->loaderModTreeView->selectionModel();
|
|
|
|
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
|
|
|
SLOT(loaderCurrent(QModelIndex, QModelIndex)));
|
2013-08-27 23:59:27 +05:30
|
|
|
}
|
|
|
|
// texture packs
|
|
|
|
{
|
2013-08-28 08:08:29 +05:30
|
|
|
ensureFolderPathExists(m_inst->texturePacksDir());
|
2013-08-27 23:59:27 +05:30
|
|
|
m_texturepacks = m_inst->texturePackList();
|
2013-10-06 04:43:40 +05:30
|
|
|
ui->texPackTreeView->setModel(m_texturepacks.get());
|
|
|
|
ui->texPackTreeView->installEventFilter(this);
|
2013-08-27 23:59:27 +05:30
|
|
|
m_texturepacks->startWatching();
|
|
|
|
}
|
2013-07-28 01:12:32 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
LegacyModEditDialog::~LegacyModEditDialog()
|
|
|
|
{
|
2013-08-25 05:02:42 +05:30
|
|
|
m_mods->stopWatching();
|
|
|
|
m_coremods->stopWatching();
|
|
|
|
m_jarmods->stopWatching();
|
|
|
|
m_texturepacks->stopWatching();
|
2013-07-28 01:12:32 +05:30
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2013-10-06 04:43:40 +05:30
|
|
|
bool LegacyModEditDialog::coreListFilter(QKeyEvent *keyEvent)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
switch (keyEvent->key())
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
case Qt::Key_Delete:
|
|
|
|
on_rmCoreBtn_clicked();
|
|
|
|
return true;
|
|
|
|
case Qt::Key_Plus:
|
|
|
|
on_addCoreBtn_clicked();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
2013-10-06 04:43:40 +05:30
|
|
|
return QDialog::eventFilter(ui->coreModsTreeView, keyEvent);
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
|
|
|
|
2013-10-06 04:43:40 +05:30
|
|
|
bool LegacyModEditDialog::jarListFilter(QKeyEvent *keyEvent)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
switch (keyEvent->key())
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
case Qt::Key_Up:
|
|
|
|
{
|
|
|
|
if (keyEvent->modifiers() & Qt::ControlModifier)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
on_moveJarUpBtn_clicked();
|
|
|
|
return true;
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
2013-10-06 04:43:40 +05:30
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Qt::Key_Down:
|
|
|
|
{
|
|
|
|
if (keyEvent->modifiers() & Qt::ControlModifier)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
on_moveJarDownBtn_clicked();
|
2013-08-21 04:37:54 +05:30
|
|
|
return true;
|
2013-10-06 04:43:40 +05:30
|
|
|
}
|
|
|
|
break;
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
2013-10-06 04:43:40 +05:30
|
|
|
case Qt::Key_Delete:
|
|
|
|
on_rmJarBtn_clicked();
|
|
|
|
return true;
|
|
|
|
case Qt::Key_Plus:
|
|
|
|
on_addJarBtn_clicked();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return QDialog::eventFilter(ui->jarModsTreeView, keyEvent);
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
|
|
|
|
2013-10-06 04:43:40 +05:30
|
|
|
bool LegacyModEditDialog::loaderListFilter(QKeyEvent *keyEvent)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
switch (keyEvent->key())
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
case Qt::Key_Delete:
|
|
|
|
on_rmModBtn_clicked();
|
|
|
|
return true;
|
|
|
|
case Qt::Key_Plus:
|
|
|
|
on_addModBtn_clicked();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
2013-10-06 04:43:40 +05:30
|
|
|
return QDialog::eventFilter(ui->loaderModTreeView, keyEvent);
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
|
|
|
|
2013-10-06 04:43:40 +05:30
|
|
|
bool LegacyModEditDialog::texturePackListFilter(QKeyEvent *keyEvent)
|
2013-08-25 05:02:42 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
switch (keyEvent->key())
|
2013-08-25 05:02:42 +05:30
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
case Qt::Key_Delete:
|
|
|
|
on_rmTexPackBtn_clicked();
|
|
|
|
return true;
|
|
|
|
case Qt::Key_Plus:
|
|
|
|
on_addTexPackBtn_clicked();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
2013-08-25 05:02:42 +05:30
|
|
|
}
|
2013-10-06 04:43:40 +05:30
|
|
|
return QDialog::eventFilter(ui->texPackTreeView, keyEvent);
|
2013-08-25 05:02:42 +05:30
|
|
|
}
|
|
|
|
|
2013-10-06 04:43:40 +05:30
|
|
|
bool LegacyModEditDialog::eventFilter(QObject *obj, QEvent *ev)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
|
|
|
if (ev->type() != QEvent::KeyPress)
|
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
return QDialog::eventFilter(obj, ev);
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
2013-10-06 04:43:40 +05:30
|
|
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
|
|
|
|
if (obj == ui->jarModsTreeView)
|
2013-08-21 04:37:54 +05:30
|
|
|
return jarListFilter(keyEvent);
|
2013-10-06 04:43:40 +05:30
|
|
|
if (obj == ui->coreModsTreeView)
|
2013-08-21 04:37:54 +05:30
|
|
|
return coreListFilter(keyEvent);
|
2013-10-06 04:43:40 +05:30
|
|
|
if (obj == ui->loaderModTreeView)
|
2013-08-21 04:37:54 +05:30
|
|
|
return loaderListFilter(keyEvent);
|
2013-10-06 04:43:40 +05:30
|
|
|
if (obj == ui->texPackTreeView)
|
2013-08-28 08:08:29 +05:30
|
|
|
return texturePackListFilter(keyEvent);
|
2013-10-06 04:43:40 +05:30
|
|
|
return QDialog::eventFilter(obj, ev);
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
|
|
|
|
2013-08-19 00:22:17 +05:30
|
|
|
void LegacyModEditDialog::on_addCoreBtn_clicked()
|
|
|
|
{
|
2013-09-08 21:43:09 +05:30
|
|
|
//: Title of core mod selection dialog
|
|
|
|
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Core Mods"));
|
2013-10-06 04:43:40 +05:30
|
|
|
for (auto filename : fileNames)
|
2013-08-19 00:22:17 +05:30
|
|
|
{
|
2013-08-25 05:02:42 +05:30
|
|
|
m_coremods->stopWatching();
|
2013-08-19 00:22:17 +05:30
|
|
|
m_coremods->installMod(QFileInfo(filename));
|
2013-08-25 05:02:42 +05:30
|
|
|
m_coremods->startWatching();
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_addForgeBtn_clicked()
|
|
|
|
{
|
2013-10-06 18:13:46 +05:30
|
|
|
VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this);
|
2014-05-04 16:50:42 +05:30
|
|
|
vselect.setExactFilter(1, m_inst->intendedVersionId());
|
2013-09-18 03:30:35 +05:30
|
|
|
if (vselect.exec() && vselect.selectedVersion())
|
|
|
|
{
|
2013-10-06 04:43:40 +05:30
|
|
|
ForgeVersionPtr forge =
|
2013-10-09 05:33:02 +05:30
|
|
|
std::dynamic_pointer_cast<ForgeVersion>(vselect.selectedVersion());
|
2013-10-06 04:43:40 +05:30
|
|
|
if (!forge)
|
2013-09-18 03:30:35 +05:30
|
|
|
return;
|
|
|
|
auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename);
|
2013-10-06 04:43:40 +05:30
|
|
|
if (entry->stale)
|
2013-09-18 03:30:35 +05:30
|
|
|
{
|
2013-10-26 23:25:48 +05:30
|
|
|
NetJob *fjob = new NetJob("Forge download");
|
|
|
|
fjob->addNetAction(CacheDownload::make(forge->universal_url, entry));
|
2013-09-18 03:30:35 +05:30
|
|
|
ProgressDialog dlg(this);
|
|
|
|
dlg.exec(fjob);
|
2013-10-06 04:43:40 +05:30
|
|
|
if (dlg.result() == QDialog::Accepted)
|
2013-09-18 03:30:35 +05:30
|
|
|
{
|
|
|
|
m_jarmods->stopWatching();
|
|
|
|
m_jarmods->installMod(QFileInfo(entry->getFullPath()));
|
|
|
|
m_jarmods->startWatching();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// failed to download forge :/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_jarmods->stopWatching();
|
|
|
|
m_jarmods->installMod(QFileInfo(entry->getFullPath()));
|
|
|
|
m_jarmods->startWatching();
|
|
|
|
}
|
|
|
|
}
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_addJarBtn_clicked()
|
|
|
|
{
|
2013-09-08 21:43:09 +05:30
|
|
|
//: Title of jar mod selection dialog
|
|
|
|
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Jar Mods"));
|
2013-10-06 04:43:40 +05:30
|
|
|
for (auto filename : fileNames)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-08-25 05:02:42 +05:30
|
|
|
m_jarmods->stopWatching();
|
2013-08-21 04:37:54 +05:30
|
|
|
m_jarmods->installMod(QFileInfo(filename));
|
2013-08-25 05:02:42 +05:30
|
|
|
m_jarmods->startWatching();
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_addModBtn_clicked()
|
|
|
|
{
|
2013-09-08 21:43:09 +05:30
|
|
|
//: Title of regular mod selection dialog
|
|
|
|
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Loader Mods"));
|
2013-10-06 04:43:40 +05:30
|
|
|
for (auto filename : fileNames)
|
2013-08-21 04:37:54 +05:30
|
|
|
{
|
2013-08-25 05:02:42 +05:30
|
|
|
m_mods->stopWatching();
|
2013-08-21 04:37:54 +05:30
|
|
|
m_mods->installMod(QFileInfo(filename));
|
2013-08-25 05:02:42 +05:30
|
|
|
m_mods->startWatching();
|
2013-08-21 04:37:54 +05:30
|
|
|
}
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_addTexPackBtn_clicked()
|
|
|
|
{
|
2013-09-08 21:43:09 +05:30
|
|
|
//: Title of texture pack selection dialog
|
|
|
|
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select Texture Packs"));
|
2013-10-06 04:43:40 +05:30
|
|
|
for (auto filename : fileNames)
|
2013-08-25 05:02:42 +05:30
|
|
|
{
|
|
|
|
m_texturepacks->stopWatching();
|
|
|
|
m_texturepacks->installMod(QFileInfo(filename));
|
|
|
|
m_texturepacks->startWatching();
|
|
|
|
}
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
2013-08-21 04:37:54 +05:30
|
|
|
|
2013-08-19 00:22:17 +05:30
|
|
|
void LegacyModEditDialog::on_moveJarDownBtn_clicked()
|
|
|
|
{
|
2013-08-21 04:37:54 +05:30
|
|
|
int first, last;
|
|
|
|
auto list = ui->jarModsTreeView->selectionModel()->selectedRows();
|
2013-10-06 04:43:40 +05:30
|
|
|
|
|
|
|
if (!lastfirst(list, first, last))
|
2013-08-21 04:37:54 +05:30
|
|
|
return;
|
2013-08-19 00:22:17 +05:30
|
|
|
|
2013-08-21 04:37:54 +05:30
|
|
|
m_jarmods->moveModsDown(first, last);
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_moveJarUpBtn_clicked()
|
|
|
|
{
|
2013-08-21 04:37:54 +05:30
|
|
|
int first, last;
|
|
|
|
auto list = ui->jarModsTreeView->selectionModel()->selectedRows();
|
2013-10-06 04:43:40 +05:30
|
|
|
|
|
|
|
if (!lastfirst(list, first, last))
|
2013-08-21 04:37:54 +05:30
|
|
|
return;
|
|
|
|
m_jarmods->moveModsUp(first, last);
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_rmCoreBtn_clicked()
|
|
|
|
{
|
2013-08-21 04:37:54 +05:30
|
|
|
int first, last;
|
|
|
|
auto list = ui->coreModsTreeView->selectionModel()->selectedRows();
|
2013-10-06 04:43:40 +05:30
|
|
|
|
|
|
|
if (!lastfirst(list, first, last))
|
2013-08-19 00:22:17 +05:30
|
|
|
return;
|
2013-08-25 05:02:42 +05:30
|
|
|
m_coremods->stopWatching();
|
2013-08-21 04:37:54 +05:30
|
|
|
m_coremods->deleteMods(first, last);
|
2013-08-25 05:02:42 +05:30
|
|
|
m_coremods->startWatching();
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_rmJarBtn_clicked()
|
|
|
|
{
|
2013-08-21 04:37:54 +05:30
|
|
|
int first, last;
|
|
|
|
auto list = ui->jarModsTreeView->selectionModel()->selectedRows();
|
2013-10-06 04:43:40 +05:30
|
|
|
|
|
|
|
if (!lastfirst(list, first, last))
|
2013-08-19 00:22:17 +05:30
|
|
|
return;
|
2013-08-25 05:02:42 +05:30
|
|
|
m_jarmods->stopWatching();
|
2013-08-21 04:37:54 +05:30
|
|
|
m_jarmods->deleteMods(first, last);
|
2013-08-25 05:02:42 +05:30
|
|
|
m_jarmods->startWatching();
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_rmModBtn_clicked()
|
|
|
|
{
|
2013-08-21 04:37:54 +05:30
|
|
|
int first, last;
|
2013-08-28 08:08:29 +05:30
|
|
|
auto list = ui->loaderModTreeView->selectionModel()->selectedRows();
|
2013-10-06 04:43:40 +05:30
|
|
|
|
|
|
|
if (!lastfirst(list, first, last))
|
2013-08-19 00:22:17 +05:30
|
|
|
return;
|
2013-08-25 05:02:42 +05:30
|
|
|
m_mods->stopWatching();
|
2013-08-21 04:37:54 +05:30
|
|
|
m_mods->deleteMods(first, last);
|
2013-08-25 05:02:42 +05:30
|
|
|
m_mods->startWatching();
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_rmTexPackBtn_clicked()
|
|
|
|
{
|
2013-08-25 05:02:42 +05:30
|
|
|
int first, last;
|
|
|
|
auto list = ui->texPackTreeView->selectionModel()->selectedRows();
|
2013-10-06 04:43:40 +05:30
|
|
|
|
|
|
|
if (!lastfirst(list, first, last))
|
2013-08-25 05:02:42 +05:30
|
|
|
return;
|
|
|
|
m_texturepacks->stopWatching();
|
|
|
|
m_texturepacks->deleteMods(first, last);
|
|
|
|
m_texturepacks->startWatching();
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_viewCoreBtn_clicked()
|
|
|
|
{
|
|
|
|
openDirInDefaultProgram(m_inst->coreModsDir(), true);
|
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_viewModBtn_clicked()
|
|
|
|
{
|
2013-08-27 23:59:27 +05:30
|
|
|
openDirInDefaultProgram(m_inst->loaderModsDir(), true);
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
void LegacyModEditDialog::on_viewTexPackBtn_clicked()
|
|
|
|
{
|
2013-08-28 08:08:29 +05:30
|
|
|
openDirInDefaultProgram(m_inst->texturePacksDir(), true);
|
2013-08-19 00:22:17 +05:30
|
|
|
}
|
|
|
|
|
2013-07-28 01:12:32 +05:30
|
|
|
void LegacyModEditDialog::on_buttonBox_rejected()
|
|
|
|
{
|
|
|
|
close();
|
2013-10-08 05:06:11 +05:30
|
|
|
}
|
|
|
|
|
2013-10-09 05:33:02 +05:30
|
|
|
void LegacyModEditDialog::jarCurrent(QModelIndex current, QModelIndex previous)
|
2013-10-09 02:15:48 +05:30
|
|
|
{
|
2013-11-04 07:23:05 +05:30
|
|
|
if (!current.isValid())
|
2013-10-09 05:33:02 +05:30
|
|
|
{
|
|
|
|
ui->jarMIFrame->clear();
|
2013-10-09 02:15:48 +05:30
|
|
|
return;
|
2013-10-09 05:33:02 +05:30
|
|
|
}
|
|
|
|
int row = current.row();
|
|
|
|
Mod &m = m_jarmods->operator[](row);
|
|
|
|
ui->jarMIFrame->updateWithMod(m);
|
2013-10-09 02:15:48 +05:30
|
|
|
}
|
|
|
|
|
2013-10-09 05:33:02 +05:30
|
|
|
void LegacyModEditDialog::coreCurrent(QModelIndex current, QModelIndex previous)
|
2013-10-09 02:15:48 +05:30
|
|
|
{
|
2013-11-04 07:23:05 +05:30
|
|
|
if (!current.isValid())
|
2013-10-09 05:33:02 +05:30
|
|
|
{
|
|
|
|
ui->coreMIFrame->clear();
|
2013-10-09 02:15:48 +05:30
|
|
|
return;
|
2013-10-09 05:33:02 +05:30
|
|
|
}
|
|
|
|
int row = current.row();
|
|
|
|
Mod &m = m_coremods->operator[](row);
|
|
|
|
ui->coreMIFrame->updateWithMod(m);
|
2013-10-09 02:15:48 +05:30
|
|
|
}
|
|
|
|
|
2013-10-09 05:33:02 +05:30
|
|
|
void LegacyModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous)
|
2013-10-09 02:15:48 +05:30
|
|
|
{
|
2013-11-04 07:23:05 +05:30
|
|
|
if (!current.isValid())
|
2013-10-09 05:33:02 +05:30
|
|
|
{
|
|
|
|
ui->loaderMIFrame->clear();
|
2013-10-09 02:15:48 +05:30
|
|
|
return;
|
2013-10-09 05:33:02 +05:30
|
|
|
}
|
|
|
|
int row = current.row();
|
|
|
|
Mod &m = m_mods->operator[](row);
|
|
|
|
ui->loaderMIFrame->updateWithMod(m);
|
2013-10-09 02:15:48 +05:30
|
|
|
}
|