Merge pull request #3919 from hamarb123/develop

Stop application freezes on macOS by moving data to MultiMC.app/Data
This commit is contained in:
Petr Mrázek
2021-07-23 16:13:32 +02:00
committed by GitHub
4 changed files with 86 additions and 0 deletions

View File

@@ -29,6 +29,9 @@
#include "BuildConfig.h"
#include "themes/ITheme.h"
#include <QApplication>
#include <QProcess>
// FIXME: possibly move elsewhere
enum InstSortMode
{
@@ -78,6 +81,13 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP
}
connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview()));
connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview()));
//move mac data button
QFile file(QDir::current().absolutePath() + "/dontmovemacdata");
if (!file.exists())
{
ui->migrateDataFolderMacBtn->setVisible(false);
}
}
MultiMCPage::~MultiMCPage()
@@ -146,6 +156,13 @@ void MultiMCPage::on_modsDirBrowseBtn_clicked()
ui->modsDirTextBox->setText(cooked_dir);
}
}
void MultiMCPage::on_migrateDataFolderMacBtn_clicked()
{
QFile file(QDir::current().absolutePath() + "/dontmovemacdata");
file.remove();
QProcess::startDetached(qApp->arguments()[0]);
qApp->quit();
}
void MultiMCPage::refreshUpdateChannelList()
{

View File

@@ -67,6 +67,7 @@ slots:
void on_instDirBrowseBtn_clicked();
void on_modsDirBrowseBtn_clicked();
void on_iconsDirBrowseBtn_clicked();
void on_migrateDataFolderMacBtn_clicked();
/*!
* Updates the list of update channels in the combo box.

View File

@@ -157,6 +157,13 @@
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="migrateDataFolderMacBtn">
<property name="text">
<string>Move MultiMC data to new location (will restart MultiMC)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">