fancy shadows in conversations
This commit is contained in:
parent
b2699e0087
commit
3d15682b37
@ -21,6 +21,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QGraphicsDropShadowEffect>
|
||||||
|
|
||||||
Conversation::Conversation(Models::Contact* p_contact, QWidget* parent):
|
Conversation::Conversation(Models::Contact* p_contact, QWidget* parent):
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -63,12 +64,38 @@ Conversation::Conversation(Models::Contact* p_contact, QWidget* parent):
|
|||||||
vs->setBackgroundRole(QPalette::Base);
|
vs->setBackgroundRole(QPalette::Base);
|
||||||
vs->setAutoFillBackground(true);
|
vs->setAutoFillBackground(true);
|
||||||
connect(vs, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
|
connect(vs, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
|
||||||
|
|
||||||
|
applyVisualEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
Conversation::~Conversation()
|
Conversation::~Conversation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Conversation::applyVisualEffects()
|
||||||
|
{
|
||||||
|
QGraphicsDropShadowEffect *e1 = new QGraphicsDropShadowEffect;
|
||||||
|
e1->setBlurRadius(10);
|
||||||
|
e1->setXOffset(0);
|
||||||
|
e1->setYOffset(-2);
|
||||||
|
e1->setColor(Qt::black);
|
||||||
|
m_ui->bl->setGraphicsEffect(e1);
|
||||||
|
|
||||||
|
QGraphicsDropShadowEffect *e2 = new QGraphicsDropShadowEffect;
|
||||||
|
e2->setBlurRadius(7);
|
||||||
|
e2->setXOffset(0);
|
||||||
|
e2->setYOffset(2);
|
||||||
|
e2->setColor(Qt::black);
|
||||||
|
m_ui->ul->setGraphicsEffect(e2);
|
||||||
|
|
||||||
|
QGraphicsDropShadowEffect *e3 = new QGraphicsDropShadowEffect;
|
||||||
|
e3->setBlurRadius(10);
|
||||||
|
e3->setXOffset(0);
|
||||||
|
e3->setYOffset(2);
|
||||||
|
e3->setColor(Qt::black);
|
||||||
|
m_ui->ut->setGraphicsEffect(e3);
|
||||||
|
}
|
||||||
|
|
||||||
void Conversation::setName(const QString& name)
|
void Conversation::setName(const QString& name)
|
||||||
{
|
{
|
||||||
m_ui->nameLabel->setText(name);
|
m_ui->nameLabel->setText(name);
|
||||||
|
@ -68,6 +68,7 @@ protected:
|
|||||||
void setState(Shared::Availability state);
|
void setState(Shared::Availability state);
|
||||||
void setStatus(const QString& status);
|
void setStatus(const QString& status);
|
||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
|
void applyVisualEffects();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onContactChanged(Models::Item* item, int row, int col);
|
void onContactChanged(Models::Item* item, int row, int col);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>572</width>
|
<width>572</width>
|
||||||
<height>377</height>
|
<height>485</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
@ -70,56 +70,98 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<widget class="QWidget" name="widget_3" native="true">
|
||||||
<item>
|
<property name="autoFillBackground">
|
||||||
<widget class="QLabel" name="statusIcon">
|
<bool>true</bool>
|
||||||
<property name="text">
|
</property>
|
||||||
<string/>
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
</widget>
|
<number>0</number>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="topMargin">
|
||||||
<widget class="QLabel" name="nameLabel">
|
<number>0</number>
|
||||||
<property name="text">
|
</property>
|
||||||
<string/>
|
<property name="rightMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="bottomMargin">
|
||||||
<item>
|
<number>0</number>
|
||||||
<widget class="QLabel" name="statusLabel">
|
</property>
|
||||||
<property name="text">
|
<item>
|
||||||
<string/>
|
<widget class="QLabel" name="statusIcon">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string/>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<spacer name="horizontalSpacer_2">
|
</item>
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<widget class="QLabel" name="nameLabel">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="sizeHint" stdset="0">
|
<string/>
|
||||||
<size>
|
</property>
|
||||||
<width>40</width>
|
</widget>
|
||||||
<height>20</height>
|
</item>
|
||||||
</size>
|
<item>
|
||||||
</property>
|
<widget class="QLabel" name="statusLabel">
|
||||||
</spacer>
|
<property name="text">
|
||||||
</item>
|
<string/>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QLabel" name="historyStatus">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string/>
|
<item>
|
||||||
</property>
|
<spacer name="horizontalSpacer_2">
|
||||||
</widget>
|
<property name="orientation">
|
||||||
</item>
|
<enum>Qt::Horizontal</enum>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QLabel" name="avatar">
|
<property name="sizeHint" stdset="0">
|
||||||
<property name="text">
|
<size>
|
||||||
<string/>
|
<width>40</width>
|
||||||
</property>
|
<height>20</height>
|
||||||
</widget>
|
</size>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="historyStatus">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="avatar">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="ul" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
@ -129,9 +171,18 @@
|
|||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="midLineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="horizontalScrollBarPolicy">
|
<property name="horizontalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -141,7 +192,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>572</width>
|
<width>572</width>
|
||||||
<height>95</height>
|
<height>111</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
@ -164,7 +215,42 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="bl" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
<zorder>scrollArea</zorder>
|
||||||
|
<zorder>bl</zorder>
|
||||||
|
<zorder>ul</zorder>
|
||||||
|
<zorder>widget_3</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -173,6 +259,9 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -190,83 +279,131 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<widget class="QWidget" name="panel" native="true">
|
||||||
<item>
|
<property name="autoFillBackground">
|
||||||
<widget class="QPushButton" name="smilesButton">
|
<bool>true</bool>
|
||||||
<property name="text">
|
</property>
|
||||||
<string/>
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<property name="icon">
|
<number>0</number>
|
||||||
<iconset theme="smiley-shape">
|
</property>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<property name="topMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="flat">
|
</property>
|
||||||
<bool>true</bool>
|
<property name="rightMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="bottomMargin">
|
||||||
<item>
|
<number>0</number>
|
||||||
<spacer name="horizontalSpacer">
|
</property>
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<widget class="QPushButton" name="smilesButton">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="sizeHint" stdset="0">
|
<string/>
|
||||||
<size>
|
</property>
|
||||||
<width>40</width>
|
<property name="icon">
|
||||||
<height>20</height>
|
<iconset theme="smiley-shape">
|
||||||
</size>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="flat">
|
||||||
</item>
|
<bool>true</bool>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QPushButton" name="attachButton">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string/>
|
<item>
|
||||||
</property>
|
<spacer name="horizontalSpacer">
|
||||||
<property name="icon">
|
<property name="orientation">
|
||||||
<iconset theme="document-send-symbolic">
|
<enum>Qt::Horizontal</enum>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
</property>
|
||||||
</property>
|
<property name="sizeHint" stdset="0">
|
||||||
<property name="flat">
|
<size>
|
||||||
<bool>true</bool>
|
<width>40</width>
|
||||||
</property>
|
<height>20</height>
|
||||||
</widget>
|
</size>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</spacer>
|
||||||
<widget class="QPushButton" name="clearButton">
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string/>
|
<widget class="QPushButton" name="attachButton">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="icon">
|
<string/>
|
||||||
<iconset theme="edit-clear-all">
|
</property>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<property name="icon">
|
||||||
</property>
|
<iconset theme="document-send-symbolic">
|
||||||
<property name="flat">
|
<normaloff>.</normaloff>.</iconset>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="flat">
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QPushButton" name="sendButton">
|
</item>
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<widget class="QPushButton" name="clearButton">
|
||||||
<horstretch>0</horstretch>
|
<property name="text">
|
||||||
<verstretch>0</verstretch>
|
<string/>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
<property name="icon">
|
||||||
<property name="text">
|
<iconset theme="edit-clear-all">
|
||||||
<string/>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="flat">
|
||||||
<iconset theme="document-send">
|
<bool>true</bool>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="flat">
|
</item>
|
||||||
<bool>true</bool>
|
<item>
|
||||||
</property>
|
<widget class="QPushButton" name="sendButton">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
</item>
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
</layout>
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-send">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="ut" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPlainTextEdit" name="messageEditor">
|
<widget class="QPlainTextEdit" name="messageEditor">
|
||||||
@ -294,6 +431,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
<zorder>messageEditor</zorder>
|
||||||
|
<zorder>ut</zorder>
|
||||||
|
<zorder>panel</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "messageline.h"
|
#include "messageline.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QGraphicsDropShadowEffect>
|
||||||
|
|
||||||
MessageLine::MessageLine(QWidget* parent):
|
MessageLine::MessageLine(QWidget* parent):
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -72,7 +73,7 @@ MessageLine::Position MessageLine::message(const Shared::Message& msg)
|
|||||||
QWidget* message = new QWidget();
|
QWidget* message = new QWidget();
|
||||||
message->setLayout(vBox);
|
message->setLayout(vBox);
|
||||||
message->setBackgroundRole(QPalette::AlternateBase);
|
message->setBackgroundRole(QPalette::AlternateBase);
|
||||||
message->setAutoFillBackground(true);;
|
message->setAutoFillBackground(true);
|
||||||
|
|
||||||
QLabel* body = new QLabel(msg.getBody());
|
QLabel* body = new QLabel(msg.getBody());
|
||||||
body->setTextInteractionFlags(body->textInteractionFlags() | Qt::TextSelectableByMouse);
|
body->setTextInteractionFlags(body->textInteractionFlags() | Qt::TextSelectableByMouse);
|
||||||
@ -93,6 +94,14 @@ MessageLine::Position MessageLine::message(const Shared::Message& msg)
|
|||||||
vBox->addWidget(body);
|
vBox->addWidget(body);
|
||||||
vBox->addWidget(time);
|
vBox->addWidget(time);
|
||||||
|
|
||||||
|
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
||||||
|
effect->setBlurRadius(10);
|
||||||
|
effect->setXOffset(1);
|
||||||
|
effect->setYOffset(1);
|
||||||
|
effect->setColor(Qt::black);
|
||||||
|
|
||||||
|
message->setGraphicsEffect(effect);
|
||||||
|
|
||||||
if (msg.getOutgoing()) {
|
if (msg.getOutgoing()) {
|
||||||
//body->setAlignment(Qt::AlignRight);
|
//body->setAlignment(Qt::AlignRight);
|
||||||
sender->setAlignment(Qt::AlignRight);
|
sender->setAlignment(Qt::AlignRight);
|
||||||
|
Loading…
Reference in New Issue
Block a user