diff options
| author | Anton <anton@picapica> | 2019-02-27 23:17:54 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2019-02-27 23:17:54 +0400 |
| commit | 0b49edf464a238e7e7ff141310681613b1b1b050 (patch) | |
| tree | d95b3d53d121933cfe3ccbf44916f8b78e85a461 | |
| parent | 29bc265a6e10d4e5daaf9fa87aa82dd010d192e8 (diff) | |
| download | pica-pica-0b49edf464a238e7e7ff141310681613b1b1b050.tar.gz pica-pica-0b49edf464a238e7e7ff141310681613b1b1b050.zip | |
pica-client: Qt5 support
| -rw-r--r-- | configure.ac | 28 | ||||
| -rw-r--r-- | pica-client/contactlistwidget.cpp | 2 | ||||
| -rw-r--r-- | pica-client/main.cpp | 4 | ||||
| -rw-r--r-- | pica-client/openssltool.cpp | 8 | ||||
| -rw-r--r-- | pica-client/skynet.cpp | 12 | ||||
| -rw-r--r-- | pica-client/sound.cpp | 2 |
6 files changed, 40 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac index 00f7d6e..88fd60f 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,12 @@ AC_ARG_WITH([miniupnpc], [], [with_miniupnpc=yes]) +AC_ARG_WITH([qt], + [AS_HELP_STRING([--with-qt=qt4|qt5 qt5 is default], + [Select Qt version, 4 or 5])], + [qt_version=$withval], + [qt_version=qt5]) + AS_IF([test "x$with_miniupnpc" != xno], [AC_CHECK_LIB([miniupnpc], [main], [], @@ -34,6 +40,22 @@ AS_IF([test "x$with_miniupnpc" != xno], [miniupnpc test failed (--without-miniupnpc to disable)])], [])]) +AS_IF([test "x$qt_version" = xqt5], + [ + QT_MODULES="Qt5Core Qt5Gui Qt5Sql Qt5Network Qt5Widgets" + QT_UIC_NAMES="uic-qt5 uic5 uic" + QT_MOC_NAMES="moc-qt5 moc5 moc" + CFLAGS="-fPIC $CFLAGS" + CXXFLAGS="-fPIC $CXXFLAGS" + ], + [test "x$qt_version" = xqt4], + [ + QT_MODULES="QtCore QtGui QtSql QtNetwork" + QT_UIC_NAMES="uic-qt4 uic4 uic" + QT_MOC_NAMES="moc-qt4 moc4 moc" + ], + [AC_MSG_ERROR(["Invalid Qt version"])]) + # Checks for common libraries, required by both pica-node and pica-client AC_SEARCH_LIBS([dlopen], [dl]) AC_CHECK_LIB([crypto], [RAND_add],[],[AC_MSG_ERROR(["libcrypto from OpenSSL package not found"])],[ -lz ]) @@ -81,11 +103,11 @@ AS_IF([test "x$SQLITE3" != xyes], [ AC_MSG_ERROR(["sqlite3 program not found"]) #pica-client tests AS_IF([test "x$PICA_CLIENT_ENABLED" = "xyes"],[ #AC_PROG_CXX -PKG_CHECK_MODULES([QT_DEPENDENCIES], [QtCore QtGui QtSql QtNetwork]) +PKG_CHECK_MODULES([QT_DEPENDENCIES], [$QT_MODULES]) AC_SUBST([QT_DEPENDENCIES_CFLAGS]) AC_SUBST([QT_DEPENDENCIES_LIBS]) -AC_CHECK_PROGS([UIC], [uic-qt4 uic4 uic], [notfound]) -AC_CHECK_PROGS([MOC], [moc-qt4 moc4 moc], [notfound]) +AC_CHECK_PROGS([UIC], [$QT_UIC_NAMES], [notfound]) +AC_CHECK_PROGS([MOC], [$QT_MOC_NAMES], [notfound]) #fail if not found ... AS_IF([test "x$UIC" = xnotfound],[AC_MSG_ERROR(["uic program not found. Please install Qt development package"])]) AS_IF([test "x$MOC" = xnotfound],[AC_MSG_ERROR(["moc program not found. Please install Qt development package"])]) 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 <https://www.gnu.org/licenses/>. */ -#include <QtGui/QApplication> +//#include <QtGui/QApplication> +#include <QCoreApplication> +#include <QApplication> #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); |
