~ubuntu-branches/ubuntu/wily/smplayer/wily

« back to all changes in this revision

Viewing changes to src/mplayerwindow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-11-04 12:45:38 UTC
  • mto: (1.1.10 upstream) (3.1.3 squeeze)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20091104124538-i5ntu42ni0e1njnv
ImportĀ upstreamĀ versionĀ 0.6.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        last_cursor_pos = QPoint(0,0);
51
51
#endif
52
52
 
53
 
        QTimer *timer = new QTimer(this);
54
 
        connect( timer, SIGNAL(timeout()), this, SLOT(checkMousePos()) );
55
 
#if NEW_MOUSE_CHECK_POS
56
 
        timer->start(500);
57
 
#else
58
 
        timer->start(2000);
 
53
        check_mouse_timer = new QTimer(this);
 
54
        connect( check_mouse_timer, SIGNAL(timeout()), this, SLOT(checkMousePos()) );
 
55
#if !NEW_MOUSE_CHECK_POS
 
56
        check_mouse_timer->start(2000);
59
57
#endif
60
58
 
61
59
        // Change attributes
65
63
        setAttribute(Qt::WA_PaintOnScreen);
66
64
        setAttribute(Qt::WA_PaintUnclipped);
67
65
        //setAttribute(Qt::WA_PaintOutsidePaintEvent);
 
66
 
 
67
#if NEW_MOUSE_CHECK_POS
 
68
        setAutoHideInterval(1000);
 
69
        setAutoHideCursor(false);
 
70
#endif
68
71
}
69
72
 
70
73
Screen::~Screen() {
78
81
}
79
82
 
80
83
#if NEW_MOUSE_CHECK_POS
 
84
void Screen::setAutoHideCursor(bool b) {
 
85
        qDebug("Screen::setAutoHideCursor: %d", b);
 
86
 
 
87
        autohide_cursor = b;
 
88
        if (autohide_cursor) {
 
89
                check_mouse_timer->setInterval(autohide_interval);
 
90
                check_mouse_timer->start();
 
91
        } else {
 
92
                check_mouse_timer->stop();
 
93
        }
 
94
}
 
95
 
81
96
void Screen::checkMousePos() {
82
97
        //qDebug("Screen::checkMousePos");
 
98
 
 
99
        if (!autohide_cursor) {
 
100
                setCursor(QCursor(Qt::ArrowCursor));
 
101
                return;
 
102
        }
 
103
 
83
104
        QPoint pos = mapFromGlobal(QCursor::pos());
84
105
 
 
106
        //qDebug("Screen::checkMousePos: x: %d, y: %d", pos.x(), pos.y());
 
107
 
85
108
        if (mouse_last_position != pos) {
86
109
                setCursor(QCursor(Qt::ArrowCursor));
87
110
        } else {
116
139
}
117
140
#endif
118
141
 
 
142
void Screen::playingStarted() {
 
143
#if NEW_MOUSE_CHECK_POS
 
144
        qDebug("Screen::playingStarted");
 
145
        setAutoHideCursor(true);
 
146
#endif
 
147
}
 
148
 
 
149
void Screen::playingStopped() {
 
150
#if NEW_MOUSE_CHECK_POS
 
151
        qDebug("Screen::playingStopped");
 
152
        setAutoHideCursor(false);
 
153
#endif
 
154
}
 
155
 
119
156
/* ---------------------------------------------------------------------- */
120
157
 
121
158
MplayerLayer::MplayerLayer(QWidget* parent, Qt::WindowFlags f) 
149
186
        qDebug("MplayerLayer::playingStarted");
150
187
        repaint();
151
188
        playing = true;
 
189
 
 
190
        Screen::playingStarted();
152
191
}
153
192
 
154
193
void MplayerLayer::playingStopped() {
155
194
        qDebug("MplayerLayer::playingStopped");
156
195
        playing = false;
157
196
        repaint();
 
197
 
 
198
        Screen::playingStopped();
158
199
}
159
200
 
160
201
/* ---------------------------------------------------------------------- */