Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 710 → Rev 711

/QMK-Groundstation/trunk/QMK-Communicator/Dialogs/dlg_Main.cpp
4,7 → 4,7
* *
* 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. *
* the Free Software Con_Server; 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 *
13,11 → 13,12
* *
* 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., *
* Free Software Con_Server, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#include <QMessageBox>
#include <QCryptographicHash>
 
#include "dlg_Main.h"
 
30,6 → 31,7
o_Settings = new cSettings();
 
o_Input = new Input();
o_Output = new Input();
 
f_Terminal = new dlg_Terminal(this);
 
65,10 → 67,10
 
for (int z = 0; z < DEV_IP_MAX; z++)
{
Item[z][0] = new QListWidgetItem();
Item[z][1] = new QListWidgetItem();
Item[z] = new QListWidgetItem();
}
 
// Liste der Devices
for(int z = 0; z < o_Settings->CLIENT.TTY_MAX; z++)
{
if (cb_Device->findText(o_Settings->CLIENT.TTY_DEVICES[z]) == -1)
78,8 → 80,23
}
 
cb_Device->setCurrentIndex(o_Settings->CLIENT.TTY_ID);
 
// Liste der IP-Server
for(int z = 0; z < o_Settings->CLIENT.TCP_MAX; z++)
{
if (cb_Server->findText(o_Settings->CLIENT.TCP_SERVER[z]) == -1)
{
cb_Server->addItem(o_Settings->CLIENT.TCP_SERVER[z]);
}
}
 
cb_Server->setCurrentIndex(o_Settings->CLIENT.TCP_ID);
 
// Password für IP-Verbindung.
le_Password->setText(o_Settings->CLIENT.TCP_Password);
 
}
 
// Signale mit Slots verbinden
//////////////////////////////
void dlg_Main::init_Connections()
94,6 → 111,7
connect(btn_cLogger, SIGNAL(clicked()), this, SLOT(slot_btn_cLogger()));
 
connect(btn_Terminal, SIGNAL(clicked()), this, SLOT(slot_btn_Terminal()));
connect(btn_ConnectServer, SIGNAL(clicked()), this, SLOT(slot_btn_ConnectServer()));
 
// About QMK-Kernel & About-QT Dialog einfügen
connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About()));
107,12 → 125,15
bool dlg_Main::init_TCP()
{
Connect_Count = 0;
Connection[0].TCP = false;
Connection[0].UDP = false;
 
Con_Server[0].Status = 0;
 
Con_Server[0].TCP = false;
Con_Server[0].UDP = false;
 
for (int a = 0; a < DEV_IP_MAX; a++)
{
Connection[a].Open = false;
Con_Server[a].Status = 0;
}
 
TCP_Server = new QTcpServer(this);
165,17 → 186,36
// An alle offenen TCP-Sockets senden.
for (int a = 1; a < DEV_IP_MAX; a++)
{
if (Connection[a].Open == true)
if (Con_Server[a].Status > 0)
{
if (Connection[a].TCP == true)
if (Con_Server[a].TCP == true)
{
if ((Con_Server[a].Fields == "") || (Con_Server[a].Fields.contains(t_Data.at(2)) == true))
{
if (o_Input->Mode() == TTY)
{
send_TCP(o_TCP[a], t_Data + "\r");
}
else
{
send_TCP(o_TCP[a], t_Data);
}
}
else
{
// qDebug("Not Send Data");
// qDebug(t_Data.toLatin1().data());
}
}
}
}
if ((o_Output->IsOpen()) && ((Con_Output.Fields == "") || (Con_Output.Fields.contains(t_Data.at(2)) == true)))
{
o_Output->send_Data(t_Data);
}
}
 
void dlg_Main::parse_TCP_Data(QString t_Data, int t_ID)
void dlg_Main::parse_TCP_Server_Data(QString t_Data, int t_ID)
{
QStringList Data;
Data = t_Data.split(":");
183,44 → 223,187
if (Data.count() > 1)
{
int CMD = Data[2].toInt();
QString A = Data[2];
// qDebug(A.toLatin1().data());
 
switch(CMD)
{
case 101 :
{
Item[t_ID][1]->setText(Data[3]);
if (Connection[t_ID].Auth == true)
Item[t_ID][1]->setText("* " + Data[3]);
Con_Server[t_ID].Version = Data[3];
Item[t_ID]->setText(" " + QString(o_TCP[t_ID]->peerAddress().toString()).leftJustified(15,' ') + " - " + Con_Server[t_ID].Version);
 
if (Con_Server[t_ID].Status == 2)
{
Item[t_ID]->setText("*" + QString(o_TCP[t_ID]->peerAddress().toString()).leftJustified(15,' ') + " - " + Con_Server[t_ID].Version);
}
else
{
send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 502, "105"));
}
 
send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 502, "106"));
}
break;
case 105 :
{
if (Connection[t_ID].Auth == false)
if (Con_Server[t_ID].Status != 2)
{
if ((o_Settings->SERVER.Password != "") && (Data[3] == o_Settings->SERVER.Password))
// qDebug("Get 105");
QString s_MD5PW;
QByteArray a_MD5PW;
 
a_MD5PW = QCryptographicHash::hash(o_Settings->SERVER.Password.toAscii(),QCryptographicHash::Md5);
 
s_MD5PW = QString(a_MD5PW.toHex().data());
 
if ((o_Settings->SERVER.Password != "") && (Data[3] == s_MD5PW))
{
// qDebug("Set 505 OK");
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());
Con_Server[t_ID].Status = 2;
Item[t_ID]->setText("*" + QString(o_TCP[t_ID]->peerAddress().toString()).leftJustified(15,' ') + " - " + Con_Server[t_ID].Version);
}
else
{
// qDebug("Set 505 NO");
send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 505, "NO"));
}
}
else
{
send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 505, "OK"));
}
}
break;
case 106 : // Datenfelder anfordern.
{
if (Con_Server[t_ID].Status == 2)
{
Con_Server[t_ID].Fields = Data[3];
Item[t_ID]->setText("*" + QString(o_TCP[t_ID]->peerAddress().toString()).leftJustified(15,' ') + " - " + Con_Server[t_ID].Version + " - " + Con_Server[t_ID].Fields);
// send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 506, Con_Server[t_ID].Fields));
}
}
}
}
}
 
// IP-Input-Daten verarbeiten.
void dlg_Main::parse_TCP_Input_Data(QString t_Data)
{
QStringList Data;
Data = t_Data.split(":");
 
if (Data.count() > 1)
{
int CMD = Data[2].toInt();
 
switch(CMD)
{
case 502 :
{
// qDebug("Request Data");
switch (Data[3].toInt())
{
case 105 :
{
QString s_MD5PW;
QByteArray a_MD5PW;
 
a_MD5PW = QCryptographicHash::hash(le_Password->text().toAscii(),QCryptographicHash::Md5);
 
s_MD5PW = QString(a_MD5PW.toHex().data());
 
o_Input->send_Data(HandlerIP::make_Frame(ID_COMMUNICATOR, 105, s_MD5PW));
}
break;
}
}
break;
case 505 :
{
if (Data[3] == "OK")
{
}
else
{
QMessageBox::warning(this, QA_NAME, trUtf8("Authentifizierung fehlgeschlagen. <br />Daten senden zum Mikrokopter nicht möglich."), QMessageBox::Ok);
}
}
break;
}
}
}
 
// IP-Input-Daten verarbeiten.
void dlg_Main::parse_TCP_Output_Data(QString t_Data)
{
QStringList Data;
Data = t_Data.split(":");
 
if (Data.count() > 1)
{
int CMD = Data[2].toInt();
 
switch(CMD)
{
case 101 :
{
Con_Output.Version = Data[3];
o_Output->send_Data(HandlerIP::make_Frame(ID_COMMUNICATOR, 101, QA_NAME + " " + QA_VERSION));
}
break;
case 106 : // Datenfelder anfordern.
{
Con_Output.Fields = Data[3];
// send_TCP(o_TCP[t_ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 506, Con_Server[t_ID].Fields));
}
break;
case 502 :
{
switch (Data[3].toInt())
{
case 104 :
{
// qDebug("Request PW");
QString s_MD5PW;
QByteArray a_MD5PW;
 
a_MD5PW = QCryptographicHash::hash(QString("madlen").toAscii(),QCryptographicHash::Md5);
 
s_MD5PW = QString(a_MD5PW.toHex().data());
 
o_Output->send_Data(HandlerIP::make_Frame(ID_COMMUNICATOR, 104, "keyoz@c64-power.net;" + s_MD5PW));
}
break;
}
}
break;
case 504 :
{
if (Data[3] == "OK")
{
Con_Output.Status = 2;
o_Output->send_Data(HandlerIP::make_Frame(ID_COMMUNICATOR, 502, "106"));
}
else
{
QMessageBox::warning(this, QA_NAME, trUtf8("Authentifizierung fehlgeschlagen."), QMessageBox::Ok);
}
}
break;
}
}
}
 
// Freies IP-Socket ermitteln
int dlg_Main::get_FreeSocket()
{
for (int a = 1; a < DEV_IP_MAX; a++)
{
if (Connection[a].Open == false)
if (Con_Server[a].Status == 0)
return a;
}
return 0;
232,9 → 415,12
QByteArray SendText = Data.toAscii();
 
Socket->write(SendText + "\n");
Socket->flush();
 
// qDebug(SendText.data());
}
 
///////////ettings
///////////
// Slots //
///////////
 
311,7 → 497,107
}
}
 
// Verbindung herstellen
// Verbindung herstellen zum Datenserver
void dlg_Main::slot_btn_ConnectServer()
{
if (!o_Output->IsOpen())
{
Con_Output = Con_Server[0];
 
s_Output.Main = "127.0.0.1";//Server[0];
s_Output.Sub = "64410";//Server[1];
 
o_Output = new Input_TCP();
o_Output->Init();
 
if (o_Output->Open(s_Output) == true)
{
connect(o_Output, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Output_Disconnected(int)));
connect(o_Output, SIGNAL(sig_Connected()), this, SLOT(slot_Output_Connected()));
}
btn_ConnectServer->setText(tr("Trenne Server"));
Con_Output.Status = 1;
}
else
{
btn_ConnectServer->setText(tr("Verbinde Server"));
 
o_Output->Close();
disconnect(o_Output, SIGNAL(sig_NewData(QString)), 0, 0);
if (o_Output->Mode() == TCP)
{
disconnect(o_Output, SIGNAL(sig_Disconnected(int)), 0, 0);
disconnect(o_Output, SIGNAL(sig_Connected()), 0, 0);
}
}
}
 
void dlg_Main::slot_Output_Disconnected(int Error)
{
// cb_Server->setEnabled(true);
// le_Password->setEnabled(true);
 
disconnect(o_Output, SIGNAL(sig_NewData(QString)), 0, 0);
if (o_Output->Mode() == TCP)
{
disconnect(o_Output, SIGNAL(sig_Disconnected(int)), 0, 0);
disconnect(o_Output, SIGNAL(sig_Connected()), 0, 0);
}
 
btn_ConnectServer->setText(tr("Verbinde Server"));
 
/* switch (Error)
{
case REMOTECLOSED :
{
// lb_Status->setText(tr("Verbindung vom Server beendet."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok);
}
break;
case REFUSED :
{
// lb_Status->setText(tr("Server nicht gefunden."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok);
}
break;
case 3 :
{
// lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok);
}
break;
default :
{
// lb_Status->setText(tr("Getrennt vom QMK-Datenserver."));
}
break;
}
*/
 
}
 
void dlg_Main::slot_Output_Connected()
{
connect(o_Output, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Output_Data(QString)));
 
// o_Output->send_Data(HandlerIP::make_Frame(ID_COMMUNICATOR, 101, QA_NAME + " " + QA_VERSION));
// o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION);
// btn_Connect->setText(tr("Trennen"));
}
 
void dlg_Main::slot_Output_Data(QString t_Data)
{
if ((t_Data[0] == '#'))
{
}
else if (o_Output->Mode() == TCP)
{
show_Terminal(6, t_Data);
parse_TCP_Output_Data(t_Data);
}
}
 
// Verbindung herstellen zum Kopter
void dlg_Main::slot_btn_Connect()
{
if (!o_Input->IsOpen())
339,18 → 625,137
cb_Device->setEnabled(false);
}
}
else if (rb_TCP->isChecked())
{
if (cb_Server->findText(cb_Device->currentText()) == -1)
{
cb_Server->addItem(cb_Server->currentText());
cb_Server->setCurrentIndex(cb_Server->findText(cb_Server->currentText()));
}
 
cb_Server->setEnabled(false);
le_Password->setEnabled(false);
 
o_Input = new Input_TCP();
o_Input->Init();
 
set_Input s_Input;
 
QStringList Server = cb_Server->currentText().split(":");
 
s_Input.Main = Server[0];
s_Input.Sub = Server[1];
 
if (o_Input->Open(s_Input) == true)
{
connect(o_Input, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Input_Disconnected(int)));
connect(o_Input, SIGNAL(sig_Connected()), this, SLOT(slot_Input_Connected()));
}
}
 
}
else
{
if (rb_Device->isChecked())
{
cb_Device->setEnabled(true);
cb_Server->setEnabled(true);
le_Password->setEnabled(true);
 
o_Input->Close();
btn_Connect->setText(tr("Verbinden"));
cb_Device->setEnabled(true);
disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0);
if (o_Input->Mode() == TCP)
{
disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0);
disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0);
}
}
}
}
 
// Neue Daten empfangen.
void dlg_Main::slot_Input_Data(QString t_Data)
{
if ((t_Data[0] == '#'))
{
 
if ((HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length() - 1)) || ((o_Input->Mode() == TTY) && (HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length()))))
{
show_Terminal(1, "MK: " + t_Data);
parse_Input_Data(t_Data);
route_Input_Data(t_Data);
}
else
{
show_Terminal(2, t_Data);
}
}
else if ((o_Input->Mode() == TCP) && (t_Data[0] == '$'))
{
show_Terminal(4, t_Data);
parse_TCP_Input_Data(t_Data);
}
else
{
show_Terminal(2, t_Data);
}
 
 
}
 
void dlg_Main::slot_Input_Disconnected(int Error)
{
cb_Server->setEnabled(true);
le_Password->setEnabled(true);
 
disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0);
if (o_Input->Mode() == TCP)
{
disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0);
disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0);
}
 
btn_Connect->setText(tr("Verbinden"));
 
/* switch (Error)
{
case REMOTECLOSED :
{
// lb_Status->setText(tr("Verbindung vom Server beendet."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok);
}
break;
case REFUSED :
{
// lb_Status->setText(tr("Server nicht gefunden."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok);
}
break;
case 3 :
{
// lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok);
}
break;
default :
{
// lb_Status->setText(tr("Getrennt vom QMK-Datenserver."));
}
break;
}
*/
 
}
 
void dlg_Main::slot_Input_Connected()
{
connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString)));
 
o_Input->send_Data(HandlerIP::make_Frame(ID_COMMUNICATOR, 101, QA_NAME + " " + QA_VERSION));
// o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION);
btn_Connect->setText(tr("Trennen"));
}
 
// About-Dialog
void dlg_Main::slot_ac_About()
{
370,7 → 775,6
}
}
 
// Neue Daten empfangen.
void dlg_Main::show_Terminal(int t_Typ, QString t_Data)
{
if (f_Terminal->isVisible())
379,28 → 783,16
}
}
 
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 Server //
/////////////////////
 
//////////////
// IP-Slots //
//////////////
 
void dlg_Main::slot_TCP_NewConnection()
{
if (!o_Input->IsOpen())
{
slot_btn_Connect();
}
 
int ID = get_FreeSocket();
 
407,39 → 799,46
if (ID != 0)
{
Connect_Count++;
// Leeres Connection erzeugen
Connection[ID] = Connection[0];
Connection[ID].Open = true;
Connection[ID].TCP = true;
Connection[ID].Auth = false;
 
// Leeres Con_Server erzeugen
Con_Server[ID] = Con_Server[0];
 
Con_Server[ID].Status = 1;
Con_Server[ID].TCP = true;
 
Con_Server[ID].Fields = "";
Con_Server[ID].Version = "n/a";
 
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));
send_TCP(o_TCP[ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 101, 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]);
Item[ID]->setText(" " + QString(o_TCP[ID]->peerAddress().toString()).leftJustified(15,' ') + " - n/a");
lw_Clients->addItem(Item[ID]);
 
if (Item[ID][0]->text() == "127.0.0.1")
Connection[ID].Auth = true;
if (o_TCP[ID]->peerAddress().toString() == "127.0.0.1")
{
Con_Server[ID].Status = 2;
Item[ID]->setText("*" + QString(o_TCP[ID]->peerAddress().toString()).leftJustified(15,' ') + " - n/a");
}
 
if (Connection[ID].Auth)
Item[ID][1]->setText("* n/a");
if (o_Input->IsOpen())
{
// send_TCP(o_TCP[ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 520, cb_Device->currentText()));
}
 
}
else
{ // Server voll
else // Server voll
{
o_TCP[ID] = TCP_Server->nextPendingConnection();
o_TCP[ID]->setProperty("ID", ID);
 
// send_TCP(o_TCP[ID], QString("SERVER FULL\n"));
send_TCP(o_TCP[ID],HandlerIP::make_Frame(ID_COMMUNICATOR, 521, "Sorry, Server full."));
o_TCP[ID]->disconnectFromHost();
}
}
453,21 → 852,48
int ID = Socket->property("ID").toUInt();
ID = ID;
 
// QString t_Data = QString(TCP_Socket->readLine(TCP_Socket->bytesAvailable())).remove(QChar('\n'));
QString t_Data = QString(Socket->readAll());
 
QStringList l_Data = t_Data.split('\r');
 
for (int z = 0; z < l_Data.count(); z++)
{
if ((l_Data[z].length() > 3))
{
if (l_Data[z][0] == '$')
{
parse_TCP_Server_Data(l_Data[z], ID);
show_Terminal(5, "IP: " + l_Data[z]);
}
else
{
if ((Con_Server[ID].Status >= 2))
{
show_Terminal(3, "MK> " + l_Data[z]);
o_Input->send_Data(l_Data[z]);
}
}
}
}
 
/*
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++)
for (int z = 0; z < s_Data.count() - 1; z++)
{
if (s_Data[z][0] == '$')
{
// qDebug(QString("TCP: " + s_Data[z]).toLatin1().data());
parse_TCP_Data(s_Data[z], ID);
parse_TCP_Server_Data(s_Data[z], ID);
show_Terminal(5, "IP: " + s_Data[z]);
 
}
else
{ // Daten vom Client an den MK. todo: Nur erlauben wenn autemtifiziert oder Localhost
if ((Connection[ID].Auth == true))
{
if ((Con_Server[ID].Status >= 2))
{
show_Terminal(3, s_Data[z]);
o_Input->send_Data(s_Data[z]);
}
474,7 → 900,9
}
}
}
*/
}
}
 
void dlg_Main::slot_TCP_Disconnect()
{
482,16 → 910,16
 
int ID = Socket->property("ID").toUInt();
 
Item[ID][1]->setText("Disconected");
Item[ID]->setText(" " + QString(o_TCP[ID]->peerAddress().toString()).leftJustified(15,' ') + " - Disconected");
 
Connection[ID] = Connection[0];
Connection[ID].Open = false;
Con_Server[ID] = Con_Server[0];
Con_Server[ID].Status = 0;
 
Connect_Count--;
 
Socket->setProperty("ID", 0);
 
if (Connect_Count == 0)
if ((Connect_Count == 0) && (o_Input->IsOpen()))
slot_btn_Connect();
}
 
515,7 → 943,17
}
}
 
o_Settings->CLIENT.TCP_MAX = cb_Server->count();
o_Settings->CLIENT.TCP_ID = cb_Server->currentIndex();
 
for (int z = 0; z < cb_Server->count(); z++)
{
if (z < 10)
{
o_Settings->CLIENT.TCP_SERVER[z] = cb_Server->itemText(z);
}
}
 
o_Settings->write_Settings();
 
// qDebug("Ende.");