UI: ProgramEdit: Show icon for wildcard too

This commit is contained in:
Nodir Temirkhodjaev 2024-02-02 18:04:27 +03:00
parent 96dae7f9d9
commit 8cc60c496c
2 changed files with 17 additions and 6 deletions

View File

@ -126,7 +126,7 @@ void ProgramEditDialog::initializePathNameFields()
const bool isPathEditable = isSingleSelection && (m_appRow.appId == 0 || isWildcard());
initializePathField(isSingleSelection, isPathEditable);
initializeNameField(isSingleSelection, isPathEditable);
initializeNameField(isSingleSelection);
}
void ProgramEditDialog::initializePathField(bool isSingleSelection, bool isPathEditable)
@ -143,7 +143,7 @@ void ProgramEditDialog::initializePathField(bool isSingleSelection, bool isPathE
m_editWildcard->setVisible(isWildcard());
}
void ProgramEditDialog::initializeNameField(bool isSingleSelection, bool isPathEditable)
void ProgramEditDialog::initializeNameField(bool isSingleSelection)
{
m_btSelectFile->setEnabled(isSingleSelection);
m_editName->setText(isSingleSelection ? m_appRow.appName : QString());
@ -154,9 +154,7 @@ void ProgramEditDialog::initializeNameField(bool isSingleSelection, bool isPathE
m_editNotes->setText(m_appRow.notes);
m_editNotes->setEnabled(isSingleSelection);
m_labelEditNotes->setPixmap(isSingleSelection && !isPathEditable
? IoC<AppInfoCache>()->appPixmap(m_appRow.appPath)
: QPixmap());
m_labelEditNotes->setPixmap(appIcon(isSingleSelection));
if (isSingleSelection) {
if (m_appRow.appName.isEmpty()) {
@ -165,6 +163,17 @@ void ProgramEditDialog::initializeNameField(bool isSingleSelection, bool isPathE
}
}
QPixmap ProgramEditDialog::appIcon(bool isSingleSelection) const
{
if (!isSingleSelection)
return {};
if (isWildcard())
return IconCache::file(":/icons/asterisk_orange.png");
return IoC<AppInfoCache>()->appPixmap(m_appRow.appPath);
}
void ProgramEditDialog::initializeFocus()
{
if (!isEmpty()) {

View File

@ -53,7 +53,9 @@ protected:
private:
void initializePathNameFields();
void initializePathField(bool isSingleSelection, bool isPathEditable);
void initializeNameField(bool isSingleSelection, bool isPathEditable);
void initializeNameField(bool isSingleSelection);
QPixmap appIcon(bool isSingleSelection) const;
void initializeFocus();