Skip to content

Commit

Permalink
GH-3427 add low effort datapack button to worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
peterix committed Nov 24, 2020
1 parent 66c0999 commit 88d6b6e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions application/pages/instance/WorldListPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ void WorldListPage::on_actionView_Folder_triggered()
DesktopServices::openDirectory(m_worlds->dir().absolutePath(), true);
}

void WorldListPage::on_actionDatapacks_triggered()
{
QModelIndex index = getSelectedWorld();

if (!index.isValid())
{
return;
}

if(!worldSafetyNagQuestion())
return;

auto fullPath = m_worlds->data(index, WorldList::FolderRole).toString();

DesktopServices::openDirectory(FS::PathCombine(fullPath, "datapacks"), true);
}


void WorldListPage::on_actionReset_Icon_triggered()
{
auto proxiedIndex = getSelectedWorld();
Expand Down
1 change: 1 addition & 0 deletions application/pages/instance/WorldListPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private slots:
void on_actionRename_triggered();
void on_actionRefresh_triggered();
void on_actionView_Folder_triggered();
void on_actionDatapacks_triggered();
void on_actionReset_Icon_triggered();
void worldChanged(const QModelIndex &current, const QModelIndex &previous);
void mceditState(LoggedProcess::State state);
Expand Down
9 changes: 9 additions & 0 deletions application/pages/instance/WorldListPage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<addaction name="actionCopy"/>
<addaction name="actionRemove"/>
<addaction name="actionMCEdit"/>
<addaction name="actionDatapacks"/>
<addaction name="actionReset_Icon"/>
<addaction name="separator"/>
<addaction name="actionCopy_Seed"/>
Expand Down Expand Up @@ -139,6 +140,14 @@
<string>Remove world icon to make the game re-generate it on next load.</string>
</property>
</action>
<action name="actionDatapacks">
<property name="text">
<string>Datapacks</string>
</property>
<property name="toolTip">
<string>Manage datapacks inside the world.</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down

0 comments on commit 88d6b6e

Please sign in to comment.