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