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>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="allworlds"/>
|
<iconset theme="worlds"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&All Worlds</string>
|
<string>&All Worlds</string>
|
||||||
|
|
|
||||||
|
|
@ -397,6 +397,7 @@ void MultiWorldListPage::worldChanged([[maybe_unused]] const QModelIndex& curren
|
||||||
ui->actionData_Packs->setEnabled(enable);
|
ui->actionData_Packs->setEnabled(enable);
|
||||||
ui->actionView_Folder->setEnabled(enable);
|
ui->actionView_Folder->setEnabled(enable);
|
||||||
ui->actionJoin->setEnabled(enable);
|
ui->actionJoin->setEnabled(enable);
|
||||||
|
ui->actionJoin_Offline->setEnabled(enable);
|
||||||
ui->actionInstance_Settings->setEnabled(enable);
|
ui->actionInstance_Settings->setEnabled(enable);
|
||||||
bool hasIcon = !index.data(MultiWorldList::IconFileRole).isNull();
|
bool hasIcon = !index.data(MultiWorldList::IconFileRole).isNull();
|
||||||
ui->actionReset_Icon->setEnabled(enable && hasIcon);
|
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*);
|
Q_DECLARE_METATYPE(BaseInstance*);
|
||||||
|
|
||||||
MinecraftInstance* MultiWorldListPage::selectInstance(const QString& message, BaseInstance* preselectedInstance)
|
MinecraftInstance* MultiWorldListPage::selectInstance(const QString& message, BaseInstance* preselectedInstance)
|
||||||
{
|
{
|
||||||
auto *dialog = new QDialog(this);
|
auto *dialog = new QDialog(this);
|
||||||
|
|
@ -559,7 +560,7 @@ void MultiWorldListPage::on_actionRefresh_triggered()
|
||||||
void MultiWorldListPage::worldDoubleClicked(const QModelIndex& index)
|
void MultiWorldListPage::worldDoubleClicked(const QModelIndex& index)
|
||||||
{
|
{
|
||||||
auto proxy = (QSortFilterProxyModel*)ui->worldTreeView->model();
|
auto proxy = (QSortFilterProxyModel*)ui->worldTreeView->model();
|
||||||
join(proxy->mapToSource(index));
|
join(proxy->mapToSource(index), LaunchMode::Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiWorldListPage::fileDropped(const QFileInfo& worldInfo)
|
void MultiWorldListPage::fileDropped(const QFileInfo& worldInfo)
|
||||||
|
|
@ -576,17 +577,23 @@ void MultiWorldListPage::fileDropped(const QFileInfo& worldInfo)
|
||||||
void MultiWorldListPage::on_actionJoin_triggered()
|
void MultiWorldListPage::on_actionJoin_triggered()
|
||||||
{
|
{
|
||||||
QModelIndex index = getSelectedWorld();
|
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()) {
|
if (!index.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto worldVariant = m_worlds->data(index, MultiWorldList::ObjectRole);
|
auto worldVariant = m_worlds->data(index, MultiWorldList::ObjectRole);
|
||||||
auto *world = static_cast<InstanceWorld*>(worldVariant.value<void*>());
|
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);
|
emit worldJoined(world->instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage {
|
||||||
bool isWorldSafe(QModelIndex index);
|
bool isWorldSafe(QModelIndex index);
|
||||||
bool worldSafetyNagQuestion(const QString& actionType);
|
bool worldSafetyNagQuestion(const QString& actionType);
|
||||||
void mceditError();
|
void mceditError();
|
||||||
void join(QModelIndex index);
|
void join(const QModelIndex& index, LaunchMode launchMode);
|
||||||
MinecraftInstance* selectInstance(const QString& message, BaseInstance* instance = nullptr);
|
MinecraftInstance* selectInstance(const QString& message, BaseInstance* instance = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -105,6 +105,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage {
|
||||||
void worldChanged(const QModelIndex& current, const QModelIndex& previous);
|
void worldChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||||
void mceditState(LoggedProcess::State state);
|
void mceditState(LoggedProcess::State state);
|
||||||
void on_actionJoin_triggered();
|
void on_actionJoin_triggered();
|
||||||
|
void on_actionJoin_Offline_triggered();
|
||||||
void worldDoubleClicked(const QModelIndex& index);
|
void worldDoubleClicked(const QModelIndex& index);
|
||||||
void fileDropped(const QFileInfo& worldInfo);
|
void fileDropped(const QFileInfo& worldInfo);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@
|
||||||
<addaction name="actionAdd"/>
|
<addaction name="actionAdd"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionJoin"/>
|
<addaction name="actionJoin"/>
|
||||||
|
<addaction name="actionJoin_Offline"/>
|
||||||
<addaction name="actionRename"/>
|
<addaction name="actionRename"/>
|
||||||
<addaction name="actionCopy"/>
|
<addaction name="actionCopy"/>
|
||||||
<addaction name="actionRemove"/>
|
<addaction name="actionRemove"/>
|
||||||
|
|
@ -107,6 +108,11 @@
|
||||||
<string>Join</string>
|
<string>Join</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionJoin_Offline">
|
||||||
|
<property name="text">
|
||||||
|
<string>Join Offline</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="actionRename">
|
<action name="actionRename">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Rename</string>
|
<string>Rename</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue