mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
150 lines
3.3 KiB
C++
150 lines
3.3 KiB
C++
#include "info_comics_view.h"
|
|
|
|
#include <QtQuick>
|
|
|
|
#include "comic_model.h"
|
|
#include "comic_db.h"
|
|
|
|
#include "QsLog.h"
|
|
|
|
InfoComicsView::InfoComicsView(QWidget *parent)
|
|
:ComicsView(parent)
|
|
{
|
|
qmlRegisterType<ComicModel>("com.yacreader.ComicModel",1,0,"ComicModel");
|
|
qmlRegisterType<ComicInfo>("com.yacreader.ComicInfo",1,0,"ComicInfo");
|
|
|
|
view = new QQuickView();
|
|
container = QWidget::createWindowContainer(view, this);
|
|
|
|
container->setFocusPolicy(Qt::StrongFocus);
|
|
|
|
view->setSource(QUrl("qrc:/qml/InfoComicsView.qml"));
|
|
|
|
|
|
QObject *rootObject = dynamic_cast<QObject*>(view->rootObject());
|
|
flow = rootObject->findChild<QObject*>("flow");
|
|
list = rootObject->findChild<QObject*>("list");
|
|
|
|
connect(flow, SIGNAL(currentCoverChanged(int)), this, SLOT(updateInfoForIndex(int)));
|
|
|
|
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)
|
|
{
|
|
toolBar->setParent(this);
|
|
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::setModel(ComicModel *model)
|
|
{
|
|
BOOL setModel = model != this->model;
|
|
|
|
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();
|
|
|
|
if(setModel)
|
|
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)
|
|
{
|
|
QQmlProperty(list, "currentIndex").write(index.row());
|
|
}
|
|
|
|
|
|
void InfoComicsView::updateInfoForIndex(int index)
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
QModelIndex InfoComicsView::currentIndex()
|
|
{
|
|
int FIXME;
|
|
|
|
return QModelIndex();
|
|
}
|
|
|
|
QItemSelectionModel *InfoComicsView::selectionModel()
|
|
{
|
|
int FIXME;
|
|
|
|
return 0;
|
|
}
|
|
|
|
void InfoComicsView::scrollTo(const QModelIndex &mi, QAbstractItemView::ScrollHint hint)
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::toFullScreen()
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::toNormal()
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::updateConfig(QSettings *settings)
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::enableFilterMode(bool enabled)
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::selectIndex(int index)
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::setShowMarks(bool show)
|
|
{
|
|
int FIXME;
|
|
}
|
|
|
|
void InfoComicsView::selectAll()
|
|
{
|
|
int FIXME;
|
|
}
|