1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'pr1370'

This commit is contained in:
Dubslow 2015-03-11 22:33:30 -05:00
commit 407ffef1b9
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
3 changed files with 11 additions and 15 deletions

View File

@ -199,7 +199,7 @@ void GeneralForm::onSetCloseToTray()
void GeneralForm::onSetLightTrayIcon() void GeneralForm::onSetLightTrayIcon()
{ {
Settings::getInstance().setLightTrayIcon(bodyUI->lightTrayIcon->isChecked()); Settings::getInstance().setLightTrayIcon(bodyUI->lightTrayIcon->isChecked());
Widget::getInstance()->updateTrayIcon(); Widget::getInstance()->updateIcons();
} }
void GeneralForm::onSetMinimizeToTray() void GeneralForm::onSetMinimizeToTray()

View File

@ -92,10 +92,6 @@ void Widget::init()
{ {
ui->setupUi(this); ui->setupUi(this);
QIcon themeIcon = QIcon::fromTheme("qtox");
if (!themeIcon.isNull())
setWindowIcon(themeIcon);
timer = new QTimer(); timer = new QTimer();
timer->start(1000); timer->start(1000);
offlineMsgTimer = new QTimer(); offlineMsgTimer = new QTimer();
@ -173,6 +169,7 @@ void Widget::init()
Style::setThemeColor(Settings::getInstance().getThemeColor()); Style::setThemeColor(Settings::getInstance().getThemeColor());
reloadTheme(); reloadTheme();
updateIcons();
filesForm = new FilesForm(); filesForm = new FilesForm();
addFriendForm = new AddFriendForm; addFriendForm = new AddFriendForm;
@ -226,11 +223,8 @@ void Widget::setTranslation()
QCoreApplication::installTranslator(translator); QCoreApplication::installTranslator(translator);
} }
void Widget::updateTrayIcon() void Widget::updateIcons()
{ {
if (!icon)
return;
QString status; QString status;
if (eventIcon) if (eventIcon)
status = "event"; status = "event";
@ -248,6 +242,8 @@ void Widget::updateTrayIcon()
ico = QIcon(":img/taskbar/" + color + "/taskbar_" + status + ".svg"); ico = QIcon(":img/taskbar/" + color + "/taskbar_" + status + ".svg");
} }
setWindowIcon(ico);
if (icon)
icon->setIcon(ico); icon->setIcon(ico);
} }
@ -394,7 +390,7 @@ void Widget::onStatusSet(Status status)
ui->statusButton->setIcon(QIcon(":img/status/dot_away_2x.png")); ui->statusButton->setIcon(QIcon(":img/status/dot_away_2x.png"));
break; break;
} }
updateTrayIcon(); updateIcons();
} }
void Widget::setWindowTitle(const QString& title) void Widget::setWindowTitle(const QString& title)
@ -986,7 +982,7 @@ bool Widget::event(QEvent * e)
{ {
eventFlag = false; eventFlag = false;
eventIcon = false; eventIcon = false;
updateTrayIcon(); updateIcons();
} }
default: default:
break; break;
@ -1028,7 +1024,7 @@ void Widget::onEventIconTick()
if (eventFlag) if (eventFlag)
{ {
eventIcon ^= true; eventIcon ^= true;
updateTrayIcon(); updateIcons();
} }
} }
@ -1040,7 +1036,7 @@ void Widget::onTryCreateTrayIcon()
if (QSystemTrayIcon::isSystemTrayAvailable()) if (QSystemTrayIcon::isSystemTrayAvailable())
{ {
icon = new SystemTrayIcon; icon = new SystemTrayIcon;
updateTrayIcon(); updateIcons();
trayMenu = new QMenu; trayMenu = new QMenu;
actionQuit = new QAction(tr("&Quit"), this); actionQuit = new QAction(tr("&Quit"), this);

View File

@ -63,7 +63,7 @@ public:
bool getIsWindowMinimized(); bool getIsWindowMinimized();
void clearContactsList(); void clearContactsList();
void setTranslation(); void setTranslation();
void updateTrayIcon(); void updateIcons();
~Widget(); ~Widget();
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);