added SortVolumeComics widget (and models)

This commit is contained in:
Luis Ángel San Martín 2013-10-19 09:20:23 +02:00
parent 8678e5368d
commit 63636dd417
19 changed files with 411 additions and 72 deletions

View File

@ -12,7 +12,11 @@ HEADERS += \
comic_vine/model/volumes_model.h \
comic_vine/model/comics_model.h \
comic_vine/model/json_model.h \
comic_vine/model/response_parser.h
comic_vine/model/response_parser.h \
comic_vine/scrapper_tableview.h \
comic_vine/sort_volume_comics.h \
comic_vine/model/local_comic_list_model.h \
comic_vine/model/volume_comics_model.h
SOURCES += \
comic_vine/comic_vine_dialog.cpp \
@ -27,4 +31,8 @@ SOURCES += \
comic_vine/model/volumes_model.cpp \
comic_vine/model/comics_model.cpp \
comic_vine/model/json_model.cpp \
comic_vine/model/response_parser.cpp
comic_vine/model/response_parser.cpp \
comic_vine/scrapper_tableview.cpp \
comic_vine/sort_volume_comics.cpp \
comic_vine/model/local_comic_list_model.cpp \
comic_vine/model/volume_comics_model.cpp

View File

@ -17,9 +17,9 @@ static const QString CV_SEARCH = CV_WEB_ADDRESS + "/search/?api_key=" + CV_API_K
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 ids for comics in a volume id %1
static const QString CV_COMIC_IDS = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY +
"&format=json&field_list=name,issue_number,id,image&filter=volume:%1&page=%1";//offset??
//gets info for comics in a volume id %1
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";//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 +
@ -64,6 +64,13 @@ void ComicVineClient::proccessSeriesDetailData(const QByteArray &data)
emit finished();
}
void ComicVineClient::processVolumeComicsInfo(const QByteArray &data)
{
QString json(data);
emit volumeComicsInfo(json);
emit finished();
}
void ComicVineClient::queryTimeOut()
{
@ -89,9 +96,13 @@ void ComicVineClient::getSeriesCover(const QString & url)
}
//CV_COMIC_IDS
void ComicVineClient::getComicIds(const QString & id, int page)
void ComicVineClient::getVolumeComicsInfo(const QString & idVolume)
{
HttpWorker * search = new HttpWorker(CV_COMICS_INFO.arg(idVolume));
connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(processVolumeComicsInfo(const QByteArray &)));
connect(search,SIGNAL(timeout()),this,SLOT(queryTimeOut())); //TODO
connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
search->get();
}
//CV_COMIC_ID

View File

@ -15,19 +15,23 @@ signals:
void searchResult(QString);
void seriesDetail(QString);//JSON
void seriesCover(const QByteArray &);
void volumeComicsInfo(QString);
void finished();
public slots:
void search(const QString & query, int page = 0);
void getSeriesDetail(const QString & id);
void getSeriesCover(const QString & url);
void getVolumeComicsInfo(const QString & idVolume);
void getComicIds(const QString & id, int page = 0);
void getComicId(const QString & id, int comicNumber);
void getComicDetail(const QString & id);
void getCoverURL(const QString & id);
protected slots:
void proccessVolumesSearchData(const QByteArray & data);
void proccessSeriesDetailData(const QByteArray & data);
void processVolumeComicsInfo(const QByteArray & data);
void queryTimeOut();
};

View File

@ -17,6 +17,7 @@
#include "search_volume.h"
#include "select_comic.h"
#include "select_volume.h"
#include "sort_volume_comics.h"
#include "response_parser.h"
@ -82,6 +83,7 @@ void ComicVineDialog::doStackedWidgets()
content->addWidget(searchVolumeWidget = new SearchVolume);
content->addWidget(selectVolumeWidget = new SelectVolume);
content->addWidget(selectComicWidget = new SelectComic);
content->addWidget(sortVolumeComicsWidget = new SortVolumeComics);
}
void ComicVineDialog::doConnections()
@ -114,7 +116,7 @@ void ComicVineDialog::goNext()
else
{
ComicDB comic = comics[currentIndex];
QString title = comic.getTitleOrPath();
QString title = comic.getTitleOrFileName();
titleHeader->setSubTitle(tr("comic %1 of %2 - %3").arg(currentIndex+1).arg(comics.length()).arg(title));
showLoading();
@ -123,8 +125,13 @@ void ComicVineDialog::goNext()
mode = SingleComicInList;
}
}
else if (content->currentWidget() == searchSingleComicWidget) {
else if (content->currentWidget() == selectVolumeWidget) {
showLoading();
ComicVineClient * comicVineClient = new ComicVineClient;
connect(comicVineClient,SIGNAL(volumeComicsInfo(QString)),this,SLOT(showSortVolumeComics(QString)));
connect(comicVineClient,SIGNAL(finished()),comicVineClient,SLOT(deleteLater()));
comicVineClient->getVolumeComicsInfo(selectVolumeWidget->getSelectedVolumeId());
}
}
@ -142,7 +149,7 @@ void ComicVineDialog::show()
if(comics.length() == 1)
{
ComicDB singleComic = comics[0];
QString title = singleComic.getTitleOrPath();
QString title = singleComic.getTitleOrFileName();
titleHeader->setSubTitle(title);
showLoading();
@ -240,6 +247,12 @@ void ComicVineDialog::showSearchVolume()
void ComicVineDialog::showSelectVolume(const QString & json)
{
content->setCurrentWidget(selectVolumeWidget);
backButton->setVisible(true);
nextButton->setVisible(true);
searchButton->setHidden(true);
closeButton->setVisible(true);
selectVolumeWidget->load(json);
}
@ -249,6 +262,12 @@ void ComicVineDialog::showSelectComic(const QString &json)
selectComicWidget->load(json);
}
void ComicVineDialog::showSortVolumeComics(const QString &json)
{
content->setCurrentWidget(sortVolumeComicsWidget);
sortVolumeComicsWidget->setData(comics, json);
}
void ComicVineDialog::showLoading()
{
content->setCurrentIndex(0);

View File

@ -17,6 +17,7 @@ class SearchSingleComic;
class SearchVolume;
class SelectComic;
class SelectVolume;
class SortVolumeComics;
//----------------------------------------
@ -46,6 +47,7 @@ protected slots:
void launchSearchComic();
void showSelectVolume(const QString & json);
void showSelectComic(const QString & json);
void showSortVolumeComics(const QString & json);
private:
enum ScrapperMode
@ -94,6 +96,7 @@ private:
SearchVolume * searchVolumeWidget;
SelectVolume * selectVolumeWidget;
SelectComic * selectComicWidget;
SortVolumeComics * sortVolumeComicsWidget;
};
#endif // COMIC_VINE_DIALOG_H

View File

@ -0,0 +1,82 @@
#include "local_comic_list_model.h"
LocalComicListModel::LocalComicListModel(QObject *parent) :
QAbstractItemModel(parent)
{
}
void LocalComicListModel::load(QList<ComicDB> &comics)
{
_data = comics;
}
QModelIndex LocalComicListModel::parent(const QModelIndex &index) const
{
Q_UNUSED(index)
return QModelIndex(); //no parent
}
int LocalComicListModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return _data.count();
}
int LocalComicListModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
if(_data.isEmpty())
return 0;
else
return 1;//_data.at(0)->count();
}
QVariant LocalComicListModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (role == Qt::DecorationRole)
{
return QVariant();
}
if (role == Qt::TextAlignmentRole)
{
//TODO
}
if(role != Qt::DisplayRole)
return QVariant();
int row = index.row();
int column = index.column();
return _data[row].getFileName();
}
Qt::ItemFlags LocalComicListModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
QVariant LocalComicListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
{
return QVariant(QString(tr("file name")));
}
return QVariant();
}
QModelIndex LocalComicListModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
return createIndex(row, column);
}

View File

@ -0,0 +1,34 @@
#ifndef LOCAL_COMIC_LIST_MODEL_H
#define LOCAL_COMIC_LIST_MODEL_H
#include <QAbstractItemModel>
#include "comic_db.h"
class LocalComicListModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit LocalComicListModel(QObject *parent = 0);
void load(QList<ComicDB> & comics);
//QAbstractItemModel methods
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
signals:
public slots:
private:
QList<ComicDB> _data;
};
#endif // LOCAL_COMIC_LIST_MODEL_H

View File

@ -0,0 +1,11 @@
#include "volume_comics_model.h"
VolumeComicsModel::VolumeComicsModel(QObject * parent) :
JSONModel(parent)
{
}
void VolumeComicsModel::load(const QString & json)
{
}

View File

@ -0,0 +1,18 @@
#ifndef VOLUME_COMICS_MODEL_H
#define VOLUME_COMICS_MODEL_H
#include "json_model.h"
class VolumeComicsModel : public JSONModel
{
Q_OBJECT
public:
explicit VolumeComicsModel(QObject *parent = 0);
void load(const QString & json);
signals:
public slots:
};
#endif // VOLUME_COMICS_MODEL_H

View File

@ -139,3 +139,8 @@ QModelIndex VolumesModel::index(int row, int column, const QModelIndex &parent)
return createIndex(row, column, _data[row]);
}
QString VolumesModel::getVolumeId(const QModelIndex &index) const
{
return _data.at(index.row())->at(ID);
}

View File

@ -22,6 +22,8 @@ public:
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QString getVolumeId(const QModelIndex & index) const;
signals:
public slots:

View File

@ -0,0 +1,59 @@
#include "scrapper_tableview.h"
#include <QHeaderView>
ScrapperTableView::ScrapperTableView(QWidget *parent) :
QTableView(parent)
{
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: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:vertical {border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE;}"
"QScrollBar:vertical { border: none; background: #2B2B2B; width: 3px; margin: 0; }"
"QScrollBar:horizontal { border: none; background: #2B2B2B; height: 3px; margin: 0; }"
"QScrollBar::handle:vertical { background: #DDDDDD; width: 7px; min-height: 20px; }"
"QScrollBar::handle:horizontal { 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::add-line:horizontal { border: none; background: #404040; width: 10px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 0 3px 0;}"
"QScrollBar::sub-line:horizontal { border: none; background: #404040; width: 10px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 0 3px 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, QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {background: none; }";
setStyleSheet(tableStylesheet);
setShowGrid(false);
#if QT_VERSION >= 0x050000
verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
#else
verticalHeader()->setResizeMode(QHeaderView::Fixed);
#endif
//comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
horizontalHeader()->setStretchLastSection(true);
#if QT_VERSION >= 0x050000
horizontalHeader()->setSectionsClickable(false);
#else
horizontalHeader()->setClickable(false);
#endif
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
verticalHeader()->setDefaultSectionSize(24);
#if QT_VERSION >= 0x050000
verticalHeader()->setSectionsClickable(false); //TODO comportamiento anómalo
#else
verticalHeader()->setClickable(false); //TODO comportamiento anómalo
#endif
setCornerButtonEnabled(false);
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAlternatingRowColors(true);
verticalHeader()->hide();
setSelectionMode(QAbstractItemView::SingleSelection);
}

View File

@ -0,0 +1,18 @@
#ifndef SCRAPPER_TABLEVIEW_H
#define SCRAPPER_TABLEVIEW_H
#include <QTableView>
class ScrapperTableView : public QTableView
{
Q_OBJECT
public:
explicit ScrapperTableView(QWidget *parent = 0);
signals:
public slots:
};
#endif // SCRAPPER_TABLEVIEW_H

View File

@ -1,14 +1,15 @@
#include "select_volume.h"
#include <QLabel>
#include <QTableView>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QScrollBar>
#include <QModelIndex>
#include <QScrollArea>
#include <QDesktopServices>
#include <QHeaderView>
#include "scrapper_tableview.h"
#include <QtScript>
@ -19,22 +20,6 @@ SelectVolume::SelectVolume(QWidget *parent)
:QWidget(parent),model(0)
{
QString labelStylesheet = "QLabel {color:white; font-size:12px;font-family:Arial;}";
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: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:vertical {border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE;}"
"QScrollBar:vertical { border: none; background: #2B2B2B; width: 3px; margin: 0; }"
"QScrollBar:horizontal { border: none; background: #2B2B2B; height: 3px; margin: 0; }"
"QScrollBar::handle:vertical { background: #DDDDDD; width: 7px; min-height: 20px; }"
"QScrollBar::handle:horizontal { 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::add-line:horizontal { border: none; background: #404040; width: 10px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 0 3px 0;}"
"QScrollBar::sub-line:horizontal { border: none; background: #404040; width: 10px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 0 3px 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, QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {background: none; }";
QLabel * label = new QLabel(tr("Please, select the right series for your comic."));
label->setStyleSheet(labelStylesheet);
@ -80,42 +65,7 @@ SelectVolume::SelectVolume(QWidget *parent)
//iScroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
//iScroll->show();
tableVolumes = new QTableView();
tableVolumes->setStyleSheet(tableStylesheet);
tableVolumes->setShowGrid(false);
#if QT_VERSION >= 0x050000
tableVolumes->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
#else
tableVolumes->verticalHeader()->setResizeMode(QHeaderView::Fixed);
#endif
//comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
tableVolumes->horizontalHeader()->setStretchLastSection(true);
#if QT_VERSION >= 0x050000
tableVolumes->horizontalHeader()->setSectionsClickable(false);
#else
tableVolumes->horizontalHeader()->setClickable(false);
#endif
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
tableVolumes->verticalHeader()->setDefaultSectionSize(24);
#if QT_VERSION >= 0x050000
tableVolumes->verticalHeader()->setSectionsClickable(false); //TODO comportamiento anómalo
#else
tableVolumes->verticalHeader()->setClickable(false); //TODO comportamiento anómalo
#endif
tableVolumes->setCornerButtonEnabled(false);
tableVolumes->setSelectionBehavior(QAbstractItemView::SelectRows);
tableVolumes->setSelectionMode(QAbstractItemView::ExtendedSelection);
tableVolumes->setAlternatingRowColors(true);
tableVolumes->verticalHeader()->hide();
tableVolumes->setSelectionMode(QAbstractItemView::SingleSelection);
tableVolumes = new ScrapperTableView();
//connections
connect(tableVolumes,SIGNAL(clicked(QModelIndex)),this,SLOT(loadVolumeInfo(QModelIndex)));
@ -221,7 +171,9 @@ void SelectVolume::setDescription(const QString & jsonDetail)
else
{
detailLabel->setAlignment(Qt::AlignTop|Qt::AlignLeft);
detailLabel->setText(sc.property("results").property("description").toString().replace("<a","<a style = 'color:#827A68; text-decoration:none;'"));
QScriptValue descriptionValues = sc.property("results").property("description");
bool valid = !descriptionValues.isNull() && descriptionValues.isValid();
detailLabel->setText(valid?descriptionValues.toString().replace("<a","<a style = 'color:#827A68; text-decoration:none;'"):tr("description unavailable"));
detailLabel->adjustSize();
}
}
@ -231,3 +183,8 @@ void SelectVolume::openLink(const QString & link)
QDesktopServices::openUrl(QUrl("http://www.comicvine.com"+link));
}
QString SelectVolume::getSelectedVolumeId()
{
return model->getVolumeId(tableVolumes->currentIndex());
}

View File

@ -4,10 +4,11 @@
#include <QWidget>
class QLabel;
class QTableView;
class VolumesModel;
class QModelIndex;
class ScrapperTableView;
class SelectVolume : public QWidget
{
Q_OBJECT
@ -20,10 +21,11 @@ public slots:
void setCover(const QByteArray &);
void setDescription(const QString & jsonDetail);
void openLink(const QString & link);
QString getSelectedVolumeId();
private:
QLabel * cover;
QLabel * detailLabel;
QTableView * tableVolumes;
ScrapperTableView * tableVolumes;
VolumesModel * model;
};

View File

@ -0,0 +1,62 @@
#include "sort_volume_comics.h"
#include <QLabel>
#include <QBoxLayout>
#include <QPushButton>
#include <QScrollBar>
#include "scrapper_tableview.h"
#include "local_comic_list_model.h"
SortVolumeComics::SortVolumeComics(QWidget *parent) :
QWidget(parent)
{
QString labelStylesheet = "QLabel {color:white; font-size:12px;font-family:Arial;}";
QLabel * label = new QLabel(tr("Please, sort the list of comics info on the right until it matches your comics."));
label->setStyleSheet(labelStylesheet);
QLabel * sortLabel = new QLabel(tr("sort comic info to match your comic files"));
moveUpButton = new QPushButton;
moveDownButton = new QPushButton;
QVBoxLayout * l = new QVBoxLayout;
QHBoxLayout * content = new QHBoxLayout;
QHBoxLayout * sortButtonsLayout = new QHBoxLayout;
tableFiles = new ScrapperTableView();
tableVolumeComics = new ScrapperTableView();
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);
connect(tableVolumeComics->verticalScrollBar(), SIGNAL(valueChanged(int)), tableFiles->verticalScrollBar(), SLOT(setValue(int)));
sortButtonsLayout->addStretch();
sortButtonsLayout->addWidget(sortLabel);
sortButtonsLayout->addWidget(moveUpButton);
sortButtonsLayout->addWidget(moveDownButton);
l->addSpacing(15);
l->addWidget(label);
l->addSpacing(5);
l->addLayout(content);
l->addLayout(sortButtonsLayout);
l->addStretch();
l->setContentsMargins(0,0,0,0);
setLayout(l);
setContentsMargins(0,0,0,0);
}
void SortVolumeComics::setData(QList<ComicDB> & comics, const QString &json)
{
//set up models
localComicsModel = new LocalComicListModel;
localComicsModel->load(comics);
tableFiles->setModel(localComicsModel);
}

View File

@ -0,0 +1,36 @@
#ifndef SORT_VOLUME_COMICS_H
#define SORT_VOLUME_COMICS_H
#include <QWidget>
#include "comic_db.h"
class ScrapperTableView;
class QPushButton;
class LocalComicListModel;
class VolumeComicsModel;
class SortVolumeComics : public QWidget
{
Q_OBJECT
public:
explicit SortVolumeComics(QWidget *parent = 0);
signals:
public slots:
void setData(QList<ComicDB> & comics, const QString & json);
private:
ScrapperTableView * tableFiles;
ScrapperTableView * tableVolumeComics;
LocalComicListModel * localComicsModel;
VolumeComicsModel * volumeComicsModel;
QPushButton * moveUpButton;
QPushButton * moveDownButton;
};
#endif // SORT_VOLUME_COMICS_H

View File

@ -108,7 +108,12 @@ QString ComicDB::toTXT()
return txt;
}
QString ComicDB::getTitleOrPath()
QString ComicDB::getFileName() const
{
return QFileInfo(path).fileName();
}
QString ComicDB::getTitleOrFileName() const
{
if(info.title && info.title->isEmpty())
return *(info.title);
@ -116,7 +121,7 @@ QString ComicDB::getTitleOrPath()
return QFileInfo(path).fileName();
}
QString ComicDB::getParentFolderName()
QString ComicDB::getParentFolderName() const
{
QStringList paths = path.split('/');
if(paths.length()<2)

View File

@ -132,11 +132,14 @@ public:
bool hasCover() {return _hasCover;};
//return comic file name
QString getFileName() const;
//returns comic title if it isn't null or empty, in other case returns fileName
QString getTitleOrPath();
QString getTitleOrFileName() const;
//returns parent folder name
QString getParentFolderName();
QString getParentFolderName() const;
QString toTXT();