From 0b49edf464a238e7e7ff141310681613b1b1b050 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 27 Feb 2019 23:17:54 +0400 Subject: pica-client: Qt5 support --- pica-client/contactlistwidget.cpp | 2 +- pica-client/main.cpp | 4 +++- pica-client/openssltool.cpp | 8 ++++---- pica-client/skynet.cpp | 12 ++++++------ pica-client/sound.cpp | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) (limited to 'pica-client') diff --git a/pica-client/contactlistwidget.cpp b/pica-client/contactlistwidget.cpp index dd23d34..bf47cae 100644 --- a/pica-client/contactlistwidget.cpp +++ b/pica-client/contactlistwidget.cpp @@ -105,7 +105,7 @@ void ContactListWidget::add_contact() if (ok && !input.isEmpty()) { - QByteArray user_id = QByteArray::fromBase64(input.toAscii()).left(PICA_ID_SIZE); + QByteArray user_id = QByteArray::fromBase64(input.toLatin1()).left(PICA_ID_SIZE); if (user_id.size() != PICA_ID_SIZE) { diff --git a/pica-client/main.cpp b/pica-client/main.cpp index debb105..5da0698 100644 --- a/pica-client/main.cpp +++ b/pica-client/main.cpp @@ -15,7 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include +//#include +#include +#include #include "mainwindow.h" #include "accountswindow.h" #include "globals.h" diff --git a/pica-client/openssltool.cpp b/pica-client/openssltool.cpp index e630b36..d38dba6 100644 --- a/pica-client/openssltool.cpp +++ b/pica-client/openssltool.cpp @@ -68,7 +68,7 @@ QString OpenSSLTool::NameFromCertString(QString cert_pem) if (!openssl.waitForStarted()) return QString(); - openssl.write(cert_pem.toAscii()); + openssl.write(cert_pem.toLatin1()); if (!openssl.waitForFinished()) return QString(); @@ -104,7 +104,7 @@ QString OpenSSLTool::CertTextFromString(QString cert_pem) if (!openssl.waitForStarted()) return QString(); - ba = cert_pem.toAscii(); + ba = cert_pem.toLatin1(); ret = openssl.write(data = (char*)ba.constData()); openssl.closeWriteChannel(); @@ -150,7 +150,7 @@ bool OpenSSLTool::GenRSAKeySignal(QString keyfile, bool setpassword, QString pas if (setpassword) { - openssl_.write((password + "\n").toAscii().constData()); + openssl_.write((password + "\n").toLatin1().constData()); } openssl_.disconnect(&openssl_, SIGNAL(finished(int, QProcess::ExitStatus)), 0, 0); @@ -183,7 +183,7 @@ bool OpenSSLTool::GenCertSignal(QString cert_file, QString keyfile, QString keyp if (!openssl_.waitForStarted()) return false; - openssl_.write((keypassword + "\n").toAscii().constData()); + openssl_.write((keypassword + "\n").toLatin1().constData()); openssl_.disconnect(&openssl_, SIGNAL(finished(int, QProcess::ExitStatus)), 0, 0); openssl_.connect(&openssl_, SIGNAL(finished(int, QProcess::ExitStatus)), receiver, finished_slot); diff --git a/pica-client/skynet.cpp b/pica-client/skynet.cpp index 311e492..913c7dc 100644 --- a/pica-client/skynet.cpp +++ b/pica-client/skynet.cpp @@ -68,7 +68,7 @@ SkyNet::SkyNet() connect(this, SIGNAL(PeerCertificateReceived(QByteArray, QString, bool*)), this, SLOT(verify_peer_cert(QByteArray, QString, bool*)), Qt::DirectConnection); connect(this, SIGNAL(MultiloginMessageReceived(quint64,QString,quint16)), this, SLOT(multilogin_event(quint64,QString,quint16)), Qt::QueuedConnection); - event_loop_timer_id = startTimer(0); + event_loop_timer_id = startTimer(100); } @@ -249,8 +249,8 @@ void SkyNet::verify_peer_cert(QByteArray peer_id, QString cert_pem, bool *verifi QByteArray stored_DER, received_DER; - stored_DER = QByteArray::fromBase64(stripped_stored_cert.toAscii().constData()); - received_DER = QByteArray::fromBase64(stripped_received_cert.toAscii().constData()); + stored_DER = QByteArray::fromBase64(stripped_stored_cert.toLatin1().constData()); + received_DER = QByteArray::fromBase64(stripped_received_cert.toLatin1().constData()); if (stored_DER.size() != received_DER.size() || memcmp(stored_DER.constData(), received_DER.constData(), stored_DER.size()) != 0) @@ -283,7 +283,7 @@ void SkyNet::timerEvent(QTimerEvent *e) nodelinks.append(NULL); - ret = PICA_event_loop(nodelinks.data(), 1); + ret = PICA_event_loop(nodelinks.data(), 25); while(!connected_nodes_to_close.empty()) { @@ -410,7 +410,7 @@ void SkyNet::Join(Accounts::AccountRecord &accrec) } int ret = PICA_new_listener(acc, - public_addr.toAscii().constData(), + public_addr.toLatin1().constData(), pub_port, loc_port, &listener); if (ret != PICA_OK) @@ -915,7 +915,7 @@ int SkyNet::peer_cert_verify_cb(const unsigned char *peer_id, const char *cert_p { bool verified = true; - skynet->emit_PeerCertificateReceived(QByteArray((const char*)peer_id, PICA_ID_SIZE), QString::fromAscii(cert_pem, nb), &verified); + skynet->emit_PeerCertificateReceived(QByteArray((const char*)peer_id, PICA_ID_SIZE), QString::fromLatin1(cert_pem, nb), &verified); if (!verified) return 0; diff --git a/pica-client/sound.cpp b/pica-client/sound.cpp index 3684942..08294bc 100644 --- a/pica-client/sound.cpp +++ b/pica-client/sound.cpp @@ -50,7 +50,7 @@ void Sound::play(const QString sndfile) QProcess::execute("aplay -q " + sndfile); #endif #if defined(WIN32) - sndPlaySound(sndfile.toAscii().constData(), SND_ASYNC | SND_NODEFAULT); + sndPlaySound(sndfile.toLatin1().constData(), SND_ASYNC | SND_NODEFAULT); #endif #if defined(__APPLE__) QProcess::execute("/usr/bin/afplay " + sndfile); -- cgit v1.2.1