From a1fd50e920eba0f198b898e5df4ff5f60424d355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 9 Sep 2015 23:53:33 +0200 Subject: GH-1227: World import using drag and drop - zip files and folders --- application/pages/WorldListPage.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'application/pages/WorldListPage.cpp') diff --git a/application/pages/WorldListPage.cpp b/application/pages/WorldListPage.cpp index 8b95b2b0..be1d58b8 100644 --- a/application/pages/WorldListPage.cpp +++ b/application/pages/WorldListPage.cpp @@ -25,6 +25,7 @@ #include "MultiMC.h" +#include WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr worlds, QString id, QString iconName, QString displayName, QString helpPage, @@ -67,8 +68,6 @@ WorldListPage::~WorldListPage() bool WorldListPage::shouldDisplay() const { - if (m_inst) - return !m_inst->isRunning(); return true; } @@ -200,3 +199,20 @@ void WorldListPage::worldChanged(const QModelIndex ¤t, const QModelIndex & ui->mcEditBtn->setEnabled(enable); ui->rmWorldBtn->setEnabled(enable); } + +void WorldListPage::on_addBtn_clicked() +{ + auto list = GuiUtil::BrowseForFiles( + m_helpName, + tr("Select a Minecraft world zip"), + tr("Minecraft World Zip File (*.zip)"), QString(), this->parentWidget()); + if (!list.empty()) + { + m_worlds->stopWatching(); + for (auto filename : list) + { + m_worlds->installWorld(QFileInfo(filename)); + } + m_worlds->startWatching(); + } +} \ No newline at end of file -- cgit v1.2.3