mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-11-20 08:10:11 +00:00
NOISSUE bring back instance creation
This commit is contained in:
parent
f557c13679
commit
77f27a628f
@ -31,6 +31,9 @@
|
||||
#include <QFileDialog>
|
||||
#include <QValidator>
|
||||
|
||||
#include <meta/Index.h>
|
||||
#include <meta/VersionList.h>
|
||||
|
||||
class UrlValidator : public QValidator
|
||||
{
|
||||
public:
|
||||
@ -61,12 +64,25 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, QWidget *pare
|
||||
resize(minimumSizeHint());
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
// FIXME: bring this back...
|
||||
auto vlist = ENV.getVersionList("net.minecraft");
|
||||
if(vlist)
|
||||
auto vlist = ENV.metadataIndex()->get("net.minecraft");
|
||||
if(vlist->isLoaded())
|
||||
{
|
||||
setSelectedVersion(vlist->getRecommended());
|
||||
}
|
||||
else
|
||||
{
|
||||
vlist->load();
|
||||
auto task = vlist->getLoadTask();
|
||||
if(vlist->isLoaded())
|
||||
{
|
||||
setSelectedVersion(vlist->getRecommended());
|
||||
}
|
||||
if(task)
|
||||
{
|
||||
connect(task.get(), &Task::succeeded, this, &NewInstanceDialog::versionListUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
InstIconKey = "default";
|
||||
ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey));
|
||||
|
||||
@ -99,6 +115,15 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, QWidget *pare
|
||||
updateDialogState();
|
||||
}
|
||||
|
||||
void NewInstanceDialog::versionListUpdated()
|
||||
{
|
||||
if(!m_versionSetByUser)
|
||||
{
|
||||
auto vlist = ENV.metadataIndex()->get("net.minecraft");
|
||||
setSelectedVersion(vlist->getRecommended());
|
||||
}
|
||||
}
|
||||
|
||||
NewInstanceDialog::~NewInstanceDialog()
|
||||
{
|
||||
delete ui;
|
||||
@ -138,7 +163,7 @@ void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version)
|
||||
|
||||
if (m_selectedVersion)
|
||||
{
|
||||
ui->versionTextBox->setText(version->name());
|
||||
ui->versionTextBox->setText(version->descriptor());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -196,13 +221,16 @@ BaseVersionPtr NewInstanceDialog::selectedVersion() const
|
||||
|
||||
void NewInstanceDialog::on_btnChangeVersion_clicked()
|
||||
{
|
||||
VersionSelectDialog vselect(ENV.getVersionList("net.minecraft").get(), tr("Change Minecraft version"), this);
|
||||
VersionSelectDialog vselect(ENV.metadataIndex()->get("net.minecraft").get(), tr("Change Minecraft version"), this);
|
||||
vselect.exec();
|
||||
if (vselect.result() == QDialog::Accepted)
|
||||
{
|
||||
BaseVersionPtr version = vselect.selectedVersion();
|
||||
if (version)
|
||||
{
|
||||
m_versionSetByUser = true;
|
||||
setSelectedVersion(version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,6 @@ public:
|
||||
|
||||
void setSelectedVersion(BaseVersionPtr version);
|
||||
|
||||
void loadVersionList();
|
||||
|
||||
QString instName() const;
|
||||
QString instGroup() const;
|
||||
QString iconKey() const;
|
||||
@ -50,10 +48,12 @@ slots:
|
||||
void on_iconButton_clicked();
|
||||
void on_modpackBtn_clicked();
|
||||
void on_instNameTextBox_textChanged(const QString &arg1);
|
||||
void versionListUpdated();
|
||||
|
||||
private:
|
||||
Ui::NewInstanceDialog *ui;
|
||||
|
||||
bool m_versionSetByUser = false;
|
||||
BaseVersionPtr m_selectedVersion;
|
||||
QString InstIconKey;
|
||||
QString originalPlaceholderText;
|
||||
|
Loading…
Reference in New Issue
Block a user