1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

update example

This commit is contained in:
tianduanrui 2018-04-29 14:44:39 +08:00
parent e036cdc00b
commit 5186b97238
6 changed files with 18 additions and 9 deletions

View File

@ -14,7 +14,8 @@ MainWindow::MainWindow ( QWidget* parent ) :
//
p = QQtClientConnectionInstance ( this );
connect ( p, SIGNAL ( signalServerSay ( QString ) ),
this, SLOT ( on_recv_say_hello ( QString ) ) );
this, SLOT ( on_recv_say_hello ( QString ) ),
Qt::QueuedConnection );
//QQtClient2Protocol* p0 = QQtClient2ConnectionInstance ( this );
//p0->sendCommand1();

View File

@ -149,7 +149,6 @@ protected:
}
virtual quint16 splitter ( const QByteArray& l ) override { //stream
pline() << l[0] << l[1] << l[2] << l[3] << l[4] << l[5] << l[6] << l[7];
for ( int i = 0; i < l.size(); i++ ) {
pline() << l[i];
}
@ -157,7 +156,6 @@ protected:
QByteArray s0 = l.left ( 3 );
quint8 start = 0;
quint16 size = 0;
pline() << s0[0] << s0[1] << s0[2];
s0 >> start;
s0 >> size;

0
src/linux_cd_path.sh Executable file → Normal file
View File

0
src/linux_cp_files.sh Executable file → Normal file
View File

0
src/linux_cur_path.sh Executable file → Normal file
View File

View File

@ -143,10 +143,6 @@ void QQtTcpClient::socketStateChanged ( QAbstractSocket::SocketState eSocketStat
case QAbstractSocket::UnconnectedState:
{
eConType++;
QSettings set;
set.setValue ( "Network/eConType", eConType );
set.sync();
break;
}
default:
@ -173,8 +169,19 @@ void QQtTcpClient::socketErrorOccured ( QAbstractSocket::SocketError e )
case QAbstractSocket::HostNotFoundError:
default:
{
QSettings set;
int contype = set.value ( "Network/eConType", 0 ).toInt();
contype++;
contype = contype % m_serverIP.size();
set.setValue ( "Network/eConType", contype );
set.sync();
eConType = contype;
emit signalConnectFail();
break;
}
break;
}
}
@ -212,9 +219,12 @@ void QQtTcpClient::updateProgress ( qint64 bytes )
void QQtTcpClient::connectToSingelHost()
{
//int contype = eConType % m_serverIP.size();
QSettings set;
int contype = set.value ( "Network/eConType", 0 ).toInt();
//int contype = eConType % m_serverIP.size();
contype = contype % m_serverIP.size();
QString ip = m_serverIP.at ( contype );
connectToHost ( QHostAddress ( ip ), m_PORT );