diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro
index 35cc8f17..e2a52e2e 100644
--- a/YACReaderLibrary/YACReaderLibrary.pro
+++ b/YACReaderLibrary/YACReaderLibrary.pro
@@ -42,7 +42,8 @@ HEADERS += comic_flow.h \
import_comics_info_dialog.h \
../common/check_new_version.h \
../YACReader/comic.h \
- ../YACReader/bookmarks.h
+ ../YACReader/bookmarks.h \
+ server_config_dialog.h
SOURCES += comic_flow.cpp \
create_library_dialog.cpp \
@@ -72,7 +73,8 @@ SOURCES += comic_flow.cpp \
import_comics_info_dialog.cpp \
../common/check_new_version.cpp \
../YACReader/comic.cpp \
- ../YACReader/bookmarks.cpp
+ ../YACReader/bookmarks.cpp \
+ server_config_dialog.cpp
include(./server/server.pri)
diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp
index a83f2905..6ecd73ff 100644
--- a/YACReaderLibrary/library_window.cpp
+++ b/YACReaderLibrary/library_window.cpp
@@ -186,6 +186,8 @@ void LibraryWindow::doDialogs()
addLibraryDialog = new AddLibraryDialog(this);
optionsDialog = new OptionsDialog(this);
optionsDialog->restoreOptions();
+ serverConfigDialog = new ServerConfigDialog(this);
+
had = new HelpAboutDialog(this); //TODO load data.
QString sufix = QLocale::system().name();
if(QFile(":/files/about_"+sufix+".html").exists())
@@ -197,6 +199,8 @@ void LibraryWindow::doDialogs()
had->loadHelp(":/files/helpYACReaderLibrary_"+sufix+".html");
else
had->loadHelp(":/files/helpYACReaderLibrary.html");
+
+
}
void LibraryWindow::doModels()
@@ -323,6 +327,10 @@ void LibraryWindow::createActions()
optionsAction->setToolTip(tr("Show options dialog"));
optionsAction->setIcon(QIcon(":/images/options.png"));
+ serverConfigAction = new QAction(this);
+ serverConfigAction->setToolTip(tr("Show comics server options dialog"));
+ serverConfigAction->setIcon(QIcon(":/images/options.png"));
+
//disable actions
updateLibraryAction->setEnabled(false);
renameLibraryAction->setEnabled(false);
@@ -473,6 +481,7 @@ void LibraryWindow::createToolBars()
libraryToolBar->addAction(toggleFullScreenAction);
libraryToolBar->addWidget(new QToolBarStretch());
+ libraryToolBar->addAction(serverConfigAction);
libraryToolBar->addAction(optionsAction);
libraryToolBar->addAction(helpAboutAction);
@@ -561,7 +570,7 @@ void LibraryWindow::createConnections()
connect(exportComicsInfo,SIGNAL(triggered()),this,SLOT(showExportComicsInfo()));
connect(importComicsInfo,SIGNAL(triggered()),this,SLOT(showImportComicsInfo()));
- //properties
+ //properties & config
connect(propertiesDialog,SIGNAL(accepted()),this,SLOT(reloadCovers()));
connect(updateLibraryAction,SIGNAL(triggered()),this,SLOT(updateLibrary()));
@@ -575,6 +584,7 @@ void LibraryWindow::createConnections()
connect(colapseAllNodesAction,SIGNAL(triggered()),foldersView,SLOT(collapseAll()));
connect(toggleFullScreenAction,SIGNAL(triggered()),this,SLOT(toggleFullScreen()));
connect(optionsAction, SIGNAL(triggered()),optionsDialog,SLOT(show()));
+ connect(serverConfigAction, SIGNAL(triggered()), serverConfigDialog, SLOT(show()));
connect(optionsDialog, SIGNAL(optionsChanged()),this,SLOT(reloadOptions()));
//ComicFlow
connect(comicFlow,SIGNAL(selected(unsigned int)),this,SLOT(openComic()));
diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h
index 5e77d420..f04403d3 100644
--- a/YACReaderLibrary/library_window.h
+++ b/YACReaderLibrary/library_window.h
@@ -28,6 +28,7 @@
#include "treemodel.h"
#include "tablemodel.h"
#include "treeitem.h"
+#include "server_config_dialog.h"
class LibraryWindow : public QMainWindow
{
@@ -98,6 +99,7 @@ private:
QAction * renameLibraryAction;
QAction * toggleFullScreenAction;
QAction * optionsAction;
+ QAction * serverConfigAction;
//tree actions
QAction * setRootIndexAction;
@@ -126,6 +128,7 @@ private:
QToolBar * editInfoToolBar;
OptionsDialog * optionsDialog;
+ ServerConfigDialog * serverConfigDialog;
QString libraryPath;
QString comicsPath;
diff --git a/YACReaderLibrary/server/controllers/foldercontroller.cpp b/YACReaderLibrary/server/controllers/foldercontroller.cpp
index f4888e9a..828b1625 100644
--- a/YACReaderLibrary/server/controllers/foldercontroller.cpp
+++ b/YACReaderLibrary/server/controllers/foldercontroller.cpp
@@ -14,6 +14,11 @@ void FolderController::service(HttpRequest& request, HttpResponse& response)
{
response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
+ HttpSession session=Static::sessionStore->getSession(request,response);
+
+ QString y = session.get("xxx").toString();
+ response.writeText(QString("session xxx : %1
").arg(y));
+
Template t=Static::templateLoader->getTemplate("folder",request.getHeader("Accept-Language"));
t.enableWarnings();
QString path = request.getPath();
diff --git a/YACReaderLibrary/server/controllers/librariescontroller.cpp b/YACReaderLibrary/server/controllers/librariescontroller.cpp
index 8cfc459c..7ffb582e 100644
--- a/YACReaderLibrary/server/controllers/librariescontroller.cpp
+++ b/YACReaderLibrary/server/controllers/librariescontroller.cpp
@@ -12,6 +12,10 @@ void LibrariesController::service(HttpRequest& request, HttpResponse& response)
{
response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
+ HttpSession session=Static::sessionStore->getSession(request,response);
+
+ session.set("xxx","yyy");
+
Template t=Static::templateLoader->getTemplate("libraries",request.getHeader("Accept-Language"));
t.enableWarnings();
diff --git a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp
index c7e4963b..f4d92460 100644
--- a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp
+++ b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp
@@ -220,6 +220,7 @@ void HttpSession::setCurrentComic(qulonglong id, Comic * comic)
{
if(dataPtr)
{
+ dismissCurrentComic();
dataPtr->yacreaderSessionData.comicId = id;
dataPtr->yacreaderSessionData.comic = comic;
}
diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp
new file mode 100644
index 00000000..67190caa
--- /dev/null
+++ b/YACReaderLibrary/server_config_dialog.cpp
@@ -0,0 +1,52 @@
+#include "server_config_dialog.h"
+#include
+#include
+
+
+ServerConfigDialog::ServerConfigDialog(QWidget * parent)
+ :QDialog(parent)
+{
+ accept = new QPushButton(tr("Generar"));
+ connect(accept,SIGNAL(clicked()),this,SLOT(generateQR()));
+ qrCodeImage = new QPixmap();
+ qrCode = new QLabel("xxxx",this);
+
+ QGridLayout * mainLayout = new QGridLayout;
+ mainLayout->addWidget(accept,0,0);
+ mainLayout->addWidget(qrCode,0,1);
+
+
+ this->setLayout(mainLayout);
+}
+
+void ServerConfigDialog::generateQR()
+{
+ generateQR("192.168.2.110:8080");
+}
+
+void ServerConfigDialog::generateQR(const QString & serverAddress)
+{
+ qrGenerator = new QProcess();
+ QStringList attributes;
+ attributes << "-o" << QCoreApplication::applicationDirPath()+"/utils/tmp.png" << "-s" << "8" << "-l" << "H" << serverAddress;
+ connect(qrGenerator,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(updateImage(void)));
+ connect(qrGenerator,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError)));
+ qrGenerator->start(QCoreApplication::applicationDirPath()+"/utils/qrcode",attributes);
+}
+
+void ServerConfigDialog::updateImage()
+{
+ //QByteArray imgBinary = qrGenerator->readAllStandardOutput();
+ //imgBinary = imgBinary.replace(0x0D0A,0x0A);
+ //qrCodeImage->loadFromData(imgBinary);
+ //if(imgBinary.isEmpty())
+ // qrCode->setText("yyyyy");
+ //else
+ // qrCode->setText("")
+ //delete qrGenerator;
+
+ qrCodeImage->load(QCoreApplication::applicationDirPath()+"/utils/tmp.png");
+ qrCode->setPixmap(*qrCodeImage);
+
+ delete qrGenerator;
+}
\ No newline at end of file
diff --git a/YACReaderLibrary/server_config_dialog.h b/YACReaderLibrary/server_config_dialog.h
new file mode 100644
index 00000000..87d3084e
--- /dev/null
+++ b/YACReaderLibrary/server_config_dialog.h
@@ -0,0 +1,37 @@
+#ifndef __SERVER_CONFIG_DIALOG_H
+#define __SERVER_CONFIG_DIALOG_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class ServerConfigDialog : public QDialog
+{
+Q_OBJECT
+ public:
+ ServerConfigDialog(QWidget * parent = 0);
+ private:
+ QLabel * ipLabel;
+ QLabel * portLabel;
+ QLineEdit * portEdit;
+ QPushButton * close;
+ QPushButton * accept;
+ QLabel * qrCode;
+ QPixmap * qrCodeImage;
+
+ QProcess * qrGenerator;
+ public slots:
+ void generateQR();
+ void generateQR(const QString & serverAddress);
+ void updateImage();
+signals:
+ void portChanged(QString port);
+
+};
+
+
+#endif
\ No newline at end of file