mirror of
https://github.com/YACReader/yacreader
synced 2025-07-22 23:15:14 -04:00
HttpWorker added, performs a http request in a background thread
ComicVineDialog, work in progress...
This commit is contained in:
@ -77,7 +77,9 @@ HEADERS += comic_flow.h \
|
||||
yacreader_local_server.h \
|
||||
yacreader_main_toolbar.h \
|
||||
comics_remover.h \
|
||||
comic_vine_dialog.h
|
||||
comic_vine_dialog.h \
|
||||
comic_vine_client.h \
|
||||
../common/http_worker.h
|
||||
|
||||
SOURCES += comic_flow.cpp \
|
||||
create_library_dialog.cpp \
|
||||
@ -117,7 +119,9 @@ SOURCES += comic_flow.cpp \
|
||||
yacreader_local_server.cpp \
|
||||
yacreader_main_toolbar.cpp \
|
||||
comics_remover.cpp \
|
||||
comic_vine_dialog.cpp
|
||||
comic_vine_dialog.cpp \
|
||||
comic_vine_client.cpp \
|
||||
../common/http_worker.cpp
|
||||
|
||||
|
||||
include(./server/server.pri)
|
||||
|
79
YACReaderLibrary/comic_vine_client.cpp
Normal file
79
YACReaderLibrary/comic_vine_client.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
#include "comic_vine_client.h"
|
||||
|
||||
//this is the API key used by YACReader to access Comic Vine
|
||||
//please, do not use it in your own software, get one for free at Comic Vine
|
||||
static const QString CV_API_KEY = "46680bebb358f1de690a5a365e15d325f9649f91";
|
||||
|
||||
static const QString CV_WEB_ADDRESS = "http://comicvine.com/api";
|
||||
|
||||
//gets any volumen containing any comic matching 'query'
|
||||
static const QString CV_SEARCH = CV_WEB_ADDRESS + "/search/?api_key=" + CV_API_KEY +
|
||||
"&format=xml&limit=100&resources=volume"
|
||||
"&field_list=name,start_year,publisher,id,image,count_of_issues"
|
||||
"&query=%1&page=%2";
|
||||
|
||||
//gets the detail for a volume %1
|
||||
static const QString CV_SERIES_DETAIL = CV_WEB_ADDRESS + "/volume/4050-%1/?api_key=" + CV_API_KEY +
|
||||
"&format=xml&field_list=name,start_year,publisher,image,count_of_issues,id";
|
||||
|
||||
//gets ids for comics in a volume id %1
|
||||
static const QString CV_COMIC_IDS = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY +
|
||||
"&format=xml&field_list=name,issue_number,id,image&filter=volume:%1&page=%1";//offset??
|
||||
|
||||
//gets id for comic number %2 in a volume id %1
|
||||
static const QString CV_COMIC_ID = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY +
|
||||
"&format=xml&field_list=name,issue_number,id,image"
|
||||
"&filter=volume:%1,issue_number:%2";
|
||||
//gets comic detail
|
||||
static const QString CV_COMIC_DETAIL = CV_WEB_ADDRESS + "/issue/4000-%1/?api_key=" + CV_API_KEY + "&format=xml";
|
||||
|
||||
//gets comic cover URL
|
||||
static const QString CV_COVER_URL = CV_WEB_ADDRESS + "/issue/4000-%1/?api_key=" + CV_API_KEY + "&format=xml&field_list=image";
|
||||
|
||||
//gets comics matching name %1 and number %2
|
||||
//http://comicvine.com/api/issues/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&limit=20&filter=name:super,issue_number:15
|
||||
|
||||
ComicVineClient::ComicVineClient(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ComicVineClient::search(const QString & query, int page)
|
||||
{
|
||||
CVSearch * search = new CVSearch(query,page);
|
||||
connect(search,SIGNAL(dataReady(const QByteArry &)),this,SLOT(proccessVolumesSearchData(const QByteArry &)));
|
||||
connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
||||
search->get();
|
||||
}
|
||||
|
||||
void ComicVineClient::proccessVolumesSearchData(const QByteArray & data)
|
||||
{
|
||||
QString xml(data);
|
||||
}
|
||||
|
||||
void ComicVineClient::getSeriesDetail(const QString & id)
|
||||
{
|
||||
}
|
||||
|
||||
void ComicVineClient::getComicIds(const QString & id, int page)
|
||||
{
|
||||
}
|
||||
|
||||
void ComicVineClient::getComicId(const QString & id, int comicNumber)
|
||||
{
|
||||
}
|
||||
|
||||
void ComicVineClient::getComicDetail(const QString & id)
|
||||
{
|
||||
}
|
||||
|
||||
void ComicVineClient::getCoverURL(const QString & id)
|
||||
{
|
||||
}
|
||||
|
||||
//CVSearch
|
||||
CVSearch::CVSearch(const QString & query, int page)
|
||||
:HttpWorker(CV_SEARCH.arg(query).arg(page))
|
||||
{
|
||||
}
|
34
YACReaderLibrary/comic_vine_client.h
Normal file
34
YACReaderLibrary/comic_vine_client.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef COMIC_VINE_CLIENT_H
|
||||
#define COMIC_VINE_CLIENT_H
|
||||
|
||||
#include "http_worker.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ComicVineClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ComicVineClient(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void search(const QString & query, int page = 0);
|
||||
void getSeriesDetail(const QString & id);
|
||||
void getComicIds(const QString & id, int page = 0);
|
||||
void getComicId(const QString & id, int comicNumber);
|
||||
void getComicDetail(const QString & id);
|
||||
void getCoverURL(const QString & id);
|
||||
private slots:
|
||||
void proccessVolumesSearchData(const QByteArray & data);
|
||||
|
||||
};
|
||||
|
||||
class CVSearch : public HttpWorker
|
||||
{
|
||||
public:
|
||||
CVSearch(const QString & query, int page=0);
|
||||
};
|
||||
|
||||
#endif // COMIC_VINE_CLIENT_H
|
@ -1,10 +1,105 @@
|
||||
#include "comic_vine_dialog.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
#include <QRadioButton>
|
||||
|
||||
ComicVineDialog::ComicVineDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
doLayout();
|
||||
doStackedWidgets();
|
||||
doConnections();
|
||||
}
|
||||
|
||||
void ComicVineDialog::doLayout()
|
||||
{
|
||||
setStyleSheet(""
|
||||
"QDialog {background-color: #404040; }"
|
||||
"");
|
||||
|
||||
QString dialogButtonsStyleSheet = "QPushButton {border: 1px solid #242424; background: #2e2e2e; color:white; padding: 5px 26px 5px 26px; font-size:12px;font-family:Arial; font-weight:bold;}";
|
||||
|
||||
QLabel * mainTitleLabel = new QLabel(tr("SEARCH"));
|
||||
QLabel * subTitleLabel = new QLabel(tr("%1 comics selected"));
|
||||
|
||||
mainTitleLabel->setStyleSheet("QLabel {color:white; font-size:18px;font-family:Arial;}");
|
||||
subTitleLabel->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
nextButton = new QPushButton(tr("next"));
|
||||
closeButton = new QPushButton(tr("close"));
|
||||
|
||||
nextButton->setStyleSheet(dialogButtonsStyleSheet);
|
||||
closeButton->setStyleSheet(dialogButtonsStyleSheet);
|
||||
|
||||
content = new QStackedWidget(this);
|
||||
//
|
||||
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout;
|
||||
QHBoxLayout * titleLayout = new QHBoxLayout;
|
||||
QVBoxLayout * titleLabelsLayout = new QVBoxLayout;
|
||||
QHBoxLayout * buttonLayout = new QHBoxLayout;
|
||||
|
||||
titleLabelsLayout->addWidget(mainTitleLabel);
|
||||
titleLabelsLayout->addWidget(subTitleLabel);
|
||||
titleLabelsLayout->setSpacing(0);
|
||||
|
||||
titleLayout->addLayout(titleLabelsLayout);
|
||||
|
||||
buttonLayout->addStretch();
|
||||
buttonLayout->addWidget(nextButton);
|
||||
buttonLayout->addWidget(closeButton);
|
||||
buttonLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
mainLayout->addLayout(titleLayout);
|
||||
mainLayout->addWidget(content);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(buttonLayout);
|
||||
|
||||
mainLayout->setContentsMargins(26,16,26,11);
|
||||
|
||||
setLayout(mainLayout);
|
||||
setFixedSize(672,529);
|
||||
}
|
||||
|
||||
void ComicVineDialog::doStackedWidgets()
|
||||
{
|
||||
doSeriesQuestion();
|
||||
}
|
||||
void ComicVineDialog::doSeriesQuestion()
|
||||
{
|
||||
QWidget * w = new QWidget;
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
|
||||
QLabel * questionLabel = new QLabel(tr("You are trying to get information for various comics at once, are they part of the same series?"));
|
||||
questionLabel->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
QRadioButton * yes = new QRadioButton(tr("yes"));
|
||||
QRadioButton * no = new QRadioButton(tr("no"));
|
||||
|
||||
QString rbStyle = "QRadioButton {margin-left:27px; margin-top:5px; color:white;font-size:12px;font-family:Arial;}"
|
||||
"QRadioButton::indicator {width:11px;height:11px;}"
|
||||
"QRadioButton::indicator::unchecked {image : url(:/images/comic_vine/radioUnchecked.png);}"
|
||||
"QRadioButton::indicator::checked {image : url(:/images/comic_vine/radioChecked.png);}";
|
||||
yes->setStyleSheet(rbStyle);
|
||||
no->setStyleSheet(rbStyle);
|
||||
|
||||
yes->setChecked(true);
|
||||
|
||||
l->addSpacing(35);
|
||||
l->addWidget(questionLabel);
|
||||
l->addWidget(yes);
|
||||
l->addWidget(no);
|
||||
l->addStretch();
|
||||
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
w->setLayout(l);
|
||||
w->setContentsMargins(0,0,0,0);
|
||||
content->addWidget(w);
|
||||
}
|
||||
|
||||
void ComicVineDialog::doConnections()
|
||||
{
|
||||
connect(closeButton,SIGNAL(pressed()),this,SLOT(close()));
|
||||
}
|
@ -3,6 +3,9 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
|
||||
class ComicVineDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -12,7 +15,21 @@ public:
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QPushButton * nextButton;
|
||||
QPushButton * closeButton;
|
||||
|
||||
//stacked widgets
|
||||
QStackedWidget * content;
|
||||
|
||||
QWidget * infoNotFound;
|
||||
QWidget * singleComicBrowser;
|
||||
|
||||
void doLayout();
|
||||
void doStackedWidgets();
|
||||
void doSeriesQuestion();
|
||||
void doConnections();
|
||||
};
|
||||
|
||||
#endif // COMIC_VINE_DIALOG_H
|
||||
|
@ -1,65 +1,65 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>../images/folder.png</file>
|
||||
<file>../images/icon.png</file>
|
||||
<file>../images/iconLibrary.png</file>
|
||||
<file>../images/new.png</file>
|
||||
<file>../images/openLibrary.png</file>
|
||||
<file>../images/removeLibraryIcon.png</file>
|
||||
<file>../images/updateLibraryIcon.png</file>
|
||||
<file>../images/comicFolder.png</file>
|
||||
<file>../images/notCover.png</file>
|
||||
<file>../images/edit.png</file>
|
||||
<file>../images/editIcon.png</file>
|
||||
<file>../images/flow1.png</file>
|
||||
<file>../images/flow2.png</file>
|
||||
<file>../images/flow3.png</file>
|
||||
<file>../images/flow4.png</file>
|
||||
<file>../images/flow5.png</file>
|
||||
<file>../images/importLibrary.png</file>
|
||||
<file>../images/importLibraryIcon.png</file>
|
||||
<file>../images/exportLibrary.png</file>
|
||||
<file>../images/exportLibraryIcon.png</file>
|
||||
<file>../images/open.png</file>
|
||||
<file>../images/coversPackage.png</file>
|
||||
<file>../images/setRead.png</file>
|
||||
<!--<file>../images/setAllRead.png</file>-->
|
||||
<file>../images/setUnread.png</file>
|
||||
<!--<file>../images/setAllUnread.png</file>-->
|
||||
<file>../images/showMarks.png</file>
|
||||
<file>../images/editComic.png</file>
|
||||
<file>../images/selectAll.png</file>
|
||||
<file>../images/hideComicFlow.png</file>
|
||||
<file>../images/exportComicsInfo.png</file>
|
||||
<file>../images/importComicsInfo.png</file>
|
||||
<file>../images/exportComicsInfoIcon.png</file>
|
||||
<file>../images/importComicsInfoIcon.png</file>
|
||||
<file>../images/db.png</file>
|
||||
<file>../images/asignNumber.png</file>
|
||||
<file>../images/defaultCover.png</file>
|
||||
<file>../images/iphoneConfig.png</file>
|
||||
<file>../images/onStartFlowSelection.png</file>
|
||||
<file>../images/onStartFlowSelection_es.png</file>
|
||||
<file>../images/useNewFlowButton.png</file>
|
||||
<file>../images/useOldFlowButton.png</file>
|
||||
<file>../images/serverConfigBackground.png</file>
|
||||
<file>../images/noLibrariesIcon.png</file>
|
||||
<file>../images/noLibrariesLine.png</file>
|
||||
<file>../images/importingIcon.png</file>
|
||||
<file>../images/updatingIcon.png</file>
|
||||
<file>../images/importTopCoversDecoration.png</file>
|
||||
<file>../images/importBottomCoversDecoration.png</file>
|
||||
<file>../images/glowLine.png</file>
|
||||
<file>../images/clearSearch.png</file>
|
||||
<file>../images/iconSearch.png</file>
|
||||
<file>../images/readRibbon.png</file>
|
||||
<file>../images/readingRibbon.png</file>
|
||||
<file>../images/shownCovers.png</file>
|
||||
<file>../images/hiddenCovers.png</file>
|
||||
<file>../images/trash.png</file>
|
||||
<file>../images/setReadButton.png</file>
|
||||
<file>../images/openInYACReader.png</file>
|
||||
<!--<file>../images/deleting_progress/imgTopLeft.png</file>
|
||||
<qresource prefix="/" >
|
||||
<file>../images/folder.png</file>
|
||||
<file>../images/icon.png</file>
|
||||
<file>../images/iconLibrary.png</file>
|
||||
<file>../images/new.png</file>
|
||||
<file>../images/openLibrary.png</file>
|
||||
<file>../images/removeLibraryIcon.png</file>
|
||||
<file>../images/updateLibraryIcon.png</file>
|
||||
<file>../images/comicFolder.png</file>
|
||||
<file>../images/notCover.png</file>
|
||||
<file>../images/edit.png</file>
|
||||
<file>../images/editIcon.png</file>
|
||||
<file>../images/flow1.png</file>
|
||||
<file>../images/flow2.png</file>
|
||||
<file>../images/flow3.png</file>
|
||||
<file>../images/flow4.png</file>
|
||||
<file>../images/flow5.png</file>
|
||||
<file>../images/importLibrary.png</file>
|
||||
<file>../images/importLibraryIcon.png</file>
|
||||
<file>../images/exportLibrary.png</file>
|
||||
<file>../images/exportLibraryIcon.png</file>
|
||||
<file>../images/open.png</file>
|
||||
<file>../images/coversPackage.png</file>
|
||||
<file>../images/setRead.png</file>
|
||||
<!--<file>../images/setAllRead.png</file>-->
|
||||
<file>../images/setUnread.png</file>
|
||||
<!--<file>../images/setAllUnread.png</file>-->
|
||||
<file>../images/showMarks.png</file>
|
||||
<file>../images/editComic.png</file>
|
||||
<file>../images/selectAll.png</file>
|
||||
<file>../images/hideComicFlow.png</file>
|
||||
<file>../images/exportComicsInfo.png</file>
|
||||
<file>../images/importComicsInfo.png</file>
|
||||
<file>../images/exportComicsInfoIcon.png</file>
|
||||
<file>../images/importComicsInfoIcon.png</file>
|
||||
<file>../images/db.png</file>
|
||||
<file>../images/asignNumber.png</file>
|
||||
<file>../images/defaultCover.png</file>
|
||||
<file>../images/iphoneConfig.png</file>
|
||||
<file>../images/onStartFlowSelection.png</file>
|
||||
<file>../images/onStartFlowSelection_es.png</file>
|
||||
<file>../images/useNewFlowButton.png</file>
|
||||
<file>../images/useOldFlowButton.png</file>
|
||||
<file>../images/serverConfigBackground.png</file>
|
||||
<file>../images/noLibrariesIcon.png</file>
|
||||
<file>../images/noLibrariesLine.png</file>
|
||||
<file>../images/importingIcon.png</file>
|
||||
<file>../images/updatingIcon.png</file>
|
||||
<file>../images/importTopCoversDecoration.png</file>
|
||||
<file>../images/importBottomCoversDecoration.png</file>
|
||||
<file>../images/glowLine.png</file>
|
||||
<file>../images/clearSearch.png</file>
|
||||
<file>../images/iconSearch.png</file>
|
||||
<file>../images/readRibbon.png</file>
|
||||
<file>../images/readingRibbon.png</file>
|
||||
<file>../images/shownCovers.png</file>
|
||||
<file>../images/hiddenCovers.png</file>
|
||||
<file>../images/trash.png</file>
|
||||
<file>../images/setReadButton.png</file>
|
||||
<file>../images/openInYACReader.png</file>
|
||||
<!--<file>../images/deleting_progress/imgTopLeft.png</file>
|
||||
<file>../images/deleting_progress/imgTopMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgTopRight.png</file>
|
||||
<file>../images/deleting_progress/imgLeftMiddle.png</file>
|
||||
@ -75,19 +75,21 @@
|
||||
<file>../images/social_dialog/shadow.png</file>
|
||||
<file>../images/social_dialog/twitter.png</file>
|
||||
<file>../images/social_dialog/separator.png</file>-->
|
||||
<file>../images/main_toolbar/divider.png</file>
|
||||
<file>../images/collapsed_branch_osx.png</file>
|
||||
<file>../images/expanded_branch_osx.png</file>
|
||||
<file>../images/folder_macosx.png</file>
|
||||
<file>../images/libraryIconSelected.png</file>
|
||||
<file>../images/libraryOptions.png</file>
|
||||
<file>../images/branch-open.png</file>
|
||||
<file>../images/branch-closed.png</file>
|
||||
<file>../images/expanded_branch_selected.png</file>
|
||||
<file>../images/collapsed_branch_selected.png</file>
|
||||
<file>../images/previousCoverPage.png</file>
|
||||
<file>../images/nextCoverPage.png</file>
|
||||
<file>../images/getInfo.png</file>
|
||||
<!--<file>../images/busy_background.png</file>-->
|
||||
</qresource>
|
||||
<file>../images/main_toolbar/divider.png</file>
|
||||
<file>../images/collapsed_branch_osx.png</file>
|
||||
<file>../images/expanded_branch_osx.png</file>
|
||||
<file>../images/folder_macosx.png</file>
|
||||
<file>../images/libraryIconSelected.png</file>
|
||||
<file>../images/libraryOptions.png</file>
|
||||
<file>../images/branch-open.png</file>
|
||||
<file>../images/branch-closed.png</file>
|
||||
<file>../images/expanded_branch_selected.png</file>
|
||||
<file>../images/collapsed_branch_selected.png</file>
|
||||
<file>../images/previousCoverPage.png</file>
|
||||
<file>../images/nextCoverPage.png</file>
|
||||
<file>../images/getInfo.png</file>
|
||||
<file>../images/comic_vine/radioChecked.png</file>
|
||||
<file>../images/comic_vine/radioUnchecked.png</file>
|
||||
<!--<file>../images/busy_background.png</file>-->
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Reference in New Issue
Block a user