1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(chatform): combine toggleVideoPreview implementations

This commit is contained in:
Anthony Bilinski 2020-01-25 23:34:01 -08:00
parent 89913e0f9a
commit 981ecfcaeb
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
3 changed files with 8 additions and 16 deletions

View File

@ -96,7 +96,7 @@ NetCamView::NetCamView(ToxPk friendPk, QWidget* parent)
exitFullScreenButton = createButton("exitFullScreenButton", "none");
exitFullScreenButton->setToolTip(tr("Exit full screen"));
connect(videoPreviewButton, &QPushButton::clicked, this, &NetCamView::genericToggleVideoPreview);
connect(videoPreviewButton, &QPushButton::clicked, this, &NetCamView::toggleVideoPreview);
connect(volumeButton, &QPushButton::clicked, this, &NetCamView::volMuteToggle);
connect(microphoneButton, &QPushButton::clicked, this, &NetCamView::micMuteToggle);
connect(endVideoButton, &QPushButton::clicked, this, &NetCamView::endVideoCall);
@ -217,15 +217,6 @@ void NetCamView::updateFrameSize(QSize size)
selfFrame->setMaximumHeight(selfFrame->maximumWidth() / selfVideoSurface->getRatio());
}
void NetCamView::toggleVideoPreview()
{
if (selfFrame->isHidden()) {
selfFrame->show();
} else {
selfFrame->hide();
}
}
QSize NetCamView::getSurfaceMinSize()
{
QSize surfaceSize = videoSurface->minimumSize();
@ -292,10 +283,14 @@ void NetCamView::endVideoCall()
emit videoCallEnd();
}
void NetCamView::genericToggleVideoPreview()
void NetCamView::toggleVideoPreview()
{
toggleButtonState(videoPreviewButton);
emit videoPreviewToggle();
if (selfFrame->isHidden()) {
selfFrame->show();
} else {
selfFrame->hide();
}
}
QPushButton* NetCamView::createButton(const QString& name, const QString& state)

View File

@ -49,7 +49,6 @@ public:
void setSource(VideoSource* s);
void setTitle(const QString& title);
void toggleVideoPreview();
QSize getSurfaceMinSize();
protected:
@ -63,7 +62,6 @@ signals:
void videoCallEnd();
void volMuteToggle();
void micMuteToggle();
void videoPreviewToggle();
public slots:
void setShowMessages(bool show, bool notify = false);
@ -80,7 +78,7 @@ private:
void enterFullScreen();
void exitFullScreen();
void endVideoCall();
void genericToggleVideoPreview();
void toggleVideoPreview();
void toggleButtonState(QPushButton* btn);
void updateButtonState(QPushButton* btn, bool active);
void keyPressEvent(QKeyEvent *event);

View File

@ -489,7 +489,6 @@ std::unique_ptr<NetCamView> ChatForm::createNetcam()
connect(view.get(), &NetCamView::videoCallEnd, this, &ChatForm::onVideoCallTriggered);
connect(view.get(), &NetCamView::volMuteToggle, this, &ChatForm::onVolMuteToggle);
connect(view.get(), &NetCamView::micMuteToggle, this, &ChatForm::onMicMuteToggle);
connect(view.get(), &NetCamView::videoPreviewToggle, view.get(), &NetCamView::toggleVideoPreview);
return view;
}