Commit 8d8f41a0 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Sébastien Blin
Browse files

popupwidget: memory optimization for qmlPopUpWidget and popUpWidget

Change-Id: Ie0bd666eb5e05ccc21bd1cbcfa59952b8d0a2989
parent ae95e721
......@@ -50,9 +50,10 @@ void
AboutDialog::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
auto cp = getContainer()->parentWidget();
if (auto mainWindow = qobject_cast<MainWindow*>(cp)) {
mainWindow->darken();
if (auto cp = getContainer().toStrongRef()) {
if (auto mainWindow = qobject_cast<MainWindow*>(cp->parentWidget())) {
mainWindow->darken();
}
}
}
......@@ -60,9 +61,10 @@ void
AboutDialog::hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
auto cp = getContainer()->parentWidget();
if (auto mainWindow = qobject_cast<MainWindow*>(cp)) {
mainWindow->lighten();
if (auto cp = getContainer().toStrongRef()) {
if (auto mainWindow = qobject_cast<MainWindow*>(cp->parentWidget())) {
mainWindow->lighten();
}
}
}
......@@ -77,7 +79,9 @@ AboutDialog::on_changelogButton_clicked()
void
AboutDialog::on_closeAboutDialogButton_clicked()
{
getContainer()->accept();
if (auto cp = getContainer().toStrongRef()) {
cp->accept();
}
}
void
......
......@@ -227,8 +227,8 @@ CallWidget::CallWidget(QWidget* parent) :
connect(ui->changelogButton, &QAbstractButton::clicked,
[this] {
auto aboutDialog = std::make_unique<AboutDialog>(&MainWindow::instance());
aboutDialog->getContainer()->exec();
AboutDialog aboutDialog (&MainWindow::instance());
aboutDialog.getContainer().toStrongRef()->exec();
});
// set first view to welcome view
......@@ -422,7 +422,7 @@ CallWidget::setupSmartListContextMenu(const QPoint& pos)
connect(profileShowingAction, &QAction::triggered,
[conversation, this]() {
UserProfile userProfile(conversation, qobject_cast<MainWindow*>(this->parent()->parent()->parent()));
userProfile.getContainer()->exec();
userProfile.getContainer().toStrongRef()->exec();
});
}
smartListModel_->isContextMenuOpen = true;
......@@ -1599,13 +1599,13 @@ CallWidget::registerShortCuts()
connect(shortcutsTableSC, &QShortcut::activated,
[this] {
QUrl qmlSource{ QStringLiteral("qrc:/src/KeyBoardShortcutTable.qml") };
QmlPopupWidget* qmlKeyboardShortcuts = new QmlPopupWidget(qmlSource, qobject_cast<MainWindow*>(parent()->parent()->parent()));
qmlKeyboardShortcuts->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
qmlKeyboardShortcuts->setAttribute(Qt::WA_AlwaysStackOnTop);
qmlKeyboardShortcuts->setClearColor(Qt::transparent);
qmlKeyboardShortcuts->setMinimumWidth(qmlKeyboardShortcuts->rootObject()->property("minWidth").toInt());
qmlKeyboardShortcuts->setMinimumHeight(qmlKeyboardShortcuts->rootObject()->property("minHeight").toInt());
qmlKeyboardShortcuts->getContainer()->exec();
QmlPopupWidget qmlKeyboardShortcuts(qmlSource, qobject_cast<MainWindow*>(parent()->parent()->parent()));
qmlKeyboardShortcuts.setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
qmlKeyboardShortcuts.setAttribute(Qt::WA_AlwaysStackOnTop);
qmlKeyboardShortcuts.setClearColor(Qt::transparent);
qmlKeyboardShortcuts.setMinimumWidth(qmlKeyboardShortcuts.rootObject()->property("minWidth").toInt());
qmlKeyboardShortcuts.setMinimumHeight(qmlKeyboardShortcuts.rootObject()->property("minHeight").toInt());
qmlKeyboardShortcuts.getContainer().toStrongRef()->exec();
});
connect(navigateToMediaSettingsSC, &QShortcut::activated,
......
......@@ -242,7 +242,7 @@ bool MainWindow::nativeEvent(const QByteArray& eventType, void* message, long* r
if (msg->wParam == IDM_ABOUTBOX) {
*result = 0;
AboutDialog aboutDialog(this);
aboutDialog.getContainer()->exec();
aboutDialog.getContainer().toStrongRef()->exec();
return true;
}
if (msg->wParam == IDM_SHORTCUTSBOX) {
......@@ -445,13 +445,13 @@ void MainWindow::slotAccountListChanged()
void
MainWindow::generateQmlDialog(const QUrl& qmlSource)
{
QScopedPointer<QmlPopupWidget> qmlKeyboardShortcuts (new QmlPopupWidget(qmlSource, this));
QmlPopupWidget qmlKeyboardShortcuts(qmlSource, this);
qmlKeyboardShortcuts->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
qmlKeyboardShortcuts->setAttribute(Qt::WA_AlwaysStackOnTop);
qmlKeyboardShortcuts->setClearColor(Qt::transparent);
qmlKeyboardShortcuts->setMinimumWidth(qmlKeyboardShortcuts->rootObject()->property("minWidth").toInt());
qmlKeyboardShortcuts->setMinimumHeight(qmlKeyboardShortcuts->rootObject()->property("minHeight").toInt());
qmlKeyboardShortcuts.setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
qmlKeyboardShortcuts.setAttribute(Qt::WA_AlwaysStackOnTop);
qmlKeyboardShortcuts.setClearColor(Qt::transparent);
qmlKeyboardShortcuts.setMinimumWidth(qmlKeyboardShortcuts.rootObject()->property("minWidth").toInt());
qmlKeyboardShortcuts.setMinimumHeight(qmlKeyboardShortcuts.rootObject()->property("minHeight").toInt());
qmlKeyboardShortcuts->getContainer()->exec();
qmlKeyboardShortcuts.getContainer().toStrongRef()->exec();
}
\ No newline at end of file
......@@ -129,9 +129,6 @@ MessageWebView::MessageWebView(QWidget *parent)
fullScreenWebWidget_.reset();
}
});
recordWidget_ = new RecordWidget(this);
recordWidget_->getContainer()->hide();
}
MessageWebView::~MessageWebView()
......@@ -280,10 +277,13 @@ MessageWebView::openAudioRecorder(int spikePosX, int spikePosY)
}
// spikePosX, spikePosY are positions relative to Document
auto pointOfAudioButton = mapToGlobal(QPoint(spikePosX, spikePosY));
recordWidget_->getContainer()->move(
pointOfAudioButton.x() - recordWidget_->width() / 2,
pointOfAudioButton.y() - recordWidget_->height() - recordWidgetMargin_);
recordWidget_->openRecorder(true);
RecordWidget recordWidget(this);
if (auto container = recordWidget.getContainer().toStrongRef()) {
container->move(pointOfAudioButton.x() - recordWidget.width() / 2,
pointOfAudioButton.y() - recordWidget.height() - recordWidgetMargin_);
}
recordWidget.openRecorder(true);
}
void
......@@ -296,10 +296,13 @@ MessageWebView::openVideoRecorder(int spikePosX, int spikePosY)
}
// spikePosX, spikePosY are positions relative to Document
auto pointOfVideoButton = mapToGlobal(QPoint(spikePosX, spikePosY));
recordWidget_->getContainer()->move(
pointOfVideoButton.x() - recordWidget_->width() / 2,
pointOfVideoButton.y() - recordWidget_->height() - recordWidgetMargin_);
recordWidget_->openRecorder(false);
RecordWidget recordWidget(this);
if (auto container = recordWidget.getContainer().toStrongRef()) {
container->move(pointOfVideoButton.x() - recordWidget.width() / 2,
pointOfVideoButton.y() - recordWidget.height() - recordWidgetMargin_);
}
recordWidget.openRecorder(false);
}
void
......
......@@ -136,7 +136,6 @@ private:
PrivateBridging* jsBridge_;
QLabel* dragDroplabel_;
bool textSelected_;
RecordWidget* recordWidget_;
/*TODO: Generatic Popup Dialog setGeometry function corrsponding to spike alignment*/
const quint16 recordWidgetMargin_{ 15 };
......
......@@ -26,18 +26,21 @@
PreviewWidget::PreviewWidget(QWidget * parent)
: VideoWidgetBase(Qt::transparent, parent)
{
connect(LRCInstance::renderer(), &RenderManager::previewFrameUpdated,
previewFrameUpdatedConnection_ = connect(LRCInstance::renderer(), &RenderManager::previewFrameUpdated,
[this]() {
repaint();
});
connect(LRCInstance::renderer(), &RenderManager::previewRenderingStopped,
previewRenderingStopped_ = connect(LRCInstance::renderer(), &RenderManager::previewRenderingStopped,
[this]() {
repaint();
});
}
PreviewWidget::~PreviewWidget()
{}
{
disconnect(previewFrameUpdatedConnection_);
disconnect(previewRenderingStopped_);
}
void
PreviewWidget::paintBackground(QPainter* painter)
......
......@@ -37,6 +37,10 @@ protected:
virtual void paintEvent(QPaintEvent* e) override;
virtual void paintBackground(QPainter* painter) override;
private:
QMetaObject::Connection previewFrameUpdatedConnection_;
QMetaObject::Connection previewRenderingStopped_;
};
// A rounded image for photobooths
......
......@@ -207,7 +207,9 @@ RecordOverlay::on_recordOverlaySendBtn_pressed()
if(recordWidget_->sendRecording()) {
setRecorderState(RecorderState::aboutToRecord);
// define what to do when the record is sent out
recordWidget_->getContainer()->accept();
if (auto container = recordWidget_->getContainer().toStrongRef()) {
container->accept();
}
}
}
......
......@@ -16,6 +16,7 @@
* 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 "recordwidget.h"
#include "ui_recordwidget.h"
......@@ -30,13 +31,19 @@ RecordWidget::RecordWidget(QWidget *parent) :
ui(new Ui::RecordWidget)
{
ui->setupUi(this);
recordOverlay_ = new RecordOverlay(this);
previewWidget_ = new VideoRecordPreviewWidget(this);
recordOverlay_ = QSharedPointer<RecordOverlay>(new RecordOverlay(this));
previewWidget_ = QSharedPointer<VideoRecordPreviewWidget>(new VideoRecordPreviewWidget(this));
recordOverlay_->setDrawRoundedCorner(true);
}
RecordWidget::~RecordWidget()
{}
{
LRCInstance::avModel().stopLocalRecorder(recordedFilePath_.toStdString());
Utils::forceDeleteAsync(recordedFilePath_);
if (!isAudio_) {
LRCInstance::avModel().stopPreview();
}
}
bool
RecordWidget::startRecording()
......@@ -118,7 +125,7 @@ RecordWidget::openRecorder(bool isAudio)
if(!isAudio_) {
LRCInstance::avModel().startPreview();
}
widgetContainer_->show();
widgetContainer_->exec();
}
bool
......@@ -133,18 +140,5 @@ void RecordWidget::resizeEvent(QResizeEvent* event)
recordOverlay_->resize(this->size());
previewWidget_->resize(this->size());
previewWidget_->stackUnder(recordOverlay_);
}
void
RecordWidget::hideEvent(QHideEvent* event)
{
Q_UNUSED(event);
LRCInstance::avModel().stopLocalRecorder(recordedFilePath_.toStdString());
Utils::forceDeleteAsync(recordedFilePath_);
if(!isAudio_) {
LRCInstance::avModel().stopPreview();
previewWidget_->toPaintingBackground(true);
previewWidget_->toDrawLastFrame(false);
}
previewWidget_->stackUnder(recordOverlay_.data());
}
......@@ -48,13 +48,12 @@ public:
protected:
void resizeEvent(QResizeEvent* event) override;
void hideEvent(QHideEvent* event) override;
private:
Ui::RecordWidget* ui;
VideoRecordPreviewWidget* previewWidget_;
RecordOverlay* recordOverlay_;
QSharedPointer<VideoRecordPreviewWidget> previewWidget_;
QSharedPointer<RecordOverlay> recordOverlay_;
bool isAudio_ = true;
QString recordedFilePath_;
......
......@@ -33,8 +33,6 @@ VideoOverlay::VideoOverlay(QWidget* parent)
: FadeOutable(parent)
, ui(new Ui::VideoOverlay)
, oneSecondTimer_(new QTimer(this))
, contactPicker_(new ContactPicker(this))
, sipInputPanel_(new SIPInputPanelWidget(this))
{
ui->setupUi(this);
......@@ -50,19 +48,6 @@ VideoOverlay::VideoOverlay(QWidget* parent)
ui->addToConferenceButton->setVisible(true);
ui->addToConferenceButton->setCheckable(true);
contactPicker_->getContainer()->setVisible(false);
sipInputPanel_->getContainer()->setVisible(false);
connect(contactPicker_, &ContactPicker::contactWillJoinConference,
this, &VideoOverlay::slotContactWillJoinConference);
connect(contactPicker_, &ContactPicker::callWillJoinConference,
this, &VideoOverlay::slotCallWillJoinConference);
connect(contactPicker_, &ContactPicker::contactWillDoTransfer,
this, &VideoOverlay::slotWillDoTransfer);
connect(sipInputPanel_, &SIPInputPanelWidget::sipInputPanelClicked,
this, &VideoOverlay::slotSIPInputPanelClicked);
ui->holdButton->setVisible(false);
}
......@@ -99,7 +84,7 @@ VideoOverlay::updateCall(const conversation::Info& convInfo)
auto bestName = QString::fromStdString(
Utils::bestNameForConversation(convInfo, *convModel));
contactPicker_->setCurrentCalleeDisplayName(bestName);
currentBestCalleeDisplayName_ = bestName;
ui->nameLabel->setText(bestName);
bool isPaused = call->status == lrc::api::call::Status::PAUSED;
......@@ -153,8 +138,7 @@ VideoOverlay::shouldFadeOut()
bool hoveringOnButtons = ui->bottomButtons->underMouse() || ui->topInfoBar->underMouse();
return not (hoveringOnButtons ||
(callInfo.status == lrc::api::call::Status::PAUSED) ||
contactPicker_->getContainer()->isActiveWindow() ||
sipInputPanel_->getContainer()->isActiveWindow());
popUpShown_);
}
void
......@@ -275,36 +259,7 @@ VideoOverlay::on_addToConferenceButton_toggled(bool checked)
return;
}
contactPicker_->setType(SmartListModel::Type::CONFERENCE);
contactPicker_->setTitle(QObject::tr("Add to conference"));
QPoint globalPos_button = mapToGlobal(ui->addToConferenceButton->pos());
QPoint globalPos_bottomButtons = mapToGlobal(ui->bottomButtons->pos());
contactPicker_->getContainer()->move(globalPos_button.x(),
globalPos_bottomButtons.y() - contactPicker_->height() - popupMargin_);
// receive the signal that ensure the button checked status is correct and contactpicker
// is properly hidden
Utils::oneShotConnect(contactPicker_->getContainer(), &PopupDialog::willClose,
[this](QMouseEvent* event) {
contactPicker_->getContainer()->hide();
// check if current mouse position is on button
auto relativeClickPos = ui->addToConferenceButton->mapFromGlobal(event->globalPos());
if (!ui->addToConferenceButton->rect().contains(relativeClickPos)) {
ui->addToConferenceButton->setChecked(false);
ui->addToConferenceButton->resetToOriginal();
}
});
// for esc key, receive reject signal
Utils::oneShotConnect(contactPicker_->getContainer(), &QDialog::rejected,
[this] {
ui->addToConferenceButton->setChecked(false);
ui->addToConferenceButton->resetToOriginal();
});
contactPicker_->getContainer()->show();
contactPickerPopup(SmartListModel::Type::CONFERENCE, ui->addToConferenceButton);
}
void
......@@ -316,43 +271,15 @@ VideoOverlay::on_transferCallButton_toggled(bool checked)
!checked) {
return;
}
contactPicker_->setType(SmartListModel::Type::TRANSFER);
contactPicker_->setTitle(QObject::tr("Select peer to transfer to"));
QPoint globalPos_button = mapToGlobal(ui->transferCallButton->pos());
QPoint globalPos_bottomButtons = mapToGlobal(ui->bottomButtons->pos());
contactPicker_->getContainer()->move(globalPos_button.x(),
globalPos_bottomButtons.y() - contactPicker_->height() - popupMargin_);
// receive the signal that ensure the button checked status is correct and contactpicker
// is properly hidden
Utils::oneShotConnect(contactPicker_->getContainer(), &PopupDialog::willClose,
[this](QMouseEvent *event) {
contactPicker_->getContainer()->hide();
// check if current mouse position is on button
auto relativeClickPos = ui->transferCallButton->mapFromGlobal(event->globalPos());
if (!ui->transferCallButton->rect().contains(relativeClickPos)) {
ui->transferCallButton->setChecked(false);
ui->transferCallButton->resetToOriginal();
}
});
// for esc key, receive reject signal
Utils::oneShotConnect(contactPicker_->getContainer(), &QDialog::rejected,
[this] {
ui->transferCallButton->setChecked(false);
ui->transferCallButton->resetToOriginal();
});
contactPicker_->getContainer()->show();
contactPickerPopup(SmartListModel::Type::TRANSFER, ui->transferCallButton);
}
void
VideoOverlay::slotWillDoTransfer(const std::string& contactUri)
{
auto callModel = LRCInstance::getCurrentCallModel();
contactPicker_->getContainer()->hide();
ui->transferCallButton->setChecked(false);
ui->transferCallButton->resetToOriginal();
......@@ -388,7 +315,7 @@ void
VideoOverlay::slotContactWillJoinConference(const std::string& contactUri)
{
auto callModel = LRCInstance::getCurrentCallModel();
contactPicker_->getContainer()->hide();
ui->addToConferenceButton->setChecked(false);
ui->addToConferenceButton->resetToOriginal();
......@@ -404,7 +331,7 @@ void
VideoOverlay::slotCallWillJoinConference(const std::string& callId)
{
auto callModel = LRCInstance::getCurrentCallModel();
contactPicker_->getContainer()->hide();
ui->addToConferenceButton->setChecked(false);
ui->addToConferenceButton->resetToOriginal();
......@@ -427,33 +354,42 @@ VideoOverlay::on_sipInputPanelButton_toggled(bool checked)
return;
}
SIPInputPanelWidget sipInputPanel(this);
connect(&sipInputPanel, &SIPInputPanelWidget::sipInputPanelClicked,
this, &VideoOverlay::slotSIPInputPanelClicked);
QPoint globalPos_button = mapToGlobal(ui->sipInputPanelButton->pos());
QPoint globalPos_bottomButtons = mapToGlobal(ui->bottomButtons->pos());
sipInputPanel_->getContainer()->move(globalPos_button.x(),
globalPos_bottomButtons.y() - sipInputPanel_->height() - popupMargin_);
// receive the signal that ensure the button checked status is correct and contactpicker
// is properly hidden
Utils::oneShotConnect(sipInputPanel_->getContainer(), &PopupDialog::willClose,
[this](QMouseEvent *event) {
sipInputPanel_->getContainer()->hide();
// check if current mouse position is on button
auto relativeClickPos = ui->sipInputPanelButton->mapFromGlobal(event->globalPos());
if (!ui->sipInputPanelButton->rect().contains(relativeClickPos)) {
if (auto container = sipInputPanel.getContainer().toStrongRef()) {
container->move(globalPos_button.x(),
globalPos_bottomButtons.y() - sipInputPanel.height() - popupMargin_);
// receive the signal that ensure the button checked status is correct and contactpicker
// is properly hidden
Utils::oneShotConnect(container.data(), &PopupDialog::willClose,
[this](QMouseEvent* event) {
// check if current mouse position is on button
auto relativeClickPos = ui->sipInputPanelButton->mapFromGlobal(event->globalPos());
if (!ui->sipInputPanelButton->rect().contains(relativeClickPos)) {
ui->sipInputPanelButton->setChecked(false);
ui->sipInputPanelButton->resetToOriginal();
}
});
// for esc key, receive reject signal
Utils::oneShotConnect(container.data(), &QDialog::rejected,
[this] {
ui->sipInputPanelButton->setChecked(false);
ui->sipInputPanelButton->resetToOriginal();
}
});
// for esc key, receive reject signal
Utils::oneShotConnect(sipInputPanel_->getContainer(), &QDialog::rejected,
[this] {
ui->sipInputPanelButton->setChecked(false);
ui->sipInputPanelButton->resetToOriginal();
});
});
sipInputPanel_->getContainer()->show();
popUpShown_ = true;
container->exec();
popUpShown_ = false;
}
}
void
......@@ -484,3 +420,51 @@ VideoOverlay::slotSIPInputPanelClicked(const int& id)
break;
}
}
void
VideoOverlay::contactPickerPopup(SmartListModel::Type type, OverlayButton* locateButton)
{
ContactPicker contactPicker(this);
contactPicker.setType(type);
contactPicker.setTitle(QObject::tr("Add to conference"));
contactPicker.setCurrentCalleeDisplayName(currentBestCalleeDisplayName_);
connect(&contactPicker, &ContactPicker::contactWillJoinConference,
this, &VideoOverlay::slotContactWillJoinConference);
connect(&contactPicker, &ContactPicker::callWillJoinConference,
this, &VideoOverlay::slotCallWillJoinConference);
connect(&contactPicker, &ContactPicker::contactWillDoTransfer,
this, &VideoOverlay::slotWillDoTransfer);
QPoint globalPos_button = mapToGlobal(locateButton->pos());
QPoint globalPos_bottomButtons = mapToGlobal(ui->bottomButtons->pos());
if (auto container = contactPicker.getContainer().toStrongRef()) {
container->move(globalPos_button.x(),
globalPos_bottomButtons.y() - contactPicker.height() - popupMargin_);
// receive the signal that ensure the button checked status is correct and contactpicker
// is properly hidden
Utils::oneShotConnect(container.data(), &PopupDialog::willClose,
[locateButton, this](QMouseEvent* event) {
// check if current mouse position is on button
auto relativeClickPos = locateButton->mapFromGlobal(event->globalPos());
if (!locateButton->rect().contains(relativeClickPos)) {
locateButton->setChecked(false);
locateButton->resetToOriginal();
}
});
// for esc key, receive reject signal
Utils::oneShotConnect(container.data(), &QDialog::rejected,
[this] {
ui->addToConferenceButton->setChecked(false);
ui->addToConferenceButton->resetToOriginal();
});
popUpShown_ = true;
container->exec();
popUpShown_ = false;
}
}
......@@ -19,6 +19,7 @@
#pragma once
#include "widgethelpers.h"
#include "smartlistmodel.h"
#include "api/conversationmodel.h"
......@@ -30,6 +31,7 @@
class ContactPicker;
class SIPInputPanelWidget;
class OverlayButton;
namespace Ui {
class VideoOverlay;
......@@ -56,6 +58,9 @@ signals:
void holdStateChanged(bool state);
void videoMuteStateChanged(bool state);
private:
void contactPickerPopup(SmartListModel::Type type, OverlayButton* locateButton);
private slots:
void setTime();
void on_hangupButton_clicked();
......@@ -79,9 +84,9 @@ private:
std::string accountId_;
std::string convUid_;
ContactPicker* contactPicker_;
SIPInputPanelWidget* sipInputPanel_;
QTimer* oneSecondTimer_;
QString currentBestCalleeDisplayName_ { "" };
bool popUpShown_ { false };
quint16 popupMargin_{ 16 };
};
......@@ -203,9 +203,10 @@ void
QmlPopupWidget::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
auto cp = getContainer()->parentWidget();
if (auto mainWindow = qobject_cast<MainWindow*>(cp)) {
mainWindow->darken();
if (auto cp = getContainer().toStrongRef()) {
if (auto mainWindow = qobject_cast<MainWindow*>(cp->parentWidget())) {
mainWindow->darken();
}
}
}
......@@ -213,8 +214,9 @@ void
QmlPopupWidget::hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
auto cp = getContainer()->parentWidget();
if (auto mainWindow = qobject_cast<MainWindow*>(cp)) {
mainWindow->lighten();
if (auto cp = getContainer().toStrongRef()) {
if (auto mainWindow = qobject_cast<MainWindow*>(cp->parentWidget())) {
mainWindow->lighten();
}