mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added covers size slider to grid view
This commit is contained in:
parent
a0438f8bed
commit
581608b3ab
@ -337,12 +337,12 @@ void ClassicComicsView::removeItemsFromFlow(const QModelIndex &parent, int from,
|
|||||||
|
|
||||||
void ClassicComicsView::closeEvent(QCloseEvent *event)
|
void ClassicComicsView::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
|
toolbar->removeAction(toolBarStretchAction);
|
||||||
|
toolbar->removeAction(hideFlowViewAction);
|
||||||
|
|
||||||
saveTableHeadersStatus();
|
saveTableHeadersStatus();
|
||||||
saveSplitterStatus();
|
saveSplitterStatus();
|
||||||
ComicsView::closeEvent(event);
|
ComicsView::closeEvent(event);
|
||||||
|
|
||||||
toolbar->removeAction(toolBarStretchAction);
|
|
||||||
toolbar->removeAction(hideFlowViewAction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassicComicsView::setupSearchingIcon()
|
void ClassicComicsView::setupSearchingIcon()
|
||||||
|
@ -1,16 +1,37 @@
|
|||||||
#include "grid_comics_view.h"
|
#include "grid_comics_view.h"
|
||||||
|
|
||||||
#include <QtWidgets>
|
|
||||||
#include <QtQuick>
|
#include <QtQuick>
|
||||||
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include "yacreader_global.h"
|
|
||||||
#include "comic.h"
|
#include "comic.h"
|
||||||
#include "comic_files_manager.h"
|
#include "comic_files_manager.h"
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
#include "yacreader_global.h"
|
||||||
|
#include "yacreader_tool_bar_stretch.h"
|
||||||
|
|
||||||
|
//values relative to visible cells
|
||||||
|
const unsigned int YACREADER_MIN_GRID_ZOOM_WIDTH = 156;
|
||||||
|
const unsigned int YACREADER_MAX_GRID_ZOOM_WIDTH = 312;
|
||||||
|
|
||||||
|
//GridView cells
|
||||||
|
const unsigned int YACREADER_MIN_CELL_CUSTOM_HEIGHT = 295;
|
||||||
|
const unsigned int YACREADER_MIN_CELL_CUSTOM_WIDTH = 185;
|
||||||
|
|
||||||
|
//Covers
|
||||||
|
const unsigned int YACREADER_MAX_COVER_HEIGHT = 236;
|
||||||
|
const unsigned int YACREADER_MIN_COVER_WIDTH = YACREADER_MIN_GRID_ZOOM_WIDTH;
|
||||||
|
|
||||||
|
//visible cells (realCell in qml), grid cells size is used to create faux inner margings
|
||||||
|
const unsigned int YACREADER_MIN_ITEM_HEIGHT = YACREADER_MAX_COVER_HEIGHT + 51; //51 is the height of the bottom rectangle used for title and other info
|
||||||
|
const unsigned int YACREADER_MIN_ITEM_WIDTH = YACREADER_MIN_COVER_WIDTH;
|
||||||
|
|
||||||
|
|
||||||
GridComicsView::GridComicsView(QWidget *parent) :
|
GridComicsView::GridComicsView(QWidget *parent) :
|
||||||
ComicsView(parent),_selectionModel(NULL)
|
ComicsView(parent),_selectionModel(NULL)
|
||||||
{
|
{
|
||||||
|
settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini", QSettings::IniFormat, this);
|
||||||
|
settings->beginGroup("libraryConfig");
|
||||||
|
|
||||||
qmlRegisterType<ComicModel>("comicModel",1,0,"TableModel");
|
qmlRegisterType<ComicModel>("comicModel",1,0,"TableModel");
|
||||||
|
|
||||||
view = new QQuickView();
|
view = new QQuickView();
|
||||||
@ -20,60 +41,15 @@ GridComicsView::GridComicsView(QWidget *parent) :
|
|||||||
container->setFocusPolicy(Qt::TabFocus);
|
container->setFocusPolicy(Qt::TabFocus);
|
||||||
view->setSource(QUrl("qrc:/qml/GridComicsView.qml"));
|
view->setSource(QUrl("qrc:/qml/GridComicsView.qml"));
|
||||||
|
|
||||||
setShowMarks(true);//TODO save this in settings
|
createCoverSizeSliderWidget();
|
||||||
|
|
||||||
QVBoxLayout * l = new QVBoxLayout;
|
int coverSize = settings->value(COMICS_GRID_COVER_SIZES, YACREADER_MIN_COVER_WIDTH).toInt();
|
||||||
l->addWidget(container);
|
|
||||||
this->setLayout(l);
|
|
||||||
|
|
||||||
setContentsMargins(0,0,0,0);
|
coverSizeSlider->setValue(coverSize);
|
||||||
l->setContentsMargins(0,0,0,0);
|
setCoversSize(coverSize);
|
||||||
l->setSpacing(0);
|
|
||||||
|
|
||||||
QLOG_INFO() << "GridComicsView";
|
|
||||||
}
|
|
||||||
|
|
||||||
GridComicsView::~GridComicsView()
|
|
||||||
{
|
|
||||||
delete view;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridComicsView::setToolBar(QToolBar *toolBar)
|
|
||||||
{
|
|
||||||
QLOG_INFO() << "setToolBar";
|
|
||||||
static_cast<QVBoxLayout *>(this->layout())->insertWidget(1,toolBar);
|
|
||||||
this->toolbar = toolBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridComicsView::setModel(ComicModel *model)
|
|
||||||
{
|
|
||||||
QLOG_INFO() << "setModel";
|
|
||||||
|
|
||||||
QQmlContext *ctxt = view->rootContext();
|
QQmlContext *ctxt = view->rootContext();
|
||||||
|
|
||||||
//there is only one mothel in the system
|
|
||||||
ComicsView::setModel(model);
|
|
||||||
if(this->model != NULL)
|
|
||||||
{
|
|
||||||
QLOG_INFO() << "xxx";
|
|
||||||
|
|
||||||
if(_selectionModel != NULL)
|
|
||||||
delete _selectionModel;
|
|
||||||
_selectionModel = new QItemSelectionModel(this->model);
|
|
||||||
|
|
||||||
ctxt->setContextProperty("comicsList", this->model);
|
|
||||||
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);
|
|
||||||
|
|
||||||
if(model->rowCount()>0)
|
|
||||||
setCurrentIndex(model->index(0,0));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
ctxt->setContextProperty("backgroundColor", "#F5F5F5");
|
ctxt->setContextProperty("backgroundColor", "#F5F5F5");
|
||||||
ctxt->setContextProperty("cellColor", "#FFFFFF");
|
ctxt->setContextProperty("cellColor", "#FFFFFF");
|
||||||
@ -105,6 +81,90 @@ void GridComicsView::setModel(ComicModel *model)
|
|||||||
ctxt->setContextProperty("fontSpacing", 0.5);
|
ctxt->setContextProperty("fontSpacing", 0.5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
setShowMarks(true);//TODO save this in settings
|
||||||
|
|
||||||
|
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_INFO() << "GridComicsView";
|
||||||
|
}
|
||||||
|
|
||||||
|
GridComicsView::~GridComicsView()
|
||||||
|
{
|
||||||
|
delete view;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridComicsView::createCoverSizeSliderWidget()
|
||||||
|
{
|
||||||
|
toolBarStretch = new YACReaderToolBarStretch(this);
|
||||||
|
coverSizeSliderWidget = new QWidget(this);
|
||||||
|
coverSizeSliderWidget->setFixedWidth(200);
|
||||||
|
coverSizeSlider = new QSlider();
|
||||||
|
coverSizeSlider->setOrientation(Qt::Horizontal);
|
||||||
|
coverSizeSlider->setRange(YACREADER_MIN_GRID_ZOOM_WIDTH, YACREADER_MAX_GRID_ZOOM_WIDTH);
|
||||||
|
|
||||||
|
QHBoxLayout * horizontalLayout = new QHBoxLayout();
|
||||||
|
QLabel * smallLabel = new QLabel();
|
||||||
|
smallLabel->setPixmap(QPixmap(":/images/small_size_grid_zoom.png"));
|
||||||
|
horizontalLayout->addWidget(smallLabel);
|
||||||
|
horizontalLayout->addWidget(coverSizeSlider, 0, Qt::AlignVCenter);
|
||||||
|
QLabel * bigLabel = new QLabel();
|
||||||
|
bigLabel->setPixmap(QPixmap(":/images/big_size_grid_zoom.png"));
|
||||||
|
horizontalLayout->addWidget(bigLabel);
|
||||||
|
horizontalLayout->addSpacing(10);
|
||||||
|
horizontalLayout->setMargin(0);
|
||||||
|
|
||||||
|
coverSizeSliderWidget->setLayout(horizontalLayout);
|
||||||
|
//TODO add shortcuts (ctrl-+ and ctrl-- for zooming in out, + ctrl-0 for reseting the zoom)
|
||||||
|
|
||||||
|
connect(coverSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(setCoversSize(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridComicsView::setToolBar(QToolBar *toolBar)
|
||||||
|
{
|
||||||
|
QLOG_INFO() << "setToolBar";
|
||||||
|
static_cast<QVBoxLayout *>(this->layout())->insertWidget(1,toolBar);
|
||||||
|
this->toolbar = toolBar;
|
||||||
|
|
||||||
|
toolBarStretchAction = toolBar->addWidget(toolBarStretch);
|
||||||
|
coverSizeSliderAction = toolBar->addWidget(coverSizeSliderWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridComicsView::setModel(ComicModel *model)
|
||||||
|
{
|
||||||
|
QLOG_INFO() << "setModel";
|
||||||
|
|
||||||
|
QQmlContext *ctxt = view->rootContext();
|
||||||
|
|
||||||
|
//there is only one mothel in the system
|
||||||
|
ComicsView::setModel(model);
|
||||||
|
if(this->model != NULL)
|
||||||
|
{
|
||||||
|
QLOG_INFO() << "xxx";
|
||||||
|
|
||||||
|
if(_selectionModel != NULL)
|
||||||
|
delete _selectionModel;
|
||||||
|
_selectionModel = new QItemSelectionModel(this->model);
|
||||||
|
|
||||||
|
ctxt->setContextProperty("comicsList", this->model);
|
||||||
|
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);
|
||||||
|
|
||||||
|
if(model->rowCount()>0)
|
||||||
|
setCurrentIndex(model->index(0,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +245,32 @@ void GridComicsView::requestedContextMenu(const QPoint &point)
|
|||||||
emit customContextMenuViewRequested(point);
|
emit customContextMenuViewRequested(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridComicsView::setCoversSize(int width)
|
||||||
|
{
|
||||||
|
QQmlContext *ctxt = view->rootContext();
|
||||||
|
|
||||||
|
QQuickItem * grid = view->rootObject()->findChild<QQuickItem *>(QStringLiteral("grid"));
|
||||||
|
|
||||||
|
if(grid != 0)
|
||||||
|
{
|
||||||
|
QLOG_INFO() << "method invoked";
|
||||||
|
QVariant cellCustomWidth = (width * YACREADER_MIN_CELL_CUSTOM_WIDTH) / YACREADER_MIN_GRID_ZOOM_WIDTH;
|
||||||
|
QMetaObject::invokeMethod(grid, "calculateCellWidths",
|
||||||
|
Q_ARG(QVariant, cellCustomWidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
int cellBottomMarging = 8 * (1 + 2*(1 - (float(YACREADER_MAX_GRID_ZOOM_WIDTH - width) / (YACREADER_MAX_GRID_ZOOM_WIDTH - YACREADER_MIN_GRID_ZOOM_WIDTH))) );
|
||||||
|
|
||||||
|
ctxt->setContextProperty("cellCustomHeight", ((width * YACREADER_MAX_COVER_HEIGHT) / YACREADER_MIN_COVER_WIDTH) + 51 + cellBottomMarging);
|
||||||
|
ctxt->setContextProperty("cellCustomWidth", (width * YACREADER_MIN_CELL_CUSTOM_WIDTH) / YACREADER_MIN_COVER_WIDTH );
|
||||||
|
|
||||||
|
ctxt->setContextProperty("itemWidth", width);
|
||||||
|
ctxt->setContextProperty("itemHeight", ((width * YACREADER_MAX_COVER_HEIGHT) / YACREADER_MIN_COVER_WIDTH) + 51);
|
||||||
|
|
||||||
|
ctxt->setContextProperty("coverWidth", width);
|
||||||
|
ctxt->setContextProperty("coverHeight", (width * YACREADER_MAX_COVER_HEIGHT) / YACREADER_MIN_COVER_WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
QSize GridComicsView::sizeHint()
|
QSize GridComicsView::sizeHint()
|
||||||
{
|
{
|
||||||
QLOG_INFO() << "sizeHint";
|
QLOG_INFO() << "sizeHint";
|
||||||
@ -333,6 +419,9 @@ void GridComicsView::setShowMarks(bool show)
|
|||||||
|
|
||||||
void GridComicsView::closeEvent(QCloseEvent *event)
|
void GridComicsView::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
|
toolbar->removeAction(toolBarStretchAction);
|
||||||
|
toolbar->removeAction(coverSizeSliderAction);
|
||||||
|
|
||||||
QLOG_INFO() << "closeEvent";
|
QLOG_INFO() << "closeEvent";
|
||||||
QObject *object = view->rootObject();
|
QObject *object = view->rootObject();
|
||||||
QMetaObject::invokeMethod(object, "exit");
|
QMetaObject::invokeMethod(object, "exit");
|
||||||
@ -340,4 +429,7 @@ void GridComicsView::closeEvent(QCloseEvent *event)
|
|||||||
view->close();
|
view->close();
|
||||||
event->accept();
|
event->accept();
|
||||||
ComicsView::closeEvent(event);
|
ComicsView::closeEvent(event);
|
||||||
|
|
||||||
|
//save settings
|
||||||
|
settings->setValue(COMICS_GRID_COVER_SIZES, coverSizeSlider->value());
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ class QItemSelectionModel;
|
|||||||
class QQuickView;
|
class QQuickView;
|
||||||
class QQuickView;
|
class QQuickView;
|
||||||
|
|
||||||
|
class YACReaderToolBarStretch;
|
||||||
|
|
||||||
class GridComicsView : public ComicsView
|
class GridComicsView : public ComicsView
|
||||||
{
|
{
|
||||||
@ -65,14 +66,22 @@ public slots:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void requestedContextMenu(const QPoint & point);
|
void requestedContextMenu(const QPoint & point);
|
||||||
|
void setCoversSize(int width);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QSettings * settings;
|
||||||
QToolBar * toolbar;
|
QToolBar * toolbar;
|
||||||
|
YACReaderToolBarStretch * toolBarStretch;
|
||||||
|
QAction * toolBarStretchAction;
|
||||||
|
QWidget * coverSizeSliderWidget;
|
||||||
|
QSlider * coverSizeSlider;
|
||||||
|
QAction * coverSizeSliderAction;
|
||||||
QItemSelectionModel * _selectionModel;
|
QItemSelectionModel * _selectionModel;
|
||||||
QQuickView *view;
|
QQuickView *view;
|
||||||
QWidget *container;
|
QWidget *container;
|
||||||
bool dummy;
|
bool dummy;
|
||||||
void closeEvent ( QCloseEvent * event );
|
void closeEvent ( QCloseEvent * event );
|
||||||
|
void createCoverSizeSliderWidget();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
<file>../images/editComic.png</file>
|
<file>../images/editComic.png</file>
|
||||||
<file>../images/selectAll.png</file>
|
<file>../images/selectAll.png</file>
|
||||||
<file>../images/hideComicFlow.png</file>
|
<file>../images/hideComicFlow.png</file>
|
||||||
|
<file>../images/small_size_grid_zoom.png</file>
|
||||||
|
<file>../images/big_size_grid_zoom.png</file>
|
||||||
<file>../images/exportComicsInfo.png</file>
|
<file>../images/exportComicsInfo.png</file>
|
||||||
<file>../images/importComicsInfo.png</file>
|
<file>../images/importComicsInfo.png</file>
|
||||||
<file>../images/exportComicsInfoIcon.png</file>
|
<file>../images/exportComicsInfoIcon.png</file>
|
||||||
|
@ -48,7 +48,9 @@ Rectangle {
|
|||||||
dragging = false;
|
dragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 156; height: 287
|
width: itemWidth
|
||||||
|
height: itemHeight
|
||||||
|
|
||||||
color: ((dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index))?selectedColor:cellColor;
|
color: ((dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index))?selectedColor:cellColor;
|
||||||
border.color: ((dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index))?selectedBorderColor:borderColor;
|
border.color: ((dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index))?selectedBorderColor:borderColor;
|
||||||
border.width: (Qt.platform.os === "osx")?1:0;
|
border.width: (Qt.platform.os === "osx")?1:0;
|
||||||
@ -159,9 +161,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
@ -169,8 +169,8 @@ Rectangle {
|
|||||||
//cover
|
//cover
|
||||||
Image {
|
Image {
|
||||||
id: coverElement
|
id: coverElement
|
||||||
width: 156
|
width: coverWidth
|
||||||
height: 236
|
height: coverHeight
|
||||||
anchors {horizontalCenter: parent.horizontalCenter; top: realCell.top; topMargin: 0}
|
anchors {horizontalCenter: parent.horizontalCenter; top: realCell.top; topMargin: 0}
|
||||||
source: cover_path
|
source: cover_path
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
@ -183,8 +183,8 @@ Rectangle {
|
|||||||
|
|
||||||
//border
|
//border
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 156
|
width: coverElement.width
|
||||||
height: 236
|
height: coverElement.height
|
||||||
anchors {horizontalCenter: parent.horizontalCenter; top: realCell.top; topMargin: 0}
|
anchors {horizontalCenter: parent.horizontalCenter; top: realCell.top; topMargin: 0}
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
border {
|
border {
|
||||||
@ -206,8 +206,8 @@ Rectangle {
|
|||||||
//title
|
//title
|
||||||
Text {
|
Text {
|
||||||
id : titleText
|
id : titleText
|
||||||
anchors { top: realCell.top; left: realCell.left; leftMargin: 4; rightMargin: 4; topMargin: 238; }
|
anchors { top: coverElement.bottom; left: realCell.left; leftMargin: 4; rightMargin: 4; topMargin: 4; }
|
||||||
width: 148
|
width: itemWidth - 8
|
||||||
maximumLineCount: 2
|
maximumLineCount: 2
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
text: title
|
text: title
|
||||||
@ -218,6 +218,7 @@ Rectangle {
|
|||||||
font.pointSize: fontSize
|
font.pointSize: fontSize
|
||||||
font.family: fontFamily
|
font.family: fontFamily
|
||||||
}
|
}
|
||||||
|
|
||||||
//number
|
//number
|
||||||
Text {
|
Text {
|
||||||
anchors {bottom: realCell.bottom; left: realCell.left; margins: 4}
|
anchors {bottom: realCell.bottom; left: realCell.left; margins: 4}
|
||||||
@ -227,12 +228,14 @@ Rectangle {
|
|||||||
font.pointSize: fontSize
|
font.pointSize: fontSize
|
||||||
font.family: fontFamily
|
font.family: fontFamily
|
||||||
}
|
}
|
||||||
|
|
||||||
//page icon
|
//page icon
|
||||||
Image {
|
Image {
|
||||||
id: pageImage
|
id: pageImage
|
||||||
anchors {bottom: realCell.bottom; right: realCell.right; bottomMargin: 5; rightMargin: 4; leftMargin: 4}
|
anchors {bottom: realCell.bottom; right: realCell.right; bottomMargin: 5; rightMargin: 4; leftMargin: 4}
|
||||||
source: "page.png"
|
source: "page.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
//numPages
|
//numPages
|
||||||
Text {
|
Text {
|
||||||
id: pages
|
id: pages
|
||||||
@ -243,6 +246,7 @@ Rectangle {
|
|||||||
font.pointSize: fontSize
|
font.pointSize: fontSize
|
||||||
font.family: fontFamily
|
font.family: fontFamily
|
||||||
}
|
}
|
||||||
|
|
||||||
//rating icon
|
//rating icon
|
||||||
Image {
|
Image {
|
||||||
id: ratingImage
|
id: ratingImage
|
||||||
@ -282,7 +286,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YACReaderScrollView{
|
Rectangle{
|
||||||
id: scrollView
|
id: scrollView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 0
|
anchors.margins: 0
|
||||||
@ -335,13 +339,13 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
id:grid
|
id:grid
|
||||||
|
objectName: "grid"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cellHeight: 295
|
cellHeight: cellCustomHeight
|
||||||
highlight: appHighlight
|
highlight: appHighlight
|
||||||
focus: true
|
focus: true
|
||||||
model: comicsList
|
model: comicsList
|
||||||
@ -388,20 +392,23 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function numCellsPerRow() {
|
function numCellsPerRow() {
|
||||||
return Math.floor(width / 185);
|
return Math.floor(width / cellCustomWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
var numCells = numCellsPerRow();
|
calculateCellWidths(cellCustomWidth);
|
||||||
var rest = width % 185;
|
}
|
||||||
|
|
||||||
if(numCells > 0)
|
function calculateCellWidths(cWidth) {
|
||||||
{
|
|
||||||
cellWidth = Math.floor(width / numCells) ;
|
var wholeCells = Math.floor(width / cWidth);
|
||||||
//console.log("numCells=",numCells,"rest=",rest,"cellWidth=",cellWidth,"width=",width);
|
var rest = width - (cWidth * wholeCells)
|
||||||
}
|
|
||||||
|
grid.cellWidth = cWidth + Math.floor(rest / wholeCells);
|
||||||
|
console.log("cWidth",cWidth,"wholeCells=",wholeCells,"rest=",rest,"cellWidth=",cellWidth,"width=",width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
focus: true
|
focus: true
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
if (event.modifiers & Qt.ControlModifier || event.modifiers & Qt.ShiftModifier)
|
if (event.modifiers & Qt.ControlModifier || event.modifiers & Qt.ShiftModifier)
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#define COMICS_VIEW_STATUS "COMICS_VIEW_STATUS"
|
#define COMICS_VIEW_STATUS "COMICS_VIEW_STATUS"
|
||||||
#define COMICS_VIEW_FLOW_SPLITTER_STATUS "COMICS_VIEW_FLOW_SPLITTER_STATUS"
|
#define COMICS_VIEW_FLOW_SPLITTER_STATUS "COMICS_VIEW_FLOW_SPLITTER_STATUS"
|
||||||
#define SIDEBAR_SPLITTER_STATUS "SIDEBAR_SPLITTER_STATUS"
|
#define SIDEBAR_SPLITTER_STATUS "SIDEBAR_SPLITTER_STATUS"
|
||||||
|
#define COMICS_GRID_COVER_SIZES "COMICS_GRID_COVER_SIZES"
|
||||||
|
|
||||||
#define NUM_DAYS_BETWEEN_VERSION_CHECKS "NUM_DAYS_BETWEEN_VERSION_CHECKS"
|
#define NUM_DAYS_BETWEEN_VERSION_CHECKS "NUM_DAYS_BETWEEN_VERSION_CHECKS"
|
||||||
#define LAST_VERSION_CHECK "LAST_VERSION_CHECK"
|
#define LAST_VERSION_CHECK "LAST_VERSION_CHECK"
|
||||||
|
BIN
images/big_size_grid_zoom.png
Normal file
BIN
images/big_size_grid_zoom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 166 B |
BIN
images/small_size_grid_zoom.png
Normal file
BIN
images/small_size_grid_zoom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 165 B |
Loading…
x
Reference in New Issue
Block a user