NOISSUE update component buttons some more when the versions change
This commit is contained in:
parent
5110b58def
commit
b9d4293552
@ -635,6 +635,9 @@ void ComponentList::componentDataChanged()
|
|||||||
qWarning() << "ComponentList got dataChenged signal from a non-Component!";
|
qWarning() << "ComponentList got dataChenged signal from a non-Component!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(objPtr->getID() == "net.minecraft") {
|
||||||
|
emit minecraftChanged();
|
||||||
|
}
|
||||||
// figure out which one is it... in a seriously dumb way.
|
// figure out which one is it... in a seriously dumb way.
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (auto component: d->components)
|
for (auto component: d->components)
|
||||||
|
@ -104,6 +104,9 @@ public:
|
|||||||
/// if there is a save scheduled, do it now.
|
/// if there is a save scheduled, do it now.
|
||||||
void saveNow();
|
void saveNow();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void minecraftChanged();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// get the profile component by id
|
/// get the profile component by id
|
||||||
Component * getComponent(const QString &id);
|
Component * getComponent(const QString &id);
|
||||||
|
@ -113,9 +113,6 @@ public:
|
|||||||
|
|
||||||
virtual JavaVersion getJavaVersion() const;
|
virtual JavaVersion getJavaVersion() const;
|
||||||
|
|
||||||
signals:
|
|
||||||
void versionReloaded();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QMap<QString, QString> createCensorFilterFromSession(AuthSessionPtr session);
|
QMap<QString, QString> createCensorFilterFromSession(AuthSessionPtr session);
|
||||||
QStringList validLaunchMethods();
|
QStringList validLaunchMethods();
|
||||||
|
@ -109,25 +109,18 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
|
|||||||
|
|
||||||
reloadComponentList();
|
reloadComponentList();
|
||||||
|
|
||||||
if (m_profile)
|
auto proxy = new IconProxy(ui->packageView);
|
||||||
{
|
proxy->setSourceModel(m_profile.get());
|
||||||
auto proxy = new IconProxy(ui->packageView);
|
ui->packageView->setModel(proxy);
|
||||||
proxy->setSourceModel(m_profile.get());
|
ui->packageView->installEventFilter(this);
|
||||||
ui->packageView->setModel(proxy);
|
ui->packageView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
ui->packageView->installEventFilter(this);
|
connect(ui->packageView->selectionModel(), &QItemSelectionModel::currentChanged, this, &VersionPage::versionCurrent);
|
||||||
ui->packageView->setSelectionMode(QAbstractItemView::SingleSelection);
|
auto smodel = ui->packageView->selectionModel();
|
||||||
connect(ui->packageView->selectionModel(), &QItemSelectionModel::currentChanged, this, &VersionPage::versionCurrent);
|
connect(smodel, &QItemSelectionModel::currentChanged, this, &VersionPage::packageCurrent);
|
||||||
auto smodel = ui->packageView->selectionModel();
|
|
||||||
connect(smodel, &QItemSelectionModel::currentChanged, this, &VersionPage::packageCurrent);
|
updateVersionControls();
|
||||||
updateVersionControls();
|
preselect(0);
|
||||||
// select first item.
|
connect(m_profile.get(), &ComponentList::minecraftChanged, this, &VersionPage::updateVersionControls);
|
||||||
preselect(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
disableVersionControls();
|
|
||||||
}
|
|
||||||
connect(m_inst, &MinecraftInstance::versionReloaded, this, &VersionPage::updateVersionControls);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionPage::~VersionPage()
|
VersionPage::~VersionPage()
|
||||||
@ -181,21 +174,20 @@ void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex &
|
|||||||
void VersionPage::updateVersionControls()
|
void VersionPage::updateVersionControls()
|
||||||
{
|
{
|
||||||
// FIXME: this is a dirty hack
|
// FIXME: this is a dirty hack
|
||||||
auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft"));
|
if(m_profile) {
|
||||||
bool newCraft = minecraftVersion >= Version("1.14");
|
auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft"));
|
||||||
bool oldCraft = minecraftVersion <= Version("1.12.2");
|
bool newCraft = minecraftVersion >= Version("1.14");
|
||||||
ui->fabricBtn->setEnabled(newCraft);
|
bool oldCraft = minecraftVersion <= Version("1.12.2");
|
||||||
ui->forgeBtn->setEnabled(oldCraft);
|
ui->fabricBtn->setEnabled(newCraft);
|
||||||
ui->liteloaderBtn->setEnabled(oldCraft);
|
ui->forgeBtn->setEnabled(oldCraft);
|
||||||
updateButtons();
|
ui->liteloaderBtn->setEnabled(oldCraft);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
void VersionPage::disableVersionControls()
|
ui->fabricBtn->setEnabled(false);
|
||||||
{
|
ui->forgeBtn->setEnabled(false);
|
||||||
ui->fabricBtn->setEnabled(false);
|
ui->liteloaderBtn->setEnabled(false);
|
||||||
ui->forgeBtn->setEnabled(false);
|
ui->reloadBtn->setEnabled(false);
|
||||||
ui->liteloaderBtn->setEnabled(false);
|
}
|
||||||
ui->reloadBtn->setEnabled(false);
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ private slots:
|
|||||||
void on_downloadBtn_clicked();
|
void on_downloadBtn_clicked();
|
||||||
|
|
||||||
void updateVersionControls();
|
void updateVersionControls();
|
||||||
void disableVersionControls();
|
|
||||||
void on_changeVersionBtn_clicked();
|
void on_changeVersionBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user