mirror of https://github.com/procxx/kepka.git
fixed popup hide, moved toggle notifications display moved under open / minimize in tray menu
This commit is contained in:
parent
17114350c4
commit
4f562bca09
|
@ -363,6 +363,7 @@ void PopupMenu::paintEvent(QPaintEvent *e) {
|
|||
QPainter::CompositionMode m = p.compositionMode();
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
if (_a_hide.animating()) {
|
||||
p.setOpacity(a_opacity.current());
|
||||
p.drawPixmap(0, 0, _cache);
|
||||
return;
|
||||
}
|
||||
|
@ -494,13 +495,9 @@ void PopupMenu::fastHide() {
|
|||
void PopupMenu::hideStart() {
|
||||
if (isHidden()) return;
|
||||
|
||||
if (cPlatform() == dbipMac) {
|
||||
fastHide(); // animated itself
|
||||
} else {
|
||||
_cache = myGrab(this);
|
||||
a_opacity.start(0);
|
||||
_a_hide.start();
|
||||
}
|
||||
_cache = myGrab(this);
|
||||
a_opacity.start(0);
|
||||
_a_hide.start();
|
||||
}
|
||||
|
||||
void PopupMenu::hideFinish() {
|
||||
|
|
|
@ -453,13 +453,13 @@ void Window::firstShow() {
|
|||
? lng_disable_notifications_from_tray : lng_enable_notifications_from_tray);
|
||||
|
||||
if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
|
||||
trayIconMenu->addAction(notificationItem, this, SLOT(toggleDisplayNotifyFromTray()))->setEnabled(true);
|
||||
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
|
||||
trayIconMenu->addAction(notificationItem, this, SLOT(toggleDisplayNotifyFromTray()))->setEnabled(true);
|
||||
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
|
||||
} else {
|
||||
trayIconMenu->addAction(notificationItem, this, SLOT(toggleDisplayNotifyFromTray()))->setEnabled(true);
|
||||
trayIconMenu->addAction(lang(lng_open_from_tray), this, SLOT(showFromTray()))->setEnabled(true);
|
||||
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
|
||||
trayIconMenu->addAction(notificationItem, this, SLOT(toggleDisplayNotifyFromTray()))->setEnabled(true);
|
||||
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
|
||||
}
|
||||
psUpdateWorkmode();
|
||||
|
@ -1047,17 +1047,20 @@ void Window::updateTrayMenu(bool force) {
|
|||
QString notificationItem = lang(cDesktopNotify()
|
||||
? lng_disable_notifications_from_tray : lng_enable_notifications_from_tray);
|
||||
|
||||
QAction *first = trayIconMenu->actions().at(0);
|
||||
first->setText(notificationItem);
|
||||
if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
|
||||
QAction *second = trayIconMenu->actions().at(1);
|
||||
second->setText(lang(active ? lng_minimize_to_tray : lng_open_from_tray));
|
||||
disconnect(second, SIGNAL(triggered(bool)), 0, 0);
|
||||
connect(second, SIGNAL(triggered(bool)), this, active ? SLOT(minimizeToTray()) : SLOT(showFromTray()));
|
||||
} else {
|
||||
QAction *third = trayIconMenu->actions().at(2);
|
||||
third->setDisabled(!isVisible());
|
||||
}
|
||||
QAction *toggle = trayIconMenu->actions().at(0);
|
||||
disconnect(toggle, SIGNAL(triggered(bool)), this, SLOT(minimizeToTray()));
|
||||
disconnect(toggle, SIGNAL(triggered(bool)), this, SLOT(showFromTray()));
|
||||
connect(toggle, SIGNAL(triggered(bool)), this, active ? SLOT(minimizeToTray()) : SLOT(showFromTray()));
|
||||
toggle->setText(lang(active ? lng_minimize_to_tray : lng_open_from_tray));
|
||||
|
||||
trayIconMenu->actions().at(1)->setText(notificationItem);
|
||||
} else {
|
||||
QAction *minimize = trayIconMenu->actions().at(1);
|
||||
minimize->setDisabled(!isVisible());
|
||||
|
||||
trayIconMenu->actions().at(2)->setText(notificationItem);
|
||||
}
|
||||
#ifndef Q_OS_WIN
|
||||
if (trayIcon) {
|
||||
trayIcon->setContextMenu((active || cPlatform() != dbipMac) ? trayIconMenu : 0);
|
||||
|
|
Loading…
Reference in New Issue