Merge branch 'develop' into data-packs
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
commit
e2f3641395
516 changed files with 10962 additions and 7457 deletions
|
@ -83,7 +83,7 @@ class WorldListProxyModel : public QSortFilterProxyModel {
|
|||
}
|
||||
};
|
||||
|
||||
WorldListPage::WorldListPage(MinecraftInstance* inst, std::shared_ptr<WorldList> worlds, QWidget* parent)
|
||||
WorldListPage::WorldListPage(MinecraftInstancePtr inst, std::shared_ptr<WorldList> worlds, QWidget* parent)
|
||||
: QMainWindow(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -114,6 +114,11 @@ void WorldListPage::openedImpl()
|
|||
{
|
||||
m_worlds->startWatching();
|
||||
|
||||
auto mInst = std::dynamic_pointer_cast<MinecraftInstance>(m_inst);
|
||||
if (!mInst || !mInst->traits().contains("feature:is_quick_play_singleplayer")) {
|
||||
ui->toolBar->removeAction(ui->actionJoin);
|
||||
}
|
||||
|
||||
auto const setting_name = QString("WideBarVisibility_%1").arg(id());
|
||||
if (!APPLICATION->settings()->contains(setting_name))
|
||||
m_wide_bar_setting = APPLICATION->settings()->registerSetting(setting_name);
|
||||
|
@ -208,7 +213,7 @@ void WorldListPage::on_actionRemove_triggered()
|
|||
|
||||
void WorldListPage::on_actionView_Folder_triggered()
|
||||
{
|
||||
DesktopServices::openDirectory(m_worlds->dir().absolutePath(), true);
|
||||
DesktopServices::openPath(m_worlds->dir().absolutePath(), true);
|
||||
}
|
||||
|
||||
void WorldListPage::on_actionData_Packs_triggered()
|
||||
|
@ -361,11 +366,19 @@ void WorldListPage::worldChanged([[maybe_unused]] const QModelIndex& current, [[
|
|||
ui->actionData_Packs->setEnabled(enable);
|
||||
bool hasIcon = !index.data(WorldList::IconFileRole).isNull();
|
||||
ui->actionReset_Icon->setEnabled(enable && hasIcon);
|
||||
|
||||
auto mInst = std::dynamic_pointer_cast<MinecraftInstance>(m_inst);
|
||||
auto supportsJoin = mInst && mInst->traits().contains("feature:is_quick_play_singleplayer");
|
||||
ui->actionJoin->setEnabled(enable && supportsJoin);
|
||||
|
||||
if (!supportsJoin) {
|
||||
ui->toolBar->removeAction(ui->actionJoin);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldListPage::on_actionAdd_triggered()
|
||||
{
|
||||
auto list = GuiUtil::BrowseForFiles(displayName(), tr("Select a Minecraft world zip"), tr("Minecraft World Zip File (*.zip)"),
|
||||
auto list = GuiUtil::BrowseForFiles(displayName(), tr("Select a Minecraft world zip"), tr("Minecraft World Zip File") + " (*.zip)",
|
||||
QString(), this->parentWidget());
|
||||
if (!list.empty()) {
|
||||
m_worlds->stopWatching();
|
||||
|
@ -440,4 +453,15 @@ void WorldListPage::on_actionRefresh_triggered()
|
|||
m_worlds->update();
|
||||
}
|
||||
|
||||
void WorldListPage::on_actionJoin_triggered()
|
||||
{
|
||||
QModelIndex index = getSelectedWorld();
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
auto worldVariant = m_worlds->data(index, WorldList::ObjectRole);
|
||||
auto world = (World*)worldVariant.value<void*>();
|
||||
APPLICATION->launch(m_inst, true, false, std::make_shared<MinecraftTarget>(MinecraftTarget::parse(world->folderName(), true)));
|
||||
}
|
||||
|
||||
#include "WorldListPage.moc"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue