Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curse_multiple_loaders2
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -118,7 +118,9 @@
|
||||
#include "minecraft/mod/TexturePackFolderModel.h"
|
||||
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||
|
||||
#include "modplatform/ModIndex.h"
|
||||
#include "modplatform/flame/FlameAPI.h"
|
||||
#include "modplatform/flame/FlameModIndex.h"
|
||||
|
||||
#include "KonamiCode.h"
|
||||
|
||||
@ -923,6 +925,7 @@ void MainWindow::processURLs(QList<QUrl> urls)
|
||||
if (url.scheme().isEmpty())
|
||||
url.setScheme("file");
|
||||
|
||||
ModPlatform::IndexedVersion version;
|
||||
QMap<QString, QString> extra_info;
|
||||
QUrl local_url;
|
||||
if (!url.isLocalFile()) { // download the remote resource and identify
|
||||
@ -948,20 +951,19 @@ void MainWindow::processURLs(QList<QUrl> urls)
|
||||
auto api = FlameAPI();
|
||||
auto job = api.getFile(addonId, fileId, array);
|
||||
|
||||
QString resource_name;
|
||||
|
||||
connect(job.get(), &Task::failed, this,
|
||||
[this](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); });
|
||||
connect(job.get(), &Task::succeeded, this, [this, array, addonId, fileId, &dl_url, &resource_name] {
|
||||
connect(job.get(), &Task::succeeded, this, [this, array, addonId, fileId, &dl_url, &version] {
|
||||
qDebug() << "Returned CFURL Json:\n" << array->toStdString().c_str();
|
||||
auto doc = Json::requireDocument(*array);
|
||||
auto data = Json::ensureObject(Json::ensureObject(doc.object()), "data");
|
||||
// No way to find out if it's a mod or a modpack before here
|
||||
// And also we need to check if it ends with .zip, instead of any better way
|
||||
auto fileName = Json::ensureString(data, "fileName");
|
||||
version = FlameMod::loadIndexedPackVersion(data);
|
||||
auto fileName = version.fileName;
|
||||
|
||||
// Have to use ensureString then use QUrl to get proper url encoding
|
||||
dl_url = QUrl(Json::ensureString(data, "downloadUrl", "", "downloadUrl"));
|
||||
dl_url = QUrl(version.downloadUrl);
|
||||
if (!dl_url.isValid()) {
|
||||
CustomMessageBox::selectable(
|
||||
this, tr("Error"),
|
||||
@ -972,7 +974,6 @@ void MainWindow::processURLs(QList<QUrl> urls)
|
||||
}
|
||||
|
||||
QFileInfo dl_file(dl_url.fileName());
|
||||
resource_name = Json::ensureString(data, "displayName", dl_file.completeBaseName(), "displayName");
|
||||
});
|
||||
|
||||
{ // drop stack
|
||||
@ -1047,7 +1048,7 @@ void MainWindow::processURLs(QList<QUrl> urls)
|
||||
qWarning() << "Importing of Data Packs not supported at this time. Ignoring" << localFileName;
|
||||
break;
|
||||
case PackedResourceType::Mod:
|
||||
minecraftInst->loaderModList()->installMod(localFileName);
|
||||
minecraftInst->loaderModList()->installMod(localFileName, version);
|
||||
break;
|
||||
case PackedResourceType::ShaderPack:
|
||||
minecraftInst->shaderPackList()->installResource(localFileName);
|
||||
|
@ -151,10 +151,7 @@ class MainWindow : public QMainWindow {
|
||||
void deleteGroup();
|
||||
void undoTrashInstance();
|
||||
|
||||
inline void on_actionExportInstance_triggered()
|
||||
{
|
||||
on_actionExportInstanceZip_triggered();
|
||||
}
|
||||
inline void on_actionExportInstance_triggered() { on_actionExportInstanceZip_triggered(); }
|
||||
void on_actionExportInstanceZip_triggered();
|
||||
void on_actionExportInstanceMrPack_triggered();
|
||||
void on_actionExportInstanceFlamePack_triggered();
|
||||
|
@ -185,6 +185,7 @@ void JavaPage::updateThresholds()
|
||||
{
|
||||
auto sysMiB = Sys::getSystemRam() / Sys::mebibyte;
|
||||
unsigned int maxMem = ui->maxMemSpinBox->value();
|
||||
unsigned int minMem = ui->minMemSpinBox->value();
|
||||
|
||||
QString iconName;
|
||||
|
||||
@ -194,6 +195,9 @@ void JavaPage::updateThresholds()
|
||||
} else if (maxMem > (sysMiB * 0.9)) {
|
||||
iconName = "status-yellow";
|
||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity."));
|
||||
} else if (maxMem < minMem) {
|
||||
iconName = "status-yellow";
|
||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value"));
|
||||
} else {
|
||||
iconName = "status-good";
|
||||
ui->labelMaxMemIcon->setToolTip("");
|
||||
|
@ -478,6 +478,7 @@ void InstanceSettingsPage::updateThresholds()
|
||||
{
|
||||
auto sysMiB = Sys::getSystemRam() / Sys::mebibyte;
|
||||
unsigned int maxMem = ui->maxMemSpinBox->value();
|
||||
unsigned int minMem = ui->minMemSpinBox->value();
|
||||
|
||||
QString iconName;
|
||||
|
||||
@ -487,6 +488,9 @@ void InstanceSettingsPage::updateThresholds()
|
||||
} else if (maxMem > (sysMiB * 0.9)) {
|
||||
iconName = "status-yellow";
|
||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity."));
|
||||
} else if (maxMem < minMem) {
|
||||
iconName = "status-yellow";
|
||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value"));
|
||||
} else {
|
||||
iconName = "status-good";
|
||||
ui->labelMaxMemIcon->setToolTip("");
|
||||
|
@ -354,14 +354,8 @@ class ServersModel : public QAbstractListModel {
|
||||
}
|
||||
}
|
||||
|
||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override
|
||||
{
|
||||
return parent.isValid() ? 0 : m_servers.size();
|
||||
}
|
||||
int columnCount(const QModelIndex& parent) const override
|
||||
{
|
||||
return parent.isValid() ? 0 : COLUMN_COUNT;
|
||||
}
|
||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override { return parent.isValid() ? 0 : m_servers.size(); }
|
||||
int columnCount(const QModelIndex& parent) const override { return parent.isValid() ? 0 : COLUMN_COUNT; }
|
||||
|
||||
Server* at(int index)
|
||||
{
|
||||
@ -445,10 +439,7 @@ class ServersModel : public QAbstractListModel {
|
||||
qDebug() << "Changed:" << path;
|
||||
load();
|
||||
}
|
||||
void fileChanged(const QString& path)
|
||||
{
|
||||
qDebug() << "Changed:" << path;
|
||||
}
|
||||
void fileChanged(const QString& path) { qDebug() << "Changed:" << path; }
|
||||
|
||||
private slots:
|
||||
void save_internal()
|
||||
@ -492,10 +483,7 @@ class ServersModel : public QAbstractListModel {
|
||||
m_saveTimer.stop();
|
||||
}
|
||||
|
||||
bool saveIsScheduled() const
|
||||
{
|
||||
return m_dirty;
|
||||
}
|
||||
bool saveIsScheduled() const { return m_dirty; }
|
||||
|
||||
void updateFSObserver()
|
||||
{
|
||||
|
@ -186,12 +186,20 @@ QString JavaSettingsWidget::javaPath() const
|
||||
|
||||
int JavaSettingsWidget::maxHeapSize() const
|
||||
{
|
||||
return m_maxMemSpinBox->value();
|
||||
auto min = m_minMemSpinBox->value();
|
||||
auto max = m_maxMemSpinBox->value();
|
||||
if (max < min)
|
||||
max = min;
|
||||
return max;
|
||||
}
|
||||
|
||||
int JavaSettingsWidget::minHeapSize() const
|
||||
{
|
||||
return m_minMemSpinBox->value();
|
||||
auto min = m_minMemSpinBox->value();
|
||||
auto max = m_maxMemSpinBox->value();
|
||||
if (min > max)
|
||||
min = max;
|
||||
return min;
|
||||
}
|
||||
|
||||
bool JavaSettingsWidget::permGenEnabled() const
|
||||
@ -214,17 +222,9 @@ void JavaSettingsWidget::memoryValueChanged(int)
|
||||
if (obj == m_minMemSpinBox && min != observedMinMemory) {
|
||||
observedMinMemory = min;
|
||||
actuallyChanged = true;
|
||||
if (min > max) {
|
||||
observedMaxMemory = min;
|
||||
m_maxMemSpinBox->setValue(min);
|
||||
}
|
||||
} else if (obj == m_maxMemSpinBox && max != observedMaxMemory) {
|
||||
observedMaxMemory = max;
|
||||
actuallyChanged = true;
|
||||
if (min > max) {
|
||||
observedMinMemory = max;
|
||||
m_minMemSpinBox->setValue(max);
|
||||
}
|
||||
} else if (obj == m_permGenSpinBox && permgen != observedPermGenMemory) {
|
||||
observedPermGenMemory = permgen;
|
||||
actuallyChanged = true;
|
||||
@ -361,8 +361,8 @@ void JavaSettingsWidget::checkJavaPath(const QString& path)
|
||||
setJavaStatus(JavaStatus::Pending);
|
||||
m_checker.reset(new JavaChecker());
|
||||
m_checker->m_path = path;
|
||||
m_checker->m_minMem = m_minMemSpinBox->value();
|
||||
m_checker->m_maxMem = m_maxMemSpinBox->value();
|
||||
m_checker->m_minMem = minHeapSize();
|
||||
m_checker->m_maxMem = maxHeapSize();
|
||||
if (m_permGenSpinBox->isVisible()) {
|
||||
m_checker->m_permGen = m_permGenSpinBox->value();
|
||||
}
|
||||
@ -415,6 +415,9 @@ void JavaSettingsWidget::updateThresholds()
|
||||
} else if (observedMaxMemory > (m_availableMemory * 0.9)) {
|
||||
iconName = "status-yellow";
|
||||
m_labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity."));
|
||||
} else if (observedMaxMemory < observedMinMemory) {
|
||||
iconName = "status-yellow";
|
||||
m_labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value"));
|
||||
} else {
|
||||
iconName = "status-good";
|
||||
m_labelMaxMemIcon->setToolTip("");
|
||||
|
Reference in New Issue
Block a user