mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
clang-format
This commit is contained in:
@ -15,7 +15,7 @@ ApiKeyDialog::ApiKeyDialog(QWidget *parent)
|
||||
auto layout = new QVBoxLayout;
|
||||
auto buttonsLayout = new QHBoxLayout;
|
||||
|
||||
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
|
||||
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
|
||||
settings->beginGroup("ComicVine");
|
||||
|
||||
QLabel *info = new QLabel(tr("Before you can connect to Comic Vine, you need your own API key. Please, get one free <a href=\"http://www.comicvine.com/api/\">here</a>"));
|
||||
@ -57,7 +57,7 @@ ApiKeyDialog::~ApiKeyDialog()
|
||||
|
||||
void ApiKeyDialog::enableAccept(const QString &text)
|
||||
{
|
||||
//TODO key validation
|
||||
// TODO key validation
|
||||
acceptButton->setEnabled(!text.isEmpty());
|
||||
}
|
||||
|
||||
|
@ -3,54 +3,54 @@
|
||||
|
||||
#include "comic_vine_all_volume_comics_retriever.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 = "%CV_API_KEY%"; //get from settings
|
||||
// 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 = "%CV_API_KEY%"; // get from settings
|
||||
static const QString CV_API_KEY_DEFAULT = "46680bebb358f1de690a5a365e15d325f9649f91";
|
||||
|
||||
static const QString CV_WEB_ADDRESS = "%CV_WEB_ADDRESS%"; //get from settings
|
||||
static const QString CV_WEB_ADDRESS = "%CV_WEB_ADDRESS%"; // get from settings
|
||||
|
||||
//gets any volumen containing any comic matching 'query'
|
||||
// gets any volumen containing any comic matching 'query'
|
||||
static const QString CV_SEARCH = CV_WEB_ADDRESS + "/search/?api_key=" + CV_API_KEY +
|
||||
"&format=json&limit=100&resources=volume"
|
||||
"&field_list=name,start_year,publisher,id,image,count_of_issues,deck"
|
||||
"&sort=name:asc"
|
||||
"&query=%1&page=%2";
|
||||
//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,deck&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,deck&query=superman
|
||||
|
||||
//gets the detail for a volume %1
|
||||
// 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=json&field_list=name,start_year,publisher,image,count_of_issues,id,description";
|
||||
|
||||
//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 +
|
||||
"&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";
|
||||
|
||||
//"http://www.comicvine.com/api/issues/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json&field_list=name,issue_number,id,image&filter=volume:%1&page=%2
|
||||
|
||||
//gets id for comic number %2 in a volume id %1
|
||||
// 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=json&field_list=name,issue_number,id,image"
|
||||
"&filter=volume:%1,issue_number:%2";
|
||||
//gets comic detail
|
||||
// gets comic detail
|
||||
static const QString CV_COMIC_DETAIL = CV_WEB_ADDRESS + "/issue/4000-%1/?api_key=" + CV_API_KEY + "&format=json";
|
||||
//http://www.comicvine.com/api/issue/4000-%1/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json
|
||||
// http://www.comicvine.com/api/issue/4000-%1/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json
|
||||
|
||||
//gets comic cover URL
|
||||
// gets comic cover URL
|
||||
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
|
||||
// gets comics matching name %1 and number %2
|
||||
// http://comicvine.com/api/issues/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&limit=20&filter=name:super,issue_number:15
|
||||
|
||||
//gets story arc detail
|
||||
// gets story arc detail
|
||||
static const QString CV_STORY_ARC_DETAIL = CV_WEB_ADDRESS + "/story_arc/4045-%1/?api_key=" + CV_API_KEY + "&format=json";
|
||||
|
||||
ComicVineClient::ComicVineClient(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
|
||||
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
|
||||
settings->beginGroup("ComicVine");
|
||||
baseURL = settings->value(COMIC_VINE_BASE_URL, "https://comicvine.gamespot.com/api").toString();
|
||||
}
|
||||
@ -60,7 +60,7 @@ ComicVineClient::~ComicVineClient()
|
||||
delete settings;
|
||||
}
|
||||
|
||||
//CV_SEARCH
|
||||
// CV_SEARCH
|
||||
void ComicVineClient::search(const QString &query, int page)
|
||||
{
|
||||
HttpWorker *search = new HttpWorker(QString(CV_SEARCH).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(query).arg(page));
|
||||
@ -69,7 +69,7 @@ void ComicVineClient::search(const QString &query, int page)
|
||||
connect(search, &QThread::finished, search, &QObject::deleteLater);
|
||||
search->get();
|
||||
}
|
||||
//CV_SEARCH result
|
||||
// CV_SEARCH result
|
||||
void ComicVineClient::proccessVolumesSearchData(const QByteArray &data)
|
||||
{
|
||||
QString json(data);
|
||||
@ -98,7 +98,7 @@ void ComicVineClient::proccessComicDetailData(const QByteArray &data)
|
||||
emit finished();
|
||||
}
|
||||
|
||||
//CV_SERIES_DETAIL
|
||||
// CV_SERIES_DETAIL
|
||||
void ComicVineClient::getSeriesDetail(const QString &id)
|
||||
{
|
||||
HttpWorker *search = new HttpWorker(QString(CV_SERIES_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
|
||||
@ -112,17 +112,17 @@ void ComicVineClient::getSeriesCover(const QString &url)
|
||||
{
|
||||
auto search = new HttpWorker(url);
|
||||
connect(search, &HttpWorker::dataReady, this, &ComicVineClient::seriesCover);
|
||||
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); //TODO
|
||||
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); // TODO
|
||||
connect(search, &QThread::finished, search, &QObject::deleteLater);
|
||||
search->get();
|
||||
}
|
||||
|
||||
//CV_COMIC_IDS
|
||||
// CV_COMIC_IDS
|
||||
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 doesn't work 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, &HttpWorker::dataReady, this, &ComicVineClient::processVolumeComicsInfo);
|
||||
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); //TODO
|
||||
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); // TODO
|
||||
connect(search, &QThread::finished, search, &QObject::deleteLater);
|
||||
search->get();
|
||||
}
|
||||
@ -140,21 +140,21 @@ void ComicVineClient::getAllVolumeComicsInfo(const QString &idVolume)
|
||||
comicsRetriever->getAllVolumeComics();
|
||||
}
|
||||
|
||||
//CV_COMIC_ID
|
||||
// CV_COMIC_ID
|
||||
void ComicVineClient::getComicId(const QString &id, int comicNumber)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
Q_UNUSED(comicNumber);
|
||||
}
|
||||
|
||||
//CV_COMIC_DETAIL
|
||||
// CV_COMIC_DETAIL
|
||||
QByteArray ComicVineClient::getComicDetail(const QString &id, bool &outError, bool &outTimeout)
|
||||
{
|
||||
HttpWorker *search = new HttpWorker(QString(CV_COMIC_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
|
||||
|
||||
//connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
|
||||
//connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
|
||||
//connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
||||
// connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
|
||||
// connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
|
||||
// connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
||||
search->get();
|
||||
search->wait();
|
||||
outError = !(search->wasValid());
|
||||
@ -165,7 +165,7 @@ QByteArray ComicVineClient::getComicDetail(const QString &id, bool &outError, bo
|
||||
return result;
|
||||
}
|
||||
|
||||
//CV_COMIC_DETAIL
|
||||
// CV_COMIC_DETAIL
|
||||
void ComicVineClient::getComicDetailAsync(const QString &id)
|
||||
{
|
||||
HttpWorker *search = new HttpWorker(QString(CV_COMIC_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
|
||||
@ -176,14 +176,14 @@ void ComicVineClient::getComicDetailAsync(const QString &id)
|
||||
search->get();
|
||||
}
|
||||
|
||||
//CV_STORY_ARC_DETAIL
|
||||
// CV_STORY_ARC_DETAIL
|
||||
QByteArray ComicVineClient::getStoryArcDetail(const QString &id, bool &outError, bool &outTimeout)
|
||||
{
|
||||
HttpWorker *search = new HttpWorker(QString(CV_STORY_ARC_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
|
||||
|
||||
//connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
|
||||
//connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
|
||||
//connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
||||
// connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
|
||||
// connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
|
||||
// connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
|
||||
search->get();
|
||||
search->wait();
|
||||
outError = !(search->wasValid());
|
||||
@ -198,12 +198,12 @@ void ComicVineClient::getComicCover(const QString &url)
|
||||
{
|
||||
auto search = new HttpWorker(url);
|
||||
connect(search, &HttpWorker::dataReady, this, &ComicVineClient::comicCover);
|
||||
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); //TODO
|
||||
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); // TODO
|
||||
connect(search, &QThread::finished, search, &QObject::deleteLater);
|
||||
search->get();
|
||||
}
|
||||
|
||||
//CV_COVER_DETAIL
|
||||
// CV_COVER_DETAIL
|
||||
void ComicVineClient::getCoverURL(const QString &id)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
|
@ -15,8 +15,8 @@ public:
|
||||
|
||||
signals:
|
||||
void searchResult(QString);
|
||||
void seriesDetail(QString); //JSON
|
||||
void comicDetail(QString); //JSON
|
||||
void seriesDetail(QString); // JSON
|
||||
void comicDetail(QString); // JSON
|
||||
void seriesCover(const QByteArray &);
|
||||
void comicCover(const QByteArray &);
|
||||
void volumeComicsInfo(QString);
|
||||
|
@ -151,7 +151,7 @@ void ComicVineDialog::goNext()
|
||||
} else if (content->currentWidget() == sortVolumeComicsWidget) {
|
||||
showLoading();
|
||||
|
||||
//ComicDB-ComicVineID
|
||||
// ComicDB-ComicVineID
|
||||
QList<QPair<ComicDB, QString>> matchingInfo = sortVolumeComicsWidget->getMatchingInfo();
|
||||
int count = selectVolumeWidget->getSelectedVolumeNumIssues();
|
||||
QString publisher = selectVolumeWidget->getSelectedVolumePublisher();
|
||||
@ -273,7 +273,7 @@ void ComicVineDialog::debugClientResults(const QString &string)
|
||||
{
|
||||
ResponseParser p;
|
||||
p.loadJSONResponse(string);
|
||||
//QMessageBox::information(0,"Result", QString("Number of results : %1").arg(p.getNumResults()));
|
||||
// QMessageBox::information(0,"Result", QString("Number of results : %1").arg(p.getNumResults()));
|
||||
if (p.responseError()) {
|
||||
QMessageBox::critical(0, tr("Error connecting to ComicVine"), p.errorDescription());
|
||||
goBack();
|
||||
@ -433,15 +433,15 @@ void ComicVineDialog::getComicsInfo(QList<QPair<ComicDB, QString>> &matchingInfo
|
||||
QList<ComicDB> comics;
|
||||
foreach (p, matchingInfo) {
|
||||
auto comicVineClient = new ComicVineClient;
|
||||
//connect(comicVineClient,SIGNAL(searchResult(QString)),this,SLOT(debugClientResults(QString)));
|
||||
//connect(comicVineClient,SIGNAL(timeOut()),this,SLOT(queryTimeOut()));
|
||||
//connect(comicVineClient,SIGNAL(finished()),comicVineClient,SLOT(deleteLater()));
|
||||
// connect(comicVineClient,SIGNAL(searchResult(QString)),this,SLOT(debugClientResults(QString)));
|
||||
// connect(comicVineClient,SIGNAL(timeOut()),this,SLOT(queryTimeOut()));
|
||||
// connect(comicVineClient,SIGNAL(finished()),comicVineClient,SLOT(deleteLater()));
|
||||
bool error;
|
||||
bool timeout;
|
||||
QByteArray result = comicVineClient->getComicDetail(p.second, error, timeout); //TODO check timeOut or Connection error
|
||||
QByteArray result = comicVineClient->getComicDetail(p.second, error, timeout); // TODO check timeOut or Connection error
|
||||
if (error || timeout)
|
||||
continue; //TODO
|
||||
ComicDB comic = parseComicInfo(p.first, result, count, publisher); //TODO check result error
|
||||
continue; // TODO
|
||||
ComicDB comic = parseComicInfo(p.first, result, count, publisher); // TODO check result error
|
||||
comic.info.comicVineID = p.second;
|
||||
comics.push_back(comic);
|
||||
|
||||
@ -469,9 +469,9 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr
|
||||
auto comicVineClient = new ComicVineClient;
|
||||
bool error;
|
||||
bool timeout;
|
||||
QByteArray result = comicVineClient->getComicDetail(comicId, error, timeout); //TODO check timeOut or Connection error
|
||||
QByteArray result = comicVineClient->getComicDetail(comicId, error, timeout); // TODO check timeOut or Connection error
|
||||
if (error || timeout) {
|
||||
//TODO
|
||||
// TODO
|
||||
if (mode == SingleComic || currentIndex == (comics.count() - 1)) {
|
||||
emit accepted();
|
||||
} else {
|
||||
@ -479,7 +479,7 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr
|
||||
}
|
||||
}
|
||||
|
||||
ComicDB comic = parseComicInfo(comics[currentIndex], result, count, publisher); //TODO check result error
|
||||
ComicDB comic = parseComicInfo(comics[currentIndex], result, count, publisher); // TODO check result error
|
||||
comic.info.comicVineID = comicId;
|
||||
setLoadingMessage(tr("Retrieving tags for : %1").arg(comics[currentIndex].getFileName()));
|
||||
QString connectionName = "";
|
||||
@ -512,7 +512,7 @@ ComicDB ComicVineDialog::parseComicInfo(ComicDB &comic, const QString &json, int
|
||||
return comic;
|
||||
}
|
||||
|
||||
int numResults = sc.value("number_of_total_results").toInt(); //fix to weird behaviour using hasNext
|
||||
int numResults = sc.value("number_of_total_results").toInt(); // fix to weird behaviour using hasNext
|
||||
|
||||
if (numResults > 0) {
|
||||
QVariantMap result = sc.value("results").toMap();
|
||||
@ -665,7 +665,7 @@ QPair<QString, QString> ComicVineDialog::getArcNumberAndArcCount(const QString &
|
||||
return qMakePair(QString(), QString());
|
||||
}
|
||||
|
||||
int numResults = sc.value("number_of_total_results").toInt(); //fix to weird behaviour using hasNext
|
||||
int numResults = sc.value("number_of_total_results").toInt(); // fix to weird behaviour using hasNext
|
||||
|
||||
if (numResults > 0) {
|
||||
QVariantMap result = sc.value("results").toMap();
|
||||
@ -779,7 +779,7 @@ void ComicVineDialog::getVolumeComicsInfo(const QString &vID, int /* page */)
|
||||
void ComicVineDialog::launchSearchVolume()
|
||||
{
|
||||
showLoading(tr("Looking for volume..."));
|
||||
//TODO: check if volume info is empty.
|
||||
// TODO: check if volume info is empty.
|
||||
searchVolume(searchVolumeWidget->getVolumeInfo());
|
||||
}
|
||||
|
||||
@ -788,9 +788,9 @@ void ComicVineDialog::launchSearchComic()
|
||||
showLoading(tr("Looking for comic..."));
|
||||
|
||||
QString volumeInfo = searchSingleComicWidget->getVolumeInfo();
|
||||
//QString comicInfo = searchSingleComicWidget->getComicInfo();
|
||||
//int comicNumber = searchSingleComicWidget->getComicNumber();
|
||||
// QString comicInfo = searchSingleComicWidget->getComicInfo();
|
||||
// int comicNumber = searchSingleComicWidget->getComicNumber();
|
||||
|
||||
//if(comicInfo.isEmpty() && comicNumber == -1)
|
||||
// if(comicInfo.isEmpty() && comicNumber == -1)
|
||||
searchVolume(volumeInfo);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class SelectComic;
|
||||
class SelectVolume;
|
||||
class SortVolumeComics;
|
||||
|
||||
//TODO this should use a QStateMachine
|
||||
// TODO this should use a QStateMachine
|
||||
//----------------------------------------
|
||||
class ComicVineDialog : public QDialog
|
||||
{
|
||||
@ -41,7 +41,7 @@ protected slots:
|
||||
void goNext();
|
||||
void goBack();
|
||||
void debugClientResults(const QString &string);
|
||||
//show widget methods
|
||||
// show widget methods
|
||||
void showSeriesQuestion();
|
||||
void showSearchSingleComic();
|
||||
void showSearchVolume();
|
||||
@ -71,9 +71,9 @@ private:
|
||||
void toggleSkipButton();
|
||||
|
||||
enum ScraperMode {
|
||||
SingleComic, //the scraper has been opened for a single comic
|
||||
Volume, //the scraper is trying to get comics info for a whole volume
|
||||
SingleComicInList //the scraper has been opened for a list of unrelated comics
|
||||
SingleComic, // the scraper has been opened for a single comic
|
||||
Volume, // the scraper is trying to get comics info for a whole volume
|
||||
SingleComicInList // the scraper has been opened for a list of unrelated comics
|
||||
};
|
||||
|
||||
enum ScraperStatus {
|
||||
@ -100,7 +100,7 @@ private:
|
||||
QPushButton *searchButton;
|
||||
QPushButton *closeButton;
|
||||
|
||||
//stacked widgets
|
||||
// stacked widgets
|
||||
QStackedWidget *content;
|
||||
|
||||
QWidget *infoNotFound;
|
||||
|
@ -13,7 +13,7 @@ void LocalComicListModel::load(QList<ComicDB> &comics)
|
||||
QModelIndex LocalComicListModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
return QModelIndex(); //no parent
|
||||
return QModelIndex(); // no parent
|
||||
}
|
||||
|
||||
int LocalComicListModel::rowCount(const QModelIndex &parent) const
|
||||
@ -40,7 +40,7 @@ QVariant LocalComicListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
if (role == Qt::TextAlignmentRole) {
|
||||
//TODO
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
@ -48,10 +48,10 @@ QVariant LocalComicListModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
int row = index.row();
|
||||
|
||||
//if(row < _data.count())
|
||||
// if(row < _data.count())
|
||||
return _data[row].getFileName();
|
||||
//else
|
||||
//return QVariant();
|
||||
// else
|
||||
// return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags LocalComicListModel::flags(const QModelIndex &index) const
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
|
||||
void load(QList<ComicDB> &comics);
|
||||
|
||||
//QAbstractItemModel methods
|
||||
// QAbstractItemModel methods
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
|
@ -54,7 +54,7 @@ void VolumeComicsModel::load(const QString &json)
|
||||
QModelIndex VolumeComicsModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
return QModelIndex(); //no parent
|
||||
return QModelIndex(); // no parent
|
||||
}
|
||||
|
||||
int VolumeComicsModel::rowCount(const QModelIndex &parent) const
|
||||
@ -84,7 +84,7 @@ QVariant VolumeComicsModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
if (role == Qt::TextAlignmentRole) {
|
||||
switch (column) //TODO obtener esto de la query
|
||||
switch (column) // TODO obtener esto de la query
|
||||
{
|
||||
case ISSUE:
|
||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||
@ -112,7 +112,7 @@ Qt::ItemFlags VolumeComicsModel::flags(const QModelIndex &index) const
|
||||
QVariant VolumeComicsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||
switch (section) //TODO obtener esto de la query
|
||||
switch (section) // TODO obtener esto de la query
|
||||
{
|
||||
case ISSUE:
|
||||
return QVariant(QString("issue"));
|
||||
@ -122,7 +122,7 @@ QVariant VolumeComicsModel::headerData(int section, Qt::Orientation orientation,
|
||||
}
|
||||
|
||||
if (orientation == Qt::Horizontal && role == Qt::TextAlignmentRole) {
|
||||
switch (section) //TODO obtener esto de la query
|
||||
switch (section) // TODO obtener esto de la query
|
||||
{
|
||||
case ISSUE:
|
||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
@ -9,7 +9,7 @@ class VolumeComicsModel : public JSONModel
|
||||
public:
|
||||
explicit VolumeComicsModel(QObject *parent = nullptr);
|
||||
void load(const QString &json) override;
|
||||
//void load(const QStringList & jsonList);
|
||||
// void load(const QStringList & jsonList);
|
||||
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
@ -10,7 +10,7 @@ VolumesModel::VolumesModel(QObject *parent)
|
||||
|
||||
VolumesModel::~VolumesModel()
|
||||
{
|
||||
//std::for_each(_data.begin(), _data.end(), [](QList<QString> * ptr) { delete ptr; });
|
||||
// std::for_each(_data.begin(), _data.end(), [](QList<QString> * ptr) { delete ptr; });
|
||||
}
|
||||
|
||||
void VolumesModel::load(const QString &json)
|
||||
@ -23,7 +23,7 @@ void VolumesModel::load(const QString &json)
|
||||
return;
|
||||
}
|
||||
|
||||
int numResults = sc.value("number_of_total_results").toInt(); //fix to weird behaviour using hasNext
|
||||
int numResults = sc.value("number_of_total_results").toInt(); // fix to weird behaviour using hasNext
|
||||
QListIterator<QVariant> it(sc.value("results").toList());
|
||||
bool test;
|
||||
QVariantMap resultsValue;
|
||||
@ -48,7 +48,7 @@ void VolumesModel::load(const QString &json)
|
||||
QModelIndex VolumesModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
return QModelIndex(); //no parent
|
||||
return QModelIndex(); // no parent
|
||||
}
|
||||
|
||||
int VolumesModel::rowCount(const QModelIndex &parent) const
|
||||
@ -110,7 +110,7 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int
|
||||
{
|
||||
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||
switch (section) //TODO obtener esto de la query
|
||||
switch (section) // TODO obtener esto de la query
|
||||
{
|
||||
case SERIES:
|
||||
return QVariant(QString("series"));
|
||||
@ -124,7 +124,7 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int
|
||||
}
|
||||
|
||||
if (orientation == Qt::Horizontal && role == Qt::TextAlignmentRole) {
|
||||
switch (section) //TODO obtener esto de la query
|
||||
switch (section) // TODO obtener esto de la query
|
||||
{
|
||||
case YEAR:
|
||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
@ -9,10 +9,10 @@ class VolumesModel : public JSONModel
|
||||
public:
|
||||
explicit VolumesModel(QObject *parent = nullptr);
|
||||
virtual ~VolumesModel();
|
||||
//receive a valid json with a list of volumes
|
||||
// receive a valid json with a list of volumes
|
||||
void load(const QString &json) override;
|
||||
|
||||
//QAbstractItemModel methods
|
||||
// QAbstractItemModel methods
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
|
@ -39,12 +39,12 @@ ScraperTableView::ScraperTableView(QWidget *parent)
|
||||
#else
|
||||
horizontalHeader()->setClickable(false);
|
||||
#endif
|
||||
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
// comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
verticalHeader()->setDefaultSectionSize(24);
|
||||
#if QT_VERSION >= 0x050000
|
||||
verticalHeader()->setSectionsClickable(false); //TODO comportamiento anómalo
|
||||
verticalHeader()->setSectionsClickable(false); // TODO comportamiento anómalo
|
||||
#else
|
||||
verticalHeader()->setClickable(false); //TODO comportamiento anómalo
|
||||
verticalHeader()->setClickable(false); // TODO comportamiento anómalo
|
||||
#endif
|
||||
|
||||
setCornerButtonEnabled(false);
|
||||
|
@ -10,24 +10,24 @@ SearchSingleComic::SearchSingleComic(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
//QLabel * label = new QLabel(tr("Please provide some additional information. At least one field is needed."));
|
||||
// QLabel * label = new QLabel(tr("Please provide some additional information. At least one field is needed."));
|
||||
QLabel *label = new QLabel(tr("Please provide some additional information."));
|
||||
label->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
|
||||
|
||||
//titleEdit = new ScraperLineEdit(tr("Title:"));
|
||||
//numberEdit = new ScraperLineEdit(tr("Number:"));
|
||||
// titleEdit = new ScraperLineEdit(tr("Title:"));
|
||||
// numberEdit = new ScraperLineEdit(tr("Number:"));
|
||||
volumeEdit = new ScraperLineEdit(tr("Series:"));
|
||||
|
||||
//numberEdit->setMaximumWidth(126);
|
||||
// numberEdit->setMaximumWidth(126);
|
||||
|
||||
auto l = new QVBoxLayout;
|
||||
//QHBoxLayout * hl = new QHBoxLayout;
|
||||
//hl->addWidget(titleEdit);
|
||||
//hl->addWidget(numberEdit);
|
||||
// QHBoxLayout * hl = new QHBoxLayout;
|
||||
// hl->addWidget(titleEdit);
|
||||
// hl->addWidget(numberEdit);
|
||||
|
||||
l->addSpacing(35);
|
||||
l->addWidget(label);
|
||||
//l->addLayout(hl);
|
||||
// l->addLayout(hl);
|
||||
l->addWidget(volumeEdit);
|
||||
l->addStretch();
|
||||
|
||||
@ -43,16 +43,16 @@ QString SearchSingleComic::getVolumeInfo()
|
||||
|
||||
QString SearchSingleComic::getComicInfo()
|
||||
{
|
||||
//return titleEdit->text();
|
||||
// return titleEdit->text();
|
||||
return "";
|
||||
}
|
||||
|
||||
int SearchSingleComic::getComicNumber()
|
||||
{
|
||||
//QString numberText = numberEdit->text();
|
||||
//if(numberText.isEmpty())
|
||||
// QString numberText = numberEdit->text();
|
||||
// if(numberText.isEmpty())
|
||||
// return -1;
|
||||
//return numberText.toInt();
|
||||
// return numberText.toInt();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ SelectComic::SelectComic(QWidget *parent)
|
||||
auto left = new QVBoxLayout;
|
||||
auto content = new QGridLayout;
|
||||
|
||||
//widgets
|
||||
// widgets
|
||||
cover = new QLabel();
|
||||
cover->setScaledContents(true);
|
||||
cover->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
@ -32,7 +32,7 @@ SelectComic::SelectComic(QWidget *parent)
|
||||
detailLabel = new ScraperScrollLabel(this);
|
||||
|
||||
tableComics = new ScraperTableView(this);
|
||||
//connections
|
||||
// connections
|
||||
connect(tableComics, &QAbstractItemView::clicked, this, &SelectComic::loadComicInfo);
|
||||
|
||||
paginator->setCustomLabel(tr("comics"));
|
||||
|
@ -37,7 +37,7 @@ SelectVolume::SelectVolume(QWidget *parent)
|
||||
auto left = new QVBoxLayout;
|
||||
auto content = new QGridLayout;
|
||||
|
||||
//widgets
|
||||
// widgets
|
||||
cover = new QLabel();
|
||||
cover->setScaledContents(true);
|
||||
cover->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
@ -52,11 +52,11 @@ SelectVolume::SelectVolume(QWidget *parent)
|
||||
#else
|
||||
tableVolumes->horizontalHeader()->setClickable(true);
|
||||
#endif
|
||||
//tableVolumes->horizontalHeader()->setSortIndicatorShown(false);
|
||||
// tableVolumes->horizontalHeader()->setSortIndicatorShown(false);
|
||||
connect(tableVolumes->horizontalHeader(), &QHeaderView::sectionClicked,
|
||||
[=](int index) { tableVolumes->horizontalHeader()->sortIndicatorSection() == index ? tableVolumes->sortByColumn(index, tableVolumes->horizontalHeader()->sortIndicatorOrder() == Qt::AscendingOrder ? Qt::DescendingOrder : Qt::AscendingOrder)
|
||||
: tableVolumes->sortByColumn(index, Qt::AscendingOrder); });
|
||||
//connections
|
||||
// connections
|
||||
connect(tableVolumes, &QAbstractItemView::clicked, this, &SelectVolume::loadVolumeInfo);
|
||||
|
||||
paginator->setCustomLabel(tr("volumes"));
|
||||
@ -89,7 +89,7 @@ void SelectVolume::load(const QString &json, const QString &searchString)
|
||||
{
|
||||
auto tempM = new VolumesModel();
|
||||
tempM->load(json);
|
||||
//tableVolumes->setModel(tempM);
|
||||
// tableVolumes->setModel(tempM);
|
||||
|
||||
proxyModel->setSourceModel(tempM);
|
||||
tableVolumes->setModel(proxyModel);
|
||||
|
@ -27,15 +27,15 @@ SortVolumeComics::SortVolumeComics(QWidget *parent)
|
||||
moveDownButtonCL = new ScrapperToolButton(ScrapperToolButton::RIGHT);
|
||||
moveDownButtonCL->setIcon(QIcon(":/images/comic_vine/rowDown.png"));
|
||||
moveDownButtonCL->setAutoRepeat(true);
|
||||
//moveUpButtonIL = new ScrapperToolButton(ScrapperToolButton::LEFT);
|
||||
//moveUpButtonIL->setIcon(QIcon(":/images/comic_vine/rowUp.png"));
|
||||
//moveDownButtonIL = new ScrapperToolButton(ScrapperToolButton::RIGHT);
|
||||
//moveDownButtonIL->setIcon(QIcon(":/images/comic_vine/rowDown.png"));
|
||||
// moveUpButtonIL = new ScrapperToolButton(ScrapperToolButton::LEFT);
|
||||
// moveUpButtonIL->setIcon(QIcon(":/images/comic_vine/rowUp.png"));
|
||||
// moveDownButtonIL = new ScrapperToolButton(ScrapperToolButton::RIGHT);
|
||||
// moveDownButtonIL->setIcon(QIcon(":/images/comic_vine/rowDown.png"));
|
||||
|
||||
connect(moveUpButtonCL, &QAbstractButton::clicked, this, &SortVolumeComics::moveUpCL);
|
||||
connect(moveDownButtonCL, &QAbstractButton::clicked, this, &SortVolumeComics::moveDownCL);
|
||||
//connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveUpIL()));
|
||||
//connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveDownIL()));
|
||||
// connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveUpIL()));
|
||||
// connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveDownIL()));
|
||||
|
||||
auto l = new QVBoxLayout;
|
||||
auto content = new QGridLayout;
|
||||
@ -47,13 +47,13 @@ SortVolumeComics::SortVolumeComics(QWidget *parent)
|
||||
tableFiles->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
tableFiles->setSelectionMode(QAbstractItemView::ContiguousSelection);
|
||||
|
||||
//content->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop);
|
||||
// content->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop);
|
||||
|
||||
connect(tableVolumeComics->verticalScrollBar(), &QAbstractSlider::valueChanged, this, &SortVolumeComics::synchronizeScroll);
|
||||
connect(tableFiles->verticalScrollBar(), &QAbstractSlider::valueChanged, this, &SortVolumeComics::synchronizeScroll);
|
||||
|
||||
//connect(tableVolumeComics, SIGNAL(pressed(QModelIndex)), tableFiles, SLOT(setCurrentIndex(QModelIndex)));
|
||||
//connect(tableFiles, SIGNAL(pressed(QModelIndex)), tableVolumeComics, SLOT(setCurrentIndex(QModelIndex)));
|
||||
// connect(tableVolumeComics, SIGNAL(pressed(QModelIndex)), tableFiles, SLOT(setCurrentIndex(QModelIndex)));
|
||||
// connect(tableFiles, SIGNAL(pressed(QModelIndex)), tableVolumeComics, SLOT(setCurrentIndex(QModelIndex)));
|
||||
|
||||
paginator->setCustomLabel(tr("issues"));
|
||||
paginator->setMinimumWidth(422);
|
||||
@ -83,24 +83,24 @@ SortVolumeComics::SortVolumeComics(QWidget *parent)
|
||||
setLayout(l);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
//rows actions
|
||||
// rows actions
|
||||
QAction *removeItemFromList = new QAction(tr("remove selected comics"), this);
|
||||
QAction *restoreAllItems = new QAction(tr("restore all removed comics"), this);
|
||||
//QAction * restoreItems = new QAction(tr("restore removed comics"),this);
|
||||
// QAction * restoreItems = new QAction(tr("restore removed comics"),this);
|
||||
|
||||
tableFiles->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
tableFiles->addAction(removeItemFromList);
|
||||
tableFiles->addAction(restoreAllItems);
|
||||
//tableFiles->addAction(restoreItems);
|
||||
// tableFiles->addAction(restoreItems);
|
||||
|
||||
connect(removeItemFromList, &QAction::triggered, this, &SortVolumeComics::removeSelectedComics);
|
||||
connect(restoreAllItems, &QAction::triggered, this, &SortVolumeComics::restoreAllComics);
|
||||
//connect(restoreItems,SIGNAL(triggered()),this,SLOT(showRemovedComicsSelector()));
|
||||
// connect(restoreItems,SIGNAL(triggered()),this,SLOT(showRemovedComicsSelector()));
|
||||
}
|
||||
|
||||
void SortVolumeComics::setData(QList<ComicDB> &comics, const QString &json, const QString &vID)
|
||||
{
|
||||
//set up models
|
||||
// set up models
|
||||
localComicsModel = new LocalComicListModel;
|
||||
localComicsModel->load(comics);
|
||||
|
||||
@ -127,7 +127,7 @@ void SortVolumeComics::synchronizeScroll(int pos)
|
||||
{
|
||||
void *senderObject = sender();
|
||||
|
||||
if (senderObject == 0) //invalid call
|
||||
if (senderObject == 0) // invalid call
|
||||
return;
|
||||
|
||||
QScrollBar *tableVolumeComicsScrollBar = tableVolumeComics->verticalScrollBar();
|
||||
@ -203,7 +203,7 @@ QList<QPair<ComicDB, QString>> SortVolumeComics::getMatchingInfo()
|
||||
QString id;
|
||||
foreach (ComicDB c, comicList) {
|
||||
id = volumeComicsModel->getComicId(index);
|
||||
if (!c.getFileName().isEmpty() && !id.isEmpty()) //there is a valid comic, and valid comic ID
|
||||
if (!c.getFileName().isEmpty() && !id.isEmpty()) // there is a valid comic, and valid comic ID
|
||||
{
|
||||
l.push_back(QPair<ComicDB, QString>(c, id));
|
||||
}
|
||||
|
Reference in New Issue
Block a user