-
Notifications
You must be signed in to change notification settings - Fork 23
/
wdgTvController.cpp
56 lines (46 loc) · 1.48 KB
/
wdgTvController.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
#include "wdgTvController.h"
#include "ui_wdgTvController.h"
#include "tvNetworkControl.h"
#include <QFile>
wdgTvController::wdgTvController(QWidget *parent) :
QWidget(parent),
ui(new Ui::wdgTvController)
{
ui->setupUi(this);
m_tvController = new tvNetworkControl(this);
connect(m_tvController, SIGNAL(logText(QString)), ui->txtEditInformations, SLOT(appendHtml(QString)));
// key codes found here: http://wiki.samygo.tv/index.php5/D-Series_Key_Codes
QFile file(":/samsungKeyCodes.txt");
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
while (!file.atEnd()) {
QByteArray line = file.readLine();
//make sure we don't have spacing characters that would break the base64 code
QString lineStr(line);
lineStr.remove(' ');
lineStr.remove('\n');
ui->ctlSendKey->addItem(lineStr);
}
}
}
wdgTvController::~wdgTvController()
{
delete ui;
}
void wdgTvController::on_ctlIP_returnPressed()
{
m_tvController->connectToTV(ui->ctlIP->text());
}
void wdgTvController::on_btConnect_clicked()
{
m_tvController->connectToTV(ui->ctlIP->text());
}
void wdgTvController::on_btSendID_clicked()
{
m_tvController->sendIDPacket(ui->ctlRemoteIP->text(),
ui->ctlRemoteID->text(),
ui->ctlRemoteName->text());
}
void wdgTvController::on_btSendKey_clicked()
{
m_tvController->sendKey(ui->ctlSendKey->currentText());
}