mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 00:58:32 -04:00
added new comic_vine folder containing all the ComicVine related clases
added QtScript dependency (json parser)
This commit is contained in:
parent
b88715e26e
commit
9795f514e7
@ -9,7 +9,9 @@ INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common \
|
||||
./server \
|
||||
./db \
|
||||
../custom_widgets
|
||||
../custom_widgets \
|
||||
./comic_vine \
|
||||
./comic_vine/model
|
||||
|
||||
DEFINES += SERVER_RELEASE
|
||||
|
||||
@ -35,7 +37,7 @@ LIBS += -L/usr/local/lib -lpoppler-qt4
|
||||
|
||||
CONFIG += release
|
||||
CONFIG -= flat
|
||||
QT += sql network opengl
|
||||
QT += sql network opengl script
|
||||
|
||||
# Input
|
||||
HEADERS += comic_flow.h \
|
||||
@ -76,8 +78,6 @@ HEADERS += comic_flow.h \
|
||||
yacreader_local_server.h \
|
||||
yacreader_main_toolbar.h \
|
||||
comics_remover.h \
|
||||
comic_vine_dialog.h \
|
||||
comic_vine_client.h \
|
||||
../common/http_worker.h
|
||||
|
||||
SOURCES += comic_flow.cpp \
|
||||
@ -118,14 +118,13 @@ SOURCES += comic_flow.cpp \
|
||||
yacreader_local_server.cpp \
|
||||
yacreader_main_toolbar.cpp \
|
||||
comics_remover.cpp \
|
||||
comic_vine_dialog.cpp \
|
||||
comic_vine_client.cpp \
|
||||
../common/http_worker.cpp
|
||||
|
||||
|
||||
include(./server/server.pri)
|
||||
include(../custom_widgets/custom_widgets_yacreaderlibrary.pri)
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
include(./comic_vine/comic_vine.pri)
|
||||
|
||||
RESOURCES += images.qrc files.qrc
|
||||
win32:RESOURCES += images_win.qrc
|
||||
@ -147,4 +146,3 @@ TRANSLATIONS = yacreaderlibrary_es.ts \
|
||||
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
||||
|
||||
|
30
YACReaderLibrary/comic_vine/comic_vine.pri
Normal file
30
YACReaderLibrary/comic_vine/comic_vine.pri
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
HEADERS += \
|
||||
comic_vine/comic_vine_dialog.h \
|
||||
comic_vine/comic_vine_client.h \
|
||||
comic_vine/scrapper_lineedit.h \
|
||||
comic_vine/title_header.h \
|
||||
comic_vine/series_question.h \
|
||||
comic_vine/search_single_comic.h \
|
||||
comic_vine/search_volume.h \
|
||||
comic_vine/select_comic.h \
|
||||
comic_vine/select_volume.h \
|
||||
comic_vine/model/volumes_model.h \
|
||||
comic_vine/model/comics_model.h \
|
||||
comic_vine/model/json_model.h \
|
||||
comic_vine/model/response_parser.h
|
||||
|
||||
SOURCES += \
|
||||
comic_vine/comic_vine_dialog.cpp \
|
||||
comic_vine/comic_vine_client.cpp \
|
||||
comic_vine/scrapper_lineedit.cpp \
|
||||
comic_vine/title_header.cpp \
|
||||
comic_vine/series_question.cpp \
|
||||
comic_vine/search_single_comic.cpp \
|
||||
comic_vine/search_volume.cpp \
|
||||
comic_vine/select_comic.cpp \
|
||||
comic_vine/select_volume.cpp \
|
||||
comic_vine/model/volumes_model.cpp \
|
||||
comic_vine/model/comics_model.cpp \
|
||||
comic_vine/model/json_model.cpp \
|
||||
comic_vine/model/response_parser.cpp
|
@ -8,28 +8,28 @@ static const QString CV_WEB_ADDRESS = "http://www.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"
|
||||
"&format=json&limit=100&resources=volume"
|
||||
"&field_list=name,start_year,publisher,id,image,count_of_issues"
|
||||
"&query=%1&page=%2";
|
||||
//http://comicvine.com/api/search/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=xml&limit=100&resources=volume&field_list=name,start_year,publisher,id,image,count_of_issues&query=superman
|
||||
//http://www.comicvine.com/api/search/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json&limit=100&resources=volume&field_list=name,start_year,publisher,id,image,count_of_issues&query=superman
|
||||
|
||||
//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";
|
||||
"&format=json&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??
|
||||
"&format=json&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"
|
||||
"&format=json&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";
|
||||
static const QString CV_COMIC_DETAIL = CV_WEB_ADDRESS + "/issue/4000-%1/?api_key=" + CV_API_KEY + "&format=json";
|
||||
|
||||
//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";
|
||||
static const QString CV_COVER_URL = CV_WEB_ADDRESS + "/issue/4000-%1/?api_key=" + CV_API_KEY + "&format=json&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
|
||||
@ -52,8 +52,8 @@ void ComicVineClient::search(const QString & query, int page)
|
||||
//CV_SEARCH result
|
||||
void ComicVineClient::proccessVolumesSearchData(const QByteArray & data)
|
||||
{
|
||||
QString xml(data);
|
||||
emit searchResult(xml);
|
||||
QString json(data);
|
||||
emit searchResult(json);
|
||||
}
|
||||
|
||||
void ComicVineClient::queryTimeOut()
|
@ -6,9 +6,20 @@
|
||||
#include <QStackedWidget>
|
||||
#include <QRadioButton>
|
||||
#include <QMessageBox>
|
||||
#include <QTableView>
|
||||
|
||||
#include "yacreader_busy_widget.h"
|
||||
#include "comic_vine_client.h"
|
||||
#include "scrapper_lineedit.h"
|
||||
#include "title_header.h"
|
||||
#include "series_question.h"
|
||||
#include "search_single_comic.h"
|
||||
#include "search_volume.h"
|
||||
#include "select_comic.h"
|
||||
#include "select_volume.h"
|
||||
|
||||
#include "response_parser.h"
|
||||
|
||||
|
||||
ComicVineDialog::ComicVineDialog(QWidget *parent) :
|
||||
QDialog(parent),comicVineClient(new ComicVineClient)
|
||||
@ -69,6 +80,7 @@ void ComicVineDialog::doStackedWidgets()
|
||||
content->addWidget(seriesQuestion = new SeriesQuestion);
|
||||
content->addWidget(searchSingleComic = new SearchSingleComic);
|
||||
content->addWidget(searchVolume = new SearchVolume);
|
||||
content->addWidget(selectVolume = new SelectVolume);
|
||||
}
|
||||
|
||||
void ComicVineDialog::doConnections()
|
||||
@ -142,7 +154,6 @@ void ComicVineDialog::show()
|
||||
titleHeader->setSubTitle(tr("%1 comics selected").arg(comics.length()));
|
||||
showSeriesQuestion();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ComicVineDialog::doLoading()
|
||||
@ -164,6 +175,13 @@ void ComicVineDialog::doLoading()
|
||||
|
||||
void ComicVineDialog::debugClientResults(const QString & string)
|
||||
{
|
||||
ResponseParser p;
|
||||
p.loadJSONResponse(string);
|
||||
|
||||
QString debug = QString("%1 \n %2").arg(p.getNumResults()).arg(string);
|
||||
|
||||
QMessageBox::information(0,"-Response-", debug);
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case SingleComic:
|
||||
@ -177,7 +195,7 @@ void ComicVineDialog::debugClientResults(const QString & string)
|
||||
break;
|
||||
}
|
||||
|
||||
QMessageBox::information(0,"-Response-", string);
|
||||
|
||||
}
|
||||
|
||||
void ComicVineDialog::showSeriesQuestion()
|
||||
@ -214,6 +232,11 @@ void ComicVineDialog::showSearchVolume()
|
||||
skipButton->setHidden(true);
|
||||
}
|
||||
|
||||
void ComicVineDialog::showSelectVolume()
|
||||
{
|
||||
content->setCurrentWidget(selectVolume);
|
||||
}
|
||||
|
||||
void ComicVineDialog::showLoading()
|
||||
{
|
||||
content->setCurrentIndex(0);
|
||||
@ -228,193 +251,30 @@ void ComicVineDialog::search()
|
||||
{
|
||||
switch (status) {
|
||||
case Volume:
|
||||
showLoading();
|
||||
comicVineClient->search(searchVolume->getVolumeInfo());
|
||||
launchSearchVolume();
|
||||
break;
|
||||
default:
|
||||
launchSearchComic();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
//TitleHeader
|
||||
//---------------------------------------
|
||||
TitleHeader::TitleHeader(QWidget * parent )
|
||||
:QWidget(parent)
|
||||
void ComicVineDialog::launchSearchVolume()
|
||||
{
|
||||
mainTitleLabel = new QLabel();
|
||||
subTitleLabel = new QLabel();
|
||||
|
||||
mainTitleLabel->setStyleSheet("QLabel {color:white; font-size:18px;font-family:Arial;}");
|
||||
subTitleLabel->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
QHBoxLayout * titleLayout = new QHBoxLayout;
|
||||
QVBoxLayout * titleLabelsLayout = new QVBoxLayout;
|
||||
|
||||
titleLabelsLayout->addWidget(mainTitleLabel);
|
||||
titleLabelsLayout->addWidget(subTitleLabel);
|
||||
titleLabelsLayout->setSpacing(0);
|
||||
|
||||
titleLayout->addLayout(titleLabelsLayout);
|
||||
titleLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
setLayout(titleLayout);
|
||||
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
||||
setTitle(tr("SEARCH"));
|
||||
showLoading();
|
||||
//TODO: check if volume info is empty.
|
||||
comicVineClient->search(searchVolume->getVolumeInfo());
|
||||
}
|
||||
|
||||
void TitleHeader::setTitle(const QString & title)
|
||||
void ComicVineDialog::launchSearchComic()
|
||||
{
|
||||
mainTitleLabel->setText(title);
|
||||
showLoading();
|
||||
|
||||
QString volumeInfo = searchSingleComic->getVolumeInfo();
|
||||
QString comicInfo = searchSingleComic->getComicInfo();
|
||||
int comicNumber = searchSingleComic->getComicNumber();
|
||||
|
||||
if(comicInfo.isEmpty() && comicNumber == -1)
|
||||
comicVineClient->search(volumeInfo);
|
||||
}
|
||||
|
||||
void TitleHeader::setSubTitle(const QString & title)
|
||||
{
|
||||
subTitleLabel->setText(title);
|
||||
}
|
||||
|
||||
void TitleHeader::showButtons(bool show)
|
||||
{
|
||||
if(show)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
//SeriesQuestion
|
||||
//---------------------------------------
|
||||
SeriesQuestion::SeriesQuestion(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
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;}");
|
||||
yes = new QRadioButton(tr("yes"));
|
||||
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);
|
||||
setLayout(l);
|
||||
setContentsMargins(0,0,0,0);
|
||||
}
|
||||
|
||||
bool SeriesQuestion::getYes()
|
||||
{
|
||||
return yes->isChecked();
|
||||
}
|
||||
//---------------------------------------
|
||||
//ScrapperLineEdit
|
||||
//---------------------------------------
|
||||
ScrapperLineEdit::ScrapperLineEdit(const QString & title, QWidget * widget)
|
||||
:QLineEdit(widget)
|
||||
{
|
||||
titleLabel = new QLabel(title,this);
|
||||
titleLabel->setStyleSheet("QLabel {color:white;}");
|
||||
|
||||
setStyleSheet(QString("QLineEdit {"
|
||||
"border:none; background-color: #2E2E2E; color : white; padding-left: %1; padding-bottom: 1px; margin-bottom: 0px;"
|
||||
"}").arg(titleLabel->sizeHint().width()+6));
|
||||
|
||||
setFixedHeight(22);
|
||||
}
|
||||
|
||||
void ScrapperLineEdit::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
QSize szl = titleLabel->sizeHint();
|
||||
titleLabel->move(6,(rect().bottom() + 1 - szl.height())/2);
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
//SearchSingleComic
|
||||
//---------------------------------------
|
||||
SearchSingleComic::SearchSingleComic(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
|
||||
QLabel * label = new QLabel(tr("No results found, please provide some aditional information. At least one field is needed."));
|
||||
label->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
titleEdit = new ScrapperLineEdit(tr("Title:"));
|
||||
numberEdit = new ScrapperLineEdit(tr("Number:"));
|
||||
volumeEdit = new ScrapperLineEdit(tr("Series:"));
|
||||
|
||||
numberEdit->setMaximumWidth(126);
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
QHBoxLayout * hl = new QHBoxLayout;
|
||||
hl->addWidget(titleEdit);
|
||||
hl->addWidget(numberEdit);
|
||||
|
||||
l->addSpacing(35);
|
||||
l->addWidget(label);
|
||||
l->addLayout(hl);
|
||||
l->addWidget(volumeEdit);
|
||||
l->addStretch();
|
||||
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
setLayout(l);
|
||||
setContentsMargins(0,0,0,0);
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
//SearchVolume
|
||||
//---------------------------------------
|
||||
SearchVolume::SearchVolume(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
QLabel * label = new QLabel(tr("No results found, please provide some aditional information."));
|
||||
label->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
volumeEdit = new ScrapperLineEdit(tr("Series:"));
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
|
||||
l->addSpacing(35);
|
||||
l->addWidget(label);
|
||||
l->addWidget(volumeEdit);
|
||||
l->addStretch();
|
||||
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
setLayout(l);
|
||||
setContentsMargins(0,0,0,0);
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
//SelectVolume
|
||||
//---------------------------------------
|
||||
SelectVolume::SelectVolume(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{}
|
||||
|
||||
SelectVolume::~SelectVolume() {}
|
||||
|
||||
//---------------------------------------
|
||||
//SelectComic
|
||||
//---------------------------------------
|
||||
SelectComic::SelectComic(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{}
|
||||
|
||||
SelectComic::~SelectComic() {}
|
91
YACReaderLibrary/comic_vine/comic_vine_dialog.h
Normal file
91
YACReaderLibrary/comic_vine/comic_vine_dialog.h
Normal file
@ -0,0 +1,91 @@
|
||||
#ifndef COMIC_VINE_DIALOG_H
|
||||
#define COMIC_VINE_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "comic_db.h"
|
||||
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
class ComicVineClient;
|
||||
class QTableView;
|
||||
class TitleHeader;
|
||||
class SeriesQuestion;
|
||||
class SearchSingleComic;
|
||||
class SearchVolume;
|
||||
class SelectComic;
|
||||
class SelectVolume;
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
class ComicVineDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ComicVineDialog(QWidget *parent = 0);
|
||||
QString databasePath;
|
||||
QString basePath;
|
||||
void setComics(const QList<ComicDB> & comics);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void show();
|
||||
protected slots:
|
||||
void goNext();
|
||||
void debugClientResults(const QString & string);
|
||||
//show widget methods
|
||||
void showSeriesQuestion();
|
||||
void showSearchSingleComic();
|
||||
void showSearchVolume();
|
||||
void showLoading();
|
||||
void search();
|
||||
void launchSearchVolume();
|
||||
void launchSearchComic();
|
||||
void showSelectVolume();
|
||||
private:
|
||||
|
||||
enum ScrapperStatus
|
||||
{
|
||||
SingleComic,
|
||||
Volume,
|
||||
SingleComicInSeries,
|
||||
SelectingComic,
|
||||
SelectingSeries
|
||||
};
|
||||
|
||||
ScrapperStatus status;
|
||||
|
||||
ComicVineClient * comicVineClient;
|
||||
|
||||
int currentIndex;
|
||||
|
||||
TitleHeader * titleHeader;
|
||||
|
||||
QPushButton * skipButton;
|
||||
QPushButton * backButton;
|
||||
QPushButton * nextButton;
|
||||
QPushButton * searchButton;
|
||||
QPushButton * closeButton;
|
||||
|
||||
//stacked widgets
|
||||
QStackedWidget * content;
|
||||
|
||||
QWidget * infoNotFound;
|
||||
QWidget * singleComicBrowser;
|
||||
|
||||
void doLayout();
|
||||
void doStackedWidgets();
|
||||
void doLoading();
|
||||
void doConnections();
|
||||
|
||||
QList<ComicDB> comics;
|
||||
|
||||
SeriesQuestion * seriesQuestion;
|
||||
SearchSingleComic * searchSingleComic;
|
||||
SearchVolume * searchVolume;
|
||||
SelectVolume * selectVolume;
|
||||
};
|
||||
|
||||
#endif // COMIC_VINE_DIALOG_H
|
6
YACReaderLibrary/comic_vine/model/comics_model.cpp
Normal file
6
YACReaderLibrary/comic_vine/model/comics_model.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "comics_model.h"
|
||||
|
||||
ComicsModel::ComicsModel(QObject *parent) :
|
||||
JSONModel(parent)
|
||||
{
|
||||
}
|
18
YACReaderLibrary/comic_vine/model/comics_model.h
Normal file
18
YACReaderLibrary/comic_vine/model/comics_model.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef COMICS_MODEL_H
|
||||
#define COMICS_MODEL_H
|
||||
|
||||
#include "json_model.h"
|
||||
|
||||
class ComicsModel : public JSONModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ComicsModel(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // COMICS_MODEL_H
|
6
YACReaderLibrary/comic_vine/model/json_model.cpp
Normal file
6
YACReaderLibrary/comic_vine/model/json_model.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "json_model.h"
|
||||
|
||||
JSONModel::JSONModel(QObject *parent) :
|
||||
QAbstractItemModel(parent)
|
||||
{
|
||||
}
|
18
YACReaderLibrary/comic_vine/model/json_model.h
Normal file
18
YACReaderLibrary/comic_vine/model/json_model.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef JSON_MODEL_H
|
||||
#define JSON_MODEL_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
class JSONModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JSONModel(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // JSON_MODEL_H
|
42
YACReaderLibrary/comic_vine/model/response_parser.cpp
Normal file
42
YACReaderLibrary/comic_vine/model/response_parser.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "response_parser.h"
|
||||
|
||||
#include <QtScript>
|
||||
#include <QDebug>
|
||||
|
||||
ResponseParser::ResponseParser(QObject *parent) :
|
||||
QObject(parent),error(false),numResults(-1)
|
||||
{
|
||||
}
|
||||
|
||||
bool ResponseParser::responseError()
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
qint32 ResponseParser::getNumResults()
|
||||
{
|
||||
return numResults;
|
||||
}
|
||||
|
||||
void ResponseParser::loadJSONResponse(const QString &response)
|
||||
{
|
||||
QScriptEngine engine;
|
||||
QScriptValue sc;
|
||||
sc = engine.evaluate("(" + response + ")");
|
||||
|
||||
if (!sc.property("error").isValid() && sc.property("error").toString() != "OK")
|
||||
{
|
||||
error = true;
|
||||
numResults = -2;
|
||||
qDebug("Error detected");
|
||||
}
|
||||
else
|
||||
{
|
||||
error = false;
|
||||
if(sc.property("number_of_total_results").isValid())
|
||||
numResults = sc.property("number_of_total_results").toString().toInt();// sc.property("number_of_total_results").toInt32();
|
||||
else
|
||||
numResults = -3;
|
||||
qDebug() << sc.property("number_of_total_results").toString();
|
||||
}
|
||||
}
|
23
YACReaderLibrary/comic_vine/model/response_parser.h
Normal file
23
YACReaderLibrary/comic_vine/model/response_parser.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef RESPONSE_PARSER_H
|
||||
#define RESPONSE_PARSER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ResponseParser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResponseParser(QObject *parent = 0);
|
||||
bool responseError();
|
||||
qint32 getNumResults();
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void loadJSONResponse(const QString & response);
|
||||
|
||||
protected:
|
||||
bool error;
|
||||
qint32 numResults;
|
||||
};
|
||||
|
||||
#endif // RESPONSE_PARSER_H
|
6
YACReaderLibrary/comic_vine/model/volumes_model.cpp
Normal file
6
YACReaderLibrary/comic_vine/model/volumes_model.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "volumes_model.h"
|
||||
|
||||
VolumesModel::VolumesModel(QObject *parent) :
|
||||
JSONModel(parent)
|
||||
{
|
||||
}
|
18
YACReaderLibrary/comic_vine/model/volumes_model.h
Normal file
18
YACReaderLibrary/comic_vine/model/volumes_model.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef VOLUMES_MODEL_H
|
||||
#define VOLUMES_MODEL_H
|
||||
|
||||
#include "json_model.h"
|
||||
|
||||
class VolumesModel : public JSONModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VolumesModel(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // VOLUMES_MODEL_H
|
21
YACReaderLibrary/comic_vine/scrapper_lineedit.cpp
Normal file
21
YACReaderLibrary/comic_vine/scrapper_lineedit.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "scrapper_lineedit.h"
|
||||
#include <QLabel>
|
||||
|
||||
ScrapperLineEdit::ScrapperLineEdit(const QString & title, QWidget * widget)
|
||||
:QLineEdit(widget)
|
||||
{
|
||||
titleLabel = new QLabel(title,this);
|
||||
titleLabel->setStyleSheet("QLabel {color:white;}");
|
||||
|
||||
setStyleSheet(QString("QLineEdit {"
|
||||
"border:none; background-color: #2E2E2E; color : white; padding-left: %1; padding-bottom: 1px; margin-bottom: 0px;"
|
||||
"}").arg(titleLabel->sizeHint().width()+6));
|
||||
|
||||
setFixedHeight(22);
|
||||
}
|
||||
|
||||
void ScrapperLineEdit::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
QSize szl = titleLabel->sizeHint();
|
||||
titleLabel->move(6,(rect().bottom() + 1 - szl.height())/2);
|
||||
}
|
19
YACReaderLibrary/comic_vine/scrapper_lineedit.h
Normal file
19
YACReaderLibrary/comic_vine/scrapper_lineedit.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef SCRAPPER_LINEEDIT_H
|
||||
#define SCRAPPER_LINEEDIT_H
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class ScrapperLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ScrapperLineEdit(const QString & title, QWidget * widget = 0);
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
private:
|
||||
QLabel * titleLabel;
|
||||
};
|
||||
|
||||
#endif // SCRAPPER_LINEEDIT_H
|
54
YACReaderLibrary/comic_vine/search_single_comic.cpp
Normal file
54
YACReaderLibrary/comic_vine/search_single_comic.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
#include "search_single_comic.h"
|
||||
|
||||
#include "scrapper_lineedit.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
SearchSingleComic::SearchSingleComic(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
|
||||
QLabel * label = new QLabel(tr("No results found, please provide some aditional information. At least one field is needed."));
|
||||
label->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
titleEdit = new ScrapperLineEdit(tr("Title:"));
|
||||
numberEdit = new ScrapperLineEdit(tr("Number:"));
|
||||
volumeEdit = new ScrapperLineEdit(tr("Series:"));
|
||||
|
||||
numberEdit->setMaximumWidth(126);
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
QHBoxLayout * hl = new QHBoxLayout;
|
||||
hl->addWidget(titleEdit);
|
||||
hl->addWidget(numberEdit);
|
||||
|
||||
l->addSpacing(35);
|
||||
l->addWidget(label);
|
||||
l->addLayout(hl);
|
||||
l->addWidget(volumeEdit);
|
||||
l->addStretch();
|
||||
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
setLayout(l);
|
||||
setContentsMargins(0,0,0,0);
|
||||
}
|
||||
|
||||
QString SearchSingleComic::getVolumeInfo()
|
||||
{
|
||||
return volumeEdit->text();
|
||||
}
|
||||
|
||||
QString SearchSingleComic::getComicInfo()
|
||||
{
|
||||
return titleEdit->text();
|
||||
}
|
||||
|
||||
int SearchSingleComic::getComicNumber()
|
||||
{
|
||||
QString numberText = numberEdit->text();
|
||||
if(numberText.isEmpty())
|
||||
return -1;
|
||||
return numberText.toInt();
|
||||
}
|
21
YACReaderLibrary/comic_vine/search_single_comic.h
Normal file
21
YACReaderLibrary/comic_vine/search_single_comic.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef SEARCH_SINGLE_COMIC_H
|
||||
#define SEARCH_SINGLE_COMIC_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ScrapperLineEdit;
|
||||
|
||||
class SearchSingleComic : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SearchSingleComic(QWidget * parent = 0);
|
||||
QString getVolumeInfo();
|
||||
QString getComicInfo();
|
||||
int getComicNumber();
|
||||
private:
|
||||
ScrapperLineEdit * titleEdit;
|
||||
ScrapperLineEdit * numberEdit;
|
||||
ScrapperLineEdit * volumeEdit;
|
||||
};
|
||||
#endif // SEARCH_SINGLE_COMIC_H
|
31
YACReaderLibrary/comic_vine/search_volume.cpp
Normal file
31
YACReaderLibrary/comic_vine/search_volume.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include "search_volume.h"
|
||||
|
||||
#include "scrapper_lineedit.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
SearchVolume::SearchVolume(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
QLabel * label = new QLabel(tr("No results found, please provide some aditional information."));
|
||||
label->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
volumeEdit = new ScrapperLineEdit(tr("Series:"));
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
|
||||
l->addSpacing(35);
|
||||
l->addWidget(label);
|
||||
l->addWidget(volumeEdit);
|
||||
l->addStretch();
|
||||
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
setLayout(l);
|
||||
setContentsMargins(0,0,0,0);
|
||||
}
|
||||
|
||||
QString SearchVolume::getVolumeInfo()
|
||||
{
|
||||
return volumeEdit->text();
|
||||
}
|
20
YACReaderLibrary/comic_vine/search_volume.h
Normal file
20
YACReaderLibrary/comic_vine/search_volume.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef SEARCH_VOLUME_H
|
||||
#define SEARCH_VOLUME_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ScrapperLineEdit;
|
||||
|
||||
|
||||
class SearchVolume : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SearchVolume(QWidget * parent = 0);
|
||||
public slots:
|
||||
QString getVolumeInfo();
|
||||
private:
|
||||
ScrapperLineEdit * volumeEdit;
|
||||
};
|
||||
|
||||
#endif // SEARCH_VOLUME_H
|
8
YACReaderLibrary/comic_vine/select_comic.cpp
Normal file
8
YACReaderLibrary/comic_vine/select_comic.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "select_comic.h"
|
||||
|
||||
|
||||
SelectComic::SelectComic(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{}
|
||||
|
||||
SelectComic::~SelectComic() {}
|
14
YACReaderLibrary/comic_vine/select_comic.h
Normal file
14
YACReaderLibrary/comic_vine/select_comic.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef SELECT_COMIC_H
|
||||
#define SELECT_COMIC_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class SelectComic : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SelectComic(QWidget * parent = 0);
|
||||
virtual ~SelectComic();
|
||||
};
|
||||
|
||||
#endif // SELECT_COMIC_H
|
72
YACReaderLibrary/comic_vine/select_volume.cpp
Normal file
72
YACReaderLibrary/comic_vine/select_volume.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include "select_volume.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QTableView>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
#include "volumes_model.h"
|
||||
|
||||
SelectVolume::SelectVolume(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
QString labelStylesheet = "QLabel {color:white; font-size:12px;font-family:Arial;}";
|
||||
QString tableStylesheet = ""
|
||||
"QTableView {alternate-background-color: #333333;background-color: #2B2B2B; outline: 0px;}"// border: 1px solid #999999; border-right:none; border-bottom:none;}"
|
||||
"QTableCornerButton::section {background-color:#F5F5F5; border:none; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4);}"
|
||||
"QTableView::item {outline: 0px; border: 0px color:#FFFFFF;}"
|
||||
"QTableView {border-top:1px solid #B8B8B8;border-bottom:none;border-left:1px solid #B8B8B8;border-right:none;}"
|
||||
"QTableView::item:selected {outline: 0px; border-bottom: 1px solid #D4D4D4;border-top: 1px solid #D4D4D4; padding-bottom:1px; background-color: #D4D4D4; }"
|
||||
"QHeaderView::section:horizontal {background-color:#F5F5F5; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4); border-left:none; border-top:none; padding:4px; color:#313232;}"
|
||||
"QHeaderView::section:vertical {border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE;}"
|
||||
//"QTableView::item:hover {border-bottom: 1px solid #A3A3A3;border-top: 1px solid #A3A3A3; padding-bottom:1px; background-color: #A3A3A3; color: #FFFFFF; }"
|
||||
|
||||
//scrollbar
|
||||
|
||||
"QScrollBar:vertical { border: none; background: #404040; width: 3px; margin: 0; }"
|
||||
"QScrollBar::handle:vertical { background: #DDDDDD; width: 7px; min-height: 20px; }"
|
||||
"QScrollBar::add-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 3px 0 0;}"
|
||||
|
||||
"QScrollBar::sub-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 3px 0 0;}"
|
||||
"QScrollBar::up-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-up.png') center top no-repeat;}"
|
||||
"QScrollBar::down-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-down.png') center top no-repeat;}"
|
||||
|
||||
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }"
|
||||
"";
|
||||
|
||||
QLabel * label = new QLabel(tr("Please, select the right series for your comic."));
|
||||
label->setStyleSheet(labelStylesheet);
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
QWidget * leftWidget = new QWidget;
|
||||
QVBoxLayout * left = new QVBoxLayout;
|
||||
QHBoxLayout * content = new QHBoxLayout;
|
||||
|
||||
//widgets
|
||||
cover = new QLabel();
|
||||
detailLabel = new QLabel();
|
||||
detailLabel->setStyleSheet(labelStylesheet);
|
||||
tableVolumes = new QTableView();
|
||||
tableVolumes->setStyleSheet(tableStylesheet);
|
||||
|
||||
left->addWidget(cover);
|
||||
left->addWidget(detailLabel);
|
||||
left->addStretch();
|
||||
leftWidget->setMaximumWidth(168);
|
||||
leftWidget->setLayout(left);
|
||||
|
||||
content->addWidget(leftWidget);
|
||||
content->addWidget(tableVolumes);
|
||||
|
||||
l->addSpacing(15);
|
||||
l->addWidget(label);
|
||||
l->addLayout(content);
|
||||
l->addStretch();
|
||||
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
setLayout(l);
|
||||
setContentsMargins(0,0,0,0);
|
||||
}
|
||||
|
||||
|
||||
SelectVolume::~SelectVolume() {}
|
23
YACReaderLibrary/comic_vine/select_volume.h
Normal file
23
YACReaderLibrary/comic_vine/select_volume.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef SELECT_VOLUME_H
|
||||
#define SELECT_VOLUME_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
class QTableView;
|
||||
class VolumesModel;
|
||||
|
||||
class SelectVolume : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SelectVolume(QWidget * parent = 0);
|
||||
virtual ~SelectVolume();
|
||||
private:
|
||||
QLabel * cover;
|
||||
QLabel * detailLabel;
|
||||
QTableView * tableVolumes;
|
||||
VolumesModel * model;
|
||||
};
|
||||
|
||||
#endif // SELECT_VOLUME_H
|
41
YACReaderLibrary/comic_vine/series_question.cpp
Normal file
41
YACReaderLibrary/comic_vine/series_question.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "series_question.h"
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
SeriesQuestion::SeriesQuestion(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
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;}");
|
||||
yes = new QRadioButton(tr("yes"));
|
||||
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);
|
||||
setLayout(l);
|
||||
setContentsMargins(0,0,0,0);
|
||||
}
|
||||
|
||||
bool SeriesQuestion::getYes()
|
||||
{
|
||||
return yes->isChecked();
|
||||
}
|
22
YACReaderLibrary/comic_vine/series_question.h
Normal file
22
YACReaderLibrary/comic_vine/series_question.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef SERIES_QUESTION_H
|
||||
#define SERIES_QUESTION_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QRadioButton;
|
||||
|
||||
class SeriesQuestion : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SeriesQuestion(QWidget * parent = 0);
|
||||
bool getYes();
|
||||
|
||||
private:
|
||||
QRadioButton * yes;
|
||||
QRadioButton * no;
|
||||
};
|
||||
|
||||
|
||||
#endif // SERIES_QUESTION_H
|
53
YACReaderLibrary/comic_vine/title_header.cpp
Normal file
53
YACReaderLibrary/comic_vine/title_header.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "title_header.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
TitleHeader::TitleHeader(QWidget * parent )
|
||||
:QWidget(parent)
|
||||
{
|
||||
mainTitleLabel = new QLabel();
|
||||
subTitleLabel = new QLabel();
|
||||
|
||||
mainTitleLabel->setStyleSheet("QLabel {color:white; font-size:18px;font-family:Arial;}");
|
||||
subTitleLabel->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
QHBoxLayout * titleLayout = new QHBoxLayout;
|
||||
QVBoxLayout * titleLabelsLayout = new QVBoxLayout;
|
||||
|
||||
titleLabelsLayout->addWidget(mainTitleLabel);
|
||||
titleLabelsLayout->addWidget(subTitleLabel);
|
||||
titleLabelsLayout->setSpacing(0);
|
||||
|
||||
titleLayout->addLayout(titleLabelsLayout);
|
||||
titleLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
setLayout(titleLayout);
|
||||
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
||||
setTitle(tr("SEARCH"));
|
||||
}
|
||||
|
||||
void TitleHeader::setTitle(const QString & title)
|
||||
{
|
||||
mainTitleLabel->setText(title);
|
||||
}
|
||||
|
||||
void TitleHeader::setSubTitle(const QString & title)
|
||||
{
|
||||
subTitleLabel->setText(title);
|
||||
}
|
||||
|
||||
void TitleHeader::showButtons(bool show)
|
||||
{
|
||||
if(show)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
22
YACReaderLibrary/comic_vine/title_header.h
Normal file
22
YACReaderLibrary/comic_vine/title_header.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef TITLE_HEADER_H
|
||||
#define TITLE_HEADER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class TitleHeader : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TitleHeader(QWidget * parent = 0);
|
||||
public slots:
|
||||
void setTitle(const QString & title);
|
||||
void setSubTitle(const QString & title);
|
||||
void showButtons(bool show);
|
||||
private:
|
||||
QLabel * mainTitleLabel;
|
||||
QLabel * subTitleLabel;
|
||||
};
|
||||
|
||||
#endif // TITLE_HEADER_H
|
@ -1,158 +0,0 @@
|
||||
#ifndef COMIC_VINE_DIALOG_H
|
||||
#define COMIC_VINE_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "comic_db.h"
|
||||
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
class ComicVineClient;
|
||||
|
||||
class ScrapperLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ScrapperLineEdit(const QString & title, QWidget * widget = 0);
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
private:
|
||||
QLabel * titleLabel;
|
||||
};
|
||||
|
||||
//----------------------------------------
|
||||
class TitleHeader : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TitleHeader(QWidget * parent = 0);
|
||||
public slots:
|
||||
void setTitle(const QString & title);
|
||||
void setSubTitle(const QString & title);
|
||||
void showButtons(bool show);
|
||||
private:
|
||||
QLabel * mainTitleLabel;
|
||||
QLabel * subTitleLabel;
|
||||
};
|
||||
|
||||
//----------------------------------------
|
||||
class SeriesQuestion : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SeriesQuestion(QWidget * parent = 0);
|
||||
inline bool getYes();
|
||||
private:
|
||||
QRadioButton * yes;
|
||||
QRadioButton * no;
|
||||
};
|
||||
|
||||
//----------------------------------------
|
||||
class SearchSingleComic : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SearchSingleComic(QWidget * parent = 0);
|
||||
private:
|
||||
ScrapperLineEdit * titleEdit;
|
||||
ScrapperLineEdit * numberEdit;
|
||||
ScrapperLineEdit * volumeEdit;
|
||||
};
|
||||
|
||||
//---------------------------------------
|
||||
class SearchVolume : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SearchVolume(QWidget * parent = 0);
|
||||
public slots:
|
||||
QString getVolumeInfo() {return volumeEdit->text();}
|
||||
private:
|
||||
ScrapperLineEdit * volumeEdit;
|
||||
};
|
||||
|
||||
//---------------------------------------
|
||||
class SelectComic : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SelectComic(QWidget * parent = 0);
|
||||
virtual ~SelectComic();
|
||||
};
|
||||
|
||||
//---------------------------------------
|
||||
class SelectVolume : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SelectVolume(QWidget * parent = 0);
|
||||
virtual ~SelectVolume();
|
||||
};
|
||||
|
||||
//----------------------------------------
|
||||
class ComicVineDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ComicVineDialog(QWidget *parent = 0);
|
||||
QString databasePath;
|
||||
QString basePath;
|
||||
void setComics(const QList<ComicDB> & comics);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void show();
|
||||
protected slots:
|
||||
void goNext();
|
||||
void debugClientResults(const QString & string);
|
||||
//show widget methods
|
||||
void showSeriesQuestion();
|
||||
void showSearchSingleComic();
|
||||
void showSearchVolume();
|
||||
void showLoading();
|
||||
void search();
|
||||
private:
|
||||
|
||||
enum ScrapperStatus
|
||||
{
|
||||
SingleComic,
|
||||
Volume,
|
||||
SingleComicInSeries
|
||||
};
|
||||
|
||||
ScrapperStatus status;
|
||||
|
||||
ComicVineClient * comicVineClient;
|
||||
|
||||
int currentIndex;
|
||||
|
||||
TitleHeader * titleHeader;
|
||||
|
||||
QPushButton * skipButton;
|
||||
QPushButton * backButton;
|
||||
QPushButton * nextButton;
|
||||
QPushButton * searchButton;
|
||||
QPushButton * closeButton;
|
||||
|
||||
//stacked widgets
|
||||
QStackedWidget * content;
|
||||
|
||||
QWidget * infoNotFound;
|
||||
QWidget * singleComicBrowser;
|
||||
|
||||
void doLayout();
|
||||
void doStackedWidgets();
|
||||
void doLoading();
|
||||
void doConnections();
|
||||
|
||||
QList<ComicDB> comics;
|
||||
|
||||
SeriesQuestion * seriesQuestion;
|
||||
SearchSingleComic * searchSingleComic;
|
||||
SearchVolume * searchVolume;
|
||||
};
|
||||
|
||||
#endif // COMIC_VINE_DIALOG_H
|
Loading…
x
Reference in New Issue
Block a user