mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
joining world switches to main screen + fix issues with instance toolbar visibility
This commit is contained in:
parent
547d870930
commit
b0a600b720
4 changed files with 27 additions and 3 deletions
|
|
@ -192,8 +192,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
ui->instanceToolBar->addContextMenuAction(ui->instanceToolBar->toggleViewAction());
|
||||
ui->instanceToolBar->addContextMenuAction(ui->actionToggleStatusBar);
|
||||
ui->instanceToolBar->addContextMenuAction(ui->actionLockToolbars);
|
||||
|
||||
m_oldInstanceToolbarSetting = ui->instanceToolBar->isVisible();
|
||||
}
|
||||
|
||||
// set the menu for the folders help, accounts, and export tool buttons
|
||||
|
|
@ -356,6 +354,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
ui->instanceToolBar->setVisibilityState(QByteArray::fromBase64(instanceToolbarSetting->get().toString().toUtf8())); //fix instance toolbar checkbox independent of all worlds screen showing iy
|
||||
|
||||
connect(ui->actionAllWorlds, &QAction::toggled, this, &MainWindow::onAllWorldsToggled);
|
||||
connect(allWorldsPage, &MultiWorldListPage::worldJoined, this, &MainWindow::worldJoined);
|
||||
}
|
||||
|
||||
// The cat background
|
||||
|
|
@ -867,6 +866,17 @@ QString intListToString(const QList<int>& list)
|
|||
}
|
||||
|
||||
void MainWindow::onAllWorldsToggled(bool toggled)
|
||||
{
|
||||
toggleAllWorldsScreen(toggled);
|
||||
}
|
||||
|
||||
void MainWindow::worldJoined()
|
||||
{
|
||||
ui->actionAllWorlds->setChecked(false);
|
||||
toggleAllWorldsScreen(false);
|
||||
}
|
||||
|
||||
void MainWindow::toggleAllWorldsScreen(bool toggled)
|
||||
{
|
||||
if (toggled) {
|
||||
QList<BaseInstance*> allInstances = APPLICATION->instances()->getAllInstances();
|
||||
|
|
@ -883,9 +893,11 @@ void MainWindow::onAllWorldsToggled(bool toggled)
|
|||
allWorldsPage = newAllWorldsPage;
|
||||
|
||||
view->setVisible(false);
|
||||
m_oldInstanceToolbarSetting = ui->instanceToolBar->isVisible(); //won't work if starts on all worlds screen iy
|
||||
m_oldInstanceToolbarSetting = ui->instanceToolBar->isVisible();
|
||||
ui->instanceToolBar->setVisible(false);
|
||||
allWorldsPage->setVisible(true);
|
||||
|
||||
connect(allWorldsPage, &MultiWorldListPage::worldJoined, this, &MainWindow::worldJoined);
|
||||
} else {
|
||||
allWorldsPage->setVisible(false);
|
||||
view->setVisible(true);
|
||||
|
|
@ -1631,6 +1643,10 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered()
|
|||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if (view->isVisible()) {
|
||||
m_oldInstanceToolbarSetting = ui->instanceToolBar->isVisible();
|
||||
}
|
||||
toggleAllWorldsScreen(false);
|
||||
// Save the window state and geometry.
|
||||
APPLICATION->settings()->set("MainWindowState", QString::fromUtf8(saveState().toBase64()));
|
||||
APPLICATION->settings()->set("MainWindowGeometry", QString::fromUtf8(saveGeometry().toBase64()));
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ class MainWindow : public QMainWindow {
|
|||
|
||||
void taskEnd();
|
||||
|
||||
void worldJoined();
|
||||
|
||||
/**
|
||||
* called when an icon is changed in the icon model.
|
||||
*/
|
||||
|
|
@ -236,6 +238,8 @@ class MainWindow : public QMainWindow {
|
|||
void runModalTask(Task* task);
|
||||
void instanceFromInstanceTask(InstanceTask* task);
|
||||
|
||||
void toggleAllWorldsScreen(bool toggled);
|
||||
|
||||
private:
|
||||
Ui::MainWindow* ui;
|
||||
// these are managed by Qt's memory management model!
|
||||
|
|
|
|||
|
|
@ -504,6 +504,7 @@ void MultiWorldListPage::join(QModelIndex index)
|
|||
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)));
|
||||
emit worldJoined();
|
||||
}
|
||||
|
||||
#include "MultiWorldListPage.moc"
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ class MultiWorldListPage : public QMainWindow, public BasePage {
|
|||
virtual void openedImpl() override;
|
||||
virtual void closedImpl() override;
|
||||
|
||||
signals:
|
||||
void worldJoined();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* ev) override;
|
||||
bool worldListFilter(QKeyEvent* ev);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue