Commit 6815714a authored by Yang Wang's avatar Yang Wang Committed by Andreas Traczyk

videoview: subclass qpushbutton for video overlay

- created inherited class for QPushButton and promote buttons of
  video overlay to it
- could set custom property in qt designer
- tint effect is added when mouse hovering about these buttons

Change-Id: I2efa48825159523ec10b29498475cce71913a30c
parent 1da6ddb3
......@@ -72,7 +72,8 @@ HEADERS += ./aboutdialog.h \
./settingswidget.h \
./updatedownloaddialog.h \
./sipinputpanel.h \
./callaudioonlyavataroverlay.h
./callaudioonlyavataroverlay.h \
./overlaybutton.h
SOURCES += ./aboutdialog.cpp \
./banneditemwidget.cpp \
./conversationsfilterwidget.cpp \
......@@ -126,7 +127,8 @@ SOURCES += ./aboutdialog.cpp \
./smartlistselectorbuttonnotifier.cpp \
./videooverlay.cpp \
./sipinputpanel.cpp \
./callaudioonlyavataroverlay.cpp
./callaudioonlyavataroverlay.cpp \
./overlaybutton.cpp
FORMS += ./aboutdialog.ui \
./advancedsipsettingwidget.ui \
./callwidget.ui \
......
/**************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Yang Wang <yang.wang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "overlaybutton.h"
#include "utils.h"
#include <QEvent>
OverlayButton::OverlayButton(QWidget *parent)
: QPushButton(parent)
{
btnCallbacks_.push_back(
[this](QEvent* event) {
if (event->type() == QEvent::HoverEnter) isHovered_ = true;
return true;
});
btnCallbacks_.push_back(
[this](QEvent* event) {
if (event->type() == QEvent::HoverLeave) isHovered_ = false;
return true;
});
connect(this, SIGNAL(toggled(bool)), this, SLOT(slotOnToggle(bool)));
}
OverlayButton::~OverlayButton()
{
}
void
OverlayButton::setOriginPix(QPixmap originPixPath)
{
pathOriginal_ = originPixPath;
}
QPixmap
OverlayButton::getOriginPix() const
{
return pathOriginal_;
}
void
OverlayButton::setCheckedPix(QPixmap checkedPixPath)
{
pathChecked_ = checkedPixPath;
}
QPixmap
OverlayButton::getCheckedPix() const
{
return pathChecked_;
}
void
OverlayButton::setTintColor(QColor tint_color)
{
tintColor_ = tint_color;
}
QColor
OverlayButton::getTintColor() const
{
return tintColor_;
}
void
OverlayButton::updateIcon(QEvent* event)
{
if (!event)
return;
if (event->type() != QEvent::HoverEnter &&
event->type() != QEvent::HoverLeave) {
return;
}
setButtonIcon();
}
void
OverlayButton::setButtonIcon()
{
if (isSelected_) {
if (isHovered_) {
setIcon(tintCheckedIc_);
} else {
setIcon(checkedIc_);
}
} else {
if (isHovered_) {
setIcon(tintOriginIc_);
} else {
setIcon(originIc_);
}
}
}
bool
OverlayButton::event(QEvent* event)
{
QPushButton::event(event);
if (isFirstTime_) {
originIc_ = QPixmap(pathOriginal_);
checkedIc_ = QPixmap(pathChecked_);
tintOriginIc_ = Utils::generateTintedPixmap(originIc_, tintColor_);
tintCheckedIc_ = Utils::generateTintedPixmap(checkedIc_, tintColor_);
setIcon(originIc_);
isFirstTime_ = false;
}
bool isHandled = false;
// iterate the handlers of this class
for (auto cb : btnCallbacks_) {
isHandled = cb(event);
}
// emit the signal so that other callback can be defined outside of this class
updateIcon(event);
emit signalBtnEvent(event);
return isHandled;
}
void
OverlayButton::slotOnToggle(bool checked)
{
isSelected_ = checked;
setButtonIcon();
}
void
OverlayButton::resetToOriginal()
{
setIcon(originIc_);
}
void
OverlayButton::setOverlayButtonChecked(bool checked)
{
Utils::whileBlocking(this)->setChecked(checked);
isSelected_ = checked;
setButtonIcon();
}
/**************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Yang Wang <yang.wang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#pragma once
#include "utils.h"
#include <QColor>
#include <QImage>
#include <QPushButton>
#include <functional>
class OverlayButton : public QPushButton {
Q_OBJECT;
Q_PROPERTY(QPixmap originPix READ getOriginPix WRITE setOriginPix DESIGNABLE true NOTIFY originPixChanged);
Q_PROPERTY(QPixmap checkedPix READ getCheckedPix WRITE setCheckedPix DESIGNABLE true NOTIFY checkedPixChanged);
Q_PROPERTY(QColor tintColor READ getTintColor WRITE setTintColor DESIGNABLE true NOTIFY tintColorChanged);
public:
using EventCallback = std::function<bool(QEvent*)>;
OverlayButton(QWidget*);
virtual ~OverlayButton();
void resetToOriginal();
void setOverlayButtonChecked(bool);
public:
void setOriginPix(QPixmap);
QPixmap getOriginPix() const;
void setCheckedPix(QPixmap);
QPixmap getCheckedPix() const;
void setTintColor(QColor);
QColor getTintColor() const;
signals:
void signalBtnEvent(QEvent* event);
void originPixChanged(QString);
void checkedPixChanged(QString);
void tintColorChanged(QColor);
protected:
virtual bool event(QEvent* event);
private:
void updateIcon(QEvent* event);
void setButtonIcon();
private slots:
void slotOnToggle(bool);
private:
bool isHovered_ = false;
bool isSelected_ = false;
bool isFirstTime_ = true;
QPixmap pathOriginal_;
QPixmap pathChecked_;
QPixmap originIc_;
QPixmap tintOriginIc_;
QPixmap checkedIc_;
QPixmap tintCheckedIc_;
QColor tintColor_;
std::vector<EventCallback> btnCallbacks_;
};
/**************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Yang Wang <yang.wang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "overlaybutton.h"
#include "utils.h"
#include <QEvent>
OverlayButton::OverlayButton(QWidget *parent)
: QPushButton(parent)
{
btnCallbacks_.push_back(
[this](QEvent* event) {
if (event->type() == QEvent::HoverEnter) isHovered_ = true;
return true;
});
btnCallbacks_.push_back(
[this](QEvent* event) {
if (event->type() == QEvent::HoverLeave) isHovered_ = false;
return true;
});
connect(this, SIGNAL(toggled(bool)), this, SLOT(slotOnToggle(bool)));
}
OverlayButton::~OverlayButton()
{
}
void
OverlayButton::setOriginPix(QPixmap originPixPath)
{
pathOriginal_ = originPixPath;
}
QPixmap
OverlayButton::getOriginPix() const
{
return pathOriginal_;
}
void
OverlayButton::setCheckedPix(QPixmap checkedPixPath)
{
pathChecked_ = checkedPixPath;
}
QPixmap
OverlayButton::getCheckedPix() const
{
return pathChecked_;
}
void
OverlayButton::setTintColor(QColor tint_color)
{
tintColor_ = tint_color;
}
QColor
OverlayButton::getTintColor() const
{
return tintColor_;
}
void
OverlayButton::updateIcon(QEvent* event)
{
if (!event)
return;
if (event->type() != QEvent::HoverEnter &&
event->type() != QEvent::HoverLeave) {
return;
}
setButtonIcon();
}
void
OverlayButton::setButtonIcon()
{
if (isSelected_) {
if (isHovered_) {
setIcon(tintCheckedIc_);
} else {
setIcon(checkedIc_);
}
} else {
if (isHovered_) {
setIcon(tintOriginIc_);
} else {
setIcon(originIc_);
}
}
}
bool
OverlayButton::event(QEvent* event)
{
QPushButton::event(event);
if (isFirstTime_) {
originIc_ = QPixmap(pathOriginal_);
checkedIc_ = QPixmap(pathChecked_);
tintOriginIc_ = Utils::generateTintedPixmap(originIc_, tintColor_);
tintCheckedIc_ = Utils::generateTintedPixmap(checkedIc_, tintColor_);
setIcon(originIc_);
isFirstTime_ = false;
}
bool isHandled = false;
// iterate the handlers of this class
for (auto cb : btnCallbacks_) {
isHandled = cb(event);
}
// emit the signal so that other callback can be defined outside of this class
updateIcon(event);
emit signalBtnEvent(event);
return isHandled;
}
void
OverlayButton::slotOnToggle(bool checked)
{
isSelected_ = checked;
setButtonIcon();
}
void
OverlayButton::resetToOriginal()
{
setIcon(originIc_);
}
void
OverlayButton::setOverlayButtonChecked(bool checked)
{
Utils::whileBlocking(this)->setChecked(checked);
isSelected_ = checked;
setButtonIcon();
}
/**************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Yang Wang <yang.wang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#pragma once
#include "utils.h"
#include <QColor>
#include <QImage>
#include <QPushButton>
#include <functional>
class OverlayButton : public QPushButton {
Q_OBJECT;
Q_PROPERTY(QPixmap originPix READ getOriginPix WRITE setOriginPix DESIGNABLE true NOTIFY originPixChanged);
Q_PROPERTY(QPixmap checkedPix READ getCheckedPix WRITE setCheckedPix DESIGNABLE true NOTIFY checkedPixChanged);
Q_PROPERTY(QColor tintColor READ getTintColor WRITE setTintColor DESIGNABLE true NOTIFY tintColorChanged);
public:
using EventCallback = std::function<bool(QEvent*)>;
OverlayButton(QWidget*);
virtual ~OverlayButton();
void resetToOriginal();
void setOverlayButtonChecked(bool);
public:
void setOriginPix(QPixmap);
QPixmap getOriginPix() const;
void setCheckedPix(QPixmap);
QPixmap getCheckedPix() const;
void setTintColor(QColor);
QColor getTintColor() const;
signals:
void signalBtnEvent(QEvent* event);
void originPixChanged(QString);
void checkedPixChanged(QString);
void tintColorChanged(QColor);
protected:
virtual bool event(QEvent* event);
private:
void updateIcon(QEvent* event);
void setButtonIcon();
private slots:
void slotOnToggle(bool);
private:
bool isHovered_ = false;
bool isSelected_ = false;
bool isFirstTime_ = true;
QPixmap pathOriginal_;
QPixmap pathChecked_;
QPixmap originIc_;
QPixmap tintOriginIc_;
QPixmap checkedIc_;
QPixmap tintCheckedIc_;
QColor tintColor_;
std::vector<EventCallback> btnCallbacks_;
};
......@@ -85,5 +85,7 @@
<file>images/icons/round-add_a_photo-24px.svg</file>
<file>images/icons/ic_mic_white_24dp.png</file>
<file>images/icons/icon-keypad-24.png</file>
<file>images/icons/ic_play_white_24dp.png</file>
<file>images/icons/icon-keypad-24-2x.png</file>
</qresource>
</RCC>
</RCC>
\ No newline at end of file
......@@ -242,6 +242,7 @@ del /s /q $(OutDir)\Jami.exp</Command>
<ClCompile Include="currentaccountcombobox.cpp" />
<ClCompile Include="aboutdialog.cpp" />
<ClCompile Include="levelmeter.cpp" />
<ClCompile Include="overlaybutton.cpp" />
<ClCompile Include="sipinputpanel.cpp" />
<ClCompile Include="splashscreen.cpp" />
<ClCompile Include="updatedownloaddialog.cpp" />
......@@ -458,6 +459,10 @@ del /s /q $(OutDir)\Jami.exp</Command>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
</QtMoc>
<QtMoc Include="overlaybutton.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
</QtMoc>
<ClInclude Include="pixbufmanipulator.h" />
<QtMoc Include="ringbutton.h">
</QtMoc>
......@@ -728,7 +733,9 @@ del /s /q $(OutDir)\Jami.exp</Command>
<ResourceCompile Include="ico.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="images\icons\icon-keypad-24-2x.png" />
<Image Include="images\icons\ic_mic_white_24dp.png" />
<Image Include="images\icons\ic_play_white_24dp.png" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
......@@ -740,4 +747,4 @@ del /s /q $(OutDir)\Jami.exp</Command>
<UserProperties UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" Qt5Version_x0020_x64="$(DefaultQtVersion)" />
</VisualStudio>
</ProjectExtensions>
</Project>
</Project>
\ No newline at end of file
......@@ -225,6 +225,9 @@
<ClCompile Include="sipinputpanel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="overlaybutton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="aboutdialog.h">
......@@ -392,6 +395,9 @@
<QtMoc Include="sipinputpanel.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="overlaybutton.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
......@@ -836,5 +842,11 @@
<Image Include="images\icons\ic_mic_white_24dp.png">
<Filter>Resource Files</Filter>
</Image>
<Image Include="images\icons\ic_play_white_24dp.png">
<Filter>Resource Files</Filter>
</Image>
<Image Include="images\icons\icon-keypad-24-2x.png">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
</Project>
\ No newline at end of file
......@@ -179,7 +179,7 @@ QWidget#messageViewLayoutWidget, QWidget#welcomePage {
background-color: rgba(255, 255, 255, 255);
}
QPushButton#holdButton, QPushButton#chatButton, QPushButton#noMicButton, QPushButton#noVideoButton,
QPushButton#holdButton, QPushButton#chatButton, QPushButton#noMicButton, QPushButton#noVideoButton, QPushButton#hangupButton,
QPushButton#transferButton, QPushButton#addPersonButton, QPushButton#joinButton,
QPushButton#qualityButton, QPushButton#recButton, QPushButton#transferCallButton,
QPushButton#sipInputPanelButton {
......@@ -188,42 +188,34 @@ QPushButton#sipInputPanelButton {
border: solid 1px;
}
QPushButton#holdButton:hover, QPushButton#chatButton:hover, QPushButton#noMicButton:hover,
QPushButton#holdButton:hover, QPushButton#chatButton:hover, QPushButton#noMicButton:hover, QPushButton#hangupButton:hover,
QPushButton#noVideoButton:hover, QPushButton#transferButton:hover, QPushButton#addPersonButton:hover,
QPushButton#joinButton:hover, QPushButton#qualityButton:hover, QPushButton#addToContactButton:hover,
QPushButton#recButton:hover, QPushButton#transferCallButton:hover,
QPushButton#sipInputPanelButton:hover {
background-color: rgba(0, 192, 213, 0.6);
background-color: rgba(0, 0, 0, 140);
border-radius: 18px;
border: solid 1px;
}
QPushButton#holdButton:pressed, QPushButton#chatButton:pressed, QPushButton#noMicButton:pressed,
QPushButton#holdButton:pressed, QPushButton#chatButton:pressed, QPushButton#noMicButton:pressed, QPushButton#hangupButton:pressed,
QPushButton#noVideoButton:pressed, QPushButton#transferButton:pressed, QPushButton#addPersonButton:pressed,
QPushButton#joinButton:pressed, QPushButton#qualityButton:pressed, QPushButton#addToContactButton:pressed,
QPushButton#recButton:pressed {
background-color: rgba(0, 192, 213, 0.8);
background-color: rgba(0, 0, 0, 140);
border-radius: 18px;
border: solid 1px;
}
QPushButton#holdButton:checked, QPushButton#noMicButton:checked,
QPushButton#holdButton:checked, QPushButton#noMicButton:checked, QPushButton#hangupButton:checked,
QPushButton#noVideoButton:checked, QPushButton#recButton:checked,
QPushButton#chatButton:checked, QPushButton#transferCallButton:checked,
QPushButton#sipInputPanelButton:checked {
background-color: rgba(0, 192, 213, 0.8);
}
QPushButton#hangupButton {
background-color: rgba(0, 0, 0, 140);
border-radius: 18px;
border: solid 1px;
}
QPushButton#hangupButton:hover{
background-color: rgba(255, 0, 0, 0.6);
}
QPushButton#hangupButton:pressed{
background-color: rgba(255, 0, 0, 0.8);
}
QMessageBox QPushButton {
padding: 4px;
background: #369;
......
......@@ -683,6 +683,19 @@ Utils::generateTintedPixmap(const QString& filename, QColor color)
return QPixmap::fromImage(tmpImage);
}
QPixmap Utils::generateTintedPixmap(const QPixmap& pix, QColor color)
{
QPixmap px = pix;
QImage tmpImage = px.toImage();
for (int y = 0; y < tmpImage.height(); y++) {
for (int x = 0; x < tmpImage.width(); x++) {
color.setAlpha(tmpImage.pixelColor(x, y).alpha());
tmpImage.setPixelColor(x, y, color);
}
}
return QPixmap::fromImage(tmpImage);
}
QImage
Utils::scaleAndFrame(const QImage photo, const QSize& size)
{
......
......@@ -99,6 +99,7 @@ QImage fallbackAvatar(const QSize size, const std::string& alias, const std::str
QByteArray QImageToByteArray(QImage image);
QByteArray QByteArrayFromFile(const QString& filename);
QPixmap generateTintedPixmap(const QString& filename, QColor color);
QPixmap generateTintedPixmap(const QPixmap& pix, QColor color);
QImage scaleAndFrame(const QImage photo, const QSize& size = IMAGE_SIZE);
QImage accountPhoto(const lrc::api::account::Info& accountInfo, const QSize& size = IMAGE_SIZE);
QImage cropImage(const QImage& img);
......
......@@ -153,9 +153,10 @@ void
VideoOverlay::on_holdButton_toggled(bool checked)
{
auto callModel = LRCInstance::getCurrentCallModel();
bool onHold { false };
if (callModel->hasCall(callId_)) {
callModel->togglePause(callId_);
bool onHold = callModel->getCall(callId_).status == lrc::api::call::Status::PAUSED;
onHold = callModel->getCall(callId_).status == lrc::api::call::Status::PAUSED;
}
//emit that the hold button status changed
emit HoldStatusChanged(checked);
......@@ -221,6 +222,7 @@ VideoOverlay::on_transferCallButton_toggled(bool checked)
auto relativeClickPos = ui->transferCallButton->mapFromGlobal(event->globalPos());
if (!ui->transferCallButton->rect().contains(relativeClickPos)) {
ui->transferCallButton->setChecked(false);
ui->transferCallButton->resetToOriginal();
}
});
......@@ -228,6 +230,7 @@ VideoOverlay::on_transferCallButton_toggled(bool checked)
Utils::oneShotConnect(contactPicker_, &QDialog::rejected,
[this] {
ui->transferCallButton->setChecked(false);
ui->transferCallButton->resetToOriginal();
});
contactPicker_->show();
......@@ -273,10 +276,10 @@ VideoOverlay::resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecordin
//Set irrelevant buttons invisible
ui->noVideoButton->setVisible(!isAudioOnly);
// Block the signals of buttons
Utils::whileBlocking(ui->noMicButton)->setChecked(isAudioMuted);
Utils::whileBlocking(ui->noVideoButton)->setChecked(isVideoMuted);
Utils::whileBlocking(ui->recButton)->setChecked(isRecording);
Utils::whileBlocking(ui->holdButton)->setChecked(isHolding);
Utils::whileBlocking(ui->noMicButton)->setOverlayButtonChecked(isAudioMuted);
Utils::whileBlocking(ui->noVideoButton)->setOverlayButtonChecked(isVideoMuted);
Utils::whileBlocking(ui->recButton)->setOverlayButtonChecked(isRecording);
Utils::whileBlocking(ui->holdButton)->setOverlayButtonChecked(isHolding);
Utils::whileBlocking(ui->onHoldLabel)->setVisible(isHolding);
}
......@@ -301,6 +304,7 @@ VideoOverlay::on_sipInputPanelButton_toggled(bool checked)
auto relativeClickPos = ui->sipInputPanelButton->mapFromGlobal(event->globalPos());
if (!ui->sipInputPanelButton->rect().contains(relativeClickPos)) {
ui->sipInputPanelButton->setChecked(false);
ui->sipInputPanelButton->resetToOriginal();
}
});
......@@ -308,6 +312,7 @@ VideoOverlay::on_sipInputPanelButton_toggled(bool checked)
Utils::oneShotConnect(sipInputPanel_, &QDialog::rejected,
[this] {
ui->sipInputPanelButton->setChecked(false);
ui->sipInputPanelButton->resetToOriginal();
});
sipInputPanel_->show();
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment