Fix icon updating after enabling tray counter on XEmbed and fix custom icon on SNI (#56)
This commit is contained in:
parent
2232e9881b
commit
f9ad9ce03b
1 changed files with 11 additions and 7 deletions
|
|
@ -111,6 +111,13 @@ int GetCounterSlice(int counter) {
|
||||||
: counter;
|
: counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UseIconFromTheme(const QString &iconName) {
|
||||||
|
return cDisableTrayCounter()
|
||||||
|
&& !QFileInfo::exists(cWorkingDir() + "tdata/icon.png")
|
||||||
|
&& cCustomAppIcon() == 0
|
||||||
|
&& !iconName.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
bool IsIconRegenerationNeeded(
|
bool IsIconRegenerationNeeded(
|
||||||
int counter,
|
int counter,
|
||||||
bool muted,
|
bool muted,
|
||||||
|
|
@ -153,10 +160,7 @@ QIcon TrayIconGen(int counter, bool muted) {
|
||||||
|
|
||||||
const auto iconName = GetTrayIconName(counter, muted);
|
const auto iconName = GetTrayIconName(counter, muted);
|
||||||
|
|
||||||
if (cDisableTrayCounter()
|
if (UseIconFromTheme(iconName)) {
|
||||||
&& !QFileInfo::exists(cWorkingDir() + "tdata/icon.png")
|
|
||||||
&& cCustomAppIcon() == 0
|
|
||||||
&& !iconName.isEmpty()) {
|
|
||||||
const auto result = QIcon::fromTheme(iconName);
|
const auto result = QIcon::fromTheme(iconName);
|
||||||
UpdateIconRegenerationNeeded(result, counter, muted, iconThemeName);
|
UpdateIconRegenerationNeeded(result, counter, muted, iconThemeName);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -181,7 +185,8 @@ QIcon TrayIconGen(int counter, bool muted) {
|
||||||
if (currentImageBack.isNull()
|
if (currentImageBack.isNull()
|
||||||
|| iconThemeName != TrayIconThemeName
|
|| iconThemeName != TrayIconThemeName
|
||||||
|| iconName != TrayIconName
|
|| iconName != TrayIconName
|
||||||
|| cCustomAppIcon() != TrayIconCustomId) {
|
|| cCustomAppIcon() != TrayIconCustomId
|
||||||
|
|| cDisableTrayCounter() != TrayIconCounterDisabled) {
|
||||||
if (QFileInfo::exists(cWorkingDir() + "tdata/icon.png")) {
|
if (QFileInfo::exists(cWorkingDir() + "tdata/icon.png")) {
|
||||||
currentImageBack = QImage(cWorkingDir() + "tdata/icon.png");
|
currentImageBack = QImage(cWorkingDir() + "tdata/icon.png");
|
||||||
} else if (cCustomAppIcon() != 0) {
|
} else if (cCustomAppIcon() != 0) {
|
||||||
|
|
@ -527,8 +532,7 @@ void MainWindow::psTrayMenuUpdated() {
|
||||||
void MainWindow::setSNITrayIcon(int counter, bool muted) {
|
void MainWindow::setSNITrayIcon(int counter, bool muted) {
|
||||||
const auto iconName = GetTrayIconName(counter, muted);
|
const auto iconName = GetTrayIconName(counter, muted);
|
||||||
|
|
||||||
if (cDisableTrayCounter()
|
if (UseIconFromTheme(iconName)
|
||||||
&& !iconName.isEmpty()
|
|
||||||
&& (!InSnap()
|
&& (!InSnap()
|
||||||
|| qEnvironmentVariableIsSet(kForcePanelIcon.utf8()))) {
|
|| qEnvironmentVariableIsSet(kForcePanelIcon.utf8()))) {
|
||||||
if (_sniTrayIcon->iconName() == iconName) {
|
if (_sniTrayIcon->iconName() == iconName) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue