~unity-2d-team/unity-2d/shortcut-hint-overlay

« back to all changes in this revision

Viewing changes to libunity-2d-private/src/bfb.cpp

  • Committer: Tiago Salem Herrmann
  • Date: 2012-03-19 15:28:41 UTC
  • mfrom: (771.40.182 unity-2d)
  • Revision ID: tiago.herrmann@canonical.com-20120319152841-2hfflo67muks7gca
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
// Qt
28
28
 
29
29
BfbItem::BfbItem()
30
 
: m_active(false), m_view(NULL)
 
30
: m_active(false), m_activeScreen(-1), m_manager(NULL)
31
31
{
32
32
}
33
33
 
40
40
    return m_active;
41
41
}
42
42
 
 
43
int BfbItem::activeScreen() const
 
44
{
 
45
    if (active()) {
 
46
        return m_activeScreen;
 
47
    } else {
 
48
        return -1;
 
49
    }
 
50
}
 
51
 
43
52
bool BfbItem::running() const
44
53
{
45
54
    return false;
70
79
    return false;
71
80
}
72
81
 
73
 
QObject* BfbItem::dashView() const
 
82
QObject* BfbItem::dashManager() const
74
83
{
75
 
    return m_view;
 
84
    return m_manager;
76
85
}
77
86
 
78
 
void BfbItem::setDashView(QObject* view)
 
87
void BfbItem::setDashManager(QObject* manager)
79
88
{
80
 
    if (m_view != NULL) {
81
 
        disconnect(view);
 
89
    if (m_manager != NULL) {
 
90
        disconnect(m_manager);
82
91
    }
83
 
    m_view = view;
84
 
    if (m_view != NULL) {
85
 
        connect(view, SIGNAL(dashActiveChanged(bool)), this, SLOT(slotDashActiveChanged(bool)));
 
92
    m_manager = manager;
 
93
    if (m_manager != NULL) {
 
94
        connect(manager, SIGNAL(dashActiveChanged(bool)), this, SLOT(slotDashActiveChanged(bool)));
 
95
        connect(manager, SIGNAL(dashScreenChanged(int)), this, SLOT(slotDashScreenChanged(int)));
86
96
    }
87
97
}
88
98
 
89
99
void BfbItem::activate()
90
100
{
91
 
    Q_ASSERT(m_view != NULL);
92
 
    if (m_view != NULL) {
93
 
        QMetaObject::invokeMethod(m_view, "toggleDash");
 
101
    Q_ASSERT(m_manager != NULL);
 
102
    if (m_manager != NULL) {
 
103
        QMetaObject::invokeMethod(m_manager, "toggleDashRequested");
94
104
    }
95
105
}
96
106
 
103
113
    if (m_active != active) {
104
114
        m_active = active;
105
115
        Q_EMIT activeChanged(m_active);
 
116
        if (m_active) {
 
117
            Q_EMIT activeScreenChanged(m_activeScreen);
 
118
        }
 
119
    }
 
120
}
 
121
 
 
122
void BfbItem::slotDashScreenChanged(int activeScreen)
 
123
{
 
124
    if (m_activeScreen != activeScreen) {
 
125
        m_activeScreen = activeScreen;
 
126
        if (m_active) {
 
127
            Q_EMIT activeScreenChanged(m_activeScreen);
 
128
        }
106
129
    }
107
130
}
108
131
 
132
155
    return QVariant::fromValue(m_bfbItem);
133
156
}
134
157
 
135
 
QObject* BfbModel::dashView() const
 
158
QObject* BfbModel::dashManager() const
136
159
{
137
 
    return m_bfbItem->dashView();
 
160
    return m_bfbItem->dashManager();
138
161
}
139
162
 
140
 
void BfbModel::setDashView(QObject* view)
 
163
void BfbModel::setDashManager(QObject* manager)
141
164
{
142
 
    m_bfbItem->setDashView(view);
 
165
    m_bfbItem->setDashManager(manager);
143
166
}
144
167
 
145
168
#include <bfb.moc>