mirror of
https://github.com/YACReader/yacreader
synced 2025-07-22 23:15:14 -04:00
Se recuerda si se debe mostrar o no la "label" informaci?n.
Corregido bug que provocaba el fallo de YACReader al pasar muy r?pido las p?ginas. Modificado el di?logo "server config" para que muestre todas las ips y regenere el c?digo qr en caso de que el usuario cambie la ip.
This commit is contained in:
@ -17,14 +17,11 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
|
||||
qrCodeImage = new QPixmap();
|
||||
qrCode = new QLabel("xxxx",this);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QGridLayout * gridEdits = new QGridLayout;
|
||||
gridEdits->addWidget(new QLabel(tr("IP")),0,0);
|
||||
gridEdits->addWidget(new QLabel(tr("Port")),0,1);
|
||||
ip = new QLineEdit(". . .");
|
||||
ip = new QComboBox();
|
||||
connect(ip,SIGNAL(activated(const QString &)),this,SLOT(regenerateQR(const QString &)));
|
||||
gridEdits->addWidget(ip,1,0);
|
||||
port = new QLineEdit("8080");
|
||||
port->setMaximumWidth(50);
|
||||
@ -88,19 +85,24 @@ void ServerConfigDialog::generateQR()
|
||||
|
||||
QString dir;
|
||||
QList<QHostAddress> list = QHostInfo::fromName( QHostInfo::localHostName() ).addresses();
|
||||
QList<QString> otherAddresses;
|
||||
foreach(QHostAddress add, list)
|
||||
{
|
||||
QString tmp = add.toString();
|
||||
if(tmp.contains(".") && tmp != "127.0.0.1")
|
||||
{
|
||||
dir = tmp;
|
||||
break;
|
||||
}
|
||||
if(dir.isEmpty())
|
||||
dir = tmp;
|
||||
else
|
||||
otherAddresses.push_back(tmp);
|
||||
|
||||
}
|
||||
}
|
||||
if(!dir.isEmpty())
|
||||
{
|
||||
generateQR(dir+":"+s->getPort());
|
||||
ip->setText(dir);
|
||||
ip->addItem(dir);
|
||||
ip->addItems(otherAddresses);
|
||||
port->setText(s->getPort());
|
||||
}
|
||||
else
|
||||
@ -140,4 +142,9 @@ void ServerConfigDialog::updateImage()
|
||||
qrCode->setPixmap(*qrCodeImage);
|
||||
|
||||
delete qrGenerator;*/
|
||||
}
|
||||
}
|
||||
|
||||
void ServerConfigDialog::regenerateQR(const QString & ip)
|
||||
{
|
||||
generateQR(ip+":"+s->getPort());
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QProcess>
|
||||
#include <QPixmap>
|
||||
#include <QComboBox>
|
||||
|
||||
class ServerConfigDialog : public QDialog
|
||||
{
|
||||
@ -15,7 +16,7 @@ Q_OBJECT
|
||||
public:
|
||||
ServerConfigDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLineEdit * ip;
|
||||
QComboBox * ip;
|
||||
QLineEdit * port;
|
||||
QPushButton * close;
|
||||
QPushButton * accept;
|
||||
@ -26,6 +27,7 @@ Q_OBJECT
|
||||
public slots:
|
||||
void generateQR();
|
||||
void generateQR(const QString & serverAddress);
|
||||
void regenerateQR(const QString & ip);
|
||||
void updateImage();
|
||||
signals:
|
||||
void portChanged(QString port);
|
||||
|
Reference in New Issue
Block a user