~ubuntu-branches/ubuntu/precise/unity-2d/precise-security

« back to all changes in this revision

Viewing changes to panel/applets/appname/appnameapplet.cpp

  • Committer: Package Import Robot
  • Author(s): Didier Roche, Didier Roche, Aurélien Gâteau
  • Date: 2012-01-13 09:12:36 UTC
  • mfrom: (1.1.25)
  • Revision ID: package-import@ubuntu.com-20120113091236-844z32uco10hs6ym
Tags: 5.2.0-0ubuntu1
[ Didier Roche ]
* New upstream release:
  - Select quicklist items with just one right click (LP: #688830)
  - Launcher - Dragging and dropping a running application in to the Trash
    should quit the application and (if the app is pinned to the Launcher)
    un-pin the application from the Launcher (LP: #870143)
  - Dash - "See more..." line should be base-aligned with section header
    (LP: #748101)
  - right click on the dash icon should display a list of the lenses
    (LP: #868452)
  - Top Bar - rename the "Desktop" title in the Top Bar (displayed when no
    window has focus)  to "Ubuntu Desktop" (LP: #869873)
  - Application title on quicklist should be bold (or more visible)
    (LP: #900400)
  - unity-2d-launcher crashed with SIGSEGV  when opening a folder on a CD
    (LP: #831868)
  - unity-2d-places crashed with SIGSEGV in QScriptValue::call()
    (LP: #836498)
  - unity-2d-launcher crashed with SIGSEGV in geis_finish() (LP: #850893)
  - unity-2d-places crashed with SIGABRT in raise() (LP: #857575)
  - unity-2d-launcher crashed with SIGSEGV in exit() (LP: #859596)
  - [spread] layout broken since bzr revision 799 of lp:unity-2d
    (LP: #900895)
  - [workspace switcher] keyboard navigation of workspace switcher broken
    for accessibility (LP: #744978)
  - [spread] workspace switcher performance is poor, especially on low
    powered CPUs (LP: #745764)
  - Launcher - the rendering of the BFB and Lens squircle does not match the
    design (LP: #838708)
  - [dash] Huge performance hit when scrolling search results with
    accessibility enabled (LP: #862956)
  - DBUS_STARTER_ADDRESS and DBUS_STARTER_BUS_TYPE aren't always unset from
    environment making gedit and possibly others fail to start (LP: #873027)
  - Win Key can not be disabled in Unity-2d (LP: #873580)
  - [dash] Unity-2d dash very slow to open (LP: #881756)
  - [tests] LauncherViewTest hanging (LP: #894380)
  - [tests] Unit tests failing due to lack of Xserver (LP: #894381)
  - [launcher] Alt+F1 broken: does not give the focus to the launcher's
    content (LP: #901505)
  - [tests] Add Automated User Experience testing (LP: #903495)
  - [workspace switcher] Performance can be poor when using the opengl
    backend because of window texture sizes that are not limited
    (LP: #808716)
  - [dash] no way to unmaximize (LP: #860400)
  - [launcher] In non-composite mode, background is black (LP: #879288)
  - [dash] Unity 2D shows 'Search' instead of 'Run Command' on ALT + F2
    (LP: #883392)
  - [launcher] Removing icon from launcher makes it hide immediately
    (LP: #884410)
  - OpenGL disabled regardless of use-opengl setting (LP: #887957)
  - if libdir does not equal lib (LP: #888164)
  - [launcher] Launcher stuck open while mouse moved to left corner of panel
    (LP: #892004)
  - [dash] Long results label are truncated instead of elided and a few
    pixels of the next line is visible (LP: #901491)
  - [launcher] Dash icon missing in PPA (LP: #903182)
  - [launcher] Tile context menu should appear at mouse click down event
    (LP: #813036)
  - [launcher] Trash tile highlight is truncated top and bottom
    (LP: #876589)
  - [dash] Text highlighting color is wrong (LP: #880222)
  - [launcher] left edge of panel should not reveal launcher (LP: #891636)
  - [dash] Word "Filter results" has underline when highlighted
    (LP: #893061)
  - [launcher] Alt+F1, change desktop, Alt+F1, hit Esc: launcher doesn't
    give away focus (LP: #897640)
  - Top Bar - rename the "Desktop" title in the Top Bar (displayed when no
    window has focus)  to "Ubuntu Desktop" (LP: #869873)
  - [launcher] Show desktop doesn't show launcher (LP: #898161)
  - [launcher] Context menu/tooltip not positioned at Tile center
    (LP: #898349)
  - The QT_LAYOUT_DIRECTION string needs a translator comment (LP: #863058)
  - unity panel menus don't stay open when clicked on second monitor
    (LP: #869196)
  - Dash- More fixes to layout and alignments (LP: #906235)
* debian/control:
  - bump libunitycore build-dep to 5.0.

[ Aurélien Gâteau ]
* debian/control:
  - bump build-dep versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <hotkey.h>
37
37
#include <hotkeymonitor.h>
38
38
#include <indicatorentrywidget.h>
 
39
#include <unity2dtr.h>
39
40
 
40
41
// Bamf
41
42
#include <bamf-application.h>
60
61
public:
61
62
    WindowButton(const PanelStyle::WindowButtonType& buttonType, QWidget* parent = 0)
62
63
    : QAbstractButton(parent)
63
 
    , m_buttonType(buttonType)
 
64
    , m_initialized(false)
64
65
    {
65
 
        loadPixmaps();
 
66
        setButtonType(buttonType);
66
67
        if (buttonType == PanelStyle::MinimizeWindowButton) {
67
68
            setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
68
69
        } else {
69
70
            setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
70
71
        }
71
72
        setAttribute(Qt::WA_Hover);
 
73
        m_initialized = true;
 
74
    }
 
75
 
 
76
    void setButtonType(const PanelStyle::WindowButtonType& buttonType)
 
77
    {
 
78
        if (m_initialized && m_buttonType == buttonType) return;
 
79
 
 
80
        m_buttonType = buttonType;
 
81
        loadPixmaps();
 
82
        update();
72
83
    }
73
84
 
74
85
    QSize minimumSizeHint() const
89
100
    {
90
101
        QPainter painter(this);
91
102
        QPixmap pix;
92
 
        if (isDown()) {
93
 
            pix = m_downPix;
94
 
        } else if (underMouse()) {
95
 
            pix = m_hoverPix;
 
103
        if (isEnabled()) {
 
104
            if (isDown()) {
 
105
                pix = m_downPix;
 
106
            } else if (underMouse()) {
 
107
                pix = m_hoverPix;
 
108
            } else {
 
109
                pix = m_normalPix;
 
110
            }
96
111
        } else {
97
112
            pix = m_normalPix;
98
113
        }
110
125
    QPixmap m_normalPix;
111
126
    QPixmap m_hoverPix;
112
127
    QPixmap m_downPix;
 
128
    bool m_initialized;
113
129
 
114
130
    void loadPixmaps()
115
131
    {
169
185
        m_windowButtonWidget->setFixedWidth(LauncherClient::MaximumWidth);
170
186
        QObject::connect(m_closeButton, SIGNAL(clicked()), m_windowHelper, SLOT(close()));
171
187
        QObject::connect(m_minimizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(minimize()));
172
 
        QObject::connect(m_maximizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(unmaximize()));
 
188
        QObject::connect(m_maximizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(toggleMaximize()));
173
189
    }
174
190
 
175
191
    void setupWindowHelper()
243
259
        || d->m_menuBarWidget->isOpened()
244
260
        );
245
261
    bool showMenu = isOpened && !d->m_menuBarWidget->isEmpty() && isUserVisibleApp;
246
 
    bool showWindowButtons = isOpened && isMaximized;
247
 
    bool showLabel = !(isMaximized && showMenu) && isUserVisibleApp && isOnSameScreen;
 
262
    bool dashCanResize = d->m_windowHelper->dashCanResize();
 
263
    bool dashIsVisible = d->m_windowHelper->dashIsVisible();
 
264
    bool showWindowButtons = (isOpened && isMaximized) || dashIsVisible;
 
265
    bool showAppLabel = !(isMaximized && showMenu) && isUserVisibleApp && isOnSameScreen;
 
266
    bool showDesktopLabel = !app;
248
267
 
249
268
    d->m_windowButtonWidget->setVisible(showWindowButtons);
 
269
    d->m_maximizeButton->setButtonType(isMaximized ?
 
270
                                       PanelStyle::UnmaximizeWindowButton :
 
271
                                       PanelStyle::MaximizeWindowButton);
 
272
    /* disable the minimize button for the dash */
 
273
    d->m_minimizeButton->setEnabled(!dashIsVisible);
 
274
    /* and the maximize button, if the dash is not resizeable */
 
275
    d->m_maximizeButton->setEnabled(!dashIsVisible || dashCanResize);
250
276
 
251
 
    d->m_label->setVisible(showLabel);
252
 
    if (showLabel) {
253
 
        // Define text
254
 
        QString text;
255
 
        if (app) {
256
 
            if (isMaximized) {
257
 
                // When maximized, show window title
258
 
                BamfWindow* bamfWindow = BamfMatcher::get_default().active_window();
259
 
                if (bamfWindow) {
260
 
                    text = bamfWindow->name();
 
277
    if (showAppLabel || showDesktopLabel || dashIsVisible) {
 
278
        d->m_label->setVisible(true);
 
279
        if (showAppLabel) {
 
280
            // Define text
 
281
            QString text;
 
282
            if (app) {
 
283
                if (isMaximized) {
 
284
                    // When maximized, show window title
 
285
                    BamfWindow* bamfWindow = BamfMatcher::get_default().active_window();
 
286
                    if (bamfWindow) {
 
287
                        text = bamfWindow->name();
 
288
                    }
 
289
                } else {
 
290
                    // When not maximized, show application name
 
291
                    text = app->name();
261
292
                }
262
 
            } else {
263
 
                // When not maximized, show application name
264
 
                text = app->name();
265
293
            }
 
294
            d->m_label->setText(text);
 
295
        } else if (showDesktopLabel) {
 
296
            d->m_label->setText(u2dTr("Ubuntu Desktop"));
 
297
        } else {
 
298
            d->m_label->setText("");
266
299
        }
267
 
        d->m_label->setText(text);
268
300
 
269
 
        // Define width
 
301
        // Define label width
270
302
        if (!isMaximized && showMenu) {
271
303
            d->m_label->setMaximumWidth(LauncherClient::MaximumWidth);
272
304
        } else {
273
305
            d->m_label->setMaximumWidth(QWIDGETSIZE_MAX);
274
306
        }
 
307
    } else {
 
308
        d->m_label->setVisible(false);
275
309
    }
276
310
 
277
311
    d->m_menuBarWidget->setVisible(showMenu);
314
348
            d->m_windowHelper->drag(d->m_dragStartPosition);
315
349
        }
316
350
    } else {
317
 
        Unity2d::PanelApplet::mouseReleaseEvent(event);
 
351
        Unity2d::PanelApplet::mouseMoveEvent(event);
318
352
    }
319
353
}
320
354