~unity-2d-team/unity-2d/trunk

« back to all changes in this revision

Viewing changes to places/app/dashdeclarativeview.cpp

  • Committer: Tarmac
  • Author(s): Michał Sawicz, Albert Astals
  • Date: 2012-02-07 11:29:36 UTC
  • mfrom: (879.11.17 refactor-screeninfo)
  • Revision ID: tarmac-20120207112936-r1iya0418z3d7evn
This, in itself, will not change anything in unity-2d, but will later allow for easier multi-monitor implementation.. Fixes: . Approved by Gerry Boland.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <dashclient.h>
24
24
 
25
25
// Qt
26
 
#include <QDesktopWidget>
27
26
#include <QApplication>
28
27
#include <QBitmap>
29
28
#include <QCloseEvent>
55
54
    setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
56
55
    setTransparentBackground(QX11Info::isCompositingManagerRunning());
57
56
 
58
 
    QDesktopWidget* desktop = QApplication::desktop();
59
 
    connect(desktop, SIGNAL(resized(int)), SIGNAL(screenGeometryChanged()));
60
 
    connect(desktop, SIGNAL(workAreaResized(int)), SLOT(onWorkAreaResized(int)));
 
57
    m_screenInfo = new ScreenInfo(ScreenInfo::TopLeft, this);
 
58
    connect(m_screenInfo, SIGNAL(availableGeometryChanged(QRect)), SLOT(onWorkAreaResized()));
61
59
 
62
60
    updateSize();
63
61
}
64
62
 
65
63
void
66
 
DashDeclarativeView::onWorkAreaResized(int screen)
 
64
DashDeclarativeView::onWorkAreaResized()
67
65
{
68
 
    if (QApplication::desktop()->screenNumber(this) != screen) {
69
 
        return;
70
 
    }
71
 
 
72
66
    updateSize();
73
67
}
74
68
 
85
79
void
86
80
DashDeclarativeView::fitToAvailableSpace()
87
81
{
88
 
    QRect rect = ScreenInfo::instance()->panelsFreeGeometry();
 
82
    QRect rect = m_screenInfo->panelsFreeGeometry();
89
83
    move(rect.topLeft());
90
84
    setFixedSize(rect.size());
91
85
}
93
87
void
94
88
DashDeclarativeView::resizeToDesktopModeSize()
95
89
{
96
 
    QRect rect = ScreenInfo::instance()->panelsFreeGeometry();
 
90
    QRect rect = m_screenInfo->panelsFreeGeometry();
97
91
    int screenRight = rect.right();
98
92
 
99
93
    rect.setWidth(qMin(DASH_DESKTOP_WIDTH, rect.width()));