Commit dc17c81b authored by Andreas Traczyk's avatar Andreas Traczyk

smartlist: draw tabs for conversation filter switch

Change-Id: I835b229dcad51afdcf3dfea2794697a14fdfba90
parent a010f250
/***************************************************************************
* 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 "bezierconnectorwidget.h"
#include <QPainter>
#include <QDebug>
BezierConnectorWidget::BezierConnectorWidget(QWidget* parent) : QWidget(parent)
{
}
BezierConnectorWidget::~BezierConnectorWidget()
{
}
void
BezierConnectorWidget::paintEvent(QPaintEvent* event)
{
Q_UNUSED(event);
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing, true);
QPen pen(painter.pen());
pen.setWidth(2.0);
pen.setColor(QColor(240, 240, 240));
painter.setPen(pen);
QPainterPath bezierPath;
double c = 0.551915024494;
QPointF p0, p1, p2, p3;
if (this->objectName().contains("right", Qt::CaseInsensitive)) {
p0 = rect().topLeft();
p3 = rect().bottomRight();
p1 = QPointF(p0.x() + c * rect().width(), p0.y());
p2 = QPointF(p0.x() + rect().width(), p0.y() + rect().height() - (c * rect().height()));
} else if (this->objectName().contains("left", Qt::CaseInsensitive)) {
p0 = rect().bottomLeft();
p3 = rect().topRight();
p1 = QPointF(p0.x(), p0.y() - c * rect().height());
p2 = QPointF(p3.x() - c * rect().width(), p3.y());
}
bezierPath.moveTo(p0);
bezierPath.cubicTo(p1, p2, p3);
painter.drawPath(bezierPath);
}
/***************************************************************************
* 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>
class BezierConnectorWidget : public QWidget
{
Q_OBJECT
public:
explicit BezierConnectorWidget(QWidget* parent = 0);
~BezierConnectorWidget();
protected:
void paintEvent(QPaintEvent *event);
};
......@@ -218,8 +218,6 @@ CallWidget::CallWidget(QWidget* parent) :
setCallPanelVisibility(false);
ui->containerWidget->setVisible(false);
ui->smartListWidget->setStyleSheet("border-right: 2px solid rgb(240, 240, 240);");
}
CallWidget::~CallWidget()
......@@ -568,6 +566,7 @@ CallWidget::conversationsButtonClicked()
{
ui->btnConversations->setChecked(true);
ui->btnInvites->setChecked(false);
ui->ringContactLineEdit->setPlaceholderString(tr("Find a new or existing contact"));
setConversationFilter(lrc::api::profile::Type::RING);
}
......@@ -576,6 +575,7 @@ CallWidget::invitationsButtonClicked()
{
ui->btnConversations->setChecked(false);
ui->btnInvites->setChecked(true);
ui->ringContactLineEdit->setPlaceholderString(tr("Search your received invitations"));
setConversationFilter(lrc::api::profile::Type::PENDING);
}
......@@ -813,8 +813,10 @@ void CallWidget::updateConversationsFilterWidget()
LRCInstance::getCurrentConversationModel()->setFilter(currentTypeFilter_);
}
ui->conversationsFilterWidget->setVisible(invites);
ui->conversationsFilterWidget->updateBadges();
ui->searchTopLeftWidget->setVisible(invites);
ui->searchTopRightWidget->setVisible(invites);
ui->conversationsFilterWidget->update();
ui->conversationsFilterWidget->updateBadges();
}
void CallWidget::setConversationFilter(const QString & filter)
......
This diff is collapsed.
......@@ -55,7 +55,7 @@ ConversationsFilterWidget::updateNotifier(lrc::api::profile::Type typeFilter)
static inline const QRect
getNotifierRect(const QRect& buttonRect)
{
qreal radius = 8;
qreal radius = 9;
QPointF ellipseCenter(buttonRect.right() - radius * 2, buttonRect.top());
return QRect(ellipseCenter.x() - radius, ellipseCenter.y() - radius, radius * 2, radius * 2);
}
......
......@@ -75,7 +75,7 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
{
Q_UNUSED(e);
QPoint avatarTopLeft(16, 2);
QPoint avatarTopLeft(16, 6);
QPainter painter(this);
painter.setRenderHints((QPainter::Antialiasing | QPainter::TextAntialiasing), true);
......@@ -154,7 +154,7 @@ void
CurrentAccountComboBox::setupSettingsButton()
{
gearPoint_.setX(this->width() - gearSize_ - 5 * gearBorder_ - 1);
gearPoint_.setY(this->height() / 2 - gearLabel_.height() / 2 - 2 * gearBorder_ + 4.5);
gearPoint_.setY(this->height() / 2 - gearLabel_.height() / 2 - 2 * gearBorder_ + 8);
gearLabel_.setGeometry(
gearPoint_.x(), gearPoint_.y(),
gearSize_ + 2 * gearBorder_,
......
......@@ -371,4 +371,10 @@ float
MainWindow::getCurrentScalingRatio()
{
return currentScalingRatio_;
}
void MainWindow::keyReleaseEvent(QKeyEvent* ke)
{
emit keyReleased(ke);
QMainWindow::keyReleaseEvent(ke);
}
\ No newline at end of file
......@@ -60,6 +60,10 @@ protected:
bool nativeEvent(const QByteArray& eventType, void* message, long* result);
void closeEvent(QCloseEvent* event);
void resizeEvent(QResizeEvent *event);
void keyReleaseEvent(QKeyEvent* ke);
signals:
void keyReleased(QKeyEvent*ke);
public slots:
void onRingEvent(const QString& uri);
......
......@@ -244,6 +244,16 @@
<ClCompile Include="deleteaccountdialog.cpp" />
<ClCompile Include="globalsystemtray.cpp" />
<ClCompile Include="idlabel.cpp" />
<ClCompile Include="bezierconnectorwidget.cpp">
<OutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\%(Filename).moc</OutputFile>
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Release|x64'">input</DynamicSource>
<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)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>
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
<OutputFile Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName)\%(Filename).moc</OutputFile>
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">input</DynamicSource>
<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>
<Define Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">COMPILE_ONLY;_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
</ClCompile>
<ClCompile Include="invitebuttonswidget.cpp" />
<ClCompile Include="linkdevwidget.cpp" />
<ClCompile Include="main.cpp" />
......@@ -353,6 +363,12 @@
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\.;.\GeneratedFiles;.;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\lrc\src;$(ProjectDir)..\client-windows\winsparkle\include;$(ProjectDir)..\client-windows\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\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtMultimediaWidgets</IncludePath>
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;NIGHTLY_VERSION=20180706;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG;QT_MULTIMEDIA_LIB;QT_MULTIMEDIAWIDGETS_LIB</Define>
</QtMoc>
<QtMoc Include="bezierconnectorwidget.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)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>
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
<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>
<Define Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">COMPILE_ONLY;_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
</QtMoc>
<ClInclude Include="lrcinstance.h" />
<QtMoc Include="messagewebview.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\.;.\GeneratedFiles;.;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\lrc\src;$(ProjectDir)..\client-windows\winsparkle\include;$(ProjectDir)..\client-windows\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\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
......
......@@ -195,6 +195,9 @@
<ClCompile Include="runguard.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bezierconnectorwidget.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="aboutdialog.h">
......@@ -323,6 +326,9 @@
<QtMoc Include="newwizardwidget.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="bezierconnectorwidget.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
......
......@@ -26,8 +26,6 @@ RingContactLineEdit::RingContactLineEdit(QWidget* parent) :
QLineEdit(parent)
{
QPalette palette;
palette.setColor(QPalette::Base, QColor(242, 242, 242));
setPalette(palette);
setFrame(false);
......@@ -37,3 +35,9 @@ RingContactLineEdit::RingContactLineEdit(QWidget* parent) :
RingContactLineEdit::~RingContactLineEdit()
{
}
void
RingContactLineEdit::setPlaceholderString(const QString& str)
{
setPlaceholderText(str);
}
......@@ -32,4 +32,6 @@ class RingContactLineEdit : public QLineEdit
public:
explicit RingContactLineEdit(QWidget* parent = 0);
~RingContactLineEdit();
void setPlaceholderString(const QString&);
};
......@@ -106,7 +106,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
<height>13</height>
</size>
</property>
</spacer>
......@@ -1119,8 +1119,8 @@ QPushButton:pressed {background: rgb(230,230, 230); border: 0px; border-radius:
<rect>
<x>0</x>
<y>0</y>
<width>696</width>
<height>682</height>
<width>617</width>
<height>580</height>
</rect>
</property>
<property name="styleSheet">
......
......@@ -40,29 +40,38 @@ QPushButton {
color: rgb(32, 32, 32);
}
QWidget#smartListOuterWidget {
background-color: rgb(255, 255, 255);
}
QPushButton#btnConversations, QPushButton#btnInvites,
QPushButton#btnExportAccount, QPushButton#btnDeletAccount {
background-color: rgb(242, 242, 242);
border-style: solid;
border-width: 0px;
border-radius: 5px;
padding: 8px;
color: rgb(32, 32, 32);
border-radius: 0px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
color: rgb(32, 32, 32);
height: 28px;
padding: 0px;
background-color: rgb(240, 240, 240);
border-top: 2px solid rgb(240, 240, 240);
border-right: 2px solid rgb(240, 240, 240);
border-bottom: 2px solid rgb(240, 240, 240);
border-left: 2px solid rgb(240, 240, 240);
}
QPushButton#btnConversations:hover, QPushButton#btnInvites:hover,
QPushButton#btnExportAccount:hover, QPushButton#btnDeletAccount:hover {
background-color: rgb(237, 237, 237);
}
QPushButton#btnConversations:pressed, QPushButton#btnInvites:pressed,
QPushButton#btnExportAccount:pressed, QPushButton#btnDeletAccount:pressed {
background-color: rgb(212, 212, 212);
border-top: 2px solid rgb(237, 237, 237);
border-right: 2px solid rgb(237, 237, 237);
border-bottom: 2px solid rgb(237, 237, 237);
border-left: 2px solid rgb(237, 237, 237);
}
QPushButton#btnConversations:checked, QPushButton#btnInvites:checked,
QPushButton#btnExportAccount:checked, QPushButton#btnDeletAccount:checked {
background-color: rgb(237, 237, 237);
background-color: rgb(255, 255, 255);
border-bottom: 2px solid rgb(255, 255, 255);
}
QPushButton#imBackButton, QPushButton#btnAcceptInvite, QPushButton#btnIgnoreInvite,
......@@ -94,18 +103,27 @@ QPushButton#sendContactRequestButton:pressed, QPushButton#sendButton:pressed, QP
background-color: rgb(212, 212, 212);
}
QWidget#searchBarLayoutWidget, QWidget#smartList,
QWidget#sidePanelLayoutWidget, QWidget#leftSettingsWidget {
border-right: 2px solid rgb(240, 240, 240);
}
RingContactLineEdit{
border-color: rgb(242, 242, 242);
border-radius: 5px;
border-width: 2px;
background-color: rgb(242, 242, 242);
border-radius: 15px;
border: 2px solid rgb(240, 240, 240);
background-color: rgb(240, 240, 240);
}
RingContactLineEdit:focus{
border: 2px solid rgb(240, 240, 240);
background-color: rgb(255, 255, 255);
}
.QLineEdit{
border-color: rgb(242, 242, 242);
border-color: rgb(240, 240, 240);
border-radius: 15px;
border-width: 2px;
background-color: rgb(242, 242, 242);
background-color: rgb(240, 240, 240);
padding-left: 4px;
padding-right: 4px;
height: 30px;
......@@ -184,10 +202,6 @@ QWidget#messagingHeaderWidget {
border-bottom: 2px solid rgb(240, 240, 240);
}
QWidget#sidePanelLayoutWidget, QWidget#leftSettingsWidget {
border-right: 2px solid rgb(240, 240, 240);
}
QWidget#messageViewLayoutWidget, QWidget#welcomePage {
background-color: rgba(255, 255, 255, 255);
}
......
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