Make barrier try to read tray icons from themes now.

This commit is contained in:
aeghn 2020-10-27 14:11:11 +08:00
parent fc045fc793
commit 95afed5256
1 changed files with 9 additions and 1 deletions

View File

@ -80,6 +80,14 @@ static const char* barrierIconFiles[] =
#endif #endif
}; };
static const char* barrierIconNames[] =
{
"barrier-disconnected",
"barrier-disconnected",
"barrier-connected",
"barrier-transfering"
};
static const char* barrierLargeIcon = ":/res/icons/256x256/barrier.ico"; static const char* barrierLargeIcon = ":/res/icons/256x256/barrier.ico";
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
@ -296,7 +304,7 @@ void MainWindow::saveSettings()
void MainWindow::setIcon(qBarrierState state) void MainWindow::setIcon(qBarrierState state)
{ {
if (m_pTrayIcon) { if (m_pTrayIcon) {
QIcon icon = QIcon(barrierIconFiles[state]); QIcon icon = QIcon::fromTheme(barrierIconNames[state], QIcon(barrierIconFiles[state]));
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
icon.setIsMask(true); icon.setIsMask(true);
#endif #endif