Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into mods_txt

This commit is contained in:
Trial97
2023-06-15 11:46:44 +03:00
13 changed files with 201 additions and 79 deletions

View File

@ -187,7 +187,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
}
// set the menu for the folders help, and accounts tool buttons
// set the menu for the folders help, accounts, and export tool buttons
{
auto foldersMenuButton = dynamic_cast<QToolButton*>(ui->mainToolBar->widgetForAction(ui->actionFoldersButton));
ui->actionFoldersButton->setMenu(ui->foldersMenu);
@ -201,6 +201,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
auto accountMenuButton = dynamic_cast<QToolButton*>(ui->mainToolBar->widgetForAction(ui->actionAccountsButton));
accountMenuButton->setPopupMode(QToolButton::InstantPopup);
auto exportInstanceMenu = new QMenu(this);
exportInstanceMenu->addAction(ui->actionExportInstanceZip);
exportInstanceMenu->addAction(ui->actionExportInstanceMrPack);
ui->actionExportInstance->setMenu(exportInstanceMenu);
}
// hide, disable and show stuff
@ -397,8 +402,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
// removing this looks stupid
view->setFocus();
ui->actionExportInstance->setMenu(ui->exportInstanceMenu);
retranslateUi();
}
@ -470,7 +473,23 @@ void MainWindow::lockToolbars(bool state)
void MainWindow::konamiTriggered()
{
qDebug() << "Super Secret Mode ACTIVATED!";
QString gradient = " stop:0 rgba(125, 0, 0, 255), stop:0.166 rgba(125, 125, 0, 255), stop:0.333 rgba(0, 125, 0, 255), stop:0.5 rgba(0, 125, 125, 255), stop:0.666 rgba(0, 0, 125, 255), stop:0.833 rgba(125, 0, 125, 255), stop:1 rgba(125, 0, 0, 255));";
QString stylesheet = "background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0," + gradient;
if (ui->mainToolBar->styleSheet() == stylesheet) {
ui->mainToolBar->setStyleSheet("");
ui->instanceToolBar->setStyleSheet("");
ui->centralWidget->setStyleSheet("");
ui->newsToolBar->setStyleSheet("");
ui->statusBar->setStyleSheet("");
qDebug() << "Super Secret Mode DEACTIVATED!";
} else {
ui->mainToolBar->setStyleSheet(stylesheet);
ui->instanceToolBar->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1," + gradient);
ui->centralWidget->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1," + gradient);
ui->newsToolBar->setStyleSheet(stylesheet);
ui->statusBar->setStyleSheet(stylesheet);
qDebug() << "Super Secret Mode ACTIVATED!";
}
}
void MainWindow::showInstanceContextMenu(const QPoint &pos)

View File

@ -150,10 +150,6 @@
<addaction name="actionChangeInstGroup"/>
<addaction name="actionViewSelectedInstFolder"/>
<addaction name="actionExportInstance"/>
<widget class="QMenu" name="exportInstanceMenu">
<addaction name="actionExportInstanceZip"/>
<addaction name="actionExportInstanceMrPack"/>
</widget>
<addaction name="actionCopyInstance"/>
<addaction name="actionDeleteInstance"/>
<addaction name="actionCreateInstanceShortcut"/>
@ -467,11 +463,17 @@
</property>
</action>
<action name="actionExportInstanceZip">
<property name="icon">
<iconset theme="launcher"/>
</property>
<property name="text">
<string>Prism Launcher (zip)</string>
</property>
</action>
<action name="actionExportInstanceMrPack">
<property name="icon">
<iconset theme="modrinth"/>
</property>
<property name="text">
<string>Modrinth (mrpack)</string>
</property>

View File

@ -60,6 +60,10 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
m_settings = inst->settings();
ui->setupUi(this);
// As the signal will (probably) not be triggered once we click edit, let's update it manually instead.
updateRunningStatus(m_instance->isRunning());
connect(m_instance, &BaseInstance::runningStatusChanged, this, &InstanceSettingsPage::updateRunningStatus);
connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked);
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings);
connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings);
@ -70,11 +74,6 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
updateThresholds();
}
bool InstanceSettingsPage::shouldDisplay() const
{
return !m_instance->isRunning();
}
InstanceSettingsPage::~InstanceSettingsPage()
{
delete ui;
@ -524,3 +523,8 @@ void InstanceSettingsPage::updateThresholds()
ui->labelMaxMemIcon->setPixmap(pix);
}
}
void InstanceSettingsPage::updateRunningStatus(bool running)
{
setEnabled(!running);
}

View File

@ -75,12 +75,12 @@ public:
{
return "Instance-settings";
}
virtual bool shouldDisplay() const override;
void retranslate() override;
void updateThresholds();
private slots:
void updateRunningStatus(bool running);
void on_javaDetectBtn_clicked();
void on_javaTestBtn_clicked();
void on_javaBrowseBtn_clicked();

View File

@ -240,10 +240,13 @@ void ResourcePage::updateSelectionButton()
}
m_ui->resourceSelectionButton->setEnabled(true);
if (!getCurrentPack()->isVersionSelected(m_selected_version_index)) {
m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
if (getCurrentPack()) {
if (!getCurrentPack()->isVersionSelected(m_selected_version_index))
m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
else
m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
} else {
m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
qWarning() << "Tried to update the selected button but there is not a pack selected";
}
}