1 #ifndef __SERVER_CONFIG_DIALOG_H 2 #define __SERVER_CONFIG_DIALOG_H 3 4 #include <QDialog> 5 #include <QLabel> 6 #include <QLineEdit> 7 #include <QPushButton> 8 #include <QPixmap> 9 #include <QComboBox> 10 #include <QCheckBox> 11 #include <QLibrary> 12 13 class ServerConfigDialog : public QDialog 14 { 15 Q_OBJECT 16 public: 17 ServerConfigDialog(QWidget *parent = 0); 18 19 private: 20 QComboBox *ip; 21 QLineEdit *port; 22 23 QCheckBox *check; 24 QCheckBox *performanceWorkaroundCheck; 25 26 QPushButton *close; 27 QPushButton *accept; 28 QLabel *qrCode; 29 30 public slots: 31 void generateQR(); 32 void generateQR(const QString &serverAddress); 33 void regenerateQR(const QString &ip); 34 void enableServer(int status); 35 void enableperformanceWorkaround(int status); 36 void updatePort(); 37 signals: 38 void portChanged(QString port); 39 }; 40 41 class QrEncoder 42 { 43 public: 44 QrEncoder(); 45 QBitmap encode(const QString &string); 46 47 private: 48 /*libqrencode data structures*/ 49 typedef struct { 50 int version; ///< version of the symbol 51 int width; ///< width of the symbol 52 unsigned char *data; ///< symbol data 53 } QRcode; 54 typedef QRcode *(*_QRcode_encodeString8bit)(char[], int, int); 55 typedef void (*_QRcode_free)(QRcode *); 56 _QRcode_free QRcode_free; 57 _QRcode_encodeString8bit QRcode_encodeString8bit; 58 }; 59 60 #endif 61