mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 09:08:20 -04:00
generaci?n de codigo qr mediqante qrcode implementada
This commit is contained in:
parent
6373649672
commit
51b62edc71
@ -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)
|
||||
|
||||
|
@ -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()));
|
||||
|
@ -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;
|
||||
|
@ -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 <br/>").arg(y));
|
||||
|
||||
Template t=Static::templateLoader->getTemplate("folder",request.getHeader("Accept-Language"));
|
||||
t.enableWarnings();
|
||||
QString path = request.getPath();
|
||||
|
@ -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();
|
||||
|
||||
|
@ -220,6 +220,7 @@ void HttpSession::setCurrentComic(qulonglong id, Comic * comic)
|
||||
{
|
||||
if(dataPtr)
|
||||
{
|
||||
dismissCurrentComic();
|
||||
dataPtr->yacreaderSessionData.comicId = id;
|
||||
dataPtr->yacreaderSessionData.comic = comic;
|
||||
}
|
||||
|
52
YACReaderLibrary/server_config_dialog.cpp
Normal file
52
YACReaderLibrary/server_config_dialog.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include "server_config_dialog.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QGridLayout>
|
||||
|
||||
|
||||
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;
|
||||
}
|
37
YACReaderLibrary/server_config_dialog.h
Normal file
37
YACReaderLibrary/server_config_dialog.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef __SERVER_CONFIG_DIALOG_H
|
||||
#define __SERVER_CONFIG_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QPixmap>
|
||||
#include <QProcess>
|
||||
#include <QPixmap>
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user