Commit 74fe46f8 authored by Nicolas Jager's avatar Nicolas Jager

ui : improve configuration menu and contactView

- new icon for settings menu in mainwindow.
- adds animations between navwidgets.
- improves look of contactView.
- improves look of quality dialog.
- removes code for bars not used anymore.
- removes some qdebug left.
- fixes paths icons.

Tuleap: #148
Change-Id: I9f04e9c8d13c2064bfc006d95d2dd1c166160092
parent 3ba22ca2
......@@ -39,7 +39,6 @@ SOURCES += main.cpp\
callwidget.cpp \
configurationwidget.cpp \
navstack.cpp \
navbar.cpp \
navwidget.cpp \
accountdetails.cpp \
aboutdialog.cpp \
......@@ -64,7 +63,6 @@ SOURCES += main.cpp\
combar.cpp \
idlabel.cpp \
smartlist.cpp \
mainwindowtoolbar.cpp \
ringcontactlineedit.cpp \
pixbufmanipulator.cpp \
qualitydialog.cpp
......@@ -73,7 +71,6 @@ HEADERS += mainwindow.h \
callwidget.h \
configurationwidget.h \
navstack.h \
navbar.h \
navwidget.h \
accountdetails.h \
aboutdialog.h \
......@@ -99,7 +96,6 @@ HEADERS += mainwindow.h \
combar.h \
idlabel.h \
smartlist.h \
mainwindowtoolbar.h \
ringcontactlineedit.h \
pixbufmanipulator.h \
qualitydialog.h \
......@@ -113,7 +109,6 @@ contains(DEFINES, URI_PROTOCOL) {
FORMS += mainwindow.ui \
callwidget.ui \
configurationwidget.ui \
navbar.ui \
accountdetails.ui \
aboutdialog.ui \
wizarddialog.ui \
......
/***************************************************************************
* 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 *
......@@ -40,15 +40,6 @@ AccountDetails::AccountDetails(QWidget *parent) :
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
ui->audioCodecView->setShowGrid(false);
ui->audioCodecView->verticalHeader()->hide();
ui->audioCodecView->horizontalHeader()->hide();
ui->videoCodecView->setShowGrid(false);
ui->videoCodecView->verticalHeader()->hide();
ui->videoCodecView->horizontalHeader()->hide();
ui->lrcfg_username->setAlignment(Qt::AlignCenter);
connect(ui->lrcfg_tlsCaListCertificate, SIGNAL(clicked(bool)), this, SLOT(onCertButtonClicked()));
connect(ui->lrcfg_tlsCertificate, SIGNAL(clicked(bool)), this, SLOT(onCertButtonClicked()));
connect(ui->lrcfg_tlsPrivateKeyCertificate, SIGNAL(clicked(bool)), this, SLOT(onCertButtonClicked()));
......@@ -251,3 +242,10 @@ AccountDetails::stopRingtone() {
if (RingtoneModel::instance().isPlaying())
RingtoneModel::instance().play(idx);
}
QPushButton*
AccountDetails::getDeleteAccountButton()
{
return ui->deleteAccountButton;
}
......@@ -27,6 +27,8 @@
#include "audio/codecmodel.h"
#include "account.h"
class QPushButton;
namespace Ui {
class AccountDetails;
}
......@@ -39,6 +41,7 @@ public:
explicit AccountDetails(QWidget* parent = 0);
~AccountDetails();
QPushButton* getDeleteAccountButton();
void setAccount(Account* currentAccount);
void save();
......
This diff is collapsed.
......@@ -21,39 +21,55 @@
#include "accountmodel.h"
#include "account.h"
AccountStateDelegate::AccountStateDelegate(QObject *parent) :
AccountStateDelegate::AccountStateDelegate(QObject* parent) :
QStyledItemDelegate(parent)
{}
void
AccountStateDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
AccountStateDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
painter->setRenderHint(QPainter::Antialiasing);
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
if (index.column() == 0) {
// name & checkbox
auto name = index.model()->data(index, Qt::DisplayRole).toString();
opt.text = QString();
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
QStyle* style = opt.widget ? opt.widget->style() : QApplication::style();
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget);
auto rect = opt.rect;
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ?
QPalette::Normal : QPalette::Disabled;
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active))
cg = QPalette::Inactive;
auto font = painter->font() ;
font.setBold(true);
auto font = painter->font();
font.setPointSize(12);
painter->setFont(font);
painter->setPen(AccountModel::instance().
getAccountByModelIndex(index)->stateColorName());
painter->setOpacity(1.0);
painter->drawText(QRect(rect.left()+25, rect.top(),
opt.displayAlignment = Qt::AlignTop;
painter->setPen(Qt::black);
painter->drawText(QRect(rect.left() + 25, rect.top(),
rect.width(), rect.height()),
opt.displayAlignment, name);
// status
auto account = AccountModel::instance().getAccountByModelIndex(index);
QString stateColor(account->stateColorName());
QString accountStatus = account->toHumanStateName();
painter->setPen(stateColor);
opt.displayAlignment = Qt::AlignBottom|Qt::AlignLeft;
painter->drawText(QRect(rect.left() + 25, rect.top(),
rect.width(), rect.height()),
opt.displayAlignment, accountStatus);
}
}
QSize
AccountStateDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
AccountStateDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QSize result = QStyledItemDelegate::sizeHint(option, index);
return result;
......
......@@ -15,16 +15,16 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>4</number>
</property>
<property name="bottomMargin">
<number>1</number>
<number>4</number>
</property>
<item>
<widget class="QListView" name="contactView"/>
......
......@@ -53,7 +53,7 @@
#include "pixbufmanipulator.h"
CallWidget::CallWidget(QWidget* parent) :
NavWidget(END ,parent),
NavWidget(parent),
ui(new Ui::CallWidget),
menu_(new QMenu()),
imDelegate_(new ImDelegate())
......@@ -65,6 +65,8 @@ CallWidget::CallWidget(QWidget* parent) :
setActualCall(nullptr);
videoRenderer_ = nullptr;
connect(ui->settingsButton, &QPushButton::clicked, this, &CallWidget::settingsButtonClicked);
connect(ui->videoWidget, SIGNAL(setChatVisibility(bool)),
ui->instantMessagingWidget, SLOT(setVisible(bool)));
......@@ -154,7 +156,7 @@ CallWidget::CallWidget(QWidget* parent) :
setupOutOfCallIM();
setupSmartListMenu();
connect(ui->smartList, &SmartList::btnVideoClicked, this, &CallWidget::on_btnComBarVideo_clicked);
connect(ui->smartList, &SmartList::btnVideoClicked, this, &CallWidget::btnComBarVideoClicked);
connect(RecentModel::instance().selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
......@@ -558,20 +560,20 @@ CallWidget::placeCall()
}
void
CallWidget::settingsButton_clicked()
CallWidget::settingsButtonClicked()
{
ui->smartList->reset();
emit NavigationRequested(ScreenEnum::ConfScreen);
}
void
CallWidget::contactButton_clicked(bool checked)
CallWidget::contactButtonClicked(bool checked)
{
ui->mainTabMenu->setCurrentIndex(checked ? 1 : 0);
}
void
CallWidget::historicButton_clicked(bool checked)
CallWidget::historicButtonClicked(bool checked)
{
ui->mainTabMenu->setCurrentIndex(checked ? 2 : 0);
}
......@@ -596,7 +598,7 @@ CallWidget::on_btnCall_clicked()
}
void
CallWidget::on_btnComBarVideo_clicked()
CallWidget::btnComBarVideoClicked()
{
if (not highLightedIndex_.isValid())
return;
......
......@@ -55,15 +55,16 @@ public:
void atExit();
public slots:
void contactButton_clicked(bool checked);
void settingsButton_clicked();
void historicButton_clicked(bool checked);
void contactButtonClicked(bool checked);
void settingsButtonClicked();
void historicButtonClicked(bool checked);
void showIMOutOfCall(const QModelIndex& nodeIdx);
void btnComBarVideoClicked();
//UI SLOTS
public slots:
void on_ringContactLineEdit_returnPressed();
void on_btnCall_clicked();
void on_btnComBarVideo_clicked();
void showIMOutOfCall(const QModelIndex& nodeIdx);
inline void on_entered(const QModelIndex& i){highLightedIndex_ = i;};
//UI SLOTS
......
......@@ -508,6 +508,70 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing">
<number>0</number>
</property>
<property name="topMargin">
<number>7</number>
</property>
<property name="rightMargin">
<number>7</number>
</property>
<item>
<spacer name="horizontalSpacer_11">
<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="settingsButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" 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>settings menu</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/icons/ic_settings_white_48dp_2x.png</normaloff>:/images/icons/ic_settings_white_48dp_2x.png</iconset>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -529,15 +593,30 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>200</height>
<height>100</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
......@@ -699,7 +778,7 @@
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/ic_share_white.png</normaloff>:/images/ic_share_white.png</iconset>
<normaloff>:/images/icons/ic_share_white_24dp_2x.png</normaloff>:/images/icons/ic_share_white_24dp_2x.png</iconset>
</property>
<property name="iconSize">
<size>
......@@ -811,6 +890,9 @@
<height>30</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string/>
</property>
......
......@@ -23,6 +23,7 @@
#include <QDir>
#include <QStandardPaths>
#include <QFileDialog>
#include <QPropertyAnimation>
#include "video/devicemodel.h"
#include "video/channel.h"
......@@ -49,7 +50,7 @@
#endif
ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
NavWidget(Nav, parent),
NavWidget(parent),
ui(new Ui::ConfigurationWidget),
accountModel_(&AccountModel::instance()),
deviceModel_(&Video::DeviceModel::instance()),
......@@ -57,6 +58,26 @@ ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
{
ui->setupUi(this);
connect(ui->exitSettingsButton, &QPushButton::clicked, this, [=]() {
if (CallModel::instance().getActiveCalls().size() == 0
&& Video::PreviewManager::instance().isPreviewing()) {
Video::PreviewManager::instance().stopPreview();
}
accountModel_->save();
accountDetails_->save();
});
connect(accountDetails_->getDeleteAccountButton(), &QPushButton::clicked, this, [=]() {
auto account = accountModel_->getAccountByModelIndex(
ui->accountView->currentIndex());
if (account != accountModel_->ip2ip())
accountModel_->remove(account);
});
connect(ui->exitSettingsButton, &QPushButton::clicked, this, [=]() {
emit NavigationRequested(ScreenEnum::CallScreen);
});
ui->accountView->setModel(accountModel_);
accountStateDelegate_ = new AccountStateDelegate();
ui->accountView->setItemDelegate(accountStateDelegate_);
......@@ -79,7 +100,7 @@ ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
CategorizedHistoryModel::instance().historyLimit());
ui->closeOrMinCheckBox->setChecked(settings_.value(
SettingsKey::closeOrMinimized).toBool());
connect(ui->tabWidget, &QTabWidget::currentChanged, [](int index) {
connect(ui->stackedWidget, &QStackedWidget::currentChanged, [](int index) {
if (index == 1
&& CallModel::instance().getActiveCalls().size() == 0) {
Video::PreviewManager::instance().startPreview();
......@@ -105,6 +126,32 @@ ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
Media::RecordingModel::instance().setAlwaysRecording(checked);
});
connect(ui->generalTabButton, &QPushButton::toggled, [=] (bool toggled) {
if (toggled) {
ui->stackedWidget->setCurrentWidget(ui->generalPage);
ui->videoTabButton->setChecked(false);
ui->accountTabButton->setChecked(false);
}
});
connect(ui->videoTabButton, &QPushButton::toggled, [=] (bool toggled) {
if (toggled) {
ui->stackedWidget->setCurrentWidget(ui->videoPage);
ui->accountTabButton->setChecked(false);
ui->generalTabButton->setChecked(false);
}
});
connect(ui->accountTabButton, &QPushButton::toggled, [=] (bool toggled) {
if (toggled) {
ui->stackedWidget->setCurrentWidget(ui->accountPage);
ui->videoTabButton->setChecked(false);
ui->generalTabButton->setChecked(false);
}
});
ui->generalTabButton->setChecked(true);
#ifndef ENABLE_AUTOUPDATE
ui->checkUpdateButton->hide();
ui->intervalUpdateCheckSpinBox->hide();
......@@ -115,7 +162,7 @@ ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
void ConfigurationWidget::showPreview()
{
if (ui->tabWidget->currentIndex() == 1
if (ui->stackedWidget->currentIndex() == 1
&& CallModel::instance().getActiveCalls().size() == 0) {
ui->previewUnavailable->hide();
ui->videoView->show();
......@@ -139,16 +186,6 @@ ConfigurationWidget::showEvent(QShowEvent *event) {
showPreview();
}
void
ConfigurationWidget::atExit() {
if (CallModel::instance().getActiveCalls().size() == 0
&& Video::PreviewManager::instance().isPreviewing()) {
Video::PreviewManager::instance().stopPreview();
}
accountModel_->save();
accountDetails_->save();
}
ConfigurationWidget::~ConfigurationWidget()
{
delete ui;
......@@ -206,15 +243,6 @@ ConfigurationWidget::accountSelected(QItemSelection itemSel) {
AccountSerializationAdapter adapter(account, accountDetails_);
}
void
ConfigurationWidget::on_deleteAccountButton_clicked()
{
auto account = accountModel_->getAccountByModelIndex(
ui->accountView->currentIndex());
if (account != accountModel_->ip2ip())
accountModel_->remove(account);
}
void
ConfigurationWidget::on_addAccountButton_clicked()
{
......@@ -285,7 +313,7 @@ ConfigurationWidget::on_intervalUpdateCheckSpinBox_valueChanged(int arg1)
}
void
ConfigurationWidget::on_tabWidget_currentChanged(int index)
ConfigurationWidget::on_stackedWidget_currentChanged(int index)
{
Q_UNUSED(index)
showPreview();
......
/***************************************************************************
* 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,7 +41,6 @@ class ConfigurationWidget : public NavWidget
public:
explicit ConfigurationWidget(QWidget *parent = 0);
~ConfigurationWidget();
void atExit();
protected:
void showEvent(QShowEvent *event);
......@@ -50,7 +49,6 @@ protected:
private slots:
void on_deviceBox_currentIndexChanged(int index);
void on_sizeBox_currentIndexChanged(int index);
void on_deleteAccountButton_clicked();
void on_addAccountButton_clicked();
void on_startupBox_toggled(bool checked);
void on_clearHistoryButton_clicked();
......@@ -59,7 +57,7 @@ private slots:
void on_checkUpdateButton_clicked();
void on_autoUpdateCheckBox_toggled(bool checked);
void on_intervalUpdateCheckSpinBox_valueChanged(int arg1);
void on_tabWidget_currentChanged(int index);
void on_stackedWidget_currentChanged(int index);
void on_recordPath_clicked();
private slots:
......
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
<path fill="#00BFD3" d="M30,15c0,8.284-6.716,15-15,15l0,0C6.716,30,0,23.284,0,15l0,0C0,6.716,6.716,0,15,0l0,0
C23.284,0,30,6.716,30,15L30,15z"/>
<g>
<path fill="#FFFFFF" d="M19.715,14.357v1.286c0,0.179-0.062,0.33-0.188,0.455c-0.125,0.125-0.277,0.188-0.457,0.188h-2.785v2.787
c0,0.178-0.062,0.33-0.188,0.455c-0.125,0.125-0.277,0.188-0.455,0.188h-1.286c-0.179,0-0.33-0.062-0.455-0.188
s-0.188-0.277-0.188-0.455v-2.787h-2.785c-0.179,0-0.331-0.062-0.456-0.188c-0.125-0.125-0.188-0.276-0.188-0.455v-1.286
c0-0.179,0.062-0.33,0.188-0.455s0.277-0.188,0.456-0.188h2.785v-2.786c0-0.179,0.062-0.33,0.188-0.455s0.276-0.188,0.455-0.188
h1.286c0.178,0,0.33,0.062,0.455,0.188c0.125,0.125,0.188,0.276,0.188,0.455v2.786h2.785c0.18,0,0.332,0.062,0.457,0.188
S19.715,14.178,19.715,14.357z"/>
</g>
</svg>
<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="M18.5 6C15.46 6 13 8.46 13 11.5c0 1.33.47 2.55 1.26 3.5H9.74c.79-.95 1.26-2.17 1.26-3.5C11 8.46 8.54 6 5.5 6S0 8.46 0 11.5 2.46 17 5.5 17h13c3.04 0 5.5-2.46 5.5-5.5S21.54 6 18.5 6zm-13 9C3.57 15 2 13.43 2 11.5S3.57 8 5.5 8 9 9.57 9 11.5 7.43 15 5.5 15zm13 0c-1.93 0-3.5-1.57-3.5-3.5S16.57 8 18.5 8 22 9.57 22 11.5 20.43 15 18.5 15z"/>
</svg>
\ No newline at end of file