mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
join offline + icon for all worlds toggle
This commit is contained in:
parent
1c1717a8ea
commit
cb105b720b
4 changed files with 21 additions and 7 deletions
|
|
@ -786,7 +786,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="allworlds"/>
|
||||
<iconset theme="worlds"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&All Worlds</string>
|
||||
|
|
|
|||
|
|
@ -397,6 +397,7 @@ void MultiWorldListPage::worldChanged([[maybe_unused]] const QModelIndex& curren
|
|||
ui->actionData_Packs->setEnabled(enable);
|
||||
ui->actionView_Folder->setEnabled(enable);
|
||||
ui->actionJoin->setEnabled(enable);
|
||||
ui->actionJoin_Offline->setEnabled(enable);
|
||||
ui->actionInstance_Settings->setEnabled(enable);
|
||||
bool hasIcon = !index.data(MultiWorldList::IconFileRole).isNull();
|
||||
ui->actionReset_Icon->setEnabled(enable && hasIcon);
|
||||
|
|
@ -463,8 +464,8 @@ void MultiWorldListPage::on_actionCopy_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Make this a separate dialog class
|
||||
Q_DECLARE_METATYPE(BaseInstance*);
|
||||
|
||||
MinecraftInstance* MultiWorldListPage::selectInstance(const QString& message, BaseInstance* preselectedInstance)
|
||||
{
|
||||
auto *dialog = new QDialog(this);
|
||||
|
|
@ -559,7 +560,7 @@ void MultiWorldListPage::on_actionRefresh_triggered()
|
|||
void MultiWorldListPage::worldDoubleClicked(const QModelIndex& index)
|
||||
{
|
||||
auto proxy = (QSortFilterProxyModel*)ui->worldTreeView->model();
|
||||
join(proxy->mapToSource(index));
|
||||
join(proxy->mapToSource(index), LaunchMode::Normal);
|
||||
}
|
||||
|
||||
void MultiWorldListPage::fileDropped(const QFileInfo& worldInfo)
|
||||
|
|
@ -576,17 +577,23 @@ void MultiWorldListPage::fileDropped(const QFileInfo& worldInfo)
|
|||
void MultiWorldListPage::on_actionJoin_triggered()
|
||||
{
|
||||
QModelIndex index = getSelectedWorld();
|
||||
join(index);
|
||||
join(index, LaunchMode::Normal);
|
||||
}
|
||||
|
||||
void MultiWorldListPage::join(QModelIndex index)
|
||||
void MultiWorldListPage::on_actionJoin_Offline_triggered()
|
||||
{
|
||||
QModelIndex index = getSelectedWorld();
|
||||
join(index, LaunchMode::Offline);
|
||||
}
|
||||
|
||||
void MultiWorldListPage::join(const QModelIndex& index, const LaunchMode launchMode)
|
||||
{
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
auto worldVariant = m_worlds->data(index, MultiWorldList::ObjectRole);
|
||||
auto *world = static_cast<InstanceWorld*>(worldVariant.value<void*>());
|
||||
APPLICATION->launch(world->instance, LaunchMode::Normal, std::make_shared<MinecraftTarget>(MinecraftTarget::parse(world->world.folderName(), true)));
|
||||
APPLICATION->launch(world->instance, launchMode, std::make_shared<MinecraftTarget>(MinecraftTarget::parse(world->world.folderName(), true)));
|
||||
emit worldJoined(world->instance);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage {
|
|||
bool isWorldSafe(QModelIndex index);
|
||||
bool worldSafetyNagQuestion(const QString& actionType);
|
||||
void mceditError();
|
||||
void join(QModelIndex index);
|
||||
void join(const QModelIndex& index, LaunchMode launchMode);
|
||||
MinecraftInstance* selectInstance(const QString& message, BaseInstance* instance = nullptr);
|
||||
|
||||
private:
|
||||
|
|
@ -105,6 +105,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage {
|
|||
void worldChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
void mceditState(LoggedProcess::State state);
|
||||
void on_actionJoin_triggered();
|
||||
void on_actionJoin_Offline_triggered();
|
||||
void worldDoubleClicked(const QModelIndex& index);
|
||||
void fileDropped(const QFileInfo& worldInfo);
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@
|
|||
<addaction name="actionAdd"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionJoin"/>
|
||||
<addaction name="actionJoin_Offline"/>
|
||||
<addaction name="actionRename"/>
|
||||
<addaction name="actionCopy"/>
|
||||
<addaction name="actionRemove"/>
|
||||
|
|
@ -107,6 +108,11 @@
|
|||
<string>Join</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionJoin_Offline">
|
||||
<property name="text">
|
||||
<string>Join Offline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRename">
|
||||
<property name="text">
|
||||
<string>Rename</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue