From 8eb1a6fdb1fbf960de08a1179b3fca9557280345 Mon Sep 17 00:00:00 2001 From: agilob Date: Sat, 7 Mar 2015 20:29:39 +0000 Subject: [PATCH] tox URI and updated install.md --- INSTALL.md | 10 ++++++---- src/misc/qrwidget.cpp | 13 ++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index a0d4680de..5d835211a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -59,22 +59,22 @@ git clone https://github.com/tux3/qTox.git qTox The following steps assumes that you cloned the repository at "/home/user/qTox". If you decided to choose another location, replace corresponding parts. -###GCC, Qt, OpenCV and OpanAL Soft +###GCC, Qt, OpenCV, OpanAL Soft and QRCode Arch Linux: ```bash -sudo pacman -S --needed base-devel qt5 opencv openal libxss +sudo pacman -S --needed base-devel qt5 opencv openal libxss qrencode ``` Debian / Ubuntu: ```bash -sudo apt-get install build-essential qt5-qmake qt5-default qttools5-dev-tools libqt5opengl5-dev libqt5svg5-dev libopenal-dev libopencv-dev libxss-dev +sudo apt-get install build-essential qt5-qmake qt5-default qttools5-dev-tools libqt5opengl5-dev libqt5svg5-dev libopenal-dev libopencv-dev libxss-dev qrencode ``` Fedora: ```bash yum groupinstall "Development Tools" -yum install qt-devel qt-doc qt-creator qt5-qtsvg opencv-devel openal-soft-devel libXScrnSaver-devel +yum install qt-devel qt-doc qt-creator qt5-qtsvg opencv-devel openal-soft-devel libXScrnSaver-devel qrencode ``` Slackware: @@ -87,6 +87,8 @@ http://slackbuilds.org/repository/14.1/libraries/qt5/ http://slackbuilds.org/repository/14.1/libraries/opencv/ +http://slackbuilds.org/slackbuilds/14.1/graphics/qrencode/ + ###Tox Core diff --git a/src/misc/qrwidget.cpp b/src/misc/qrwidget.cpp index 19ff2b42c..cffb14804 100644 --- a/src/misc/qrwidget.cpp +++ b/src/misc/qrwidget.cpp @@ -7,7 +7,8 @@ #include "qrencode.h" QRWidget::QRWidget(QWidget *parent) : QWidget(parent), data("0") -//Note: The encoding fails with empty string so I just default to something else. Use the setQRData() call to change this. +//Note: The encoding fails with empty string so I just default to something else. +//Use the setQRData() call to change this. { //size of the qimage might be problematic in the future, but it works for me size.setWidth(480); @@ -17,7 +18,7 @@ QRWidget::QRWidget(QWidget *parent) : QWidget(parent), data("0") void QRWidget::setQRData(QString data) { - this->data = data; + this->data = "tox:" + data; paintImage(); } @@ -30,7 +31,8 @@ QString QRWidget::getImageAsText() image->save(&buffer, "PNG"); // writes the image in PNG format inside the buffer QString iconBase64 = QString::fromLatin1(ba.toBase64().data()); - QString base64Image = ""; + QString base64Image = ""; + qDebug() << base64Image; return QString(base64Image); } @@ -40,7 +42,8 @@ void QRWidget::paintImage() { QPainter painter(image); //NOTE: I have hardcoded some parameters here that would make more sense as variables. - QRcode *qr = QRcode_encodeString(data.toStdString().c_str(), 1, QR_ECLEVEL_L, QR_MODE_8, 0); + // ECLEVEL_M is much faster recognizable by barcodescanner any any other type + QRcode *qr = QRcode_encodeString(data.toStdString().c_str(), 1, QR_ECLEVEL_M, QR_MODE_8, 0); if(0 != qr) { @@ -50,7 +53,7 @@ void QRWidget::paintImage() painter.setPen(Qt::NoPen); painter.drawRect(0, 0, size.width(), size.height()); painter.setBrush(fg); - const int s = qr->width>0 ? qr->width : 1; + const int s = qr->width > 0 ? qr->width : 1; const double w = width(); const double h = height(); const double aspect = w / h;