mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Usability fixes to Comic View scraper, now the dialog can be resized and once a volume is selected all the comics in that volume are fetched, so no more problems trying to scrap info for large numbers of comics.
This commit is contained in:
parent
27f9bff91b
commit
835a072e23
@ -20,7 +20,8 @@ HEADERS += \
|
|||||||
comic_vine/scraper_scroll_label.h \
|
comic_vine/scraper_scroll_label.h \
|
||||||
comic_vine/scraper_results_paginator.h \
|
comic_vine/scraper_results_paginator.h \
|
||||||
comic_vine/scraper_selector.h \
|
comic_vine/scraper_selector.h \
|
||||||
comic_vine/api_key_dialog.h
|
comic_vine/api_key_dialog.h \
|
||||||
|
$$PWD/comic_vine_all_volume_comics_retriever.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
comic_vine/comic_vine_dialog.cpp \
|
comic_vine/comic_vine_dialog.cpp \
|
||||||
@ -43,4 +44,5 @@ SOURCES += \
|
|||||||
comic_vine/scraper_scroll_label.cpp \
|
comic_vine/scraper_scroll_label.cpp \
|
||||||
comic_vine/scraper_results_paginator.cpp \
|
comic_vine/scraper_results_paginator.cpp \
|
||||||
comic_vine/scraper_selector.cpp \
|
comic_vine/scraper_selector.cpp \
|
||||||
comic_vine/api_key_dialog.cpp
|
comic_vine/api_key_dialog.cpp \
|
||||||
|
$$PWD/comic_vine_all_volume_comics_retriever.cpp
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
#include "comic_vine_all_volume_comics_retriever.h"
|
||||||
|
|
||||||
|
#include "http_worker.h"
|
||||||
|
#include "response_parser.h"
|
||||||
|
|
||||||
|
#include <QtScript>
|
||||||
|
|
||||||
|
ComicVineAllVolumeComicsRetriever::ComicVineAllVolumeComicsRetriever(const QString &volumeURLString, QObject *parent)
|
||||||
|
: QObject(parent), volumeURLString(volumeURLString)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComicVineAllVolumeComicsRetriever::getAllVolumeComics()
|
||||||
|
{
|
||||||
|
getAllVolumeComics(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComicVineAllVolumeComicsRetriever::getAllVolumeComics(int range)
|
||||||
|
{
|
||||||
|
HttpWorker * search = new HttpWorker(volumeURLString.arg(range));
|
||||||
|
connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(appendVolumeComicsInfo(const QByteArray &)));
|
||||||
|
connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
|
||||||
|
connect(search,SIGNAL(timeout()),this,SIGNAL(finished()));
|
||||||
|
connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
||||||
|
search->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComicVineAllVolumeComicsRetriever::appendVolumeComicsInfo(const QByteArray &data)
|
||||||
|
{
|
||||||
|
QString json(data);
|
||||||
|
|
||||||
|
jsonResponses.append(data);
|
||||||
|
|
||||||
|
ResponseParser rp;
|
||||||
|
rp.loadJSONResponse(json);
|
||||||
|
|
||||||
|
qint32 currentPage = rp.getCurrentPage();
|
||||||
|
qint32 totalPages = rp.getTotalPages();
|
||||||
|
|
||||||
|
bool isLastResponse = currentPage == totalPages;
|
||||||
|
|
||||||
|
if (!isLastResponse) {
|
||||||
|
getAllVolumeComics(currentPage * 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit allVolumeComicsInfo(consolidateJSON());
|
||||||
|
emit finished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ComicVineAllVolumeComicsRetriever::consolidateJSON()
|
||||||
|
{
|
||||||
|
QJsonObject consolidatedJSON;
|
||||||
|
QJsonArray comicsInfo;
|
||||||
|
|
||||||
|
foreach (QByteArray json, jsonResponses) {
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(json);
|
||||||
|
|
||||||
|
if(doc.isNull() || !doc.isObject() || doc.isEmpty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject main = doc.object();
|
||||||
|
QJsonValue error = main["error"];
|
||||||
|
|
||||||
|
if (error.isUndefined() || error.toString() != "OK")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QJsonValue results = main["results"];
|
||||||
|
if (results.isUndefined() || !results.isArray())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonArray resultsArray = results.toArray();
|
||||||
|
foreach (const QJsonValue & v, resultsArray)
|
||||||
|
comicsInfo.append(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
consolidatedJSON["error"] = "OK";
|
||||||
|
consolidatedJSON["status_code"] = 1;
|
||||||
|
consolidatedJSON["number_of_total_results"] = comicsInfo.size();
|
||||||
|
consolidatedJSON["offset"] = 0;
|
||||||
|
consolidatedJSON["results"] = comicsInfo;
|
||||||
|
|
||||||
|
QJsonDocument doc(consolidatedJSON);
|
||||||
|
return doc.toJson(QJsonDocument::Compact);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef COMIC_VINE_ALL_VOLUME_COMICS_RETRIEVER_H
|
||||||
|
#define COMIC_VINE_ALL_VOLUME_COMICS_RETRIEVER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class ComicVineAllVolumeComicsRetriever : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ComicVineAllVolumeComicsRetriever(const QString &volumeURLString, QObject *parent = 0);
|
||||||
|
void getAllVolumeComics();
|
||||||
|
protected:
|
||||||
|
void getAllVolumeComics(const int range);
|
||||||
|
signals:
|
||||||
|
void allVolumeComicsInfo(QString json);
|
||||||
|
void finished();
|
||||||
|
void timeOut();
|
||||||
|
protected slots:
|
||||||
|
void appendVolumeComicsInfo(const QByteArray &data);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QString volumeURLString;
|
||||||
|
QList<QByteArray> jsonResponses;
|
||||||
|
|
||||||
|
QString consolidateJSON();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COMIC_VINE_ALL_VOLUME_COMICS_RETRIEVER_H
|
@ -1,6 +1,8 @@
|
|||||||
#include "comic_vine_client.h"
|
#include "comic_vine_client.h"
|
||||||
#include "yacreader_global_gui.h"
|
#include "yacreader_global_gui.h"
|
||||||
|
|
||||||
|
#include "comic_vine_all_volume_comics_retriever.h"
|
||||||
|
|
||||||
//this is the API key used by YACReader to access Comic Vine
|
//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
|
//please, do not use it in your own software, get one for free at Comic Vine
|
||||||
static const QString CV_API_KEY = "%CV_API_KEY%"; //get from settings
|
static const QString CV_API_KEY = "%CV_API_KEY%"; //get from settings
|
||||||
@ -22,7 +24,7 @@ static const QString CV_SERIES_DETAIL = CV_WEB_ADDRESS + "/volume/4050-%1/?api_k
|
|||||||
|
|
||||||
//gets info for comics in a volume id %1
|
//gets info for comics in a volume id %1
|
||||||
static const QString CV_COMICS_INFO = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY +
|
static const QString CV_COMICS_INFO = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY +
|
||||||
"&format=json&field_list=name,issue_number,id,image&filter=volume:%1"
|
"&limit=1000&format=json&field_list=name,issue_number,id,image&filter=volume:%1"
|
||||||
"&sort=cover_date:asc" //sorting by cover_date, because comic vine doesn't use natural sorting (issue_number -> 1 10 11 ... 100 2 20 21....)
|
"&sort=cover_date:asc" //sorting by cover_date, because comic vine doesn't use natural sorting (issue_number -> 1 10 11 ... 100 2 20 21....)
|
||||||
"&offset=%2";
|
"&offset=%2";
|
||||||
|
|
||||||
@ -115,11 +117,24 @@ void ComicVineClient::getSeriesCover(const QString & url)
|
|||||||
//CV_COMIC_IDS
|
//CV_COMIC_IDS
|
||||||
void ComicVineClient::getVolumeComicsInfo(const QString & idVolume, int page)
|
void ComicVineClient::getVolumeComicsInfo(const QString & idVolume, int page)
|
||||||
{
|
{
|
||||||
HttpWorker * search = new HttpWorker(QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY,settings->value(COMIC_VINE_API_KEY,CV_API_KEY_DEFAULT).toString()).arg(idVolume).arg((page-1)*100)); //page on works for search, using offset instead
|
HttpWorker * search = new HttpWorker(QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY,settings->value(COMIC_VINE_API_KEY,CV_API_KEY_DEFAULT).toString()).arg(idVolume).arg((page-1)*100)); //page doesn't work for search, using offset instead
|
||||||
connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(processVolumeComicsInfo(const QByteArray &)));
|
connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(processVolumeComicsInfo(const QByteArray &)));
|
||||||
connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut())); //TODO
|
connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut())); //TODO
|
||||||
connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
||||||
search->get();
|
search->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComicVineClient::getAllVolumeComicsInfo(const QString &idVolume)
|
||||||
|
{
|
||||||
|
QString url = QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY,settings->value(COMIC_VINE_API_KEY,CV_API_KEY_DEFAULT).toString()).arg(idVolume);
|
||||||
|
ComicVineAllVolumeComicsRetriever * comicsRetriever = new ComicVineAllVolumeComicsRetriever(url);
|
||||||
|
|
||||||
|
connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::allVolumeComicsInfo, this, &ComicVineClient::volumeComicsInfo);
|
||||||
|
connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::finished, this, &ComicVineClient::finished);
|
||||||
|
connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::finished, this, &ComicVineAllVolumeComicsRetriever::deleteLater);
|
||||||
|
connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::timeOut, this, &ComicVineClient::timeOut);
|
||||||
|
|
||||||
|
comicsRetriever->getAllVolumeComics();
|
||||||
}
|
}
|
||||||
|
|
||||||
//CV_COMIC_ID
|
//CV_COMIC_ID
|
||||||
|
@ -27,6 +27,7 @@ public slots:
|
|||||||
void getSeriesDetail(const QString & id);
|
void getSeriesDetail(const QString & id);
|
||||||
void getSeriesCover(const QString & url);
|
void getSeriesCover(const QString & url);
|
||||||
void getVolumeComicsInfo(const QString & idVolume, int page=1);
|
void getVolumeComicsInfo(const QString & idVolume, int page=1);
|
||||||
|
void getAllVolumeComicsInfo(const QString & idVolume);
|
||||||
QByteArray getComicDetail(const QString & id, bool &outError, bool &outTimeout);
|
QByteArray getComicDetail(const QString & id, bool &outError, bool &outTimeout);
|
||||||
void getComicCover(const QString & url);
|
void getComicCover(const QString & url);
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "comic_vine_dialog.h"
|
#include "comic_vine_dialog.h"
|
||||||
|
#include <QtWidgets>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@ -36,6 +37,8 @@
|
|||||||
ComicVineDialog::ComicVineDialog(QWidget *parent) :
|
ComicVineDialog::ComicVineDialog(QWidget *parent) :
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
|
setWindowFlags(Qt::Window);
|
||||||
|
|
||||||
doLayout();
|
doLayout();
|
||||||
doStackedWidgets();
|
doStackedWidgets();
|
||||||
doConnections();
|
doConnections();
|
||||||
@ -75,15 +78,13 @@ void ComicVineDialog::doLayout()
|
|||||||
buttonLayout->addWidget(closeButton);
|
buttonLayout->addWidget(closeButton);
|
||||||
buttonLayout->setContentsMargins(0,0,0,0);
|
buttonLayout->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
mainLayout->addWidget(titleHeader = new TitleHeader);
|
mainLayout->addWidget(titleHeader = new TitleHeader, 0);
|
||||||
mainLayout->addWidget(content);
|
mainLayout->addWidget(content, 1);
|
||||||
mainLayout->addStretch();
|
mainLayout->addLayout(buttonLayout, 0);
|
||||||
mainLayout->addLayout(buttonLayout);
|
|
||||||
|
|
||||||
mainLayout->setContentsMargins(26,16,26,11);
|
mainLayout->setContentsMargins(26,16,26,11);
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
setFixedSize(872,529);
|
|
||||||
|
|
||||||
setWindowTitle("Comic Vine Scraper (beta)");
|
setWindowTitle("Comic Vine Scraper (beta)");
|
||||||
}
|
}
|
||||||
@ -197,7 +198,26 @@ void ComicVineDialog::goBack()
|
|||||||
|
|
||||||
void ComicVineDialog::setComics(const QList<ComicDB> & comics)
|
void ComicVineDialog::setComics(const QList<ComicDB> & comics)
|
||||||
{
|
{
|
||||||
this->comics = comics;
|
this->comics = comics;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize ComicVineDialog::sizeHint() const
|
||||||
|
{
|
||||||
|
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
|
||||||
|
int widthDesktopResolution = QApplication::desktop()->screenGeometry().width();
|
||||||
|
int height,width;
|
||||||
|
height = qMax(529, static_cast<int>(heightDesktopResolution*0.5));
|
||||||
|
width = height * 1.65;
|
||||||
|
|
||||||
|
if (width > widthDesktopResolution)
|
||||||
|
return minimumSizeHint();
|
||||||
|
|
||||||
|
return QSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize ComicVineDialog::minimumSizeHint() const
|
||||||
|
{
|
||||||
|
return QSize(872, 529);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComicVineDialog::show()
|
void ComicVineDialog::show()
|
||||||
@ -698,7 +718,7 @@ void ComicVineDialog::getVolumeComicsInfo(const QString &vID, int page)
|
|||||||
|
|
||||||
QLOG_TRACE() << vID;
|
QLOG_TRACE() << vID;
|
||||||
|
|
||||||
comicVineClient->getVolumeComicsInfo(vID,page);
|
comicVineClient->getAllVolumeComicsInfo(vID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComicVineDialog::launchSearchVolume()
|
void ComicVineDialog::launchSearchVolume()
|
||||||
|
@ -30,7 +30,8 @@ public:
|
|||||||
QString databasePath;
|
QString databasePath;
|
||||||
QString basePath;
|
QString basePath;
|
||||||
void setComics(const QList<ComicDB> & comics);
|
void setComics(const QList<ComicDB> & comics);
|
||||||
|
QSize sizeHint() const;
|
||||||
|
QSize minimumSizeHint() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -47,9 +47,16 @@ void VolumeComicsModel::load(const QString & json)
|
|||||||
}
|
}
|
||||||
|
|
||||||
qSort(_data.begin(),_data.end(),lessThan);
|
qSort(_data.begin(),_data.end(),lessThan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*void VolumeComicsModel::load(const QStringList &jsonList)
|
||||||
|
{
|
||||||
|
foreach (QString json, jsonList) {
|
||||||
|
load(json);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
QModelIndex VolumeComicsModel::parent(const QModelIndex &index) const
|
QModelIndex VolumeComicsModel::parent(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(index)
|
Q_UNUSED(index)
|
||||||
|
@ -9,6 +9,7 @@ class VolumeComicsModel : public JSONModel
|
|||||||
public:
|
public:
|
||||||
explicit VolumeComicsModel(QObject *parent = 0);
|
explicit VolumeComicsModel(QObject *parent = 0);
|
||||||
void load(const QString & json);
|
void load(const QString & json);
|
||||||
|
//void load(const QStringList & jsonList);
|
||||||
|
|
||||||
QModelIndex parent(const QModelIndex &index) const;
|
QModelIndex parent(const QModelIndex &index) const;
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
@ -77,19 +77,36 @@ QVariant VolumesModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
if (role == Qt::DecorationRole)
|
if (role == Qt::DecorationRole)
|
||||||
{
|
{
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int row = index.row();
|
||||||
|
int column = index.column();
|
||||||
|
|
||||||
if (role == Qt::TextAlignmentRole)
|
if (role == Qt::TextAlignmentRole)
|
||||||
{
|
{
|
||||||
//TODO
|
switch(column)
|
||||||
|
{
|
||||||
|
case YEAR:
|
||||||
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
case ISSUES:
|
||||||
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
default:
|
||||||
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(role != Qt::DisplayRole)
|
if(role != Qt::DisplayRole)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
int row = index.row();
|
if (column == YEAR || column == ISSUES)
|
||||||
int column = index.column();
|
{
|
||||||
return _data[row][column];
|
return _data[row][column].toInt();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _data[row][column];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags VolumesModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags VolumesModel::flags(const QModelIndex &index) const
|
||||||
@ -113,7 +130,7 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int
|
|||||||
case ISSUES:
|
case ISSUES:
|
||||||
return QVariant(QString(tr("issues")));
|
return QVariant(QString(tr("issues")));
|
||||||
case PUBLISHER:
|
case PUBLISHER:
|
||||||
return QVariant(QString(tr("publisher")));
|
return QVariant(QString(tr("publisher")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +142,8 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int
|
|||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
case ISSUES:
|
case ISSUES:
|
||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
default:
|
||||||
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,9 @@ public:
|
|||||||
ID
|
ID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Role {
|
||||||
|
SORT_ROLE = Qt::UserRole
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VOLUMES_MODEL_H
|
#endif // VOLUMES_MODEL_H
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
ScraperTableView::ScraperTableView(QWidget *parent) :
|
ScraperTableView::ScraperTableView(QWidget *parent) :
|
||||||
QTableView(parent)
|
QTableView(parent)
|
||||||
{
|
{
|
||||||
QString tableStylesheet = "QTableView {color:white; border:0px;alternate-background-color: #2E2E2E;background-color: #2B2B2B; outline: 0px;}"
|
QString tableStylesheet = "QTableView {color:white; border:0px;alternate-background-color: #2E2E2E;background-color: #2B2B2B; outline: 0px;}"
|
||||||
"QTableView::item {outline: 0px; border: 0px; color:#FFFFFF;}"
|
"QTableView::item {outline: 0px; border: 0px; color:#FFFFFF;}"
|
||||||
"QTableView::item:selected {outline: 0px; background-color: #555555; }"
|
"QTableView::item:selected {outline: 0px; background-color: #555555; }"
|
||||||
"QHeaderView::section:horizontal {background-color:#292929; border-bottom:1px solid #1F1F1F; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #292929, stop: 1 #1F1F1F); border-left:none; border-top:none; padding:4px; color:#ebebeb;}"
|
"QHeaderView::section:horizontal {background-color:#292929; border-bottom:1px solid #1F1F1F; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #292929, stop: 1 #1F1F1F); border-left:none; border-top:none; padding:4px; color:#ebebeb;}"
|
||||||
@ -33,8 +33,7 @@ ScraperTableView::ScraperTableView(QWidget *parent) :
|
|||||||
verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
horizontalHeader()->setStretchLastSection(true);
|
||||||
horizontalHeader()->setStretchLastSection(true);
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
horizontalHeader()->setSectionsClickable(false);
|
horizontalHeader()->setSectionsClickable(false);
|
||||||
#else
|
#else
|
||||||
@ -57,5 +56,5 @@ ScraperTableView::ScraperTableView(QWidget *parent) :
|
|||||||
|
|
||||||
verticalHeader()->hide();
|
verticalHeader()->hide();
|
||||||
|
|
||||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,7 @@ SelectComic::SelectComic(QWidget *parent)
|
|||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
QWidget * leftWidget = new QWidget;
|
QWidget * leftWidget = new QWidget;
|
||||||
QVBoxLayout * left = new QVBoxLayout;
|
QVBoxLayout * left = new QVBoxLayout;
|
||||||
QVBoxLayout * right = new QVBoxLayout;
|
QGridLayout * content = new QGridLayout;
|
||||||
QHBoxLayout * content = new QHBoxLayout;
|
|
||||||
|
|
||||||
right->setContentsMargins(0,0,0,0);
|
|
||||||
|
|
||||||
//widgets
|
//widgets
|
||||||
cover = new QLabel();
|
cover = new QLabel();
|
||||||
@ -41,23 +38,22 @@ SelectComic::SelectComic(QWidget *parent)
|
|||||||
|
|
||||||
left->addWidget(cover);
|
left->addWidget(cover);
|
||||||
left->addWidget(detailLabel,1);
|
left->addWidget(detailLabel,1);
|
||||||
left->addStretch();
|
|
||||||
leftWidget->setMaximumWidth(180);
|
leftWidget->setMaximumWidth(180);
|
||||||
leftWidget->setLayout(left);
|
leftWidget->setLayout(left);
|
||||||
left->setContentsMargins(0,0,0,0);
|
left->setContentsMargins(0,0,0,0);
|
||||||
leftWidget->setContentsMargins(0,0,0,0);
|
leftWidget->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
right->addWidget(tableComics,0,Qt::AlignRight|Qt::AlignTop);
|
content->addWidget(leftWidget, 0, 0);
|
||||||
right->addWidget(paginator);
|
content->addWidget(tableComics, 0, 1);
|
||||||
|
content->addWidget(paginator, 1, 1);
|
||||||
|
|
||||||
content->addWidget(leftWidget);
|
content->setColumnStretch(1, 1);
|
||||||
content->addLayout(right);
|
content->setRowStretch(0, 1);;
|
||||||
|
|
||||||
l->addSpacing(15);
|
l->addSpacing(15);
|
||||||
l->addWidget(label);
|
l->addWidget(label);
|
||||||
l->addSpacing(5);
|
l->addSpacing(5);
|
||||||
l->addLayout(content);
|
l->addLayout(content);
|
||||||
l->addStretch();
|
|
||||||
|
|
||||||
l->setContentsMargins(0,0,0,0);
|
l->setContentsMargins(0,0,0,0);
|
||||||
setLayout(l);
|
setLayout(l);
|
||||||
@ -70,8 +66,6 @@ void SelectComic::load(const QString &json, const QString & searchString)
|
|||||||
tempM->load(json);
|
tempM->load(json);
|
||||||
tableComics->setModel(tempM);
|
tableComics->setModel(tempM);
|
||||||
|
|
||||||
tableComics->setFixedSize(619,341);
|
|
||||||
|
|
||||||
if(model != 0)
|
if(model != 0)
|
||||||
delete model;
|
delete model;
|
||||||
|
|
||||||
|
@ -35,10 +35,7 @@ SelectVolume::SelectVolume(QWidget *parent)
|
|||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
QWidget * leftWidget = new QWidget;
|
QWidget * leftWidget = new QWidget;
|
||||||
QVBoxLayout * left = new QVBoxLayout;
|
QVBoxLayout * left = new QVBoxLayout;
|
||||||
QVBoxLayout * right = new QVBoxLayout;
|
QGridLayout * content = new QGridLayout;
|
||||||
QHBoxLayout * content = new QHBoxLayout;
|
|
||||||
|
|
||||||
right->setContentsMargins(0,0,0,0);
|
|
||||||
|
|
||||||
//widgets
|
//widgets
|
||||||
cover = new QLabel();
|
cover = new QLabel();
|
||||||
@ -46,9 +43,9 @@ SelectVolume::SelectVolume(QWidget *parent)
|
|||||||
cover->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
|
cover->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
|
||||||
cover->setMinimumSize(168,168*5.0/3);
|
cover->setMinimumSize(168,168*5.0/3);
|
||||||
cover->setStyleSheet("QLabel {background-color: #2B2B2B; color:white; font-size:12px; font-family:Arial; }");
|
cover->setStyleSheet("QLabel {background-color: #2B2B2B; color:white; font-size:12px; font-family:Arial; }");
|
||||||
detailLabel = new ScraperScrollLabel(this);
|
detailLabel = new ScraperScrollLabel();
|
||||||
|
|
||||||
tableVolumes = new ScraperTableView(this);
|
tableVolumes = new ScraperTableView();
|
||||||
tableVolumes->setSortingEnabled(true);
|
tableVolumes->setSortingEnabled(true);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
tableVolumes->horizontalHeader()->setSectionsClickable(true);
|
tableVolumes->horizontalHeader()->setSectionsClickable(true);
|
||||||
@ -64,23 +61,22 @@ SelectVolume::SelectVolume(QWidget *parent)
|
|||||||
|
|
||||||
left->addWidget(cover);
|
left->addWidget(cover);
|
||||||
left->addWidget(detailLabel,1);
|
left->addWidget(detailLabel,1);
|
||||||
left->addStretch();
|
|
||||||
leftWidget->setMaximumWidth(180);
|
leftWidget->setMaximumWidth(180);
|
||||||
leftWidget->setLayout(left);
|
leftWidget->setLayout(left);
|
||||||
left->setContentsMargins(0,0,0,0);
|
left->setContentsMargins(0,0,0,0);
|
||||||
leftWidget->setContentsMargins(0,0,0,0);
|
leftWidget->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
right->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop);
|
content->addWidget(leftWidget, 0, 0);
|
||||||
right->addWidget(paginator);
|
content->addWidget(tableVolumes, 0, 1);
|
||||||
|
content->addWidget(paginator, 1, 1);
|
||||||
|
|
||||||
content->addWidget(leftWidget);
|
content->setColumnStretch(1, 1);
|
||||||
content->addLayout(right);
|
content->setRowStretch(0, 1);
|
||||||
|
|
||||||
l->addSpacing(15);
|
l->addSpacing(15);
|
||||||
l->addWidget(label);
|
l->addWidget(label);
|
||||||
l->addSpacing(5);
|
l->addSpacing(5);
|
||||||
l->addLayout(content);
|
l->addLayout(content);
|
||||||
l->addStretch();
|
|
||||||
|
|
||||||
l->setContentsMargins(0,0,0,0);
|
l->setContentsMargins(0,0,0,0);
|
||||||
setLayout(l);
|
setLayout(l);
|
||||||
@ -98,8 +94,6 @@ void SelectVolume::load(const QString & json, const QString & searchString)
|
|||||||
tableVolumes->sortByColumn(0,Qt::AscendingOrder);
|
tableVolumes->sortByColumn(0,Qt::AscendingOrder);
|
||||||
tableVolumes->resizeColumnsToContents();
|
tableVolumes->resizeColumnsToContents();
|
||||||
|
|
||||||
tableVolumes->setFixedSize(619,341);
|
|
||||||
|
|
||||||
if(model != 0)
|
if(model != 0)
|
||||||
delete model;
|
delete model;
|
||||||
|
|
||||||
@ -109,9 +103,9 @@ void SelectVolume::load(const QString & json, const QString & searchString)
|
|||||||
{
|
{
|
||||||
tableVolumes->selectRow(0);
|
tableVolumes->selectRow(0);
|
||||||
loadVolumeInfo(proxyModel->index(0,0));
|
loadVolumeInfo(proxyModel->index(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
tableVolumes->setColumnWidth(0,350);
|
tableVolumes->setColumnWidth(0,350);
|
||||||
|
|
||||||
ScraperSelector::load(json,searchString);
|
ScraperSelector::load(json,searchString);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ SortVolumeComics::SortVolumeComics(QWidget *parent) :
|
|||||||
//connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveDownIL()));
|
//connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveDownIL()));
|
||||||
|
|
||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
QHBoxLayout * content = new QHBoxLayout;
|
QGridLayout * content = new QGridLayout;
|
||||||
QHBoxLayout * sortButtonsLayout = new QHBoxLayout;
|
QHBoxLayout * sortButtonsLayout = new QHBoxLayout;
|
||||||
|
|
||||||
tableFiles = new ScraperTableView();
|
tableFiles = new ScraperTableView();
|
||||||
@ -47,10 +47,6 @@ SortVolumeComics::SortVolumeComics(QWidget *parent) :
|
|||||||
tableFiles->setSelectionBehavior(QAbstractItemView::SelectRows);
|
tableFiles->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
tableFiles->setSelectionMode(QAbstractItemView::ContiguousSelection);
|
tableFiles->setSelectionMode(QAbstractItemView::ContiguousSelection);
|
||||||
|
|
||||||
tableFiles->setFixedSize(407,341);
|
|
||||||
tableVolumeComics->setFixedSize(407,341);
|
|
||||||
content->addWidget(tableFiles,0,Qt::AlignLeft|Qt::AlignTop);
|
|
||||||
content->addWidget(tableVolumeComics,0,Qt::AlignRight|Qt::AlignTop);
|
|
||||||
//content->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop);
|
//content->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop);
|
||||||
|
|
||||||
connect(tableVolumeComics->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(synchronizeScroll(int)));
|
connect(tableVolumeComics->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(synchronizeScroll(int)));
|
||||||
@ -66,22 +62,22 @@ SortVolumeComics::SortVolumeComics(QWidget *parent) :
|
|||||||
sortButtonsLayout->addWidget(ScrapperToolButton::getSeparator());
|
sortButtonsLayout->addWidget(ScrapperToolButton::getSeparator());
|
||||||
sortButtonsLayout->addWidget(moveDownButtonCL);
|
sortButtonsLayout->addWidget(moveDownButtonCL);
|
||||||
sortButtonsLayout->addSpacing(10);
|
sortButtonsLayout->addSpacing(10);
|
||||||
//sortButtonsLayout->addStretch();
|
|
||||||
sortButtonsLayout->addWidget(sortLabel);
|
sortButtonsLayout->addWidget(sortLabel);
|
||||||
sortButtonsLayout->addStretch();
|
sortButtonsLayout->addStretch();
|
||||||
sortButtonsLayout->addWidget(paginator);
|
sortButtonsLayout->setSpacing(0);
|
||||||
//sortButtonsLayout->addStretch();
|
|
||||||
//sortButtonsLayout->addWidget(moveUpButtonIL);
|
|
||||||
//sortButtonsLayout->addWidget(ScrapperToolButton::getSeparator());
|
|
||||||
//sortButtonsLayout->addWidget(moveDownButtonIL);
|
|
||||||
sortButtonsLayout->setSpacing(0);
|
|
||||||
|
|
||||||
l->addSpacing(15);
|
content->addWidget(tableFiles, 0, 0);
|
||||||
l->addWidget(label);
|
content->addWidget(tableVolumeComics, 0, 1);
|
||||||
|
content->addLayout(sortButtonsLayout, 1, 0);
|
||||||
|
content->addWidget(paginator, 1, 1);
|
||||||
|
|
||||||
|
content->setRowStretch(0, 1);
|
||||||
|
|
||||||
|
l->addSpacing(15);
|
||||||
|
l->addWidget(label, 0);
|
||||||
l->addSpacing(5);
|
l->addSpacing(5);
|
||||||
l->addLayout(content);
|
l->addLayout(content, 1);
|
||||||
l->addLayout(sortButtonsLayout);
|
l->addLayout(sortButtonsLayout, 0);
|
||||||
l->addStretch();
|
|
||||||
|
|
||||||
l->setContentsMargins(0,0,0,0);
|
l->setContentsMargins(0,0,0,0);
|
||||||
setLayout(l);
|
setLayout(l);
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setData(QList<ComicDB> & comics, const QString & json, const QString & vID);
|
void setData(QList<ComicDB> & comics, const QString &json, const QString & vID);
|
||||||
QList<QPair<ComicDB,QString> > getMatchingInfo();
|
QList<QPair<ComicDB,QString> > getMatchingInfo();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user