From 57442b22c181a72abb710edaebfa7ff943ade039 Mon Sep 17 00:00:00 2001 From: Olivier SOLDANO <olivier.soldano@savoirfairelinux.com> Date: Thu, 20 Apr 2017 11:56:57 -0400 Subject: [PATCH] hover widget for quick actions on contact requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit implements a hover widget with three buttons, for accepting, discarding, and blocking a contact request without requiring to use the dedicated panel Change-Id: I5002d3d156d8783bc613f52d7dd2abaaf9fc064f Reviewed-by: Anthony Léonard <anthony.leonard@savoirfairelinux.com> --- RingWinClient.pro | 9 +- quickactcontactrequestwidget.cpp | 56 +++++++++ quickactcontactrequestwidget.h | 46 ++++++++ quickactcontactrequestwidget.ui | 193 +++++++++++++++++++++++++++++++ stylesheet.css | 30 +++++ 5 files changed, 331 insertions(+), 3 deletions(-) create mode 100644 quickactcontactrequestwidget.cpp create mode 100644 quickactcontactrequestwidget.h create mode 100644 quickactcontactrequestwidget.ui diff --git a/RingWinClient.pro b/RingWinClient.pro index d397160..5960135 100644 --- a/RingWinClient.pro +++ b/RingWinClient.pro @@ -75,7 +75,8 @@ SOURCES += main.cpp\ sendcontactrequestwidget.cpp \ currentaccountwidget.cpp \ contactrequestwidget.cpp \ - contactrequestitemdelegate.cpp + contactrequestitemdelegate.cpp \ + quickactcontactrequestwidget.cpp HEADERS += mainwindow.h \ callwidget.h \ @@ -114,7 +115,8 @@ HEADERS += mainwindow.h \ sendcontactrequestwidget.h \ currentaccountwidget.h \ contactrequestwidget.h \ - contactrequestitemdelegate.h + contactrequestitemdelegate.h \ + quickactcontactrequestwidget.h contains(DEFINES, URI_PROTOCOL) { HEADERS += shmclient.h @@ -140,7 +142,8 @@ FORMS += mainwindow.ui \ photoboothdialog.ui \ sendcontactrequestwidget.ui \ currentaccountwidget.ui \ - contactrequestwidget.ui + contactrequestwidget.ui \ + quickactcontactrequestwidget.ui win32: LIBS += -lole32 -luuid -lshlwapi LIBS += -lqrencode diff --git a/quickactcontactrequestwidget.cpp b/quickactcontactrequestwidget.cpp new file mode 100644 index 0000000..260a854 --- /dev/null +++ b/quickactcontactrequestwidget.cpp @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (C) 2015-2017 by Savoir-faire Linux * + * Author: Olivier Soldano <olivier.soldano@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 "quickactcontactrequestwidget.h" +#include "ui_quickactcontactrequestwidget.h" + +#include <QFont> + +// CLIENT +#include "contactrequestitemdelegate.h" + +QuickActContactRequestWidget::QuickActContactRequestWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::QuickActContactRequestWidget) +{ + ui->setupUi(this); + + // set symbols in buttons using FontAwsome + ui->quickValidCRBtn->setText(QChar(0xf00c)); + ui->quickMuteCRBtn->setText(QChar(0xf12d)); + ui->quickBanCRBtn->setText(QChar(0xf00d)); + + connect(ui->quickValidCRBtn, &QPushButton::clicked, this, [=](){ + emit quickValidCRBtnClicked(); + }); + + connect(ui->quickMuteCRBtn, &QPushButton::clicked, this, [=](){ + emit quickValidCRBtnClicked(); + }); + + connect(ui->quickBanCRBtn, &QPushButton::clicked, this, [=](){ + emit quickValidCRBtnClicked(); + }); + +} + +QuickActContactRequestWidget::~QuickActContactRequestWidget() +{ + disconnect(this); + delete ui; +} diff --git a/quickactcontactrequestwidget.h b/quickactcontactrequestwidget.h new file mode 100644 index 0000000..b74c292 --- /dev/null +++ b/quickactcontactrequestwidget.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2015-2017 by Savoir-faire Linux * + * Author: Olivier Soldano <olivier.soldano@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/>. * + **************************************************************************/ + +#ifndef QUICKACTCONTACTREQUESTWIDGET_H +#define QUICKACTCONTACTREQUESTWIDGET_H + +#include <QWidget> + + +namespace Ui { +class QuickActContactRequestWidget; +} + +class QuickActContactRequestWidget : public QWidget +{ + Q_OBJECT + +public: + explicit QuickActContactRequestWidget(QWidget *parent = 0); + ~QuickActContactRequestWidget(); + +signals: + void quickValidCRBtnClicked(); + void quickMuteCRBtnClicked(); + void quickBanCRBtnClicked(); + +private: + Ui::QuickActContactRequestWidget *ui; +}; + +#endif // QUICKACTCONTACTREQUESTWIDGET_H diff --git a/quickactcontactrequestwidget.ui b/quickactcontactrequestwidget.ui new file mode 100644 index 0000000..e2d0784 --- /dev/null +++ b/quickactcontactrequestwidget.ui @@ -0,0 +1,193 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QuickActContactRequestWidget</class> + <widget class="QWidget" name="QuickActContactRequestWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>687</width> + <height>147</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="windowTitle"> + <string/> + </property> + <layout class="QHBoxLayout" name="horizontalLayout" stretch="3,1"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>428</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout" stretch="9,3,1"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="topMargin"> + <number>5</number> + </property> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item alignment="Qt::AlignHCenter|Qt::AlignVCenter"> + <widget class="QPushButton" name="quickValidCRBtn"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="quickMuteCRBtn"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="quickBanCRBtn"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/stylesheet.css b/stylesheet.css index de3ee94..da4d352 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -428,6 +428,36 @@ QPushButton#generalTabButton, QPushButton#videoTabButton, QPushButton#accountTab padding: 2px; } +QPushButton#quickValidCRBtn, QPushButton#quickMuteCRBtn, QPushButton#quickBanCRBtn{ + border-radius: 2px; + height:25px; + width:25px; + margin: 2px 2px 2px 2px; + text-align: center; + font: 10pt "FontAwesome"; +} + +QPushButton#quickValidCRBtn{ + background-color: #66cc00; +} +QPushButton#quickValidCRBtn:hover{ + background-color: #80ff00; +} + +QPushButton#quickMuteCRBtn{ + background-color: #ff9933; +} +QPushButton#quickMuteCRBtn:hover{ + background-color: #ffb366; +} + +QPushButton#quickBanCRBtn{ + background-color: #ff3333; +} +QPushButton#quickBanCRBtn:hover{ + background-color: #ff6666; +} + QTabBar::tab{ background: transparent; color: rgb(77, 77, 77); -- GitLab