/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Main.cpp |
---|
0,0 → 1,522 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#include <QMessageBox> |
#include "dlg_Main.h" |
// Konstruktor Main-Form |
//////////////////////// |
dlg_Main::dlg_Main() |
{ |
setupUi(this); |
o_Settings = new cSettings(); |
o_Input = new Input(); |
f_Terminal = new dlg_Terminal(this); |
init_GUI(); |
init_Connections(); |
init_TCP(); |
} |
void dlg_Main::set_ARGV(char *Programm) |
{ |
QString tmp = QString(Programm); |
QMK_Dir = tmp.left(tmp.lastIndexOf("/")); |
} |
// Grafische Oberfläche initialisieren |
////////////////////////////////////// |
void dlg_Main::init_GUI() |
{ |
setWindowTitle(QA_NAME + " " + QA_VERSION); |
resize(o_Settings->GUI.Size); |
move(o_Settings->GUI.Point); |
if (o_Settings->GUI.isMax) |
{ |
showMaximized(); |
} |
// todo: In abhängigkeit von Settings |
wg_IP->setVisible(false); |
rb_Device->setChecked(true); |
for (int z = 0; z < DEV_IP_MAX; z++) |
{ |
Item[z][0] = new QListWidgetItem(); |
Item[z][1] = new QListWidgetItem(); |
} |
for(int z = 0; z < o_Settings->CLIENT.TTY_MAX; z++) |
{ |
if (cb_Device->findText(o_Settings->CLIENT.TTY_DEVICES[z]) == -1) |
{ |
cb_Device->addItem(o_Settings->CLIENT.TTY_DEVICES[z]); |
} |
} |
cb_Device->setCurrentIndex(o_Settings->CLIENT.TTY_ID); |
} |
// Signale mit Slots verbinden |
////////////////////////////// |
void dlg_Main::init_Connections() |
{ |
// Connect-Button |
connect(btn_Connect, SIGNAL(clicked()), this, SLOT(slot_btn_Connect())); |
connect(btn_cScope, SIGNAL(clicked()), this, SLOT(slot_btn_cScope())); |
connect(btn_cSettings, SIGNAL(clicked()), this, SLOT(slot_btn_cSettings())); |
connect(btn_cMaps, SIGNAL(clicked()), this, SLOT(slot_btn_cMaps())); |
connect(btn_cVoice, SIGNAL(clicked()), this, SLOT(slot_btn_cVoice())); |
connect(btn_cLogger, SIGNAL(clicked()), this, SLOT(slot_btn_cLogger())); |
connect(btn_Terminal, SIGNAL(clicked()), this, SLOT(slot_btn_Terminal())); |
// About QMK-Kernel & About-QT Dialog einfügen |
connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
connect(ac_Server, SIGNAL(triggered()), this, SLOT(slot_ac_Server())); |
menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
} |
// IP-Ports initialisiern |
///////////////////////// |
// todo: Port und Anzahl aus Settings |
bool dlg_Main::init_TCP() |
{ |
Connect_Count = 0; |
Connection[0].TCP = false; |
Connection[0].UDP = false; |
for (int a = 0; a < DEV_IP_MAX; a++) |
{ |
Connection[a].Open = false; |
} |
TCP_Server = new QTcpServer(this); |
if (TCP_Server->listen(QHostAddress::Any, qint16(o_Settings->SERVER.TCP_PORT))) |
{ |
connect(TCP_Server, SIGNAL(newConnection()), this, SLOT(slot_TCP_NewConnection())); |
} |
return true; |
} |
// Eingangsdaten verarbeiten |
//////////////////////////// |
void dlg_Main::parse_Input_Data(QString t_Data) |
{ |
unsigned char OutData[150]; |
char *InData = t_Data.toLatin1().data(); |
if (HandlerMK::Decode_64(InData, t_Data.length(), OutData) != 0) |
{ |
switch(InData[2]) |
{ |
case 'V' : // Versions-Info |
{ |
o_Input->stop_Resend(DATA_VERSION); |
VersionInfo = HandlerMK::parse_Version(OutData, InData[1] - 'a'); |
lb_Info->setText(tr("Verbunden mit ") + VersionInfo.Hardware + " " + VersionInfo.Version + trUtf8(" über ") + s_Input.Main + "."); |
if (VersionInfo.ID == ADDRESS_FC) |
{ |
rb_FC->setChecked(true); |
} |
if (VersionInfo.ID == ADDRESS_NC) |
{ |
rb_NC->setChecked(true); |
} |
if (VersionInfo.ID == ADDRESS_MK3MAG) |
{ |
rb_MK3MAG->setChecked(true); |
} |
} |
break; |
} |
} |
} |
void dlg_Main::route_Input_Data(QString t_Data) |
{ |
// An alle offenen TCP-Sockets senden. |
for (int a = 1; a < DEV_IP_MAX; a++) |
{ |
if (Connection[a].Open == true) |
{ |
if (Connection[a].TCP == true) |
{ |
send_TCP(o_TCP[a], t_Data + "\r"); |
} |
} |
} |
} |
void dlg_Main::parse_TCP_Data(QString t_Data, int t_ID) |
{ |
QStringList Data; |
Data = t_Data.split(":"); |
if (Data.count() > 1) |
{ |
int CMD = Data[2].toInt(); |
switch(CMD) |
{ |
case 101 : |
{ |
Item[t_ID][1]->setText(Data[3]); |
if (Connection[t_ID].Auth == true) |
Item[t_ID][1]->setText("* " + Data[3]); |
} |
break; |
case 105 : |
{ |
if (Connection[t_ID].Auth == false) |
{ |
if ((o_Settings->SERVER.Password != "") && (Data[3] == o_Settings->SERVER.Password)) |
{ |
send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 505, "OK")); |
Connection[t_ID].Auth = true; |
Item[t_ID][1]->setText("* " + Item[t_ID][1]->text()); |
} |
else |
{ |
send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 505, "NO")); |
} |
} |
} |
break; |
} |
} |
} |
// Freies IP-Socket ermitteln |
int dlg_Main::get_FreeSocket() |
{ |
for (int a = 1; a < DEV_IP_MAX; a++) |
{ |
if (Connection[a].Open == false) |
return a; |
} |
return 0; |
} |
// Daten auf TCP Senden |
void dlg_Main::send_TCP(QTcpSocket *Socket, QString Data) |
{ |
QByteArray SendText = Data.toAscii(); |
Socket->write(SendText + "\n"); |
} |
///////////ettings |
// Slots // |
/////////// |
void dlg_Main::slot_btn_cScope() |
{ |
QString Programm = QMK_Dir + "/QMK-Scope"; |
QStringList Argumente; |
o_cScope = new QProcess(); |
Argumente << ""; |
o_cScope->start(Programm, Argumente); // Programmaufruf |
} |
void dlg_Main::slot_btn_cSettings() |
{ |
QString Programm = QMK_Dir + "/QMK-Settings"; |
QStringList Argumente; |
o_cSettings = new QProcess(); |
Argumente << ""; |
o_cSettings->start(Programm, Argumente); // Programmaufruf |
} |
void dlg_Main::slot_btn_cMaps() |
{ |
QString Programm = QMK_Dir + "/QMK-Maps"; |
QStringList Argumente; |
o_cMaps = new QProcess(); |
Argumente << ""; |
o_cMaps->start(Programm, Argumente); // Programmaufruf |
} |
void dlg_Main::slot_btn_cVoice() |
{ |
QString Programm = QMK_Dir + "/QMK-Voice"; |
QStringList Argumente; |
o_cVoice = new QProcess(); |
Argumente << ""; |
o_cVoice->start(Programm, Argumente); // Programmaufruf |
} |
void dlg_Main::slot_btn_cLogger() |
{ |
QString Programm = QMK_Dir + "/QMK-Logger"; |
QStringList Argumente; |
o_cLogger = new QProcess(); |
Argumente << ""; |
o_cLogger->start(Programm, Argumente); // Programmaufruf |
} |
void dlg_Main::slot_btn_Terminal() |
{ |
if (!f_Terminal->isVisible()) |
{ |
f_Terminal->show(); |
} |
} |
// Verbindung herstellen |
void dlg_Main::slot_btn_Connect() |
{ |
if (!o_Input->IsOpen()) |
{ |
if (rb_Device->isChecked()) |
{ |
if (cb_Device->findText(cb_Device->currentText()) == -1) |
{ |
cb_Device->addItem(cb_Device->currentText()); |
cb_Device->setCurrentIndex(cb_Device->findText(cb_Device->currentText())); |
} |
s_Input.Main = cb_Device->currentText(); |
o_Input = new Input_TTY(); |
o_Input->Init(); |
if (o_Input->Open(s_Input) == true) |
{ |
connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
btn_Connect->setText(tr("Trennen")); |
cb_Device->setEnabled(false); |
} |
} |
} |
else |
{ |
if (rb_Device->isChecked()) |
{ |
o_Input->Close(); |
btn_Connect->setText(tr("Verbinden")); |
cb_Device->setEnabled(true); |
} |
} |
} |
// About-Dialog |
void dlg_Main::slot_ac_About() |
{ |
QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT); |
} |
void dlg_Main::slot_ac_Server() |
{ |
dlg_Preferences *f_Preferences = new dlg_Preferences(this); |
f_Preferences->set_Settings(o_Settings); |
if (f_Preferences->exec()==QDialog::Accepted) |
{ |
o_Settings = f_Preferences->get_Settings(); |
o_Settings->write_Settings(); |
} |
} |
// Neue Daten empfangen. |
void dlg_Main::show_Terminal(int t_Typ, QString t_Data) |
{ |
if (f_Terminal->isVisible()) |
{ |
f_Terminal->show_Data(t_Typ, t_Data); |
} |
} |
void dlg_Main::slot_Input_Data(QString t_Data) |
{ |
if (HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length())) |
{ |
show_Terminal(1, t_Data); |
parse_Input_Data(t_Data); |
route_Input_Data(t_Data); |
} |
else |
{ |
show_Terminal(2, t_Data); |
} |
} |
////////////// |
// IP-Slots // |
////////////// |
void dlg_Main::slot_TCP_NewConnection() |
{ |
if (!o_Input->IsOpen()) |
slot_btn_Connect(); |
int ID = get_FreeSocket(); |
if (ID != 0) |
{ |
Connect_Count++; |
// Leeres Connection erzeugen |
Connection[ID] = Connection[0]; |
Connection[ID].Open = true; |
Connection[ID].TCP = true; |
Connection[ID].Auth = false; |
o_TCP[ID] = TCP_Server->nextPendingConnection(); |
o_TCP[ID]->setProperty("ID", ID); |
send_TCP(o_TCP[ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 501, QA_NAME + " " + QA_VERSION)); |
connect(o_TCP[ID], SIGNAL(disconnected()),o_TCP[ID], SLOT(deleteLater())); |
connect(o_TCP[ID], SIGNAL(disconnected()),this, SLOT(slot_TCP_Disconnect())); |
connect(o_TCP[ID], SIGNAL(readyRead()),this, SLOT(slot_TCP_Read())); |
Item[ID][0]->setText(o_TCP[ID]->peerAddress().toString()); |
lw_ClientsIP->addItem(Item[ID][0]); |
Item[ID][1]->setText("n/a"); |
lw_Clients->addItem(Item[ID][1]); |
if (Item[ID][0]->text() == "127.0.0.1") |
Connection[ID].Auth = true; |
if (Connection[ID].Auth) |
Item[ID][1]->setText("* n/a"); |
} |
else |
{ // Server voll |
o_TCP[ID] = TCP_Server->nextPendingConnection(); |
o_TCP[ID]->setProperty("ID", ID); |
// send_TCP(o_TCP[ID], QString("SERVER FULL\n")); |
o_TCP[ID]->disconnectFromHost(); |
} |
} |
void dlg_Main::slot_TCP_Read() |
{ |
QTcpSocket *Socket = (QTcpSocket*)sender(); |
// if (Socket->canReadLine()) |
{ |
int ID = Socket->property("ID").toUInt(); |
ID = ID; |
QString t_Data = QString(Socket->readLine((Socket->bytesAvailable()))); |
QStringList s_Data = t_Data.split('\r'); |
for (int z = 0; z < s_Data.length() - 1; z++) |
{ |
if (s_Data[z][0] == '$') |
{ |
// qDebug(QString("TCP: " + s_Data[z]).toLatin1().data()); |
parse_TCP_Data(s_Data[z], ID); |
} |
else |
{ // Daten vom Client an den MK. todo: Nur erlauben wenn autemtifiziert oder Localhost |
if ((Connection[ID].Auth == true)) |
{ |
show_Terminal(3, s_Data[z]); |
o_Input->send_Data(s_Data[z]); |
} |
} |
} |
} |
} |
void dlg_Main::slot_TCP_Disconnect() |
{ |
QTcpSocket *Socket = (QTcpSocket*)sender(); |
int ID = Socket->property("ID").toUInt(); |
Item[ID][1]->setText("Disconected"); |
Connection[ID] = Connection[0]; |
Connection[ID].Open = false; |
Connect_Count--; |
Socket->setProperty("ID", 0); |
if (Connect_Count == 0) |
slot_btn_Connect(); |
} |
// Programm Ende |
//////////////// |
dlg_Main::~dlg_Main() |
{ |
o_Settings->GUI.isMax = isMaximized(); |
o_Settings->GUI.Size = size(); |
o_Settings->GUI.Point = pos(); |
o_Settings->CLIENT.TTY_MAX = cb_Device->count(); |
o_Settings->CLIENT.TTY_ID = cb_Device->currentIndex(); |
for (int z = 0; z < cb_Device->count(); z++) |
{ |
if (z < 10) |
{ |
o_Settings->CLIENT.TTY_DEVICES[z] = cb_Device->itemText(z); |
} |
} |
o_Settings->write_Settings(); |
// qDebug("Ende."); |
} |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Main.h |
---|
0,0 → 1,132 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#ifndef DLG_MAIN_H |
#define DLG_MAIN_H |
#include <QtGui/QMainWindow> |
#include <QTcpServer> |
#include <QTcpSocket> |
#include <QProcess> |
#include <QDir> |
#include "ui_dlg_Main.h" |
#include "dlg_Preferences.h" |
#include "dlg_Terminal.h" |
#include "../Defines.h" |
#include "../TypeDefs.h" |
#include "../Classes/cSettings.h" |
#include "../../Global/Kopter.h" |
#include "../../Global/Class_Input/Input.h" |
#include "../../Global/Class_Input/Input_TTY.h" |
#include "../../Global/Class_HandlerMK/HandlerMK.h" |
#include "../../Global/Class_HandlerIP/HandlerIP.h" |
#include "../../Global/Class_SerialPort/ManageSerialPort.h" |
class dlg_Main : public QMainWindow, public Ui::dlg_Main_UI |
{ |
Q_OBJECT |
public: |
dlg_Main(); |
~dlg_Main(); |
void set_ARGV(char *Programm); |
private: |
QString QMK_Dir; |
// Input Device. |
Input *o_Input; |
set_Input s_Input; |
// Settings-Object |
cSettings *o_Settings; |
dlg_Terminal *f_Terminal; |
QProcess *o_cScope; |
QProcess *o_cSettings; |
QProcess *o_cMaps; |
QProcess *o_cVoice; |
QProcess *o_cLogger; |
// TCP Server und Socket. |
QTcpServer *TCP_Server; |
QTcpSocket *o_TCP[DEV_IP_MAX]; |
//Liste alle IP-Verbindungen und deren Parameter. |
int Connect_Count; |
sConnection Connection[DEV_IP_MAX]; |
QListWidgetItem *Item[DEV_IP_MAX][2]; |
s_Hardware VersionInfo; |
char c_Data[150]; |
// Programm-Initialisirungen |
void init_GUI(); |
void init_Connections(); |
// IP-Ports initialisieren |
bool init_TCP(); |
// Einkommende Datenpackete zerlegen. |
void parse_Input_Data(QString t_Data); |
// Einkommende Datenpackete weiterleiten |
void route_Input_Data(QString t_Data); |
void parse_TCP_Data(QString t_Data, int t_ID); |
// Freies IP-Socket ermitteln |
int get_FreeSocket(); |
// Daten aufs IP-Interface senden. |
void send_TCP(QTcpSocket *Socket, QString Data); |
void show_Terminal(int t_Typ, QString t_Data); |
private slots: |
void slot_ac_About(); |
void slot_ac_Server(); |
// Connect-Button |
void slot_btn_Connect(); |
void slot_btn_cScope(); |
void slot_btn_cSettings(); |
void slot_btn_cMaps(); |
void slot_btn_cVoice(); |
void slot_btn_cLogger(); |
void slot_btn_Terminal(); |
// Einkommende Datenpackete. |
void slot_Input_Data(QString t_Data); |
void slot_TCP_NewConnection(); |
void slot_TCP_Disconnect(); |
void slot_TCP_Read(); |
}; |
#endif // DLG_MAIN_H |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Main.ui |
---|
0,0 → 1,503 |
<?xml version="1.0" encoding="UTF-8"?> |
<ui version="4.0"> |
<class>dlg_Main_UI</class> |
<widget class="QMainWindow" name="dlg_Main_UI"> |
<property name="geometry"> |
<rect> |
<x>0</x> |
<y>0</y> |
<width>446</width> |
<height>350</height> |
</rect> |
</property> |
<property name="windowTitle"> |
<string>QMK-Communicator</string> |
</property> |
<property name="windowIcon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Communicator.png</normaloff>:/Icon/Global/Images/Icons/QMK-Communicator.png</iconset> |
</property> |
<widget class="QWidget" name="centralWidget"> |
<layout class="QGridLayout" name="gridLayout_9"> |
<property name="margin"> |
<number>2</number> |
</property> |
<item row="0" column="0"> |
<widget class="QGroupBox" name="groupBox"> |
<property name="sizePolicy"> |
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> |
<horstretch>0</horstretch> |
<verstretch>0</verstretch> |
</sizepolicy> |
</property> |
<property name="title"> |
<string>Verbindung zum Mikrokopter</string> |
</property> |
<layout class="QGridLayout" name="gridLayout_8"> |
<item row="0" column="0" colspan="2"> |
<widget class="QFrame" name="frame"> |
<property name="frameShape"> |
<enum>QFrame::StyledPanel</enum> |
</property> |
<property name="frameShadow"> |
<enum>QFrame::Raised</enum> |
</property> |
<layout class="QGridLayout" name="gridLayout_7"> |
<property name="margin"> |
<number>2</number> |
</property> |
<item row="0" column="0"> |
<layout class="QHBoxLayout" name="horizontalLayout_3"> |
<item> |
<widget class="QRadioButton" name="rb_Device"> |
<property name="text"> |
<string>Device</string> |
</property> |
</widget> |
</item> |
<item> |
<widget class="QRadioButton" name="rb_TCP"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>T CP</string> |
</property> |
</widget> |
</item> |
<item> |
<widget class="QRadioButton" name="rb_UDP"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>UDP</string> |
</property> |
</widget> |
</item> |
</layout> |
</item> |
</layout> |
<zorder></zorder> |
</widget> |
</item> |
<item row="1" column="0"> |
<widget class="QWidget" name="wg_Device" native="true"> |
<property name="sizePolicy"> |
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
<horstretch>0</horstretch> |
<verstretch>0</verstretch> |
</sizepolicy> |
</property> |
<layout class="QGridLayout" name="gridLayout_5"> |
<property name="margin"> |
<number>2</number> |
</property> |
<item row="1" column="2"> |
<widget class="QComboBox" name="cb_Device"> |
<property name="editable"> |
<bool>true</bool> |
</property> |
<property name="insertPolicy"> |
<enum>QComboBox::InsertAtTop</enum> |
</property> |
</widget> |
</item> |
<item row="1" column="0"> |
<widget class="QLabel" name="lb_Device"> |
<property name="text"> |
<string>Device:</string> |
</property> |
</widget> |
</item> |
<item row="0" column="2"> |
<spacer name="horizontalSpacer"> |
<property name="orientation"> |
<enum>Qt::Horizontal</enum> |
</property> |
<property name="sizeHint" stdset="0"> |
<size> |
<width>40</width> |
<height>1</height> |
</size> |
</property> |
</spacer> |
</item> |
</layout> |
</widget> |
</item> |
<item row="1" column="1"> |
<widget class="QWidget" name="wg_IP" native="true"> |
<property name="enabled"> |
<bool>true</bool> |
</property> |
<layout class="QGridLayout" name="gridLayout_6"> |
<property name="margin"> |
<number>2</number> |
</property> |
<item row="0" column="1"> |
<spacer name="horizontalSpacer_3"> |
<property name="orientation"> |
<enum>Qt::Horizontal</enum> |
</property> |
<property name="sizeHint" stdset="0"> |
<size> |
<width>60</width> |
<height>1</height> |
</size> |
</property> |
</spacer> |
</item> |
<item row="1" column="1"> |
<widget class="QComboBox" name="cb_IP"> |
<property name="editable"> |
<bool>true</bool> |
</property> |
</widget> |
</item> |
<item row="1" column="3"> |
<widget class="QComboBox" name="cb_Port"> |
<property name="editable"> |
<bool>true</bool> |
</property> |
</widget> |
</item> |
<item row="1" column="2"> |
<widget class="QLabel" name="label_6"> |
<property name="text"> |
<string>Port:</string> |
</property> |
</widget> |
</item> |
<item row="1" column="0"> |
<widget class="QLabel" name="label"> |
<property name="text"> |
<string>IP:</string> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
<item row="3" column="0" colspan="2"> |
<widget class="QFrame" name="frame_2"> |
<property name="frameShape"> |
<enum>QFrame::StyledPanel</enum> |
</property> |
<property name="frameShadow"> |
<enum>QFrame::Raised</enum> |
</property> |
<layout class="QGridLayout" name="gridLayout_2"> |
<property name="margin"> |
<number>2</number> |
</property> |
<item row="1" column="0"> |
<layout class="QGridLayout" name="gridLayout"> |
<item row="0" column="0"> |
<widget class="QRadioButton" name="rb_FC"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>FlightCtrl</string> |
</property> |
</widget> |
</item> |
<item row="0" column="1"> |
<widget class="QRadioButton" name="rb_NC"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>NaviCtrl</string> |
</property> |
</widget> |
</item> |
<item row="0" column="2"> |
<widget class="QRadioButton" name="rb_MK3MAG"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>MK3MAG</string> |
</property> |
</widget> |
</item> |
</layout> |
</item> |
</layout> |
</widget> |
</item> |
<item row="2" column="0" colspan="2"> |
<widget class="QPushButton" name="btn_Connect"> |
<property name="text"> |
<string>Verbinden</string> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
<item row="1" column="0"> |
<widget class="QGroupBox" name="groupBox_2"> |
<property name="title"> |
<string>Client-Verbindungen</string> |
</property> |
<layout class="QGridLayout" name="gridLayout_3"> |
<property name="horizontalSpacing"> |
<number>0</number> |
</property> |
<item row="0" column="0"> |
<widget class="QListWidget" name="lw_ClientsIP"> |
<property name="font"> |
<font> |
<family>Courier 10 Pitch</family> |
<pointsize>12</pointsize> |
</font> |
</property> |
</widget> |
</item> |
<item row="0" column="1"> |
<widget class="QListWidget" name="lw_Clients"> |
<property name="font"> |
<font> |
<family>Courier 10 Pitch</family> |
<pointsize>12</pointsize> |
</font> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
<item row="3" column="0" colspan="2"> |
<widget class="QLabel" name="lb_Info"> |
<property name="frameShape"> |
<enum>QFrame::Box</enum> |
</property> |
<property name="text"> |
<string/> |
</property> |
</widget> |
</item> |
<item row="0" column="1" rowspan="2"> |
<widget class="QGroupBox" name="groupBox_3"> |
<property name="title"> |
<string>Clients</string> |
</property> |
<layout class="QGridLayout" name="gridLayout_4"> |
<item row="0" column="0"> |
<widget class="QPushButton" name="btn_Terminal"> |
<property name="text"> |
<string>Terminal</string> |
</property> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Actions/Global/Images/Actions/Terminal.png</normaloff>:/Actions/Global/Images/Actions/Terminal.png</iconset> |
</property> |
<property name="iconSize"> |
<size> |
<width>20</width> |
<height>20</height> |
</size> |
</property> |
</widget> |
</item> |
<item row="1" column="0"> |
<widget class="Line" name="line"> |
<property name="orientation"> |
<enum>Qt::Horizontal</enum> |
</property> |
</widget> |
</item> |
<item row="2" column="0"> |
<widget class="QPushButton" name="btn_cScope"> |
<property name="text"> |
<string>Scope</string> |
</property> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Scope.png</normaloff>:/Icon/Global/Images/Icons/QMK-Scope.png</iconset> |
</property> |
<property name="iconSize"> |
<size> |
<width>20</width> |
<height>20</height> |
</size> |
</property> |
</widget> |
</item> |
<item row="3" column="0"> |
<widget class="QPushButton" name="btn_cSettings"> |
<property name="text"> |
<string>Settings</string> |
</property> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Settings.png</normaloff>:/Icon/Global/Images/Icons/QMK-Settings.png</iconset> |
</property> |
<property name="iconSize"> |
<size> |
<width>20</width> |
<height>20</height> |
</size> |
</property> |
</widget> |
</item> |
<item row="4" column="0"> |
<widget class="QPushButton" name="btn_cMaps"> |
<property name="text"> |
<string>Maps</string> |
</property> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Maps.png</normaloff>:/Icon/Global/Images/Icons/QMK-Maps.png</iconset> |
</property> |
<property name="iconSize"> |
<size> |
<width>20</width> |
<height>20</height> |
</size> |
</property> |
</widget> |
</item> |
<item row="7" column="0"> |
<spacer name="verticalSpacer"> |
<property name="orientation"> |
<enum>Qt::Vertical</enum> |
</property> |
<property name="sizeHint" stdset="0"> |
<size> |
<width>20</width> |
<height>229</height> |
</size> |
</property> |
</spacer> |
</item> |
<item row="6" column="0"> |
<widget class="QPushButton" name="btn_cVoice"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>Voice</string> |
</property> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Voice.png</normaloff>:/Icon/Global/Images/Icons/QMK-Voice.png</iconset> |
</property> |
<property name="iconSize"> |
<size> |
<width>20</width> |
<height>20</height> |
</size> |
</property> |
</widget> |
</item> |
<item row="5" column="0"> |
<widget class="QPushButton" name="btn_cLogger"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>Logger</string> |
</property> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Logger.png</normaloff>:/Icon/Global/Images/Icons/QMK-Logger.png</iconset> |
</property> |
<property name="iconSize"> |
<size> |
<width>20</width> |
<height>20</height> |
</size> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
</layout> |
</widget> |
<widget class="QMenuBar" name="menuBar"> |
<property name="geometry"> |
<rect> |
<x>0</x> |
<y>0</y> |
<width>446</width> |
<height>21</height> |
</rect> |
</property> |
<widget class="QMenu" name="menu_Program"> |
<property name="title"> |
<string>Programm</string> |
</property> |
<addaction name="ac_Quit"/> |
</widget> |
<widget class="QMenu" name="menu_Preferences"> |
<property name="title"> |
<string>Einstellungen</string> |
</property> |
<addaction name="ac_Server"/> |
</widget> |
<widget class="QMenu" name="menu_Help"> |
<property name="title"> |
<string>Hilfe</string> |
</property> |
<addaction name="ac_About"/> |
</widget> |
<addaction name="menu_Program"/> |
<addaction name="menu_Preferences"/> |
<addaction name="menu_Help"/> |
</widget> |
<action name="ac_Quit"> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Actions/Global/Images/Actions/Exit.png</normaloff>:/Actions/Global/Images/Actions/Exit.png</iconset> |
</property> |
<property name="text"> |
<string>Beenden</string> |
</property> |
</action> |
<action name="ac_About"> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Communicator.png</normaloff>:/Icon/Global/Images/Icons/QMK-Communicator.png</iconset> |
</property> |
<property name="text"> |
<string>Über QMK-Communicator</string> |
</property> |
</action> |
<action name="ac_Server"> |
<property name="icon"> |
<iconset resource="../QMK-Communicator.qrc"> |
<normaloff>:/Icon/Global/Images/Icons/QMK-Communicator.png</normaloff>:/Icon/Global/Images/Icons/QMK-Communicator.png</iconset> |
</property> |
<property name="text"> |
<string>Server</string> |
</property> |
</action> |
</widget> |
<layoutdefault spacing="6" margin="11"/> |
<resources> |
<include location="../QMK-Communicator.qrc"/> |
</resources> |
<connections> |
<connection> |
<sender>ac_Quit</sender> |
<signal>triggered()</signal> |
<receiver>dlg_Main_UI</receiver> |
<slot>close()</slot> |
<hints> |
<hint type="sourcelabel"> |
<x>-1</x> |
<y>-1</y> |
</hint> |
<hint type="destinationlabel"> |
<x>182</x> |
<y>88</y> |
</hint> |
</hints> |
</connection> |
</connections> |
</ui> |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Preferences.cpp |
---|
0,0 → 1,42 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#include "dlg_Preferences.h" |
dlg_Preferences::dlg_Preferences(QWidget *parent) : QDialog(parent) |
{ |
setupUi(this); |
} |
void dlg_Preferences::set_Settings(cSettings *t_Settings) |
{ |
o_Settings = t_Settings; |
le_TCP_Port->setText(QString("%1").arg(o_Settings->SERVER.TCP_PORT)); |
le_UDP_Port->setText(QString("%1").arg(o_Settings->SERVER.UDP_PORT)); |
le_Password->setText(o_Settings->SERVER.Password); |
} |
cSettings *dlg_Preferences::get_Settings() |
{ |
o_Settings->SERVER.Password = le_Password->text(); |
o_Settings->SERVER.TCP_PORT = le_TCP_Port->text().toInt(); |
o_Settings->SERVER.UDP_PORT = le_UDP_Port->text().toInt(); |
return o_Settings; |
} |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Preferences.h |
---|
0,0 → 1,41 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#ifndef DLG_PREFERENCES_H |
#define DLG_PREFERENCES_H |
#include "ui_dlg_Preferences.h" |
#include "../Classes/cSettings.h" |
class dlg_Preferences : public QDialog, public Ui::dlg_Preferences_UI |
{ |
Q_OBJECT |
public: |
dlg_Preferences(QWidget *parent = 0); |
void set_Settings(cSettings *t_Settings); |
cSettings *get_Settings(); |
private: |
// Settings-Object |
cSettings *o_Settings; |
}; |
#endif // DLG_PREFERENCES_H |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Preferences.ui |
---|
0,0 → 1,147 |
<?xml version="1.0" encoding="UTF-8"?> |
<ui version="4.0"> |
<class>dlg_Preferences_UI</class> |
<widget class="QDialog" name="dlg_Preferences_UI"> |
<property name="geometry"> |
<rect> |
<x>0</x> |
<y>0</y> |
<width>251</width> |
<height>160</height> |
</rect> |
</property> |
<property name="windowTitle"> |
<string>Server-Einstellungen</string> |
</property> |
<layout class="QGridLayout" name="gridLayout_2"> |
<item row="0" column="0"> |
<widget class="QGroupBox" name="groupBox"> |
<property name="title"> |
<string/> |
</property> |
<layout class="QGridLayout" name="gridLayout"> |
<item row="0" column="0"> |
<widget class="QCheckBox" name="checkBox"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>TCP</string> |
</property> |
<property name="checked"> |
<bool>true</bool> |
</property> |
</widget> |
</item> |
<item row="0" column="1"> |
<widget class="QLabel" name="label"> |
<property name="text"> |
<string>Port:</string> |
</property> |
</widget> |
</item> |
<item row="0" column="2"> |
<widget class="QLineEdit" name="le_TCP_Port"/> |
</item> |
<item row="1" column="0"> |
<widget class="QCheckBox" name="checkBox_2"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>UDP</string> |
</property> |
</widget> |
</item> |
<item row="1" column="1"> |
<widget class="QLabel" name="label_2"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
<property name="text"> |
<string>Port:</string> |
</property> |
</widget> |
</item> |
<item row="1" column="2"> |
<widget class="QLineEdit" name="le_UDP_Port"> |
<property name="enabled"> |
<bool>false</bool> |
</property> |
</widget> |
</item> |
<item row="2" column="0" colspan="3"> |
<widget class="Line" name="line"> |
<property name="orientation"> |
<enum>Qt::Horizontal</enum> |
</property> |
</widget> |
</item> |
<item row="3" column="0"> |
<widget class="QLabel" name="label_3"> |
<property name="text"> |
<string>Password:</string> |
</property> |
</widget> |
</item> |
<item row="3" column="2"> |
<widget class="QLineEdit" name="le_Password"> |
<property name="text"> |
<string>qwertz</string> |
</property> |
<property name="echoMode"> |
<enum>QLineEdit::Password</enum> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
<item row="1" column="0"> |
<widget class="QDialogButtonBox" name="buttonBox"> |
<property name="orientation"> |
<enum>Qt::Horizontal</enum> |
</property> |
<property name="standardButtons"> |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
<resources/> |
<connections> |
<connection> |
<sender>buttonBox</sender> |
<signal>accepted()</signal> |
<receiver>dlg_Preferences_UI</receiver> |
<slot>accept()</slot> |
<hints> |
<hint type="sourcelabel"> |
<x>248</x> |
<y>254</y> |
</hint> |
<hint type="destinationlabel"> |
<x>157</x> |
<y>274</y> |
</hint> |
</hints> |
</connection> |
<connection> |
<sender>buttonBox</sender> |
<signal>rejected()</signal> |
<receiver>dlg_Preferences_UI</receiver> |
<slot>reject()</slot> |
<hints> |
<hint type="sourcelabel"> |
<x>316</x> |
<y>260</y> |
</hint> |
<hint type="destinationlabel"> |
<x>286</x> |
<y>274</y> |
</hint> |
</hints> |
</connection> |
</connections> |
</ui> |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Terminal.cpp |
---|
0,0 → 1,65 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#include "dlg_Terminal.h" |
dlg_Terminal::dlg_Terminal(QWidget *parent) : QDialog(parent) |
{ |
setupUi(this); |
connect(btn_Delete, SIGNAL(clicked()), this, SLOT(slot_btn_Delete())); |
} |
void dlg_Terminal::slot_btn_Delete() |
{ |
te_Out->clear(); |
} |
void dlg_Terminal::show_Data(int t_Typ, QString t_Data) |
{ |
te_Out->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
switch(t_Typ) |
{ |
case 1: |
{ |
if (cb_Data->isChecked()) |
{ |
te_Out->insertHtml("<span style=\"color:#00ffff;\">" + t_Data + "<br /></span>"); |
} |
} |
break; |
case 2: |
{ |
if ((t_Data.length() > 0) && (cb_Info->isChecked())) |
{ |
te_Out->insertHtml("<span style=\"color:#00ff00;\">" + t_Data + "</span><br />"); |
} |
} |
break; |
case 3: |
{ |
if (cb_Send->isChecked()) |
{ |
te_Out->insertHtml("<span style='color:#ff0000;'>" + t_Data + "<br /></span>"); |
} |
} |
break; |
} |
} |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Terminal.h |
---|
0,0 → 1,37 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#ifndef DLG_TERMINAL_H |
#define DLG_TERMINAL_H |
#include <QString> |
#include "ui_dlg_Terminal.h" |
class dlg_Terminal : public QDialog, public Ui::dlg_Terminal_UI |
{ |
Q_OBJECT |
public: |
dlg_Terminal(QWidget *parent = 0); |
void show_Data(int t_Typ, QString t_Data); |
private slots: |
void slot_btn_Delete(); |
}; |
#endif // DLG_TERMINAL_H |
/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Terminal.ui |
---|
0,0 → 1,135 |
<?xml version="1.0" encoding="UTF-8"?> |
<ui version="4.0"> |
<class>dlg_Terminal_UI</class> |
<widget class="QDialog" name="dlg_Terminal_UI"> |
<property name="geometry"> |
<rect> |
<x>0</x> |
<y>0</y> |
<width>671</width> |
<height>365</height> |
</rect> |
</property> |
<property name="windowTitle"> |
<string>Terminal</string> |
</property> |
<layout class="QGridLayout" name="gridLayout_2"> |
<item row="0" column="0"> |
<widget class="QTextEdit" name="te_Out"> |
<property name="palette"> |
<palette> |
<active> |
<colorrole role="Base"> |
<brush brushstyle="SolidPattern"> |
<color alpha="255"> |
<red>0</red> |
<green>0</green> |
<blue>0</blue> |
</color> |
</brush> |
</colorrole> |
</active> |
<inactive> |
<colorrole role="Base"> |
<brush brushstyle="SolidPattern"> |
<color alpha="255"> |
<red>0</red> |
<green>0</green> |
<blue>0</blue> |
</color> |
</brush> |
</colorrole> |
</inactive> |
<disabled> |
<colorrole role="Base"> |
<brush brushstyle="SolidPattern"> |
<color alpha="255"> |
<red>255</red> |
<green>255</green> |
<blue>255</blue> |
</color> |
</brush> |
</colorrole> |
</disabled> |
</palette> |
</property> |
<property name="font"> |
<font> |
<family>Adobe Courier</family> |
<pointsize>10</pointsize> |
</font> |
</property> |
<property name="html"> |
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> |
<html><head><meta name="qrichtext" content="1" /><style type="text/css"> |
p, li { white-space: pre-wrap; } |
</style></head><body style=" font-family:'Adobe Courier'; font-size:10pt; font-weight:400; font-style:normal;"> |
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html></string> |
</property> |
</widget> |
</item> |
<item row="1" column="0"> |
<widget class="QFrame" name="frame"> |
<property name="frameShape"> |
<enum>QFrame::StyledPanel</enum> |
</property> |
<property name="frameShadow"> |
<enum>QFrame::Raised</enum> |
</property> |
<layout class="QGridLayout" name="gridLayout"> |
<item row="0" column="0"> |
<widget class="QLabel" name="label"> |
<property name="text"> |
<string>Anzeige:</string> |
</property> |
</widget> |
</item> |
<item row="0" column="1"> |
<widget class="QCheckBox" name="cb_Data"> |
<property name="text"> |
<string>Datenpackete</string> |
</property> |
</widget> |
</item> |
<item row="0" column="2"> |
<widget class="QCheckBox" name="cb_Info"> |
<property name="text"> |
<string>Meldungen</string> |
</property> |
</widget> |
</item> |
<item row="0" column="3"> |
<widget class="QCheckBox" name="cb_Send"> |
<property name="text"> |
<string>Gesendete Daten</string> |
</property> |
</widget> |
</item> |
<item row="0" column="4"> |
<spacer name="horizontalSpacer"> |
<property name="orientation"> |
<enum>Qt::Horizontal</enum> |
</property> |
<property name="sizeHint" stdset="0"> |
<size> |
<width>185</width> |
<height>20</height> |
</size> |
</property> |
</spacer> |
</item> |
<item row="0" column="5"> |
<widget class="QPushButton" name="btn_Delete"> |
<property name="text"> |
<string>Löschen</string> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
</layout> |
</widget> |
<resources/> |
<connections/> |
</ui> |