mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
GoTo flows: Untangle and refactor goTo signal to new syntax
This commit is contained in:
parent
a3a1e32198
commit
5dbbaad73b
@ -43,7 +43,7 @@ GoToFlow::GoToFlow(QWidget *parent, FlowType flowType)
|
||||
connect(flow, &PictureFlow::centerIndexChanged, this, &GoToFlow::preload);
|
||||
connect(flow, &PictureFlow::centerIndexChangedSilent, this, &GoToFlow::preload);
|
||||
|
||||
connect(toolBar, SIGNAL(goTo(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
|
||||
connect(toolBar, &GoToFlowToolBar::goToPage, this, &GoToFlow::goToPage);
|
||||
connect(toolBar, &GoToFlowToolBar::setCenter, flow, &PictureFlow::showSlide);
|
||||
|
||||
mainLayout->addWidget(flow);
|
||||
|
@ -63,9 +63,6 @@ public slots:
|
||||
void setFlowType(FlowType flowType) override;
|
||||
void updateConfig(QSettings *settings) override;
|
||||
void setFlowRightToLeft(bool b) override;
|
||||
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -24,7 +24,7 @@ GoToFlowGL::GoToFlowGL(QWidget *parent, FlowType flowType)
|
||||
connect(flow, &YACReaderFlowGL::centerIndexChanged, this, &GoToFlowWidget::setPageNumber);
|
||||
connect(flow, &YACReaderFlowGL::selected, this, &GoToFlowGL::goToPage);
|
||||
|
||||
connect(toolBar, SIGNAL(goTo(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
|
||||
connect(toolBar, &GoToFlowToolBar::goToPage, this, &GoToFlowGL::goToPage);
|
||||
connect(toolBar, &GoToFlowToolBar::setCenter, flow, &YACReaderFlowGL::setCenterIndex);
|
||||
|
||||
mainLayout->addWidget(flow);
|
||||
|
@ -27,9 +27,6 @@ public:
|
||||
void updateConfig(QSettings *settings);
|
||||
void setFlowRightToLeft(bool b) override;
|
||||
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
|
||||
private:
|
||||
YACReaderPageFlowGL *flow;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
@ -32,7 +32,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
|
||||
" border-radius: 1px;"
|
||||
"}");
|
||||
|
||||
connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); });
|
||||
connect(slider, &QSlider::valueChanged, this, [this](int v) { emit(setCenter(v)); });
|
||||
|
||||
pageHint = new QLabel("<b>" + tr("Page : ") + "</b>", this);
|
||||
v = new QIntValidator(this);
|
||||
@ -47,7 +47,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
|
||||
//edit->resize(QSize(54,50));
|
||||
edit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
//edit->setAutoFillBackground(false);
|
||||
connect(edit, SIGNAL(returnPressed()), this, SLOT(goTo()));
|
||||
connect(edit, &QLineEdit::returnPressed, this, &GoToFlowToolBar::goTo);
|
||||
|
||||
QString centerButtonCSS = "QPushButton {background-image: url(:/images/imgCenterSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
|
||||
"QPushButton:focus { border: none; outline: none;}"
|
||||
@ -68,7 +68,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
|
||||
goToButton->setFixedSize(32, 50);
|
||||
goToButton->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
|
||||
|
||||
connect(goToButton, SIGNAL(clicked()), this, SLOT(goTo()));
|
||||
connect(goToButton, &QPushButton::clicked, this, &GoToFlowToolBar::goTo);
|
||||
|
||||
normalLayout->setMargin(0);
|
||||
normalLayout->setSpacing(0);
|
||||
@ -110,7 +110,7 @@ void GoToFlowToolBar::setTop(int numPages)
|
||||
void GoToFlowToolBar::goTo()
|
||||
{
|
||||
if (edit->text().toInt() != 0)
|
||||
emit(goTo(edit->text().toInt() - 1));
|
||||
emit(goToPage(edit->text().toInt() - 1));
|
||||
}
|
||||
|
||||
void GoToFlowToolBar::centerSlide()
|
||||
|
@ -34,7 +34,7 @@ public slots:
|
||||
void updateOptions();
|
||||
signals:
|
||||
void setCenter(unsigned int);
|
||||
void goTo(unsigned int);
|
||||
void goToPage(unsigned int);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -31,6 +31,8 @@ public slots:
|
||||
virtual void updateSize();
|
||||
virtual void updateConfig(QSettings *settings);
|
||||
virtual void setFlowRightToLeft(bool b) = 0;
|
||||
signals:
|
||||
void goToPage(unsigned int);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
@ -158,7 +158,7 @@ void Viewer::createConnections()
|
||||
connect(goToDialog, &GoToDialog::goToPage, this, &Viewer::goTo);
|
||||
|
||||
//goToFlow goTo
|
||||
connect(goToFlow, SIGNAL(goToPage(unsigned int)), this, SLOT(goTo(unsigned int)));
|
||||
connect(goToFlow, &GoToFlowWidget::goToPage, this, &Viewer::goTo);
|
||||
|
||||
//current time
|
||||
auto t = new QTimer(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user