Commit a0ebd06c authored by Edric Milaret's avatar Edric Milaret

ui: improve ui

- Implement PixbufManipulator
- Adapt contactDelegate and historyDelegate and
  smartListDelegate
- Add selection hint to smartList
- Add context menu to smartlist
- Rewrite the IM delegate
- Suppress chat button in favor of selection
- Various value passed to const member to avoid a lot of
  allocation
- Various indent fixes

Change-Id: Id8fdda04e16d8479f99eed060d668e1b0c7f9445
Tuleap: #148
Tuleap: #232
parent fa05d97b
......@@ -66,7 +66,8 @@ SOURCES += main.cpp\
smartlist.cpp \
mainwindowtoolbar.cpp \
ringcontactlineedit.cpp \
smartlistscrollbar.cpp
smartlistscrollbar.cpp \
pixbufmanipulator.cpp
HEADERS += mainwindow.h \
callwidget.h \
......@@ -100,7 +101,8 @@ HEADERS += mainwindow.h \
smartlist.h \
mainwindowtoolbar.h \
ringcontactlineedit.h \
smartlistscrollbar.h
smartlistscrollbar.h \
pixbufmanipulator.h
FORMS += mainwindow.ui \
callwidget.ui \
......
......@@ -26,6 +26,7 @@
//ERROR is defined in windows.h
#include "utils.h"
#undef ERROR
#undef interface
#include "audio/settings.h"
#include "personmodel.h"
......@@ -38,6 +39,7 @@
#include "media/textrecording.h"
#include "recentmodel.h"
#include "contactmethod.h"
#include "globalinstances.h"
#include "wizarddialog.h"
#include "windowscontactbackend.h"
......@@ -48,6 +50,7 @@
#include "contactdelegate.h"
#include "smartlistdelegate.h"
#include "imdelegate.h"
#include "pixbufmanipulator.h"
CallWidget::CallWidget(QWidget* parent) :
NavWidget(END ,parent),
......@@ -91,6 +94,8 @@ CallWidget::CallWidget(QWidget* parent) :
ui->ringLogo->setPixmap(logo.scaledToHeight(100, Qt::SmoothTransformation));
ui->ringLogo->setAlignment(Qt::AlignHCenter);
GlobalInstances::setPixmapManipulator(std::unique_ptr<Interfaces::PixbufManipulator>(new Interfaces::PixbufManipulator()));
try {
callModel_ = &CallModel::instance();
......@@ -171,7 +176,8 @@ CallWidget::CallWidget(QWidget* parent) :
});
findRingAccount();
ui->listMessageView->setItemDelegate(imDelegate_);
setupOutOfCallIM();
setupSmartListMenu();
} catch (const std::exception& e) {
qDebug() << "INIT ERROR" << e.what();
......@@ -186,6 +192,69 @@ CallWidget::~CallWidget()
delete imDelegate_;
}
void
CallWidget::setupOutOfCallIM()
{
ui->listMessageView->setItemDelegate(imDelegate_);
ui->listMessageView->setContextMenuPolicy(Qt::ActionsContextMenu);
auto copyAction = new QAction(tr("Copy"), this);
ui->listMessageView->addAction(copyAction);
connect(copyAction, &QAction::triggered, [=]() {
auto idx = ui->listMessageView->currentIndex();
if (idx.isValid()) {
auto text = ui->listMessageView->model()->data(idx);
QApplication::clipboard()->setText(text.value<QString>());
}
});
auto displayDate = new QAction(tr("Display date"), this);
displayDate->setCheckable(true);
ui->listMessageView->addAction(displayDate);
auto displayAuthor = new QAction(tr("Display author"), this);
displayAuthor->setCheckable(true);
ui->listMessageView->addAction(displayAuthor);
auto lamdba = [=](){
int opts = 0;
displayAuthor->isChecked() ? opts |= ImDelegate::DisplayOptions::AUTHOR : opts;
displayDate->isChecked() ? opts |= ImDelegate::DisplayOptions::DATE : opts;
imDelegate_->setDisplayOptions(static_cast<ImDelegate::DisplayOptions>(opts));
};
connect(displayAuthor, &QAction::triggered, lamdba);
connect(displayDate, &QAction::triggered, lamdba);
}
void
CallWidget::setupSmartListMenu() {
ui->smartList->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->smartList, &QListView::customContextMenuRequested, [=](const QPoint& pos){
auto idx = ui->smartList->currentIndex();
if (not idx.isValid())
return;
QPoint globalPos = ui->smartList->mapToGlobal(pos);
QMenu menu;
ContactMethod* contactMethod = RecentModel::instance()
.getContactMethods(RecentModel::instance().peopleProxy()->mapToSource(idx)).at(0);
if (not contactMethod)
return;
auto copyAction = new QAction(tr("Copy number"), this);
menu.addAction(copyAction);
connect(copyAction, &QAction::triggered, [=]() {
QApplication::clipboard()->setText(contactMethod->uri());
});
if (not contactMethod->contact() || contactMethod->contact()->isPlaceHolder()) {
auto addExisting = new QAction(tr("Add to contact"), this);
menu.addAction(addExisting);
connect(addExisting, &QAction::triggered, [=]() {
ContactPicker contactPicker(contactMethod);
contactPicker.move(globalPos.x(), globalPos.y() - (contactPicker.height()/2));
contactPicker.exec();
});
}
menu.exec(globalPos);
});
}
void
CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec)
{
......@@ -249,7 +318,7 @@ CallWidget::callIncoming(Call* call)
if (!call->account()->isAutoAnswer()) {
ui->callerIdLabel->setText(QString(tr("%1", "%1 is the name of the caller"))
.arg(call->formattedName()));
.arg(call->formattedName()));
ui->stackedWidget->setCurrentWidget(ui->callInvitePage);
ui->callInvite->setVisible(true);
ui->callInvite->raise();
......@@ -301,12 +370,12 @@ CallWidget::callStateChanged(Call* call, Call::State previousState)
setActualCall(nullptr);
ui->instantMessagingWidget->setMediaText(nullptr);
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
//TODO : Link this so that recentModel get selected correctly
// auto onHoldCall = callModel_->getActiveCalls().first();
// if (onHoldCall != nullptr && onHoldCall->state() == Call::State::HOLD) {
// setActualCall(onHoldCall);
// onHoldCall->performAction(Call::Action::HOLD);
// }
//TODO : Link this so that recentModel get selected correctly
// auto onHoldCall = callModel_->getActiveCalls().first();
// if (onHoldCall != nullptr && onHoldCall->state() == Call::State::HOLD) {
// setActualCall(onHoldCall);
// onHoldCall->performAction(Call::Action::HOLD);
// }
} else if (call->state() == Call::State::CURRENT) {
ui->instantMessagingWidget->setMediaText(actualCall_);
ui->stackedWidget->setCurrentWidget(ui->videoPage);
......@@ -416,11 +485,12 @@ CallWidget::smartListSelectionChanged(const QItemSelection& newSel, const QItemS
auto nodeIdx = RecentModel::instance().peopleProxy()->mapToSource(newIdx);
auto newIdxCall = RecentModel::instance().getActiveCall(nodeIdx);
if (newIdxCall == actualCall_)
return;
if (newIdxCall) {
if (newIdxCall && newIdxCall != actualCall_) {
setActualCall(newIdxCall);
ui->stackedWidget->setCurrentWidget(ui->videoPage);
} else if (newIdxCall == nullptr){
setActualCall(nullptr);
showIMOutOfCall();
} else {
setActualCall(nullptr);
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
......@@ -477,7 +547,7 @@ CallWidget::on_btnvideo_clicked()
}
void
CallWidget::on_btnchat_clicked()
CallWidget::showIMOutOfCall()
{
if (not highLightedIndex_.isValid())
return;
......@@ -487,20 +557,21 @@ CallWidget::on_btnchat_clicked()
ui->contactMethodComboBox->clear();
auto nodeIdx = RecentModel::instance().peopleProxy()->mapToSource(highLightedIndex_);
ui->imNameLabel->setText(QString(tr("Conversation with %1", "%1 is the contact name"))
.arg(nodeIdx.data(static_cast<int>(Ring::Role::Name)).toString()));
auto cmVector = RecentModel::instance().getContactMethods(nodeIdx);
ui->contactMethodComboBox->setEnabled(cmVector.size() > 1);
foreach (const ContactMethod* cm, cmVector) {
ui->contactMethodComboBox->addItem(cm->uri());
ui->contactMethodComboBox->addItem(cm->uri());
}
ui->stackedWidget->currentWidget() == ui->messagingPage ?
ui->stackedWidget->setCurrentWidget(ui->welcomePage) :
ui->stackedWidget->setCurrentWidget(ui->messagingPage);
ui->stackedWidget->setCurrentWidget(ui->messagingPage);
}
void
CallWidget::on_sendButton_clicked()
{
if (ui->messageEdit->text().isEmpty())
if (ui->messageEdit->text().trimmed().isEmpty())
return;
auto number = ui->contactMethodComboBox->currentText();
if (auto cm = PhoneDirectoryModel::instance().getNumber(number)) {
......@@ -527,9 +598,9 @@ CallWidget::on_contactMethodComboBox_currentIndexChanged(const QString& number)
ui->listMessageView->setModel(txtRecording->instantMessagingModel());
disconnect(imConnection_);
imConnection_ = connect(txtRecording,
SIGNAL(messageInserted(QMap<QString,QString>,ContactMethod*,Media::Media::Direction)),
this,
SLOT(slotAccountMessageReceived(QMap<QString,QString>,ContactMethod*,Media::Media::Direction)));
SIGNAL(messageInserted(QMap<QString,QString>,ContactMethod*,Media::Media::Direction)),
this,
SLOT(slotAccountMessageReceived(QMap<QString,QString>,ContactMethod*,Media::Media::Direction)));
ui->listMessageView->scrollToBottom();
}
}
......@@ -551,3 +622,8 @@ CallWidget::on_ringContactLineEdit_textEdited(const QString& text)
{
RecentModel::instance().peopleProxy()->setFilterWildcard(text);
}
void CallWidget::on_imBackButton_clicked()
{
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
}
......@@ -61,7 +61,7 @@ public slots:
void on_ringContactLineEdit_returnPressed();
void on_btnCall_clicked();
void on_btnvideo_clicked();
void on_btnchat_clicked();
void showIMOutOfCall();
inline void on_entered(const QModelIndex& i){highLightedIndex_ = i;};
//UI SLOTS
......@@ -76,6 +76,7 @@ private slots:
void on_messageEdit_returnPressed();
void on_contactMethodComboBox_currentIndexChanged(const QString& number);
void on_ringContactLineEdit_textEdited(const QString& text);
void on_imBackButton_clicked();
private slots:
void callIncoming(Call* call);
......@@ -104,5 +105,7 @@ private:
void findRingAccount();
void setActualCall(Call* value);
void placeCall();
void setupOutOfCallIM();
void setupSmartListMenu();
};
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1019</width>
<height>839</height>
<width>1024</width>
<height>724</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -64,6 +64,12 @@
</property>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
......@@ -262,28 +268,105 @@
</layout>
</widget>
<widget class="QWidget" name="messagingPage">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="leftMargin">
<number>0</number>
<number>5</number>
</property>
<property name="topMargin">
<number>0</number>
<number>5</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>5</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>2</number>
</property>
<item>
<widget class="QListView" name="listMessageView">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="bottomMargin">
<number>0</number>
</property>
</widget>
<item>
<widget class="QPushButton" name="imBackButton">
<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="text">
<string/>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="imNameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Conversation with</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="contactMethodComboBox"/>
</item>
</layout>
</item>
<item>
<widget class="QComboBox" name="contactMethodComboBox"/>
<widget class="QListView" name="listMessageView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="selectionRectVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
......@@ -927,6 +1010,9 @@
<height>0</height>
</size>
</property>
<property name="indentation">
<number>0</number>
</property>
</widget>
</item>
</layout>
......
......@@ -66,25 +66,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnchat">
<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="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btncontactinfo">
<property name="minimumSize">
......@@ -106,8 +87,6 @@
</item>
</layout>
</widget>
<resources>
<include location="ressources.qrc"/>
</resources>
<resources/>
<connections/>
</ui>
......@@ -96,6 +96,9 @@ ContactDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QSize result = QStyledItemDelegate::sizeHint(option, index);
result.setHeight((result.height()*2)+2);
auto height = (result.height()*2)+2;
if (height < sizeImage_)
height = sizeImage_;
result.setHeight(height);
return result;
}
......@@ -35,6 +35,6 @@ protected:
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
private:
constexpr static int sizeImage_ = 49;
constexpr static int sizeImage_ = 48;
};
......@@ -37,6 +37,9 @@ HistoryDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
Call::Direction direction = index.model()->data(index, static_cast<int>(Call::Role::Direction)).value<Call::Direction>();
opt.text.clear();
opt.decorationSize = QSize(imgSize_,imgSize_);
opt.decorationPosition = QStyleOptionViewItem::Left;
opt.decorationAlignment = Qt::AlignCenter;
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget);
auto rect = opt.rect;
......@@ -46,11 +49,11 @@ HistoryDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->setPen(opt.palette.color(cg, QPalette::Text));
painter->setOpacity(1.0);
if (not number.isEmpty()) {
painter->drawText(QRect(rect.left(), rect.top(), rect.width(), rect.height()/2),
opt.displayAlignment, name);
painter->drawText(QRect(rect.left() +imgSize_ + 5, rect.top(), rect.width(), rect.height()/2),
Qt::AlignBottom, name);
painter->setOpacity(0.7);
painter->drawText(QRect(rect.left(), rect.top() + rect.height()/2, rect.width(), rect.height()/2),
opt.displayAlignment, number);
painter->drawText(QRect(rect.left()+imgSize_ + 5, rect.top() + rect.height()/2, rect.width(), rect.height()/2),
Qt::AlignTop, number);
painter->setOpacity(1.0);
QImage arrow;
switch (direction) {
......@@ -73,10 +76,5 @@ QSize
HistoryDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
QSize result = QStyledItemDelegate::sizeHint(option, index);
if (not index.model()->data(index, static_cast<int>(Call::Role::Number)).toString().isEmpty()) {
result.setHeight(result.height()*2);
} else {
result.setHeight(result.height());
}
return result;
}
<svg fill="#FFFFFF" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>
</svg>
\ No newline at end of file
......@@ -21,67 +21,120 @@
#include "media/text.h"
#include "media/textrecording.h"
#include <QApplication>
ImDelegate::ImDelegate(QObject *parent)
: QStyledItemDelegate(parent), showDate_(false), showAuthor_(false)
{}
void ImDelegate::setDisplayOptions(ImDelegate::DisplayOptions opt)
{
qDebug() << opt;
showAuthor_ = opt & DisplayOptions::AUTHOR;
showDate_ = opt & DisplayOptions::DATE;
emit sizeHintChanged(QModelIndex());
}
void
ImDelegate::formatMsg(const QModelIndex& index, QString& msg) const
{
if (showAuthor_) {
auto author = index.data(
static_cast<int>(Media::TextRecording::Role::AuthorDisplayname)).toString();
msg = QString("(%1)\n%2").arg(author, msg);
}
if (showDate_) {
auto formattedDate = index.data(
static_cast<int>(Media::TextRecording::Role::FormattedDate)).toString();
msg = QString("%2\n%1").arg(formattedDate, msg);
}
}
void
ImDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
ImDelegate::paint(QPainter* painter,
const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
if (index.isValid()) {
auto msg = index.model()->data(index, Qt::DisplayRole).toString();
auto msg = index.data(Qt::DisplayRole).toString();
opt.text.clear();
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget);
auto rect = opt.rect;
QStyle* style = opt.widget ? opt.widget->style() : QApplication::style();
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled
? QPalette::Normal : QPalette::Disabled;
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active))
cg = QPalette::Inactive;
painter->setPen(opt.palette.color(cg, QPalette::Text));
painter->setOpacity(1.0);
auto dir = index.model()->data(
index,
static_cast<int>(Media::TextRecording::Role::Direction))
auto dir = index.data(static_cast<int>(Media::TextRecording::Role::Direction))
.value<Media::Media::Direction>() == Media::Media::Direction::IN
? Qt::AlignLeft : Qt::AlignRight;
if (showAuthor_) {
auto author = index.model()->
data(index,
static_cast<int>(Media::TextRecording::Role::AuthorDisplayname)).toString();
msg = QString("(%1) %2").arg(author, msg);
formatMsg(index, msg);
QRect textRect = getBoundingRect(dir, msg, opt);
QRect bubbleRect(textRect.left() - padding_, textRect.top() - padding_, textRect.width() + padding_, textRect.height() + padding_);
bubbleRect.setBottom(bubbleRect.bottom() + padding_);
bubbleRect.setRight(bubbleRect.right() + padding_);
opt.decorationSize = iconSize_;
opt.decorationPosition = (dir == Qt::AlignRight ? QStyleOptionViewItem::Right : QStyleOptionViewItem::Left);
opt.decorationAlignment = Qt::AlignTop | Qt::AlignHCenter;
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget);
if (dir == Qt::AlignRight) {
painter->fillRect(bubbleRect, blue);
}
if (showDate_) {
auto formattedDate = index.model()->
data(index,
static_cast<int>(Media::TextRecording::Role::FormattedDate)).toString();
msg = QString("[%1] %2").arg(formattedDate, msg);
else {
painter->fillRect(bubbleRect, grey);
}
painter->drawText(QRect(rect.left(), rect.top(), rect.width(), rect.height()),
dir, msg);
painter->drawText(textRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, msg);
}
}
QRect ImDelegate::getBoundingRect(const Qt::AlignmentFlag& dir, const QString& msg, const QStyleOptionViewItem &option) const
{
QFont textFont = option.font;
QFontMetrics textFontMetrics(textFont);
QRect textRect;
if (dir == Qt::AlignRight) {
textRect = textFontMetrics.boundingRect(option.rect.left(),
option.rect.top() + padding_,
option.rect.width() - iconSize_.width() - 2 * padding_,
0,
dir|Qt::AlignTop|Qt::TextWordWrap,
msg);
} else {
textRect = textFontMetrics.boundingRect(option.rect.left() + iconSize_.width() + 2 * padding_,
option.rect.top() + padding_,
option.rect.width() - iconSize_.width(),
0,
dir|Qt::AlignTop|Qt::TextWordWrap,
msg);
}
return textRect;
}
QSize
ImDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
ImDelegate::sizeHint(const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
QSize result = QStyledItemDelegate::sizeHint(option, index);
result.setHeight(result.height());
return result;
QString msg = index.data(Qt::DisplayRole).toString();
auto dir = index.data(
static_cast<int>(Media::TextRecording::Role::Direction))
.value<Media::Media::Direction>() == Media::Media::Direction::IN
? Qt::AlignLeft : Qt::AlignRight;
formatMsg(index, msg);
QRect subheaderRect = getBoundingRect(dir, msg, option);
QSize size(option.rect.width(), subheaderRect.height() + 3 * padding_);
/* Keep the minimum height needed. */
if(size.height() < iconSize_.height())
size.setHeight(iconSize_.height() + 3 * padding_);
return size;
}
......@@ -18,11 +18,8 @@
#pragma once
#include <QObject>
#include <QApplication>
#include <QPainter>
#include <QStyledItemDelegate>
#include <QSettings>
class ImDelegate : public QStyledItemDelegate
{
......@@ -36,10 +33,18 @@ public:
void setDisplayOptions(DisplayOptions opt);
protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
private:
bool showDate_;
bool showAuthor_;
void formatMsg(const QModelIndex& index, QString& msg) const;
QRect getBoundingRect(const Qt::AlignmentFlag& dir, const QString& msg, const QStyleOptionViewItem &option) const;
const QColor blue {"#3AC0D2"};
const QColor grey {"#f2f2f2"};
const QSize iconSize_ {38,38};
constexpr static int padding_ = 5;
};
......@@ -11,7 +11,7 @@
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -20,10 +20,28 @@
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QListView" name="messageOutput">
<property name="wordWrap">
<bool>true</bool>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
......
/***************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *