Commit 39d917dd authored by Ming Rui Zhang's avatar Ming Rui Zhang

invitebuttonswidget: removal of invitebuttonswidget

Change-Id: I53c12ed26cb59819f55687c0bb6fafc297ab8ee5
parent 97a4a129
......@@ -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 \
......
......@@ -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;
......
/***************************************************************************
* 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;
}
/***************************************************************************
* 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
<?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>
......@@ -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()
......
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