summaryrefslogtreecommitdiffstats
path: root/application/pages/WorldListPage.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-09-09 23:53:33 +0200
committerPetr Mrázek <peterix@gmail.com>2015-09-09 23:53:33 +0200
commita1fd50e920eba0f198b898e5df4ff5f60424d355 (patch)
tree6b2a3e0ec704d5edfec221c84ca1571376df9c1e /application/pages/WorldListPage.cpp
parent51070a13f711e53835f9aadc220c8177440590d9 (diff)
downloadMultiMC-a1fd50e920eba0f198b898e5df4ff5f60424d355.tar
MultiMC-a1fd50e920eba0f198b898e5df4ff5f60424d355.tar.gz
MultiMC-a1fd50e920eba0f198b898e5df4ff5f60424d355.tar.lz
MultiMC-a1fd50e920eba0f198b898e5df4ff5f60424d355.tar.xz
MultiMC-a1fd50e920eba0f198b898e5df4ff5f60424d355.zip
GH-1227: World import using drag and drop - zip files and folders
Diffstat (limited to 'application/pages/WorldListPage.cpp')
-rw-r--r--application/pages/WorldListPage.cpp20
1 files changed, 18 insertions, 2 deletions
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 <GuiUtil.h>
WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr<WorldList> 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 &current, 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