-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstickynotesignalhandler.cpp
58 lines (46 loc) · 1.1 KB
/
stickynotesignalhandler.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "stickynotesignalhandler.h"
#include <QDebug>
StickyNoteSignalHandler::StickyNoteSignalHandler(QObject *parent) :
QObject(parent), m_isScrolling(false)
{
m_scrollSpeed = new QTimer(this);
m_scrollSpeed->setInterval(40);
// m_scrollSpeed->setSingleShot(true);
connect(m_scrollSpeed, SIGNAL(timeout()), this, SLOT(scroll()));
}
void StickyNoteSignalHandler::signal_submitLine(QString line)
{
emit submitLine(line);
}
void StickyNoteSignalHandler::setNote(StickyNote* note)
{
m_note = note;
}
void StickyNoteSignalHandler::signal_scrollDown()
{
if(m_isScrolling) return;
m_isScrollingUp = 0;
m_scrollSpeed->start();
}
void StickyNoteSignalHandler::signal_scrollUp()
{
if(m_isScrolling) return;
m_isScrollingUp = 1;
m_scrollSpeed->start();
}
void StickyNoteSignalHandler::signal_stopScroll()
{
m_scrollSpeed->stop();
}
void StickyNoteSignalHandler::scroll()
{
m_isScrolling = true;
if(m_isScrollingUp)
emit scrollUp();
else
emit scrollDown();
}
void StickyNoteSignalHandler::finishedScroll()
{
m_isScrolling = false;
}