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:
parent
89913e0f9a
commit
981ecfcaeb
|
@ -96,7 +96,7 @@ NetCamView::NetCamView(ToxPk friendPk, QWidget* parent)
|
||||||
exitFullScreenButton = createButton("exitFullScreenButton", "none");
|
exitFullScreenButton = createButton("exitFullScreenButton", "none");
|
||||||
exitFullScreenButton->setToolTip(tr("Exit full screen"));
|
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(volumeButton, &QPushButton::clicked, this, &NetCamView::volMuteToggle);
|
||||||
connect(microphoneButton, &QPushButton::clicked, this, &NetCamView::micMuteToggle);
|
connect(microphoneButton, &QPushButton::clicked, this, &NetCamView::micMuteToggle);
|
||||||
connect(endVideoButton, &QPushButton::clicked, this, &NetCamView::endVideoCall);
|
connect(endVideoButton, &QPushButton::clicked, this, &NetCamView::endVideoCall);
|
||||||
|
@ -217,15 +217,6 @@ void NetCamView::updateFrameSize(QSize size)
|
||||||
selfFrame->setMaximumHeight(selfFrame->maximumWidth() / selfVideoSurface->getRatio());
|
selfFrame->setMaximumHeight(selfFrame->maximumWidth() / selfVideoSurface->getRatio());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetCamView::toggleVideoPreview()
|
|
||||||
{
|
|
||||||
if (selfFrame->isHidden()) {
|
|
||||||
selfFrame->show();
|
|
||||||
} else {
|
|
||||||
selfFrame->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize NetCamView::getSurfaceMinSize()
|
QSize NetCamView::getSurfaceMinSize()
|
||||||
{
|
{
|
||||||
QSize surfaceSize = videoSurface->minimumSize();
|
QSize surfaceSize = videoSurface->minimumSize();
|
||||||
|
@ -292,10 +283,14 @@ void NetCamView::endVideoCall()
|
||||||
emit videoCallEnd();
|
emit videoCallEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetCamView::genericToggleVideoPreview()
|
void NetCamView::toggleVideoPreview()
|
||||||
{
|
{
|
||||||
toggleButtonState(videoPreviewButton);
|
toggleButtonState(videoPreviewButton);
|
||||||
emit videoPreviewToggle();
|
if (selfFrame->isHidden()) {
|
||||||
|
selfFrame->show();
|
||||||
|
} else {
|
||||||
|
selfFrame->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPushButton* NetCamView::createButton(const QString& name, const QString& state)
|
QPushButton* NetCamView::createButton(const QString& name, const QString& state)
|
||||||
|
|
|
@ -49,7 +49,6 @@ public:
|
||||||
|
|
||||||
void setSource(VideoSource* s);
|
void setSource(VideoSource* s);
|
||||||
void setTitle(const QString& title);
|
void setTitle(const QString& title);
|
||||||
void toggleVideoPreview();
|
|
||||||
QSize getSurfaceMinSize();
|
QSize getSurfaceMinSize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -63,7 +62,6 @@ signals:
|
||||||
void videoCallEnd();
|
void videoCallEnd();
|
||||||
void volMuteToggle();
|
void volMuteToggle();
|
||||||
void micMuteToggle();
|
void micMuteToggle();
|
||||||
void videoPreviewToggle();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setShowMessages(bool show, bool notify = false);
|
void setShowMessages(bool show, bool notify = false);
|
||||||
|
@ -80,7 +78,7 @@ private:
|
||||||
void enterFullScreen();
|
void enterFullScreen();
|
||||||
void exitFullScreen();
|
void exitFullScreen();
|
||||||
void endVideoCall();
|
void endVideoCall();
|
||||||
void genericToggleVideoPreview();
|
void toggleVideoPreview();
|
||||||
void toggleButtonState(QPushButton* btn);
|
void toggleButtonState(QPushButton* btn);
|
||||||
void updateButtonState(QPushButton* btn, bool active);
|
void updateButtonState(QPushButton* btn, bool active);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
|
@ -489,7 +489,6 @@ std::unique_ptr<NetCamView> ChatForm::createNetcam()
|
||||||
connect(view.get(), &NetCamView::videoCallEnd, this, &ChatForm::onVideoCallTriggered);
|
connect(view.get(), &NetCamView::videoCallEnd, this, &ChatForm::onVideoCallTriggered);
|
||||||
connect(view.get(), &NetCamView::volMuteToggle, this, &ChatForm::onVolMuteToggle);
|
connect(view.get(), &NetCamView::volMuteToggle, this, &ChatForm::onVolMuteToggle);
|
||||||
connect(view.get(), &NetCamView::micMuteToggle, this, &ChatForm::onMicMuteToggle);
|
connect(view.get(), &NetCamView::micMuteToggle, this, &ChatForm::onMicMuteToggle);
|
||||||
connect(view.get(), &NetCamView::videoPreviewToggle, view.get(), &NetCamView::toggleVideoPreview);
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user