sushantg11 / cuberok

Automatically exported from code.google.com/p/cuberok
GNU General Public License v3.0
0 stars 0 forks source link

[Patch] Systray icon mouse click behaviour #16

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
hi again,

here is a very small patch fixing strange behaviour of left-mouse click on
the systray icon. It should hide/show the window if it's shown/hidden as
it's usual for this kind of application. Anyway - feel free to commit or
reject it if you wish ;)

It just flashes (reactivates) the main window with the old code.

And one more thing - dunno why you require to call the setVisible() for all
child wodgets. It should be done automatically. But I'm not familiar with
Cuberok guts yet ;)

P.S.: can you fill SVN messages/comments for next commits, please? It's
helpful for occassional SVN users like me...

Patch:

void Cuberok::showhide(bool s)
{
    bool act = !isVisible();
    setVisible(act);
    if (act)
        activateWindow();
    /*
    bool vis = isVisible();
    if(vis && s) activateWindow();
    else if(vis != s) {
        vis = s;
        setVisible(vis);
        foreach (QWidget *widget, QApplication::allWidgets()) {
            QDialog *d = qobject_cast<QDialog*>(widget);
            if(d) d->setVisible(vis);   
        }
    }*/
}

Original issue reported on code.google.com by yarpe...@gmail.com on 9 Apr 2009 at 8:01

GoogleCodeExporter commented 8 years ago
Thanks, patch was committed

Original comment by drmoriar...@gmail.com on 9 Apr 2009 at 11:57

GoogleCodeExporter commented 8 years ago
Если вы не против, я предложу ещё такой 
пустяк. Клик средней кнопкой мыши поствит 
трек на паузу или снимет с паузы. Второе 
изменение исправляет поведение на линуксе, 
где окно из трея не разворачивалось, а 
появлялось свёрнутым в панели задач.

Index: src/cuberok.cpp
===================================================================
--- src/cuberok.cpp     (revision 200)
+++ src/cuberok.cpp     (working copy)
@@ -227,6 +227,8 @@
 {
        if(r == QSystemTrayIcon::Trigger) {
                showhide(true);
+       } else if ( r == QSystemTrayIcon::MiddleClick ) {
+               ui.actionPause->trigger();
        }
 }

@@ -234,9 +236,10 @@
 {
        bool act = !isVisible();
        setVisible(act);
-       if (act)
-               activateWindow();
-
+       if (act) {
+               activateWindow(); // for windows
+               showNormal(); // for linux
+       }
        /*bool vis = isVisible();
        if(vis && s) activateWindow();
        else if(vis != s) {

Original comment by nomen.in...@gmail.com on 22 May 2009 at 8:35

GoogleCodeExporter commented 8 years ago
Спасибо, патч принят

Original comment by drmoriar...@gmail.com on 23 May 2009 at 5:36