GH-1445 update page list when version and log pages need it
This commit is contained in:
parent
1276ecdbb7
commit
7cff5ba2e1
@ -132,7 +132,7 @@ void InstanceWindow::on_InstanceLaunchTask_changed(std::shared_ptr<LaunchTask> p
|
||||
void InstanceWindow::on_RunningState_changed(bool running)
|
||||
{
|
||||
setKillButton(running);
|
||||
m_container->refresh();
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
void InstanceWindow::on_closeButton_clicked()
|
||||
@ -195,6 +195,11 @@ bool InstanceWindow::selectPage(QString pageId)
|
||||
return m_container->selectPage(pageId);
|
||||
}
|
||||
|
||||
void InstanceWindow::refreshContainer()
|
||||
{
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
InstanceWindow::~InstanceWindow()
|
||||
{
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
virtual ~InstanceWindow();
|
||||
|
||||
bool selectPage(QString pageId) override;
|
||||
void refreshContainer() override;
|
||||
|
||||
QString instanceId();
|
||||
|
||||
|
@ -5,4 +5,5 @@ class BasePageContainer
|
||||
public:
|
||||
virtual ~BasePageContainer(){};
|
||||
virtual bool selectPage(QString pageId) = 0;
|
||||
virtual void refreshContainer() = 0;
|
||||
};
|
||||
|
@ -231,6 +231,7 @@ void LogPage::on_btnClear_clicked()
|
||||
if(!m_model)
|
||||
return;
|
||||
m_model->clear();
|
||||
m_parentContainer->refreshContainer();
|
||||
}
|
||||
|
||||
void LogPage::on_btnBottom_clicked()
|
||||
|
@ -225,6 +225,7 @@ bool VersionPage::reloadMinecraftProfile()
|
||||
void VersionPage::on_reloadBtn_clicked()
|
||||
{
|
||||
reloadMinecraftProfile();
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
void VersionPage::on_removeBtn_clicked()
|
||||
@ -238,6 +239,8 @@ void VersionPage::on_removeBtn_clicked()
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
reloadMinecraftProfile();
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
void VersionPage::on_modBtn_clicked()
|
||||
@ -354,6 +357,7 @@ void VersionPage::on_changeVersionBtn_clicked()
|
||||
}
|
||||
m_inst->setIntendedVersionId(vselect.selectedVersion()->descriptor());
|
||||
doUpdate();
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
int VersionPage::doUpdate()
|
||||
@ -367,6 +371,7 @@ int VersionPage::doUpdate()
|
||||
connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
|
||||
int ret = tDialog.execWithTask(updateTask.get());
|
||||
updateButtons();
|
||||
m_container->refreshContainer();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -383,6 +388,7 @@ void VersionPage::on_forgeBtn_clicked()
|
||||
dialog.execWithTask(
|
||||
ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
|
||||
preselect(m_profile->rowCount(QModelIndex())-1);
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,6 +406,7 @@ void VersionPage::on_liteloaderBtn_clicked()
|
||||
dialog.execWithTask(
|
||||
LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
|
||||
preselect(m_profile->rowCount(QModelIndex())-1);
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,6 +550,7 @@ void VersionPage::on_revertBtn_clicked()
|
||||
}
|
||||
updateButtons();
|
||||
preselect(currentIdx);
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
#include "VersionPage.moc"
|
||||
|
@ -77,6 +77,7 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
|
||||
m_pageList->setIconSize(QSize(pageIconSize, pageIconSize));
|
||||
m_pageList->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_pageList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_pageList->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
m_pageList->setModel(m_proxyModel);
|
||||
connect(m_pageList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
||||
this, SLOT(currentChanged(QModelIndex)));
|
||||
@ -106,7 +107,7 @@ bool PageContainer::selectPage(QString pageId)
|
||||
return false;
|
||||
}
|
||||
|
||||
void PageContainer::refresh()
|
||||
void PageContainer::refreshContainer()
|
||||
{
|
||||
m_proxyModel->invalidate();
|
||||
if(!m_currentPage->shouldDisplay())
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
virtual bool selectPage(QString pageId) override;
|
||||
|
||||
void refresh();
|
||||
void refreshContainer() override;
|
||||
|
||||
private:
|
||||
void createUI();
|
||||
|
Loading…
Reference in New Issue
Block a user