Merge pull request #561 from leo78913/iconpicker-stuff

closes https://github.com/PrismLauncher/PrismLauncher/issues/494
This commit is contained in:
Sefa Eyeoglu
2022-12-14 23:15:21 +01:00
committed by GitHub
4 changed files with 18 additions and 9 deletions

View File

@ -63,7 +63,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent)
// NOTE: ResetRole forces the button to be on the left, while the OK/Cancel ones are on the right. We win.
auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"), QDialogButtonBox::ResetRole);
auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole);
buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole);
connect(buttonAdd, SIGNAL(clicked(bool)), SLOT(addNewIcon()));
connect(buttonRemove, SIGNAL(clicked(bool)), SLOT(removeSelectedIcon()));
@ -111,6 +111,9 @@ void IconPickerDialog::addNewIcon()
void IconPickerDialog::removeSelectedIcon()
{
if (APPLICATION->icons()->trashIcon(selectedIconKey))
return;
APPLICATION->icons()->deleteIcon(selectedIconKey);
}
@ -129,6 +132,7 @@ void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection
if (!key.isEmpty()) {
selectedIconKey = key;
}
buttonRemove->setEnabled(APPLICATION->icons()->iconFileExists(selectedIconKey));
}
int IconPickerDialog::execWithSelection(QString selection)

View File

@ -37,6 +37,7 @@ protected:
private:
Ui::IconPickerDialog *ui;
QPushButton *buttonRemove;
private
slots: