Commit 0a9fc60a authored by Nicolas Jager's avatar Nicolas Jager Committed by Edric Milaret

improve callutilsdialog and qualitydialog

- adds a fancy shape to callutilsdialog/qualitydialog.
- adds few animation.
- keeps the overlay rendered while callutilsdialog/qualitydialog is open.
- adds the file used as mask for the spike.

Change-Id: I51362f986376d57634c9ded2e548043da7da1384
Tuleap: #148
parent e82782e3
/***************************************************************************
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -19,6 +19,11 @@
#include "callutilsdialog.h"
#include "ui_callutilsdialog.h"
#include <QBitmap>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#include <QScrollBar>
#include "callmodel.h"
#include "phonedirectorymodel.h"
#include "recentmodel.h"
......@@ -30,16 +35,33 @@ CallUtilsDialog::CallUtilsDialog(QWidget* parent) :
ui(new Ui::CallUtilsDialog),
confMode_(false),
smartListDelegate_(nullptr),
notCurrentProxyModel_(nullptr)
notCurrentProxyModel_(nullptr),
spikeMask_(new QPixmap(":/images/spikeMask.png"))
{
ui->setupUi(this);
this->setWindowFlags(Qt::CustomizeWindowHint);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup | Qt::NoDropShadowWindowHint);
ui->spike->setMask(spikeMask_->mask());
effect_ = new QGraphicsOpacityEffect(this);
effect_->setOpacity(1.0);
setGraphicsEffect(effect_);
fadeAnim_ = new QPropertyAnimation(effect_, "opacity");
fadeAnim_->setDuration(fadeOverlayTime_);
fadeAnim_->setStartValue(0.0);
fadeAnim_->setEndValue(1.0);
fadeAnim_->setEasingCurve(QEasingCurve::InExpo);
ui->contactView->verticalScrollBar()->hide();
}
CallUtilsDialog::~CallUtilsDialog()
{
delete effect_;
delete spikeMask_;
delete fadeAnim_;
delete smartListDelegate_;
delete notCurrentProxyModel_;
delete ui;
......@@ -59,6 +81,11 @@ CallUtilsDialog::showEvent(QShowEvent* event)
smartListDelegate_ = new SmartListDelegate();
}
ui->contactView->setItemDelegate(smartListDelegate_);
emit(isVisible(true));
fadeAnim_->setDirection(QAbstractAnimation::Forward);
fadeAnim_->start();
}
void CallUtilsDialog::removeProxyModel()
......@@ -71,6 +98,7 @@ void CallUtilsDialog::closeEvent(QCloseEvent* event)
//This prevent a crash happening in Qt5.5 in QSortFilterProxyModel
Q_UNUSED(event)
removeProxyModel();
emit(isVisible(false));
}
void
......@@ -135,3 +163,17 @@ CallUtilsDialog::on_contactView_doubleClicked(const QModelIndex& index)
}
this->close();
}
void
CallUtilsDialog::enterEvent(QEvent* event)
{
Q_UNUSED(event);
ui->contactView->verticalScrollBar()->show();
}
void
CallUtilsDialog::leaveEvent(QEvent* event)
{
Q_UNUSED(event);
ui->contactView->verticalScrollBar()->hide();
}
/***************************************************************************
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -26,6 +26,9 @@
#include "smartlistdelegate.h"
class QPropertyAnimation;
class QGraphicsOpacityEffect;
namespace Ui {
class CallUtilsDialog;
}
......@@ -59,6 +62,10 @@ public:
void setConfMode(bool active);
protected:
void enterEvent(QEvent* event);
void leaveEvent(QEvent* event);
//UI SLOTS
protected slots:
void showEvent(QShowEvent* event);
......@@ -72,7 +79,15 @@ private:
bool confMode_;
SmartListDelegate* smartListDelegate_;
NotCurrentProxyModel* notCurrentProxyModel_;
QPixmap* spikeMask_;
QPropertyAnimation* fadeAnim_;
constexpr static int fadeOverlayTime_ = 250; //msec
QGraphicsOpacityEffect* effect_;
void removeProxyModel();
signals:
void isVisible(bool visible);
};
......@@ -6,14 +6,17 @@
<rect>
<x>0</x>
<y>0</y>
<width>268</width>
<height>385</height>
<width>400</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
......@@ -27,24 +30,144 @@
<number>4</number>
</property>
<item>
<widget class="QListView" name="contactView"/>
</item>
<item>
<widget class="QLineEdit" name="numberBar">
<property name="placeholderText">
<string>or type number...</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
<widget class="QWidget" name="roundedFrame" native="true">
<layout class="QVBoxLayout" name="tata">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QListView" name="contactView">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="numberBar">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="placeholderText">
<string>or type number...</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="doTransferButton">
<property name="minimumSize">
<size>
<width>200</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Transfer</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="doTransferButton">
<property name="text">
<string>Transfer</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="spike" native="true">
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
......
......@@ -20,24 +20,42 @@
#include "qualitydialog.h"
#include "ui_qualitydialog.h"
#include <QSortFilterProxyModel>
#include <QBitmap>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#include "callmodel.h"
#include "account.h"
#include "codecmodel.h"
#include <QSortFilterProxyModel>
QualityDialog::QualityDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::QualityDialog)
ui(new Ui::QualityDialog),
spikeMask_(new QPixmap(":/images/spikeMask.png"))
{
ui->setupUi(this);
this->setWindowFlags(Qt::CustomizeWindowHint);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup | Qt::NoDropShadowWindowHint);
ui->spike->setMask(spikeMask_->mask());
effect_ = new QGraphicsOpacityEffect(this);
effect_->setOpacity(1.0);
setGraphicsEffect(effect_);
fadeAnim_ = new QPropertyAnimation(effect_, "opacity");
fadeAnim_->setDuration(fadeOverlayTime_);
fadeAnim_->setStartValue(0.0);
fadeAnim_->setEndValue(1.0);
fadeAnim_->setEasingCurve(QEasingCurve::InExpo);
}
QualityDialog::~QualityDialog()
{
delete effect_;
delete spikeMask_;
delete fadeAnim_;
delete ui;
}
......@@ -75,6 +93,18 @@ void QualityDialog::showEvent(QShowEvent* event) {
}
}
ui->autoCheckBox->blockSignals(false);
emit(isVisible(true));
fadeAnim_->setDirection(QAbstractAnimation::Forward);
fadeAnim_->start();
}
void
QualityDialog::closeEvent(QCloseEvent* event)
{
Q_UNUSED(event)
emit(isVisible(false));
}
void
......
......@@ -20,6 +20,9 @@
#include <QDialog>
class QPropertyAnimation;
class QGraphicsOpacityEffect;
namespace Ui {
class QualityDialog;
}
......@@ -34,6 +37,7 @@ public:
protected:
void showEvent(QShowEvent* event);
void closeEvent(QCloseEvent* event);
private slots:
void on_autoCheckBox_toggled(bool checked);
......@@ -42,4 +46,12 @@ private slots:
private:
Ui::QualityDialog *ui;
void setQuality();
QPixmap* spikeMask_;
QPropertyAnimation* fadeAnim_;
constexpr static int fadeOverlayTime_ = 250; //msec
QGraphicsOpacityEffect* effect_;
signals:
void isVisible(bool visible);
};
......@@ -6,49 +6,122 @@
<rect>
<x>0</x>
<y>0</y>
<width>73</width>
<height>194</height>
<width>100</width>
<height>363</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>5</number>
<number>4</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>4</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>4</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSlider" name="qualitySlider">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
<widget class="QWidget" name="roundedFrame" native="true">
<layout class="QVBoxLayout" name="tata_2">
<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>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QSlider" name="qualitySlider">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>0</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="autoCheckBox">
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="bottomMargin">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
......@@ -65,10 +138,20 @@
</spacer>
</item>
<item>
<widget class="QCheckBox" name="autoCheckBox">
<property name="text">
<string>Auto</string>
<widget class="QWidget" name="spike" native="true">
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<zorder>horizontalSpacer</zorder>
</widget>
</item>
<item>
......
......@@ -36,5 +36,6 @@
<file>images/icons/ic_arrow_drop_up_black_9dp_2x.png</file>
<file>images/icons/ic_arrow_tab_next_black_9dp_2x.png</file>
<file>images/icons/ic_arrow_tab_previous_black_9dp_2x.png</file>
<file>images/spikeMask.png</file>
</qresource>
</RCC>
......@@ -54,7 +54,7 @@ QScrollBar::handle:vertical, QScrollBar::handle:horizontal{
background: rgb(255, 255, 255);
}
SmartList, QListView#contactView{
SmartList{
background-color: white;
border: none;
}
......@@ -125,7 +125,7 @@ QListView#listMessageView{
border-top: 1px solid rgb(229, 229, 229);
}
QLineEdit#messageEdit, QLineEdit#imMessageEdit, QLineEdit#numberBar{
QLineEdit#messageEdit, QLineEdit#imMessageEdit{
border-color: rgb(0, 192, 212);
border-radius: 5px;
border-width: 1px;
......@@ -133,6 +133,14 @@ QLineEdit#messageEdit, QLineEdit#imMessageEdit, QLineEdit#numberBar{
background-color: rgb(255, 255, 255);
}
QLineEdit#numberBar{
border-color: rgba(0, 192, 212, 0.6);
border-radius: 5px;
border-width: 2px;
border-style: outset;
background-color: rgba(255, 255, 255, 0.8)
}
QPushButton#holdButton, QPushButton#chatButton, QPushButton#noMicButton, QPushButton#noVideoButton,
QPushButton#transferButton, QPushButton#addPersonButton, QPushButton#joinButton,
QPushButton#qualityButton, QPushButton#recButton{
......@@ -235,11 +243,31 @@ QDialog#WizardDialog, QWidget#welcomePage{
background-position: bottom;
}
QDialog#CallUtilsDialog, QDialog#QualityDialog{
background: transparent;
}
QWidget#roundedFrame{
background-color: rgba(250, 250, 250, 0.8);
border-color: rgba(25, 25, 25, 1.0);
border-radius: 8px;
border:solid 1px;
}
QWidget#spike{
background-color: rgba(250, 250, 250, 0.8);
border-color: rgba(25, 25, 25, 1.0);
}
QListView#contactView{
background: transparent;
}
QWidget#messagingPage{
background: rgb(242, 242, 242);
}
QPushButton#wizardButton, QPushButton#playButton, QPushButton#clearHistoryButton, QPushButton#doTransferButton,
QPushButton#wizardButton, QPushButton#playButton, QPushButton#clearHistoryButton, QPushButton#doTransferButton,
QPushButton#checkUpdateButton{
background-color: #3AC0D2;
border: 0px;
......
/***************************************************************************
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -91,6 +91,16 @@ VideoOverlay::VideoOverlay(QWidget* parent) :
|| contactMethod->contact()->isPlaceHolder());
}
});
transferDialog_->setAttribute(Qt::WA_TranslucentBackground);
connect(transferDialog_, &CallUtilsDialog::isVisible, [this] (bool visible) {
dialogVisible_ = visible;
});
qualityDialog_->setAttribute(Qt::WA_TranslucentBackground);
connect(qualityDialog_, &QualityDialog::isVisible, [this] (bool visible) {
dialogVisible_ = visible;
});
}
VideoOverlay::~VideoOverlay()
......
/***************************************************************************
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Copyright (C) 2015-2016 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -41,6 +41,7 @@ public:
public:
void setName(const QString& name);
void setTime(const QString& time);
inline bool isDialogVisible(){ return dialogVisible_; };
//UI SLOTS
private slots:
......@@ -61,6 +62,7 @@ private:
UserActionModel* actionModel_;
CallUtilsDialog* transferDialog_;
QualityDialog* qualityDialog_;
bool dialogVisible_ = false;
signals:
void setChatVisibility(bool visible);
......
......@@ -125,7 +125,8 @@ void
VideoView::leaveEvent(QEvent* event)
{
Q_UNUSED(event)
fadeAnim_->start(QAbstractAnimation::KeepWhenStopped);
if(not overlay_->isDialogVisible())
fadeAnim_->start(QAbstractAnimation::KeepWhenStopped);
}
void
......
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