diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b5d0d487..95ba81a3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ Mejorada la gesti Añadido botón que permite ocultar las portadas en la pantalla de importación Añadidos títulos "Bibliotecas" y "Carpetas" a la barra de navegación Nuevos iconos para seleccionar la carpeta raíz, expandir y contraer todos. +Botón para cambiar el puerto del servidor por el usuario. 6.2 Nueva ventana de "bienvenida" diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 721d655b..6b4f3277 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -193,7 +193,7 @@ void LibraryWindow::doLayout() left = new QWidget; QVBoxLayout * l = new QVBoxLayout; selectedLibrary = new QComboBox; - l->setContentsMargins(2,0,0,0); + l->setContentsMargins(sHorizontal->handleWidth(),0,0,0); YACReaderTitledToolBar * librariesTitle = new YACReaderTitledToolBar(tr("Libraries")); diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp index 89ce1b11..73bf07d4 100644 --- a/YACReaderLibrary/server_config_dialog.cpp +++ b/YACReaderLibrary/server_config_dialog.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "startup.h" #include "yacreader_global.h" @@ -56,8 +57,7 @@ extern Startup * s; ServerConfigDialog::ServerConfigDialog(QWidget * parent) :QDialog(parent) { - accept = new QPushButton(tr("Update IPs")); - connect(accept,SIGNAL(clicked()),this,SLOT(generateQR())); + accept = new QPushButton(tr("set port"),this); qrCodeImage = new QPixmap(); qrCode = new QLabel(this); qrCode->move(196,73); @@ -101,9 +101,14 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent) ip->setMinimumWidth(110); port = new QLineEdit("8080",this); - port->setReadOnly(true); + port->setReadOnly(false); port->setMaximumWidth(50); - port->move(571,110); + port->move(520,110); + QValidator *validator = new QIntValidator(1024, 65535, this); + port->setValidator(validator); + + accept->move(520,149); + connect(accept,SIGNAL(pressed()),this,SLOT(updatePort())); check = new QCheckBox(this); check->move(453,314); @@ -251,6 +256,7 @@ void ServerConfigDialog::generateQR() void ServerConfigDialog::generateQR(const QString & serverAddress) { + qrCode->clear(); qrGenerator = new QProcess(); QStringList attributes; attributes << "-o" << "-" /*QCoreApplication::applicationDirPath()+"/utils/tmp.png"*/ << "-s" << "8" << "-l" << "H" << "-m" << "0" << serverAddress; @@ -283,3 +289,18 @@ void ServerConfigDialog::regenerateQR(const QString & ip) { generateQR(ip+":"+s->getPort()); } + +void ServerConfigDialog::updatePort() +{ + + QSettings * settings = new QSettings(QCoreApplication::applicationDirPath()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor + settings->beginGroup("listener"); + settings->setValue("port",port->text().toInt()); + settings->endGroup(); + + s->stop(); + s->start(); + + generateQR(ip->currentText()+":"+port->text()); + +} \ No newline at end of file diff --git a/YACReaderLibrary/server_config_dialog.h b/YACReaderLibrary/server_config_dialog.h index f1c0478c..b21c96ee 100644 --- a/YACReaderLibrary/server_config_dialog.h +++ b/YACReaderLibrary/server_config_dialog.h @@ -34,6 +34,7 @@ Q_OBJECT void regenerateQR(const QString & ip); void updateImage(); void enableServer(int status); + void updatePort(); signals: void portChanged(QString port); diff --git a/custom_widgets/yacreader_titled_toolbar.cpp b/custom_widgets/yacreader_titled_toolbar.cpp index 4cc760f6..8cde71a7 100644 --- a/custom_widgets/yacreader_titled_toolbar.cpp +++ b/custom_widgets/yacreader_titled_toolbar.cpp @@ -18,7 +18,7 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *p QLabel * nameLabel = new QLabel(title,this); - QString nameLabelStyleSheet = "QLabel {color:#454545; padding:0 0 0 0px; margin:0px; font-size:14px; font-weight:bold;}"; + QString nameLabelStyleSheet = "QLabel {color:#454545; padding:0 0 0 0px; margin:0px; font-size:13px; font-weight:bold;}"; nameLabel->setStyleSheet(nameLabelStyleSheet); mainLayout->addWidget(nameLabel,Qt::AlignLeft);