Misc tweaks
* Do not nuke forge META-INF * Disable inner DnD in mod lists on linux.
This commit is contained in:
parent
93bb7c87e3
commit
78e278c1e3
@ -35,12 +35,12 @@ LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent
|
|||||||
ensureFolderPathExists(m_inst->jarModsDir());
|
ensureFolderPathExists(m_inst->jarModsDir());
|
||||||
m_jarmods = m_inst->jarModList();
|
m_jarmods = m_inst->jarModList();
|
||||||
ui->jarModsTreeView->setModel(m_jarmods.data());
|
ui->jarModsTreeView->setModel(m_jarmods.data());
|
||||||
|
#ifndef Q_OS_LINUX
|
||||||
// FIXME: internal DnD causes segfaults later
|
// FIXME: internal DnD causes segfaults later
|
||||||
ui->jarModsTreeView->setDragDropMode(QAbstractItemView::DragDrop);
|
ui->jarModsTreeView->setDragDropMode(QAbstractItemView::DragDrop);
|
||||||
// FIXME: DnD is glitched with contiguous (we move only first item in selection)
|
// FIXME: DnD is glitched with contiguous (we move only first item in selection)
|
||||||
ui->jarModsTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
|
ui->jarModsTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
#endif
|
||||||
ui->jarModsTreeView->installEventFilter( this );
|
ui->jarModsTreeView->installEventFilter( this );
|
||||||
m_jarmods->startWatching();
|
m_jarmods->startWatching();
|
||||||
}
|
}
|
||||||
|
@ -410,10 +410,12 @@ void MainWindow::on_actionRenameInstance_triggered()
|
|||||||
|
|
||||||
if (name.length() > 0)
|
if (name.length() > 0)
|
||||||
{
|
{
|
||||||
if(ok && name.length() && name.length() <= 25)
|
if(ok && name.length())
|
||||||
|
{
|
||||||
m_selectedInstance->setName(name);
|
m_selectedInstance->setName(name);
|
||||||
renameButton->setText(name);
|
renameButton->setText(name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ void LegacyUpdate::jarFailed()
|
|||||||
emitFailed("Failed to download the minecraft jar. Try again later.");
|
emitFailed("Failed to download the minecraft jar. Try again later.");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >& contained )
|
bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >& contained, MetainfAction metainf )
|
||||||
{
|
{
|
||||||
setStatus("Installing mods - Adding " + from.fileName());
|
setStatus("Installing mods - Adding " + from.fileName());
|
||||||
|
|
||||||
@ -262,15 +262,22 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
|
|||||||
for(bool more=modZip.goToFirstFile(); more; more=modZip.goToNextFile())
|
for(bool more=modZip.goToFirstFile(); more; more=modZip.goToNextFile())
|
||||||
{
|
{
|
||||||
QString filename = modZip.getCurrentFileName();
|
QString filename = modZip.getCurrentFileName();
|
||||||
if(filename.contains("META-INF"))
|
if(filename.contains("META-INF") && metainf == LegacyUpdate::IgnoreMetainf)
|
||||||
|
{
|
||||||
|
qDebug() << "Skipping META-INF " << filename << " from " << from.fileName();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if(contained.contains(filename))
|
if(contained.contains(filename))
|
||||||
|
{
|
||||||
|
qDebug() << "Skipping already contained file " << filename << " from " << from.fileName();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
contained.insert(filename);
|
contained.insert(filename);
|
||||||
qDebug() << "Adding file " << filename << " from " << from.fileName();
|
qDebug() << "Adding file " << filename << " from " << from.fileName();
|
||||||
|
|
||||||
if(!fileInsideMod.open(QIODevice::ReadOnly))
|
if(!fileInsideMod.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
|
qDebug() << "Failed to open " << filename << " from " << from.fileName();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -283,6 +290,7 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
|
|||||||
*/
|
*/
|
||||||
if(!zipOutFile.open(QIODevice::WriteOnly, info_out))
|
if(!zipOutFile.open(QIODevice::WriteOnly, info_out))
|
||||||
{
|
{
|
||||||
|
qDebug() << "Failed to open " << filename << " in the jar";
|
||||||
fileInsideMod.close();
|
fileInsideMod.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -290,6 +298,7 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
|
|||||||
{
|
{
|
||||||
zipOutFile.close();
|
zipOutFile.close();
|
||||||
fileInsideMod.close();
|
fileInsideMod.close();
|
||||||
|
qDebug() << "Failed to copy data of " << filename << " into the jar";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
zipOutFile.close();
|
zipOutFile.close();
|
||||||
@ -369,7 +378,7 @@ void LegacyUpdate::ModTheJar()
|
|||||||
auto &mod = modList->operator[](i);
|
auto &mod = modList->operator[](i);
|
||||||
if (mod.type() == Mod::MOD_ZIPFILE)
|
if (mod.type() == Mod::MOD_ZIPFILE)
|
||||||
{
|
{
|
||||||
if(!MergeZipFiles(&zipOut, mod.filename(), addedFiles))
|
if(!MergeZipFiles(&zipOut, mod.filename(), addedFiles, LegacyUpdate::KeepMetainf))
|
||||||
{
|
{
|
||||||
zipOut.close();
|
zipOut.close();
|
||||||
QFile::remove(runnableJar.filePath());
|
QFile::remove(runnableJar.filePath());
|
||||||
@ -408,7 +417,7 @@ void LegacyUpdate::ModTheJar()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!MergeZipFiles(&zipOut, baseJar, addedFiles))
|
if(!MergeZipFiles(&zipOut, baseJar, addedFiles, LegacyUpdate::IgnoreMetainf))
|
||||||
{
|
{
|
||||||
zipOut.close();
|
zipOut.close();
|
||||||
QFile::remove(runnableJar.filePath());
|
QFile::remove(runnableJar.filePath());
|
||||||
|
@ -48,7 +48,12 @@ private slots:
|
|||||||
|
|
||||||
void ModTheJar();
|
void ModTheJar();
|
||||||
private:
|
private:
|
||||||
bool MergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString>& contained);
|
enum MetainfAction
|
||||||
|
{
|
||||||
|
KeepMetainf, // the META-INF folder will be added from the merged jar
|
||||||
|
IgnoreMetainf // the META-INF from the merged jar will be ignored
|
||||||
|
};
|
||||||
|
bool MergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString>& contained, MetainfAction metainf);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QSharedPointer<QNetworkReply> m_reply;
|
QSharedPointer<QNetworkReply> m_reply;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user