Revert "Merge pull request #9 from MultiMC/develop"

This reverts commit ccc86e4e02, reversing
changes made to 306c655ab5.
This commit is contained in:
Sebastian-byte
2021-07-13 19:44:51 -05:00
parent 5019fafeb7
commit 869a92b2a2
100 changed files with 275 additions and 4805 deletions

View File

@@ -19,7 +19,7 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
{
m_settings = inst->settings();
ui->setupUi(this);
auto sysMB = Sys::getSystemRam() / Sys::mebibyte;
auto sysMB = Sys::getSystemRam() / Sys::megabyte;
ui->maxMemSpinBox->setMaximum(sysMB);
connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked);
connect(MMC, &MultiMC::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings);
@@ -177,32 +177,6 @@ void InstanceSettingsPage::applySettings()
m_settings->reset("UseNativeOpenAL");
m_settings->reset("UseNativeGLFW");
}
// Game time
bool gameTime = ui->gameTimeGroupBox->isChecked();
m_settings->set("OverrideGameTime", gameTime);
if (gameTime)
{
m_settings->set("ShowGameTime", ui->showGameTime->isChecked());
m_settings->set("RecordGameTime", ui->recordGameTime->isChecked());
}
else
{
m_settings->reset("ShowGameTime");
m_settings->reset("RecordGameTime");
}
// Join server on launch
bool joinServerOnLaunch = ui->serverJoinGroupBox->isChecked();
m_settings->set("JoinServerOnLaunch", joinServerOnLaunch);
if (joinServerOnLaunch)
{
m_settings->set("JoinServerOnLaunchAddress", ui->serverJoinAddress->text());
}
else
{
m_settings->reset("JoinServerOnLaunchAddress");
}
}
void InstanceSettingsPage::loadSettings()
@@ -264,14 +238,6 @@ void InstanceSettingsPage::loadSettings()
ui->nativeWorkaroundsGroupBox->setChecked(m_settings->get("OverrideNativeWorkarounds").toBool());
ui->useNativeGLFWCheck->setChecked(m_settings->get("UseNativeGLFW").toBool());
ui->useNativeOpenALCheck->setChecked(m_settings->get("UseNativeOpenAL").toBool());
// Miscellanous
ui->gameTimeGroupBox->setChecked(m_settings->get("OverrideGameTime").toBool());
ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool());
ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool());
ui->serverJoinGroupBox->setChecked(m_settings->get("JoinServerOnLaunch").toBool());
ui->serverJoinAddress->setText(m_settings->get("JoinServerOnLaunchAddress").toString());
}
void InstanceSettingsPage::on_javaDetectBtn_clicked()

View File

@@ -116,7 +116,7 @@
<string>The maximum amount of memory Minecraft is allowed to use.</string>
</property>
<property name="suffix">
<string notr="true"> MiB</string>
<string notr="true"> MB</string>
</property>
<property name="minimum">
<number>128</number>
@@ -138,7 +138,7 @@
<string>The amount of memory Minecraft is started with.</string>
</property>
<property name="suffix">
<string notr="true"> MiB</string>
<string notr="true"> MB</string>
</property>
<property name="minimum">
<number>128</number>
@@ -160,7 +160,7 @@
<string>The amount of memory available to store loaded Java classes.</string>
</property>
<property name="suffix">
<string notr="true"> MiB</string>
<string notr="true"> MB</string>
</property>
<property name="minimum">
<number>64</number>
@@ -416,93 +416,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="miscellanousPage">
<attribute name="title">
<string>Miscellanous</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QGroupBox" name="gameTimeGroupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Override global game time settings</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QCheckBox" name="showGameTime">
<property name="text">
<string>Show time spent playing this instance</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="recordGameTime">
<property name="text">
<string>Record time spent playing this instance</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="serverJoinGroupBox">
<property name="title">
<string>Set a server to join on launch</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<layout class="QGridLayout" name="serverJoinLayout">
<item row="0" column="0">
<widget class="QLabel" name="serverJoinAddressLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Server address:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="serverJoinAddress"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacerMiscellanous">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@@ -540,8 +453,6 @@
<tabstop>nativeWorkaroundsGroupBox</tabstop>
<tabstop>useNativeGLFWCheck</tabstop>
<tabstop>useNativeOpenALCheck</tabstop>
<tabstop>showGameTime</tabstop>
<tabstop>recordGameTime</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -236,15 +236,15 @@ void LogPage::on_btnPaste_clicked()
return;
//FIXME: turn this into a proper task and move the upload logic out of GuiUtil!
m_model->append(MessageLevel::MultiMC, QString("MultiMC: Log upload triggered at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date)));
m_model->append(MessageLevel::MultiMC, tr("MultiMC: Log upload triggered at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date)));
auto url = GuiUtil::uploadPaste(m_model->toPlainText(), this);
if(!url.isEmpty())
{
m_model->append(MessageLevel::MultiMC, QString("MultiMC: Log uploaded to: %1").arg(url));
m_model->append(MessageLevel::MultiMC, tr("MultiMC: Log uploaded to: %1").arg(url));
}
else
{
m_model->append(MessageLevel::Error, "MultiMC: Log upload failed!");
m_model->append(MessageLevel::Error, tr("MultiMC: Log upload failed!"));
}
}

View File

@@ -163,7 +163,7 @@ ModFolderPage::ModFolderPage(
auto smodel = ui->modTreeView->selectionModel();
connect(smodel, &QItemSelectionModel::currentChanged, this, &ModFolderPage::modCurrent);
connect(ui->filterEdit, &QLineEdit::textChanged, this, &ModFolderPage::on_filterTextChanged);
connect(ui->filterEdit, &QLineEdit::textChanged, this, &ModFolderPage::on_filterTextChanged );
connect(m_inst, &BaseInstance::runningStatusChanged, this, &ModFolderPage::on_RunningState_changed);
}

View File

@@ -1,5 +1,4 @@
#pragma once
#include "ModFolderPage.h"
#include "ui_ModFolderPage.h"
@@ -13,8 +12,8 @@ public:
{
ui->actionView_configs->setVisible(false);
}
virtual ~ResourcePackPage() {}
virtual ~ResourcePackPage() {}
virtual bool shouldDisplay() const override
{
return !m_inst->traits().contains("no-texturepacks") &&

View File

@@ -556,7 +556,7 @@ private:
QTimer m_saveTimer;
};
ServersPage::ServersPage(InstancePtr inst, QWidget* parent)
ServersPage::ServersPage(MinecraftInstance * inst, QWidget* parent)
: QMainWindow(parent), ui(new Ui::ServersPage)
{
ui->setupUi(this);
@@ -579,7 +579,7 @@ ServersPage::ServersPage(InstancePtr inst, QWidget* parent)
auto selectionModel = ui->serversView->selectionModel();
connect(selectionModel, &QItemSelectionModel::currentChanged, this, &ServersPage::currentChanged);
connect(m_inst.get(), &MinecraftInstance::runningStatusChanged, this, &ServersPage::on_RunningState_changed);
connect(m_inst, &MinecraftInstance::runningStatusChanged, this, &ServersPage::on_RunningState_changed);
connect(ui->nameLine, &QLineEdit::textEdited, this, &ServersPage::nameEdited);
connect(ui->addressLine, &QLineEdit::textEdited, this, &ServersPage::addressEdited);
connect(ui->resourceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(resourceIndexChanged(int)));
@@ -695,7 +695,6 @@ void ServersPage::updateState()
ui->actionMove_Down->setEnabled(serverEditEnabled);
ui->actionMove_Up->setEnabled(serverEditEnabled);
ui->actionRemove->setEnabled(serverEditEnabled);
ui->actionJoin->setEnabled(serverEditEnabled);
if(server)
{
@@ -759,10 +758,4 @@ void ServersPage::on_actionMove_Down_triggered()
}
}
void ServersPage::on_actionJoin_triggered()
{
const auto &address = m_model->at(currentServer)->m_address;
MMC->launch(m_inst, true, nullptr, std::make_shared<MinecraftServerTarget>(MinecraftServerTarget::parse(address)));
}
#include "ServersPage.moc"

View File

@@ -35,7 +35,7 @@ class ServersPage : public QMainWindow, public BasePage
Q_OBJECT
public:
explicit ServersPage(InstancePtr inst, QWidget *parent = 0);
explicit ServersPage(MinecraftInstance *inst, QWidget *parent = 0);
virtual ~ServersPage();
void openedImpl() override;
@@ -74,7 +74,6 @@ private slots:
void on_actionRemove_triggered();
void on_actionMove_Up_triggered();
void on_actionMove_Down_triggered();
void on_actionJoin_triggered();
void on_RunningState_changed(bool running);
@@ -89,6 +88,6 @@ private: // data
bool m_locked = true;
Ui::ServersPage *ui = nullptr;
ServersModel * m_model = nullptr;
InstancePtr m_inst = nullptr;
MinecraftInstance * m_inst = nullptr;
};

View File

@@ -148,7 +148,6 @@
<addaction name="actionRemove"/>
<addaction name="actionMove_Up"/>
<addaction name="actionMove_Down"/>
<addaction name="actionJoin"/>
</widget>
<action name="actionAdd">
<property name="text">
@@ -170,11 +169,6 @@
<string>Move Down</string>
</property>
</action>
<action name="actionJoin">
<property name="text">
<string>Join</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@@ -1,5 +1,4 @@
#pragma once
#include "ModFolderPage.h"
#include "ui_ModFolderPage.h"
@@ -14,7 +13,6 @@ public:
ui->actionView_configs->setVisible(false);
}
virtual ~TexturePackPage() {}
virtual bool shouldDisplay() const override
{
return m_inst->traits().contains("texturepacks");

View File

@@ -120,15 +120,7 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
auto proxy = new IconProxy(ui->packageView);
proxy->setSourceModel(m_profile.get());
m_filterModel = new QSortFilterProxyModel();
m_filterModel->setDynamicSortFilter(true);
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_filterModel->setSortCaseSensitivity(Qt::CaseInsensitive);
m_filterModel->setSourceModel(proxy);
m_filterModel->setFilterKeyColumn(-1);
ui->packageView->setModel(m_filterModel);
ui->packageView->setModel(proxy);
ui->packageView->installEventFilter(this);
ui->packageView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->packageView->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -142,8 +134,7 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
updateVersionControls();
preselect(0);
connect(m_inst, &BaseInstance::runningStatusChanged, this, &VersionPage::updateRunningStatus);
connect(ui->packageView, &ModListView::customContextMenuRequested, this, &VersionPage::showContextMenu);
connect(ui->filterEdit, &QLineEdit::textChanged, this, &VersionPage::onFilterTextChanged);
connect(ui->packageView, &ModListView::customContextMenuRequested, this, &VersionPage::ShowContextMenu);
}
VersionPage::~VersionPage()
@@ -151,7 +142,7 @@ VersionPage::~VersionPage()
delete ui;
}
void VersionPage::showContextMenu(const QPoint& pos)
void VersionPage::ShowContextMenu(const QPoint& pos)
{
auto menu = ui->toolBar->createContextMenu(this, tr("Context menu"));
menu->exec(ui->packageView->mapToGlobal(pos));
@@ -212,11 +203,11 @@ void VersionPage::updateVersionControls()
{
// FIXME: this is a dirty hack
auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft"));
bool newCraft = minecraftVersion >= Version("1.14");
bool oldCraft = minecraftVersion <= Version("1.12.2");
ui->actionInstall_Fabric->setEnabled(controlsEnabled && newCraft);
ui->actionInstall_Forge->setEnabled(controlsEnabled);
ui->actionInstall_LiteLoader->setEnabled(controlsEnabled && oldCraft);
bool newCraft = controlsEnabled && (minecraftVersion >= Version("1.14"));
bool oldCraft = controlsEnabled && (minecraftVersion <= Version("1.12.2"));
ui->actionInstall_Fabric->setEnabled(newCraft);
ui->actionInstall_Forge->setEnabled(true);
ui->actionInstall_LiteLoader->setEnabled(oldCraft);
ui->actionReload->setEnabled(true);
updateButtons();
}
@@ -629,10 +620,5 @@ void VersionPage::on_actionRevert_triggered()
m_container->refreshContainer();
}
void VersionPage::onFilterTextChanged(const QString &newContents)
{
m_filterModel->setFilterFixedString(newContents);
}
#include "VersionPage.moc"

View File

@@ -86,7 +86,6 @@ protected:
private:
Ui::VersionPage *ui;
QSortFilterProxyModel *m_filterModel;
std::shared_ptr<PackProfile> m_profile;
MinecraftInstance *m_inst;
int currentIdx = 0;
@@ -99,6 +98,5 @@ private slots:
void updateRunningStatus(bool running);
void onGameUpdateError(QString error);
void packageCurrent(const QModelIndex &current, const QModelIndex &previous);
void showContextMenu(const QPoint &pos);
void onFilterTextChanged(const QString & newContents);
void ShowContextMenu(const QPoint &pos);
};

View File

@@ -45,24 +45,6 @@
</attribute>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QLineEdit" name="filterEdit">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="filterLabel">
<property name="text">
<string>Filter:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="MCModInfoFrame" name="frame">
<property name="sizePolicy">