Commit 84cb4ff6 authored by Carsten Fuhrmann's avatar Carsten Fuhrmann
Browse files

timer works fine now :D

parent db27210f
......@@ -21,12 +21,9 @@ OverlayController::OverlayController() : QObject()
m_timer = new QTimer;
m_timer->setInterval(100);
m_timer->setInterval(5000);
m_timer->setSingleShot(true);
connect(m_timer, SIGNAL(timeout()), this, SLOT(debugPrint("HUHU")));
m_timer->start();
addChatLine("Test12");
connect(m_timer, SIGNAL(timeout()), this, SLOT(hideChat()));
}
OverlayController::~OverlayController()
......@@ -40,6 +37,7 @@ OverlayController::~OverlayController()
m_msgLines.clear();
delete m_debugWindow;
m_timer->stop();
delete m_timer;
}
......@@ -50,8 +48,22 @@ void OverlayController::deleteChatLine(QLabel * line)
m_msgLines.pop_back();
}
void OverlayController::showChat()
{
for (auto &it : m_msgLines)
it->show();
}
void OverlayController::hideChat()
{
for (auto &it : m_msgLines)
it->hide();
}
void OverlayController::addChatLine(QString message)
{
showChat();
// generate new chatline
QLabel* newChatLine = new QLabel;
......@@ -76,7 +88,8 @@ void OverlayController::addChatLine(QString message)
if (m_msgLines.size() > MAXLINES)
deleteChatLine(m_msgLines.last());
//TODO: delete after time
// hide after time
m_timer->start();
}
void OverlayController::addSpeaker(QString name)
......@@ -131,7 +144,6 @@ void OverlayController::removeSpeaker(QString name)
void OverlayController::debugPrint(QString text)
{
m_debugWindow->setText(text + "\n" + m_debugWindow->text());
m_debugWindow->setText(QString("HUHU") + "\n" + m_debugWindow->text());
}
void OverlayController::reset()
......
......@@ -32,8 +32,12 @@ private:
QTimer* m_timer;
private slots:
private:
void deleteChatLine(QLabel* line);
void showChat();
private slots:
void hideChat();
public:
void addChatLine(QString message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment