From 39d917ddd678cb14c666e9de424ecf0e6b30f05e Mon Sep 17 00:00:00 2001 From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com> Date: Fri, 13 Mar 2020 15:02:32 -0400 Subject: [PATCH] invitebuttonswidget: removal of invitebuttonswidget Change-Id: I53c12ed26cb59819f55687c0bb6fafc297ab8ee5 --- jami-qt.pro | 3 - src/conversationitemdelegate.cpp | 8 -- src/invitebuttonswidget.cpp | 46 ------- src/invitebuttonswidget.h | 43 ------ src/invitebuttonswidget.ui | 220 ------------------------------- src/smartlistview.cpp | 40 ------ 6 files changed, 360 deletions(-) delete mode 100644 src/invitebuttonswidget.cpp delete mode 100644 src/invitebuttonswidget.h delete mode 100644 src/invitebuttonswidget.ui diff --git a/jami-qt.pro b/jami-qt.pro index aa76cba..92847f5 100644 --- a/jami-qt.pro +++ b/jami-qt.pro @@ -120,7 +120,6 @@ HEADERS += ./src/aboutdialog.h \ ./src/accountitemdelegate.h \ ./src/bannedlistmodel.h \ ./src/currentaccountcombobox.h \ - ./src/invitebuttonswidget.h \ ./src/nameregistrationdialog.h \ ./src/ringcontactlineedit.h \ ./src/smartlistselectorbuttonnotifier.h \ @@ -192,7 +191,6 @@ SOURCES += ./src/aboutdialog.cpp \ ./src/accountitemdelegate.cpp \ ./src/bannedlistmodel.cpp \ ./src/currentaccountcombobox.cpp \ - ./src/invitebuttonswidget.cpp \ ./src/nameregistrationdialog.cpp \ ./src/ringcontactlineedit.cpp \ ./src/splashscreen.cpp \ @@ -258,7 +256,6 @@ FORMS += ./src/aboutdialog.ui \ ./src/ringbutton.ui \ ./src/updatedownloaddialog.ui \ ./src/contactpicker.ui \ - ./src/invitebuttonswidget.ui \ ./src/nameregistrationdialog.ui \ ./src/settingswidget.ui \ ./src/videooverlay.ui \ diff --git a/src/conversationitemdelegate.cpp b/src/conversationitemdelegate.cpp index 97692a0..2daafb7 100644 --- a/src/conversationitemdelegate.cpp +++ b/src/conversationitemdelegate.cpp @@ -363,14 +363,6 @@ ConversationItemDelegate::paintInvitationItem(QPainter* painter, auto scalingRatio = Utils::getCurrentScalingRatio(); font.setPointSize(scalingRatio > 1.0 ? fontSize_ - 2 : fontSize_); - if (option.state & QStyle::State_MouseOver) { - if (scalingRatio > 1.0) { - rightMargin = infoTextWidth_ + 12 - dx_ * 2; - } else { - rightMargin = infoTextWidth_ - dx_ * 2; - } - } - auto topMargin = 4; auto bottomMargin = 8; diff --git a/src/invitebuttonswidget.cpp b/src/invitebuttonswidget.cpp deleted file mode 100644 index 9e6397e..0000000 --- a/src/invitebuttonswidget.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2019 by Savoir-faire Linux * - * Author: Andreas Traczyk <andreas.traczyk@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 "ui_invitebuttonswidget.h" - -#include "invitebuttonswidget.h" - -InviteButtonsWidget::InviteButtonsWidget(QWidget* parent) : - QWidget(parent), - ui(new Ui::InviteButtonsWidget) -{ - ui->setupUi(this); - connect(ui->btnAcceptInvite, &QPushButton::clicked, this, - [=]() { - emit btnAcceptInviteClicked(); - }); - connect(ui->btnIgnoreInvite, &QPushButton::clicked, this, - [=]() { - emit btnIgnoreInviteClicked(); - }); - connect(ui->btnBlockInvite, &QPushButton::clicked, this, - [=]() { - emit btnBlockInviteClicked(); - }); -} - -InviteButtonsWidget::~InviteButtonsWidget() -{ - disconnect(this); - delete ui; -} diff --git a/src/invitebuttonswidget.h b/src/invitebuttonswidget.h deleted file mode 100644 index a701fc6..0000000 --- a/src/invitebuttonswidget.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2019 by Savoir-faire Linux * - * Author: Andreas Traczyk <andreas.traczyk@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 <QWidget> -#include <QItemDelegate> - -namespace Ui { -class InviteButtonsWidget; -} - -class InviteButtonsWidget : public QWidget -{ - Q_OBJECT -public: - explicit InviteButtonsWidget(QWidget* parent = 0); - ~InviteButtonsWidget(); - -private: - Ui::InviteButtonsWidget* ui; - -signals: - void btnAcceptInviteClicked() const; - void btnIgnoreInviteClicked() const; - void btnBlockInviteClicked() const; - -}; \ No newline at end of file diff --git a/src/invitebuttonswidget.ui b/src/invitebuttonswidget.ui deleted file mode 100644 index 617379b..0000000 --- a/src/invitebuttonswidget.ui +++ /dev/null @@ -1,220 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>InviteButtonsWidget</class> - <widget class="QWidget" name="InviteButtonsWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>342</width> - <height>120</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string/> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>5</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>209</width> - <height>17</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <item> - <widget class="QPushButton" name="btnAcceptInvite"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Accept</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../ressources.qrc"> - <normaloff>:/images/icons/ic_person_add_black_24dp_2x.png</normaloff>:/images/icons/ic_person_add_black_24dp_2x.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>18</width> - <height>18</height> - </size> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>8</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnIgnoreInvite"> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Refuse</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../ressources.qrc"> - <normaloff>:/images/icons/ic_clear_24px.svg</normaloff>:/images/icons/ic_clear_24px.svg</iconset> - </property> - <property name="iconSize"> - <size> - <width>18</width> - <height>18</height> - </size> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>8</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnBlockInvite"> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Block</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../ressources.qrc"> - <normaloff>:/images/icons/ic_block_24px.svg</normaloff>:/images/icons/ic_block_24px.svg</iconset> - </property> - <property name="iconSize"> - <size> - <width>18</width> - <height>18</height> - </size> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>12</width> - <height>17</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources> - <include location="../ressources.qrc"/> - </resources> - <connections/> -</ui> diff --git a/src/smartlistview.cpp b/src/smartlistview.cpp index 4accf05..e424813 100644 --- a/src/smartlistview.cpp +++ b/src/smartlistview.cpp @@ -21,7 +21,6 @@ #include "smartlistview.h" -#include "invitebuttonswidget.h" #include "smartlistmodel.h" #include "utils.h" @@ -43,45 +42,6 @@ SmartListView::SmartListView(QWidget *parent) : setSelectionMode(QAbstractItemView::SingleSelection); setMouseTracking(true); installEventFilter(this); - - QObject::connect(this, &QAbstractItemView::entered, - [this](const QModelIndex & index) { - auto type = Utils::toEnum<lrc::api::profile::Type>( - index.data(static_cast<int>(SmartListModel::Role::ContactType)).value<int>() - ); - if (type == lrc::api::profile::Type::PENDING) { - auto widget = indexWidget(index); - if (!widget) { - InviteButtonsWidget* buttons = new InviteButtonsWidget(); - setIndexWidget(index, buttons); - - QObject::connect(buttons, &InviteButtonsWidget::btnAcceptInviteClicked, this, - [this, index]() { - hoveredRow_ = QModelIndex(); - emit btnAcceptInviteClicked(index); - }); - QObject::connect(buttons, &InviteButtonsWidget::btnIgnoreInviteClicked, this, - [this, index]() { - hoveredRow_ = QModelIndex(); - emit btnIgnoreInviteClicked(index); - }); - QObject::connect(buttons, &InviteButtonsWidget::btnBlockInviteClicked, this, - [this, index]() { - hoveredRow_ = QModelIndex(); - emit btnBlockInviteClicked(index); - }); - } - else { - widget->show(); - } - - if (hoveredRow_.isValid() && indexWidget(hoveredRow_)) { - indexWidget(hoveredRow_)->hide(); - } - - hoveredRow_ = index; - } - }); } SmartListView::~SmartListView() -- GitLab