Here is the header file and some of the source file, if you want to see more code just ask.
Code:
#ifndef KETHER_H
#define KETHER_H
#include <QTcpSocket>
#include <QTcpServer>
#include <QString>
#include <QDate>
#include "ui_kether.h"
class QTcpSocket;
class QTcpServer;
class Kether : public QWidget
{
Q_OBJECT
public:
Kether(QWidget *parent = 0);
public slots:
QString morseToText(QString morseCode);
QString textToMorse(QString message);
void on_ipConnect_clicked();
void on_ipDisconnect_clicked();
void on_ipAddress_textEdited();
void on_sendMessage_clicked();
void on_messageEntry_textEdited(QString message);
void on_listen_clicked();
void readData();
void reportDisconnect();
void connectedToHost();
void handleNewConnection();
private:
Ui::kether ui;
QTcpSocket *tcpSocket;
QTcpServer *tcpServer;
QDate todaysDate;
QString dateFormat, logFileName;
const static quint16 port = 9001;
qint64 oneByte;
char endOfCharacter;
static const char morse[26][6];
static const char lookup[26];
};
/* const char Kether::morse[26][6] = {{'.','-','\0'}, //a
{'-','.','.','.','\0'}, //b
{'-','.','-','.','\0'}, //c
{'-','.','.','\0'}, //d
{'.','\0'}, //e
{'.','.','-','.','\0'}, //f
{'-','-','.','\0'}, //g
{'.','.','.','.','\0'}, //h
{'.','.','\0'}, //i
{'.','-','-','-','\0'}, //j
{'-','.','-','\0'}, //k
{'.','-','.','.','\0'}, //l
{'-','-','\0'}, //m
{'-','.','\0'}, //n
{'-','-','-','\0'}, //o
{'.','-','-','.','\0'}, //p
{'-','-','.','-','\0'}, //q
{'.','-','.','\0'}, //r
{'.','.','.','\0'}, //s
{'-','\0'}, //t
{'.','.','-','\0'}, //u
{'.','.','.','-','\0'}, //v
{'.','-','-','\0'}, //w
{'-','.','.','-','\0'}, //x
{'-','.','-','-','\0'}, //y
{'-','-','.','.','\0'} //z
};
const char Kether::lookup[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m'
,'n','o','p','q','r','s','t','u','v','w','x','y','z'};*/
#endif
Relevant part of the constructor:
Code:
const char Kether::lookup[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m'
,'n','o','p','q','r','s','t','u','v','w','x','y','z'};
const char Kether::morse[26][6] = {{'.','-','\0'}, //a
{'-','.','.','.','\0'}, //b
{'-','.','-','.','\0'}, //c
{'-','.','.','\0'}, //d
{'.','\0'}, //e
{'.','.','-','.','\0'}, //f
{'-','-','.','\0'}, //g
{'.','.','.','.','\0'}, //h
{'.','.','\0'}, //i
{'.','-','-','-','\0'}, //j
{'-','.','-','\0'}, //k
{'.','-','.','.','\0'}, //l
{'-','-','\0'}, //m
{'-','.','\0'}, //n
{'-','-','-','\0'}, //o
{'.','-','-','.','\0'}, //p
{'-','-','.','-','\0'}, //q
{'.','-','.','\0'}, //r
{'.','.','.','\0'}, //s
{'-','\0'}, //t
{'.','.','-','\0'}, //u
{'.','.','.','-','\0'}, //v
{'.','-','-','\0'}, //w
{'-','.','.','-','\0'}, //x
{'-','.','-','-','\0'}, //y
{'-','-','.','.','\0'} //z
};