MCPcopy Create free account
hub / github.com/YACReader/yacreader / FolderContentView

Method FolderContentView

YACReaderLibrary/folder_content_view.cpp:21–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19using namespace YACReader;
20
21FolderContentView::FolderContentView(QAction *toogleRecentVisibilityAction, QWidget *parent)
22 : QWidget { parent }, parent(QModelIndex()), comicModel(new ComicModel()), folderModel(new FolderModel()), smallZoomLabel(nullptr), bigZoomLabel(nullptr)
23{
24 qmlRegisterType<FolderModel>("com.yacreader.FolderModel", 1, 0, "FolderModel");
25
26 settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat, this);
27 settings->beginGroup("libraryConfig");
28
29 view = new QQuickWidget();
30
31 view->setResizeMode(QQuickWidget::SizeRootObjectToView);
32 connect(
33 view, &QQuickWidget::statusChanged, this,
34 [=](QQuickWidget::Status status) {
35 if (status == QQuickWidget::Error) {
36 QLOG_ERROR() << view->errors();
37 }
38 });
39
40 coverSizeSliderWidget = new QWidget(this);
41 coverSizeSliderWidget->setFixedWidth(200);
42 coverSizeSlider = new QSlider(coverSizeSliderWidget);
43 coverSizeSlider->setOrientation(Qt::Horizontal);
44 coverSizeSlider->setRange(YACREADER_MIN_GRID_ZOOM_WIDTH, YACREADER_MAX_GRID_ZOOM_WIDTH);
45
46 const auto &comicsToolbar = theme.comicsViewToolbar;
47
48 auto horizontalLayout = new QHBoxLayout();
49 smallZoomLabel = new QLabel();
50 smallZoomLabel->setPixmap(comicsToolbar.smallGridZoomIcon.pixmap(18, 18));
51 horizontalLayout->addWidget(smallZoomLabel);
52 horizontalLayout->addWidget(coverSizeSlider, 0, Qt::AlignVCenter);
53 bigZoomLabel = new QLabel();
54 bigZoomLabel->setPixmap(comicsToolbar.bigGridZoomIcon.pixmap(18, 18));
55 horizontalLayout->addWidget(bigZoomLabel);
56 horizontalLayout->addSpacing(10);
57 horizontalLayout->setContentsMargins(0, 0, 0, 0);
58
59 coverSizeSliderWidget->setLayout(horizontalLayout);
60
61 connect(coverSizeSlider, &QAbstractSlider::valueChanged, this, &FolderContentView::setCoversSize);
62
63 toolbar = new QToolBar();
64 toolbar->setIconSize(QSize(18, 18));
65 toolbar->addWidget(new YACReaderToolBarStretch);
66 toolbar->addAction(toogleRecentVisibilityAction);
67 toolbar->addSeparator();
68 toolbar->addWidget(coverSizeSliderWidget);
69
70 auto l = new QVBoxLayout;
71 setContentsMargins(0, 0, 0, 0);
72 l->setContentsMargins(0, 0, 0, 0);
73 l->setSpacing(0);
74 l->addWidget(view);
75 l->addWidget(toolbar);
76 this->setLayout(l);
77
78 QQmlContext *ctxt = view->rootContext();

Callers

nothing calls this directly

Calls 7

setRangeMethod · 0.80
setPixmapMethod · 0.80
pixmapMethod · 0.80
addSpacingMethod · 0.80
addActionMethod · 0.80
QModelIndexClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected