Remove software and opengl flow implementations

This simplifies the code base A LOT.
This commit is contained in:
luisangelsm
2026-01-23 19:27:15 +01:00
parent 8c04235987
commit 283475bee2
46 changed files with 611 additions and 5903 deletions

View File

@ -1,16 +1,19 @@
#include "goto_flow_widget.h"
#include <QSettings>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QCoreApplication>
#include <QApplication>
#include <QSettings>
#include "goto_flow_toolbar.h"
#include "configuration.h"
GoToFlowWidget::GoToFlowWidget(QWidget *parent)
GoToFlowWidget::GoToFlowWidget(QWidget *parent, FlowType flowType)
: QWidget(parent)
{
Q_UNUSED(flowType)
mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setSpacing(0);
@ -19,19 +22,151 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent)
setLayout(mainLayout);
// toolBar->installEventFilter(this);
flow = new YACReaderPageFlow3D(this);
flow->setShowMarks(false);
imageSize = Configuration::getConfiguration().getGotoSlideSize();
flow->setSlideSize(imageSize);
connect(flow, &YACReaderPageFlow3D::centerIndexChanged, this, &GoToFlowWidget::setPageNumber);
connect(flow, &YACReaderPageFlow3D::selected, this, &GoToFlowWidget::goToPage);
connect(toolBar, &GoToFlowToolBar::goToPage, this, &GoToFlowWidget::goToPage);
connect(toolBar, &GoToFlowToolBar::setCenter, flow, &YACReaderPageFlow3D::setCenterIndex);
mainLayout->addWidget(flow);
toolBar->raise();
resize(static_cast<int>(5 * imageSize.width()), toolBar->height() + static_cast<int>(imageSize.height() * 1.7));
this->setCursor(QCursor(Qt::ArrowCursor));
}
GoToFlowWidget::~GoToFlowWidget() { }
GoToFlowWidget::~GoToFlowWidget()
{
delete flow;
}
void GoToFlowWidget::reset()
{
flow->reset();
}
void GoToFlowWidget::centerSlide(int slide)
{
if (flow->centerIndex() != slide) {
flow->setCenterIndex(slide);
}
}
void GoToFlowWidget::setPageNumber(int page)
{
toolBar->setPage(page);
}
void GoToFlowWidget::setFlowType(FlowType flowType)
{
if (flowType == CoverFlowLike)
flow->setPreset(presetYACReaderFlowClassicConfig);
else if (flowType == Strip)
flow->setPreset(presetYACReaderFlowStripeConfig);
else if (flowType == StripOverlapped)
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
else
flow->setPreset(defaultYACReaderFlowConfig);
}
void GoToFlowWidget::setNumSlides(unsigned int slides)
{
flow->populate(slides);
toolBar->setTop(slides);
}
void GoToFlowWidget::setImageReady(int index, const QByteArray &imageData)
{
flow->rawImages[index] = imageData;
flow->imagesReady[index] = true;
}
void GoToFlowWidget::updateSize()
{
if (Configuration::getConfiguration().getQuickNaviMode() && parentWidget() != nullptr)
resize(parentWidget()->width(), height());
}
void GoToFlowWidget::updateConfig(QSettings *settings)
{
toolBar->updateOptions();
Performance performance = medium;
switch (settings->value(PERFORMANCE).toInt()) {
case 0:
performance = low;
break;
case 1:
performance = medium;
break;
case 2:
performance = high;
break;
case 3:
performance = ultraHigh;
break;
}
imageSize = Configuration::getConfiguration().getGotoSlideSize();
resize(5 * imageSize.width(), toolBar->height() + imageSize.height() * 1.7);
updateSize();
flow->setPerformance(performance);
switch (settings->value(FLOW_TYPE_GL).toInt()) {
case FlowType::CoverFlowLike:
flow->setPreset(presetYACReaderFlowClassicConfig);
break;
case FlowType::Strip:
flow->setPreset(presetYACReaderFlowStripeConfig);
break;
case FlowType::StripOverlapped:
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
break;
case FlowType::Modern:
flow->setPreset(defaultYACReaderFlowConfig);
break;
case FlowType::Roulette:
flow->setPreset(pressetYACReaderFlowDownConfig);
break;
case FlowType::Custom:
flow->setCF_RX(settings->value(X_ROTATION).toInt());
flow->setCF_Y(settings->value(Y_POSITION).toInt());
flow->setX_Distance(settings->value(COVER_DISTANCE).toInt());
flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt());
flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt());
flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt());
flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt());
flow->setRotation(settings->value(COVER_ROTATION).toInt());
flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt());
flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt());
flow->setMaxAngle(settings->value(MAX_ANGLE).toInt());
break;
}
if (Configuration::getConfiguration().getQuickNaviMode())
flow->setFadeOutDist(20);
}
void GoToFlowWidget::setFlowRightToLeft(bool b)
{
flow->setFlowRightToLeft(b);
}
void GoToFlowWidget::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Up:
QApplication::sendEvent(flow, event);
return;
case Qt::Key_Return:
case Qt::Key_Enter:
toolBar->goTo();
@ -48,31 +183,10 @@ void GoToFlowWidget::keyPressEvent(QKeyEvent *event)
event->accept();
}
void GoToFlowWidget::updateConfig(QSettings *settings)
void GoToFlowWidget::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(settings)
toolBar->updateOptions();
}
QWidget::resizeEvent(event);
void GoToFlowWidget::updateSize()
{
// called by parent in resizeEvent
// no need to update width when QuickNaviMode disabled
// height is set in updateConfig
if (Configuration::getConfiguration().getQuickNaviMode() && parentWidget() != nullptr)
resize(parentWidget()->width(), height());
toolBar->move(0, event->size().height() - toolBar->height());
toolBar->setFixedWidth(width());
}
/*bool GoToFlowWidget::eventFilter(QObject * target, QEvent * event)
{
if(event->type() == QEvent::KeyPress)
{
QKeyEvent * e = static_cast<QKeyEvent *>(event);
if(e->key()==Qt::Key_S || e->key() == Qt::Key_Space)
{
this->keyPressEvent(e);
return true;
}
}
return QWidget::eventFilter(target,event);
}*/