Commit 97a21b4d authored by Nicolas Jager's avatar Nicolas Jager Committed by Edric Milaret

Refurbishing of the MS Windows client UI

Tuleap: #148
Change-Id: Iadcad55172a857941eca0e8160f35dff2eabff5a
parent e36688f4
......@@ -57,7 +57,13 @@ SOURCES += main.cpp\
contactmethodpicker.cpp \
globalsystemtray.cpp \
smartlistdelegate.cpp \
callutilsdialog.cpp
callutilsdialog.cpp \
combar.cpp \
idlabel.cpp \
smartlist.cpp \
mainwindowtoolbar.cpp \
ringcontactlineedit.cpp \
smartlistscrollbar.cpp
HEADERS += mainwindow.h \
callwidget.h \
......@@ -85,7 +91,13 @@ HEADERS += mainwindow.h \
settingskey.h \
globalsystemtray.h \
smartlistdelegate.h \
callutilsdialog.h
callutilsdialog.h \
combar.h \
idlabel.h \
smartlist.h \
mainwindowtoolbar.h \
ringcontactlineedit.h \
smartlistscrollbar.h
FORMS += mainwindow.ui \
callwidget.ui \
......@@ -99,7 +111,8 @@ FORMS += mainwindow.ui \
videooverlay.ui \
contactpicker.ui \
contactmethodpicker.ui \
callutilsdialog.ui
callutilsdialog.ui \
combar.ui
win32: LIBS += -lole32 -luuid -lshlwapi
......
......@@ -38,7 +38,6 @@
#include "media/textrecording.h"
#include "recentmodel.h"
#include "wizarddialog.h"
#include "windowscontactbackend.h"
#include "contactpicker.h"
......@@ -48,13 +47,35 @@
#include "contactdelegate.h"
#include "smartlistdelegate.h"
CallWidget::CallWidget(QWidget *parent) :
CallWidget::CallWidget(QWidget* parent) :
NavWidget(END ,parent),
ui(new Ui::CallWidget),
menu_(new QMenu())
{
setMouseTracking(true);
ui->setupUi(this);
// TODO : add this in style sheet forms
QPalette palette;
palette.setColor(QPalette::WindowText, QColor(255,255,255));
ui->callerIdLabel->setPalette(palette);
QPalette palette2;
palette2.setColor(QPalette::WindowText, QColor(141,141,141));
ui->wantToTalkLabel->setPalette(palette2);
ui->outboundCallLabel->setPalette(palette2);
ui->cancelCallLabel->setPalette(palette2);
ui->acceptLabel->setPalette(palette2);
ui->refuseLabel->setPalette(palette2);
QFont font = ui->callerIdLabel->font();
font.setPointSize(20);
ui->callerIdLabel->setFont(font);
// end of TODO : add this in style sheet forms
ui->callInvite->setVisible(false);
setActualCall(nullptr);
......@@ -63,12 +84,6 @@ CallWidget::CallWidget(QWidget *parent) :
connect(ui->videoWidget, SIGNAL(setChatVisibility(bool)),
ui->instantMessagingWidget, SLOT(setVisible(bool)));
ui->spinnerWidget->hide();
spinner_ = new QMovie(":/images/spinner.gif");
if (spinner_->isValid()) {
ui->spinnerLabel->setMovie(spinner_);
}
QPixmap logo(":/images/logo-ring-standard-coul.png");
ui->ringLogo->setPixmap(logo.scaledToHeight(100, Qt::SmoothTransformation));
ui->ringLogo->setAlignment(Qt::AlignHCenter);
......@@ -93,9 +108,11 @@ CallWidget::CallWidget(QWidget *parent) :
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this,
SLOT(smartListSelectionChanged(QItemSelection,QItemSelection)));
connect(ui->smartList, &QTreeView::entered, this, &CallWidget::on_entered);
smartListDelegate_ = new SmartListDelegate();
ui->smartList->setItemDelegate(smartListDelegate_);
ui->smartList->setHeaderHidden(true);
ui->smartList->setSmartListItemDelegate(smartListDelegate_);
PersonModel::instance().
addCollection<WindowsContactBackend>(LoadOptions::FORCE_ENABLED);
......@@ -158,7 +175,6 @@ CallWidget::CallWidget(QWidget *parent) :
CallWidget::~CallWidget()
{
delete ui;
delete spinner_;
delete menu_;
delete contactDelegate_;
}
......@@ -182,7 +198,7 @@ CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec
return;
}
}
if (not found){
if (not found) {
ui->ringIdLabel->setText(tr("NO RING ACCOUNT FOUND"));
}
}
......@@ -215,15 +231,17 @@ CallWidget::findRingAccount()
}
void
CallWidget::callIncoming(Call *call)
CallWidget::callIncoming(Call* call)
{
ui->outboundCall->hide();
if (!QApplication::activeWindow()) {
GlobalSystemTray::instance().showMessage("Ring", "Call incoming from " + call->formattedName());
QApplication::alert(this, 5000);
}
if (!call->account()->isAutoAnswer()) {
ui->callLabel->setText(QString(tr("Call from %1", "%1 is the name of the caller"))
ui->callerIdLabel->setText(QString(tr("%1", "%1 is the name of the caller"))
.arg(call->formattedName()));
ui->stackedWidget->setCurrentWidget(ui->callInvitePage);
ui->callInvite->setVisible(true);
......@@ -257,7 +275,6 @@ CallWidget::addedCall(Call* call, Call* parent)
{
Q_UNUSED(parent);
if (call->direction() == Call::Direction::OUTGOING) {
displaySpinner(true);
setActualCall(call);
ui->stackedWidget->setCurrentWidget(ui->callInvitePage);
}
......@@ -277,7 +294,6 @@ CallWidget::callStateChanged(Call* call, Call::State previousState)
setActualCall(nullptr);
ui->instantMessagingWidget->setMediaText(nullptr);
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
displaySpinner(false);
//TODO : Link this so that recentModel get selected correctly
// auto onHoldCall = callModel_->getActiveCalls().first();
// if (onHoldCall != nullptr && onHoldCall->state() == Call::State::HOLD) {
......@@ -285,7 +301,6 @@ CallWidget::callStateChanged(Call* call, Call::State previousState)
// onHoldCall->performAction(Call::Action::HOLD);
// }
} else if (call->state() == Call::State::CURRENT) {
displaySpinner(false);
ui->instantMessagingWidget->setMediaText(actualCall_);
ui->stackedWidget->setCurrentWidget(ui->videoPage);
}
......@@ -294,11 +309,10 @@ CallWidget::callStateChanged(Call* call, Call::State previousState)
void
CallWidget::atExit()
{
}
void
CallWidget::on_contactView_doubleClicked(const QModelIndex &index)
CallWidget::on_contactView_doubleClicked(const QModelIndex& index)
{
if (not index.isValid())
return;
......@@ -328,7 +342,7 @@ CallWidget::on_contactView_doubleClicked(const QModelIndex &index)
}
void
CallWidget::on_historyList_doubleClicked(const QModelIndex &index)
CallWidget::on_historyList_doubleClicked(const QModelIndex& index)
{
if (not index.isValid())
return;
......@@ -350,14 +364,6 @@ CallWidget::setActualCall(Call* value)
ui->videoWidget->pushRenderer(value);
}
void
CallWidget::displaySpinner(bool display)
{
display ? ui->spinnerWidget->show() : ui->spinnerWidget->hide();
if (ui->spinnerLabel->movie())
display ? ui->spinnerLabel->movie()->start() : ui->spinnerLabel->movie()->stop();
}
void
CallWidget::on_cancelButton_clicked()
{
......@@ -366,7 +372,7 @@ CallWidget::on_cancelButton_clicked()
}
void
CallWidget::on_smartList_doubleClicked(const QModelIndex &index)
CallWidget::on_smartList_doubleClicked(const QModelIndex& index)
{
auto realIndex = RecentModel::instance().peopleProxy()->mapToSource(index);
if (RecentModel::instance().hasActiveCall(realIndex))
......@@ -387,7 +393,7 @@ CallWidget::on_smartList_doubleClicked(const QModelIndex &index)
}
void
CallWidget::smartListSelectionChanged(const QItemSelection &newSel, const QItemSelection &oldSel) {
CallWidget::smartListSelectionChanged(const QItemSelection& newSel, const QItemSelection& oldSel) {
Q_UNUSED(oldSel)
......@@ -411,17 +417,11 @@ CallWidget::smartListSelectionChanged(const QItemSelection &newSel, const QItemS
void
CallWidget::placeCall()
{
if (ui->searchEdit->text().isEmpty())
if (ui->ringContactLineEdit->text().isEmpty())
return;
Call* c = CallModel::instance().dialingCall(PhoneDirectoryModel::instance().getNumber(ui->searchEdit->text()));
Call* c = CallModel::instance().dialingCall(PhoneDirectoryModel::instance().getNumber(ui->ringContactLineEdit->text()));
c->performAction(Call::Action::ACCEPT);
ui->searchEdit->clear();
}
void
CallWidget::on_searchEdit_returnPressed()
{
placeCall();
ui->ringContactLineEdit->clear();
}
void
......@@ -433,15 +433,32 @@ CallWidget::on_settingsButton_clicked()
void
CallWidget::on_contactButton_clicked(bool checked)
{
if (checked)
ui->historicButton->setChecked(false);
ui->mainTabMenu->setCurrentIndex(checked ? 1 : 0);
}
void
CallWidget::on_historicButton_clicked(bool checked)
{
if (checked)
ui->contactButton->setChecked(false);
ui->mainTabMenu->setCurrentIndex(checked ? 2 : 0);
}
void
CallWidget::on_ringContactLineEdit_returnPressed()
{
placeCall();
}
void
CallWidget::on_btnCall_clicked()
{
placeCall();
}
void
CallWidget::on_btnvideo_clicked()
{
if (not highLightedIndex_.isValid())
return;
on_smartList_doubleClicked(highLightedIndex_);
}
......@@ -47,47 +47,52 @@ class CallWidget : public NavWidget
Q_OBJECT
public:
explicit CallWidget(QWidget *parent = 0);
explicit CallWidget(QWidget* parent = 0);
~CallWidget();
void atExit();
//UI SLOTS
public slots:
void on_contactButton_clicked(bool checked);
void on_settingsButton_clicked();
void on_historicButton_clicked(bool checked);
void on_ringContactLineEdit_returnPressed();
void on_btnCall_clicked();
void on_btnvideo_clicked();
inline void on_entered(const QModelIndex& i){highLightedIndex_ = i;};
//UI SLOTS
private slots:
void on_acceptButton_clicked();
void on_refuseButton_clicked();
void on_contactView_doubleClicked(const QModelIndex &index);
void on_contactView_doubleClicked(const QModelIndex& index);
void on_cancelButton_clicked();
void on_smartList_doubleClicked(const QModelIndex &index);
void on_searchEdit_returnPressed();
void on_settingsButton_clicked();
void on_historyList_doubleClicked(const QModelIndex &index);
void on_contactButton_clicked(bool checked);
void on_historicButton_clicked(bool checked);
void on_smartList_doubleClicked(const QModelIndex& index);
void on_historyList_doubleClicked(const QModelIndex& index);
private slots:
void callIncoming(Call *call);
void addedCall(Call *call, Call *parent);
void callStateChanged(Call *call, Call::State previousState);
void callIncoming(Call* call);
void addedCall(Call* call, Call* parent);
void callStateChanged(Call* call, Call::State previousState);
void findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec);
void smartListSelectionChanged(const QItemSelection &newSel, const QItemSelection &oldSel);
void smartListSelectionChanged(const QItemSelection& newSel, const QItemSelection& oldSel);
private:
Ui::CallWidget *ui;
Ui::CallWidget* ui;
Call* actualCall_;
Video::Renderer* videoRenderer_;
CallModel* callModel_;
int outputVolume_;
int inputVolume_;
QMenu *menu_;
QMovie *spinner_;
ContactDelegate *contactDelegate_;
HistoryDelegate *historyDelegate_;
QMenu* menu_;
ContactDelegate* contactDelegate_;
HistoryDelegate* historyDelegate_;
SmartListDelegate* smartListDelegate_;
QModelIndex highLightedIndex_;
private:
void findRingAccount();
void setActualCall(Call *value);
void displaySpinner(bool display);
void setActualCall(Call* value);
void placeCall();
};
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2015 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@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/>. *
**************************************************************************/
#include "combar.h"
#include "ui_combar.h"
ComBar::ComBar(QWidget* parent) :
QWidget(parent),
ui(new Ui::ComBar)
{
ui->setupUi(this);
// [jn] these buttons are for further uses
ui->btnchat->hide();
ui->btncontactinfo->hide();
}
ComBar::~ComBar()
{
delete ui;
}
void
ComBar::moveToRow(const QRect& rect)
{
move(rect.right() - width(),
rect.bottom() - height() - (rect.height()/4));
}
/***************************************************************************
* Copyright (C) 2015 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@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>
namespace Ui {
class ComBar;
}
class ComBar : public QWidget
{
Q_OBJECT
public:
explicit ComBar(QWidget* parent = 0);
~ComBar();
public slots:
void moveToRow(const QRect& rect);
private:
Ui::ComBar* ui;
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ComBar</class>
<widget class="QWidget" name="ComBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>116</width>
<height>37</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>116</width>
<height>37</height>
</size>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>7</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>7</number>
</property>
<item>
<widget class="QPushButton" name="btnvideo">
<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="text">
<string/>
</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">
<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>
</layout>
</widget>
<resources>
<include location="ressources.qrc"/>
</resources>
<connections/>
</ui>
/***************************************************************************
* Copyright (C) 2015 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@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/>. *
**************************************************************************/
#include <QClipboard>
#include <QtWidgets/QApplication>
#include "idlabel.h"
IdLabel::IdLabel(QWidget* parent) : QLabel(parent)
{
}
IdLabel::~IdLabel()
{
}
void
IdLabel::mouseDoubleClickEvent(QMouseEvent* event)
{
Q_UNUSED(event);
QApplication::clipboard()->setText(this->text());
}
/***************************************************************************
* Copyright (C) 2015 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@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 <QLabel>
class IdLabel : public QLabel