Fix MMC-15

``mod does not delete from jar''
This commit is contained in:
Petr Mrázek 2013-10-09 23:16:10 +02:00
parent 595943244c
commit eaf0cbeafc
4 changed files with 183 additions and 194 deletions

View File

@ -507,10 +507,11 @@ void MainWindow::onLoginComplete()
}
else
{
ProgressDialog *tDialog = new ProgressDialog(this);
ProgressDialog tDialog(this);
connect(updateTask, SIGNAL(succeeded()), SLOT(onGameUpdateComplete()));
connect(updateTask, SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
tDialog->exec(updateTask);
tDialog.exec(updateTask);
delete updateTask;
}
}

View File

@ -14,7 +14,8 @@
#define LAUNCHER_FILE "MultiMCLauncher.jar"
LegacyInstance::LegacyInstance(const QString& rootDir, SettingsObject* settings, QObject* parent)
LegacyInstance::LegacyInstance(const QString &rootDir, SettingsObject *settings,
QObject *parent)
: BaseInstance(new LegacyInstancePrivate(), rootDir, settings, parent)
{
settings->registerSetting(new Setting("NeedsRebuild", true));
@ -26,6 +27,7 @@ LegacyInstance::LegacyInstance(const QString& rootDir, SettingsObject* settings,
BaseUpdate *LegacyInstance::doUpdate()
{
auto list = jarModList();
return new LegacyUpdate(this, this);
}
@ -49,9 +51,8 @@ MinecraftProcess* LegacyInstance::prepareForLaunch(LoginResponse response)
if (settings().get("LaunchMaximized").toBool())
windowSize = "max";
else
windowSize = QString("%1x%2").
arg(settings().get("MinecraftWinWidth").toInt()).
arg(settings().get("MinecraftWinHeight").toInt());
windowSize = QString("%1x%2").arg(settings().get("MinecraftWinWidth").toInt()).arg(
settings().get("MinecraftWinHeight").toInt());
// window title
QString windowTitle;
@ -66,7 +67,8 @@ MinecraftProcess* LegacyInstance::prepareForLaunch(LoginResponse response)
args << QString("-Xdock:name=\"%1\"").arg(windowTitle);
#endif
QString lwjgl = QDir(MMC->settings()->get("LWJGLDir").toString() + "/" + lwjglVersion()).absolutePath();
QString lwjgl = QDir(MMC->settings()->get("LWJGLDir").toString() + "/" + lwjglVersion())
.absolutePath();
// launcher arguments
args << QString("-Xms%1m").arg(settings().get("MinMemAlloc").toInt());
@ -99,7 +101,6 @@ std::shared_ptr< ModList > LegacyInstance::coreModList()
{
d->core_mod_list.reset(new ModList(coreModsDir()));
}
else
d->core_mod_list->update();
return d->core_mod_list;
}
@ -113,7 +114,6 @@ std::shared_ptr< ModList > LegacyInstance::jarModList()
connect(list, SIGNAL(changed()), SLOT(jarModsChanged()));
d->jar_mod_list.reset(list);
}
else
d->jar_mod_list->update();
return d->jar_mod_list;
}
@ -123,7 +123,6 @@ void LegacyInstance::jarModsChanged()
setShouldRebuild(true);
}
std::shared_ptr<ModList> LegacyInstance::loaderModList()
{
I_D(LegacyInstance);
@ -131,7 +130,6 @@ std::shared_ptr< ModList > LegacyInstance::loaderModList()
{
d->loader_mod_list.reset(new ModList(loaderModsDir()));
}
else
d->loader_mod_list->update();
return d->loader_mod_list;
}
@ -143,18 +141,15 @@ std::shared_ptr< ModList > LegacyInstance::texturePackList()
{
d->texture_pack_list.reset(new ModList(texturePacksDir()));
}
else
d->texture_pack_list->update();
return d->texture_pack_list;
}
QDialog *LegacyInstance::createModEditDialog(QWidget *parent)
{
return new LegacyModEditDialog(this, parent);
}
QString LegacyInstance::jarModsDir() const
{
return PathCombine(instanceRoot(), "instMods");
@ -204,7 +199,6 @@ QString LegacyInstance::instanceConfigFolder() const
return PathCombine(minecraftRoot(), "config");
}
/*
bool LegacyInstance::shouldUpdateCurrentVersion() const
{
@ -229,7 +223,8 @@ void LegacyInstance::updateCurrentVersion(bool keepCurrent)
if (!keepCurrent)
{
// TODO: Implement GetMinecraftJarVersion function.
QString newVersion = "Unknown";//javautils::GetMinecraftJarVersion(jar.absoluteFilePath());
QString newVersion =
"Unknown";//javautils::GetMinecraftJarVersion(jar.absoluteFilePath());
setCurrentVersionId(newVersion);
}
}

View File

@ -26,13 +26,14 @@
ModList::ModList(const QString &dir, const QString &list_file)
: QAbstractListModel(), m_dir(dir), m_list_file(list_file)
{
m_dir.setFilter(QDir::Readable | QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs | QDir::NoSymLinks);
m_dir.setFilter(QDir::Readable | QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs |
QDir::NoSymLinks);
m_dir.setSorting(QDir::Name);
m_list_id = QUuid::createUuid().toString();
m_watcher = new QFileSystemWatcher(this);
is_watching = false;
connect(m_watcher,SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString)));
update();
connect(m_watcher, SIGNAL(directoryChanged(QString)), this,
SLOT(directoryChanged(QString)));
}
void ModList::startWatching()
@ -53,7 +54,6 @@ void ModList::stopWatching()
QLOG_INFO() << "Failed to stop watching " << m_dir.absolutePath();
}
bool ModList::update()
{
if (!isValid())
@ -92,7 +92,8 @@ bool ModList::update()
{
orderWasInvalid = true;
}
else for(int i = 0; i < mods.size(); i++)
else
for (int i = 0; i < mods.size(); i++)
{
if (!mods[i].strongCompare(newMods[i]))
{
@ -116,7 +117,6 @@ void ModList::directoryChanged ( QString path )
update();
}
QStringList ModList::readListFile()
{
QStringList stringList;
@ -160,7 +160,6 @@ bool ModList::saveListFile()
return false;
}
bool ModList::isValid()
{
return m_dir.exists() && m_dir.isReadable();
@ -259,7 +258,6 @@ bool ModList::deleteMods ( int first, int last )
return true;
}
bool ModList::moveModTo(int from, int to)
{
if (from < 0 || from >= mods.size())
@ -299,7 +297,6 @@ bool ModList::moveModsUp ( int first, int last )
return true;
}
bool ModList::moveModDown(int from)
{
if (from < 0)
@ -322,7 +319,6 @@ bool ModList::moveModsDown ( int first, int last )
return true;
}
int ModList::columnCount(const QModelIndex &parent) const
{
return 2;
@ -370,7 +366,6 @@ QVariant ModList::headerData ( int section, Qt::Orientation orientation, int rol
}
}
Qt::ItemFlags ModList::flags(const QModelIndex &index) const
{
Qt::ItemFlags defaultFlags = QAbstractListModel::flags(index);
@ -417,7 +412,8 @@ QMimeData* ModList::mimeData ( const QModelIndexList& indexes ) const
data->setText(params.join('|'));
return data;
}
bool ModList::dropMimeData ( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent )
bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column,
const QModelIndex &parent)
{
if (action == Qt::IgnoreAction)
return true;
@ -479,4 +475,3 @@ bool ModList::dropMimeData ( const QMimeData* data, Qt::DropAction action, int r
}
return false;
}

View File

@ -168,7 +168,6 @@ std::shared_ptr<ModList> OneSixInstance::loaderModList()
{
d->loader_mod_list.reset(new ModList(loaderModsDir()));
}
else
d->loader_mod_list->update();
return d->loader_mod_list;
}
@ -180,7 +179,6 @@ std::shared_ptr<ModList> OneSixInstance::resourcePackList()
{
d->resource_pack_list.reset(new ModList(resourcePacksDir()));
}
else
d->resource_pack_list->update();
return d->resource_pack_list;
}