GH-338, GH-513, GH-700 Unify edit instance with console window
* The resulting instance window can be closed at any point. * Main window is kept open and running instances are marked with a badge. * Multiple instances can now run from the same MultiMC - it's even more **multi** now. * MultiMC can be entirely closed, keeping Minecraft(s) running.
This commit is contained in:
		@@ -60,7 +60,6 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
 | 
			
		||||
	createUI();
 | 
			
		||||
	m_model = new PageModel(this);
 | 
			
		||||
	m_proxyModel = new PageEntryFilterModel(this);
 | 
			
		||||
	int firstIndex = -1;
 | 
			
		||||
	int counter = 0;
 | 
			
		||||
	auto pages = pageProvider->getPages();
 | 
			
		||||
	for (auto page : pages)
 | 
			
		||||
@@ -69,10 +68,6 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
 | 
			
		||||
		page->listIndex = counter;
 | 
			
		||||
		page->setParentContainer(this);
 | 
			
		||||
		counter++;
 | 
			
		||||
		if (firstIndex == -1)
 | 
			
		||||
		{
 | 
			
		||||
			firstIndex = page->stackIndex;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	m_model->setPages(pages);
 | 
			
		||||
 | 
			
		||||
@@ -111,6 +106,23 @@ bool PageContainer::selectPage(QString pageId)
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PageContainer::refresh()
 | 
			
		||||
{
 | 
			
		||||
	m_proxyModel->invalidate();
 | 
			
		||||
	if(!m_currentPage->shouldDisplay())
 | 
			
		||||
	{
 | 
			
		||||
		auto index = m_proxyModel->index(0, 0);
 | 
			
		||||
		if(index.isValid())
 | 
			
		||||
		{
 | 
			
		||||
			m_pageList->setCurrentIndex(index);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			// FIXME: unhandled corner case: what to do when there's no page to select?
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PageContainer::createUI()
 | 
			
		||||
{
 | 
			
		||||
	m_pageStack = new QStackedLayout;
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,8 @@ public:
 | 
			
		||||
 | 
			
		||||
	virtual bool selectPage(QString pageId) override;
 | 
			
		||||
 | 
			
		||||
	void refresh();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	void createUI();
 | 
			
		||||
private
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user