Implement toggling countdown state.

This commit is contained in:
Andrius Štikonas 2015-09-04 22:49:13 +01:00
parent 1b01658732
commit 1246e6d1db
3 changed files with 8 additions and 1 deletions

View File

@ -64,7 +64,7 @@ void ConsoleReader::run()
(*sockets) [number]->setCountDown(countdown); (*sockets) [number]->setCountDown(countdown);
break; break;
case 'C': case 'C':
(*sockets) [number]->setCountDown(countdown); (*sockets) [number]->toggleCountDown();
break; break;
case 'd': case 'd':
(*sockets) [number]->tableData(); (*sockets) [number]->tableData();

View File

@ -161,6 +161,12 @@ void Socket::setCountDown(uint16_t countdown)
writeSocketData(socketName, remotePassword, timeZone, countdown); writeSocketData(socketName, remotePassword, timeZone, countdown);
} }
void Socket::toggleCountDown()
{
countdownEnabled=!countdownEnabled;
writeSocketData(socketName, remotePassword, timeZone, countdown);
}
void Socket::writeSocketData(QByteArray socketName, QByteArray remotePassword, QByteArray timeZone, uint16_t countdown) void Socket::writeSocketData(QByteArray socketName, QByteArray remotePassword, QByteArray timeZone, uint16_t countdown)
{ {
QByteArray countDown; QByteArray countDown;

View File

@ -49,6 +49,7 @@ public:
void changeSocketPassword(QString newPassword); void changeSocketPassword(QString newPassword);
void changeTimezone(int8_t newTimezone); void changeTimezone(int8_t newTimezone);
void setCountDown(uint16_t countdown); void setCountDown(uint16_t countdown);
void toggleCountDown();
bool parseReply(QByteArray); bool parseReply(QByteArray);
QHostAddress ip; QHostAddress ip;