| 20 | #include <QVBoxLayout> |
| 21 | |
| 22 | GridComicsView::GridComicsView(QWidget *parent) |
| 23 | : ComicsView(parent), filterEnabled(false), smallZoomLabel(nullptr), bigZoomLabel(nullptr) |
| 24 | { |
| 25 | settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat, this); |
| 26 | settings->beginGroup("libraryConfig"); |
| 27 | |
| 28 | // view->setFocusPolicy(Qt::TabFocus); |
| 29 | |
| 30 | selectionHelper = new YACReaderComicsSelectionHelper(this); |
| 31 | connect(selectionHelper, &YACReaderComicsSelectionHelper::selectionChanged, this, &GridComicsView::dummyUpdater); |
| 32 | |
| 33 | comicInfoHelper = new YACReaderComicInfoHelper(this); |
| 34 | |
| 35 | QQmlContext *ctxt = view->rootContext(); |
| 36 | |
| 37 | // fonts settings (not theme-dependent) |
| 38 | int fontSize = QApplication::font().pointSize(); |
| 39 | if (fontSize == -1) |
| 40 | fontSize = QApplication::font().pixelSize(); |
| 41 | ctxt->setContextProperty("fontSize", fontSize); |
| 42 | ctxt->setContextProperty("fontFamily", QApplication::font().family()); |
| 43 | ctxt->setContextProperty("fontSpacing", 0.5); |
| 44 | |
| 45 | ctxt->setContextProperty("backgroundImage", QUrl()); |
| 46 | ctxt->setContextProperty("backgroundBlurOpacity", 0.0); |
| 47 | ctxt->setContextProperty("backgroundBlurRadius", 0.0); |
| 48 | ctxt->setContextProperty("backgroundBlurVisible", QVariant(false)); |
| 49 | |
| 50 | auto model = new ComicModel(); |
| 51 | selectionHelper->setModel(model); |
| 52 | ctxt->setContextProperty("comicsList", model); |
| 53 | ctxt->setContextProperty("comicsSelection", selectionHelper->selectionModel()); |
| 54 | ctxt->setContextProperty("contextMenuHelper", this); |
| 55 | ctxt->setContextProperty("comicsSelectionHelper", selectionHelper); |
| 56 | ctxt->setContextProperty("currentIndexHelper", this); |
| 57 | ctxt->setContextProperty("comicRatingHelper", this); |
| 58 | ctxt->setContextProperty("dummyValue", true); |
| 59 | ctxt->setContextProperty("dragManager", this); |
| 60 | ctxt->setContextProperty("dropManager", this); |
| 61 | ctxt->setContextProperty("comicOpener", this); |
| 62 | |
| 63 | bool showInfo = settings->value(COMICS_GRID_SHOW_INFO, false).toBool(); |
| 64 | ctxt->setContextProperty("showInfo", showInfo); |
| 65 | |
| 66 | auto comicDB = new ComicDB(); |
| 67 | auto comicInfo = &(comicDB->info); |
| 68 | ctxt->setContextProperty("currentComic", comicDB); |
| 69 | ctxt->setContextProperty("currentComicInfo", comicInfo); |
| 70 | ctxt->setContextProperty("showCurrentComic", QVariant(false)); |
| 71 | |
| 72 | showInfoAction = new QAction(tr("Show info"), this); |
| 73 | showInfoAction->setCheckable(true); |
| 74 | showInfoAction->setChecked(showInfo); |
| 75 | connect(showInfoAction, &QAction::toggled, this, &GridComicsView::showInfo); |
| 76 | |
| 77 | updateCoversSizeInContext(YACREADER_MIN_COVER_WIDTH, ctxt); |
| 78 | |
| 79 | // Seed theme globals before loading QML so the first binding pass does not |
nothing calls this directly
no test coverage detected