summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-07 00:18:27 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-07 00:18:27 +0100
commit7cff5ba2e119ae675661c32811da85cf5efacea5 (patch)
tree9b7104693a1dfb92a00854eb20c09b6bb1d986d6
parent1276ecdbb769a249a969e8d34749b8f245c3031e (diff)
downloadMultiMC-7cff5ba2e119ae675661c32811da85cf5efacea5.tar
MultiMC-7cff5ba2e119ae675661c32811da85cf5efacea5.tar.gz
MultiMC-7cff5ba2e119ae675661c32811da85cf5efacea5.tar.lz
MultiMC-7cff5ba2e119ae675661c32811da85cf5efacea5.tar.xz
MultiMC-7cff5ba2e119ae675661c32811da85cf5efacea5.zip
GH-1445 update page list when version and log pages need it
-rw-r--r--application/InstanceWindow.cpp7
-rw-r--r--application/InstanceWindow.h1
-rw-r--r--application/pages/BasePageContainer.h1
-rw-r--r--application/pages/LogPage.cpp1
-rw-r--r--application/pages/VersionPage.cpp8
-rw-r--r--application/widgets/PageContainer.cpp3
-rw-r--r--application/widgets/PageContainer.h2
7 files changed, 20 insertions, 3 deletions
diff --git a/application/InstanceWindow.cpp b/application/InstanceWindow.cpp
index f76ae18d..e3d4af66 100644
--- a/application/InstanceWindow.cpp
+++ b/application/InstanceWindow.cpp
@@ -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()
{
}
diff --git a/application/InstanceWindow.h b/application/InstanceWindow.h
index a02a3dc6..ce80eced 100644
--- a/application/InstanceWindow.h
+++ b/application/InstanceWindow.h
@@ -33,6 +33,7 @@ public:
virtual ~InstanceWindow();
bool selectPage(QString pageId) override;
+ void refreshContainer() override;
QString instanceId();
diff --git a/application/pages/BasePageContainer.h b/application/pages/BasePageContainer.h
index 5982ad76..660685d3 100644
--- a/application/pages/BasePageContainer.h
+++ b/application/pages/BasePageContainer.h
@@ -5,4 +5,5 @@ class BasePageContainer
public:
virtual ~BasePageContainer(){};
virtual bool selectPage(QString pageId) = 0;
+ virtual void refreshContainer() = 0;
};
diff --git a/application/pages/LogPage.cpp b/application/pages/LogPage.cpp
index 19d1c7fe..68a65b8f 100644
--- a/application/pages/LogPage.cpp
+++ b/application/pages/LogPage.cpp
@@ -231,6 +231,7 @@ void LogPage::on_btnClear_clicked()
if(!m_model)
return;
m_model->clear();
+ m_parentContainer->refreshContainer();
}
void LogPage::on_btnBottom_clicked()
diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp
index 14e48cff..52779856 100644
--- a/application/pages/VersionPage.cpp
+++ b/application/pages/VersionPage.cpp
@@ -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"
diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp
index 1f46ddfc..9e0d83f1 100644
--- a/application/widgets/PageContainer.cpp
+++ b/application/widgets/PageContainer.cpp
@@ -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())
diff --git a/application/widgets/PageContainer.h b/application/widgets/PageContainer.h
index e7dc8b08..26f88a04 100644
--- a/application/widgets/PageContainer.h
+++ b/application/widgets/PageContainer.h
@@ -49,7 +49,7 @@ public:
virtual bool selectPage(QString pageId) override;
- void refresh();
+ void refreshContainer() override;
private:
void createUI();