Replace qrencode with libqrencode (and do some code cleanup)

This commit is contained in:
Felix Kauselmann
2018-03-10 11:22:03 +01:00
parent ce50b285d4
commit 89ed9508ec
2 changed files with 86 additions and 94 deletions

View File

@ -6,10 +6,9 @@
#include <QLineEdit>
#include <QPushButton>
#include <QPixmap>
#include <QProcess>
#include <QPixmap>
#include <QComboBox>
#include <QCheckBox>
#include <QLibrary>
class ServerConfigDialog : public QDialog
{
@ -19,29 +18,42 @@ Q_OBJECT
private:
QComboBox * ip;
QLineEdit * port;
QCheckBox * check;
QCheckBox * performanceWorkaroundCheck;
QCheckBox * performanceWorkaroundCheck;
QPushButton * close;
QPushButton * accept;
QLabel * qrCode;
QPixmap * qrCodeImage;
QProcess * qrGenerator;
public slots:
void generateQR();
void generateQR(const QString & serverAddress);
void regenerateQR(const QString & ip);
void updateImage();
void enableServer(int status);
void enableperformanceWorkaround(int status);
void enableperformanceWorkaround(int status);
void updatePort();
signals:
void portChanged(QString port);
};
class QrEncoder
{
public:
QrEncoder();
QBitmap encode(const QString & string);
private:
/*libqrencode data structures*/
typedef struct {
int version; ///< version of the symbol
int width; ///< width of the symbol
unsigned char *data; ///< symbol data
} QRcode;
typedef QRcode* (*_QRcode_encodeString8bit)(char [], int, int);
typedef void (*_QRcode_free)(QRcode*);
_QRcode_free QRcode_free;
_QRcode_encodeString8bit QRcode_encodeString8bit;
};
#endif