Added new info comcis view skeleton + setting the comics model. So far it can loads the list of covers from the model. FlowView.qml will be a FlowGL replacement that will be the default in the ANGLE version and an option in the main version.

This commit is contained in:
Luis Ángel San Martín
2016-03-28 11:40:17 +02:00
parent 56e7737931
commit 81c785f787
8 changed files with 309 additions and 2 deletions

View File

@ -1,9 +1,32 @@
#include "info_comics_view.h"
#include <QtQuick>
#include "comic_model.h"
#include "QsLog.h"
InfoComicsView::InfoComicsView(QWidget *parent)
:ComicsView(parent)
{
int FIXME;
qmlRegisterType<ComicModel>("com.yacreader.ComicModel",1,0,"ComicModel");
view = new QQuickView();
container = QWidget::createWindowContainer(view, this);
container->setFocusPolicy(Qt::StrongFocus);
view->setSource(QUrl("qrc:/qml/InfoComicsView.qml"));
QVBoxLayout * l = new QVBoxLayout;
l->addWidget(container);
this->setLayout(l);
setContentsMargins(0,0,0,0);
l->setContentsMargins(0,0,0,0);
l->setSpacing(0);
QLOG_TRACE() << "GridComicsView";
}
void InfoComicsView::setToolBar(QToolBar *toolBar)
@ -15,7 +38,36 @@ void InfoComicsView::setToolBar(QToolBar *toolBar)
void InfoComicsView::setModel(ComicModel *model)
{
int FIXME;
if(model == NULL)
return;
ComicsView::setModel(model);
QQmlContext *ctxt = view->rootContext();
/*if(_selectionModel != NULL)
delete _selectionModel;
_selectionModel = new QItemSelectionModel(model);*/
//TODO fix crash in the following line on comics views switch
int row = currentIndex().row();
ctxt->setContextProperty("comicsList", model);
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(0, 0), ComicModel::CoverPathRole));
/*ctxt->setContextProperty("comicsSelection", _selectionModel);
ctxt->setContextProperty("contextMenuHelper",this);
ctxt->setContextProperty("comicsSelectionHelper", this);
ctxt->setContextProperty("comicRatingHelper", this);
ctxt->setContextProperty("dummyValue", true);
ctxt->setContextProperty("dragManager", this);
ctxt->setContextProperty("dropManager", this);
updateBackgroundConfig();*/
if(model->rowCount()>0)
setCurrentIndex(model->index(0,0));
}
void InfoComicsView::setCurrentIndex(const QModelIndex &index)