Commit 7d40a4a4 authored by Edric Milaret's avatar Edric Milaret

UI: add history tool-buttons

Buttons to sort history entry

Refs #73116

Change-Id: Iab4f35c403a0445c0a257c58f1dc9d0c170060f5
parent db76aa8e
......@@ -114,18 +114,22 @@ win32 {
$$RUNTIMEDIR/libfreetype-6.dll $$RUNTIMEDIR/libglib-2.0-0.dll \
$$RUNTIMEDIR/libharfbuzz-0.dll \
$$RUNTIMEDIR/libintl-8.dll $$RUNTIMEDIR/libpcre-1.dll \
$$RUNTIMEDIR/libpcre16-0.dll $$RUNTIMEDIR/libpng16-16.dll
$$RUNTIMEDIR/libpcre16-0.dll $$RUNTIMEDIR/libpng16-16.dll \
$$RUNTIMEDIR/libjpeg-62.dll
QTDEPSRUNTIME.path = $$OUT_PWD/release
QTPLATFORMS.files = $$(QTDIR)/plugins/platforms/qwindows.dll
QTPLATFORMS.path = $$OUT_PWD/release/platforms
QTPLUGINIMAGE.files = $$(QTDIR)/plugins/imageformats/
QTPLUGINIMAGE.path = $$OUT_PWD/release
LIBSTD.files = $$RUNTIMEDIR/libgcc_s_sjlj-1.dll $$RUNTIMEDIR/libstdc++-6.dll \
$$RUNTIMEDIR/libwinpthread-1.dll
LIBSTD.path = $$OUT_PWD/release
INSTALLS += RINGTONES PACKAGING LICENSE RUNTIME QTRUNTIME QTDEPSRUNTIME \
QTPLATFORMS LIBSTD
QTPLUGINIMAGE QTPLATFORMS LIBSTD
}
......@@ -36,7 +36,8 @@
CallWidget::CallWidget(QWidget *parent) :
NavWidget(Main ,parent),
ui(new Ui::CallWidget)
ui(new Ui::CallWidget),
menu_(new QMenu())
{
ui->setupUi(this);
......@@ -83,6 +84,73 @@ CallWidget::CallWidget(QWidget *parent) :
ui->historyList->setItemDelegate(new HistoryDelegate());
historyModel.release();
auto sortActionGroup = new QActionGroup(this);
auto alphabetAction = new QAction("Alphetical Order Ascending", this);
alphabetAction->setCheckable(true);
sortActionGroup->addAction(alphabetAction);
menu_->addAction(alphabetAction);
connect(alphabetAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::Name));
historyModel->setSortRole(static_cast<int>(Call::Role::Name));
historyModel->sort(0,Qt::AscendingOrder);
});
auto alphabetDownAction = new QAction("Alphetical Order Descending", this);
alphabetDownAction->setCheckable(true);
sortActionGroup->addAction(alphabetDownAction);
menu_->addAction(alphabetDownAction);
connect(alphabetDownAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::Name));
historyModel->setSortRole(static_cast<int>(Call::Role::Name));
historyModel->sort(0,Qt::DescendingOrder);
});
auto dateAction = new QAction("Date Order Ascending", this);
dateAction->setCheckable(true);
sortActionGroup->addAction(dateAction);
menu_->addAction(dateAction);
connect(dateAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::FuzzyDate));
historyModel->setSortRole(static_cast<int>(Call::Role::Date));
historyModel->sort(0,Qt::AscendingOrder);
});
auto dateDownAction = new QAction("Date Order Descending", this);
dateDownAction->setCheckable(true);
sortActionGroup->addAction(dateDownAction);
menu_->addAction(dateDownAction);
connect(dateDownAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::FuzzyDate));
historyModel->setSortRole(static_cast<int>(Call::Role::Date));
historyModel->sort(0,Qt::DescendingOrder);
});
dateDownAction->setChecked(true);
dateDownAction->trigger();
auto callsNumberAction = new QAction("Number of calls ascending", this);
callsNumberAction->setCheckable(true);
sortActionGroup->addAction(callsNumberAction);
menu_->addAction(callsNumberAction);
connect(callsNumberAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::CallCount));
historyModel->setSortRole(static_cast<int>(Call::Role::CallCount));
historyModel->sort(0,Qt::AscendingOrder);
});
auto callsDownNumberAction = new QAction("Number of calls descending", this);
callsDownNumberAction->setCheckable(true);
sortActionGroup->addAction(callsDownNumberAction);
menu_->addAction(callsDownNumberAction);
connect(callsDownNumberAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::CallCount));
historyModel->setSortRole(static_cast<int>(Call::Role::CallCount));
historyModel->sort(0,Qt::DescendingOrder);
});
ui->sortToolButton->setMenu(menu_);
ui->sortToolButton->setPopupMode(QToolButton::InstantPopup);
CategorizedContactModel::instance()->setSortAlphabetical(false);
ui->contactView->setModel(CategorizedContactModel::instance());
ui->contactView->setItemDelegate(new ContactDelegate());
......@@ -281,18 +349,14 @@ CallWidget::atExit() {
void
CallWidget::on_contactView_doubleClicked(const QModelIndex &index)
{
auto contact = index.data((int)ContactMethod::Role::Uri);
QString uri;
if (contact.isValid()) {
uri = contact.toString();
} else {
auto var = index.data((int)Person::Role::Object);
if (var.isValid()) {
Person* person = var.value<Person*>();
if (person->phoneNumbers().size() > 0) {
uri = person->phoneNumbers().at(0)->uri();
}
auto var = index.child(0,0).data(
static_cast<int>(Person::Role::Object));
if (var.isValid()) {
Person* person = var.value<Person*>();
if (person->phoneNumbers().size() > 0) {
uri = person->phoneNumbers().at(0)->uri();
}
}
if (not uri.isEmpty()) {
......
......@@ -22,6 +22,7 @@
#include <QWidget>
#include <QVector>
#include <QString>
#include <QMenu>
#include "navwidget.h"
......@@ -80,6 +81,8 @@ private:
CallModel* callModel_;
int outputVolume_;
int inputVolume_;
QMenu *menu_;
private:
void findRingAccount();
void setActualCall(Call *value);
};
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>700</width>
<height>695</height>
<height>711</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -20,6 +20,25 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="ringIdLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Your Ring ID:</string>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
......@@ -64,7 +83,7 @@
</size>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="historyTab">
<attribute name="title">
......@@ -83,6 +102,34 @@
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="placeholderText">
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="sortToolButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/sort-variant.png</normaloff>:/images/sort-variant.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="historyList">
<property name="sizePolicy">
......@@ -103,6 +150,9 @@
<height>16777215</height>
</size>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>
</layout>
......@@ -125,7 +175,26 @@
<number>4</number>
</property>
<item>
<widget class="QListView" name="contactView"/>
<widget class="QListView" name="contactView">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="resizeMode">
<enum>QListView::Fixed</enum>
</property>
<property name="layoutMode">
<enum>QListView::SinglePass</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
......@@ -170,189 +239,176 @@
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QFrame" name="videoFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>325</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="VideoWidget" name="videoWidget" native="true"/>
</item>
<item>
<widget class="QWidget" name="callInvite" native="true">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="callLabel">
<property name="text">
<string>Call</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="acceptButton">
<property name="text">
<string>Accept</string>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/phone.png</normaloff>:/images/phone.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refuseButton">
<property name="text">
<string>Refuse</string>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/phone-hangup.png</normaloff>:/images/phone-hangup.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="callStateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Call State :</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="horizontalWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="muteSpeakerButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/speaker-off.png</normaloff>:/images/speaker-off.png</iconset>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="speakerSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="muteMicButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/microphone-off.png</normaloff>:/images/microphone-off.png</iconset>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="micSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
<zorder>micSlider</zorder>
<zorder>muteMicButton</zorder>
<zorder>speakerSlider</zorder>
<zorder>muteSpeakerButton</zorder>
</widget>
</item>
<item>
<widget class="QListView" name="messageOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="messageInput"/>
</item>
</layout>
</item>
<item row="1" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="ringIdLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Your Ring ID:</string>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
<widget class="QWidget" name="CallSubGroup" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QFrame" name="videoFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>325</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="VideoWidget" name="videoWidget" native="true"/>
</item>
<item>
<widget class="QWidget" name="callInvite" native="true">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="callLabel">
<property name="text">
<string>Call</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="acceptButton">
<property name="text">
<string>Accept</string>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/phone.png</normaloff>:/images/phone.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refuseButton">
<property name="text">
<string>Refuse</string>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/phone-hangup.png</normaloff>:/images/phone-hangup.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="callStateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Call State :</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="horizontalWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="muteSpeakerButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/speaker-off.png</normaloff>:/images/speaker-off.png</iconset>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="speakerSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="muteMicButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/microphone-off.png</normaloff>:/images/microphone-off.png</iconset>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="micSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
<zorder>micSlider</zorder>
<zorder>muteMicButton</zorder>
<zorder>speakerSlider</zorder>
<zorder>muteSpeakerButton</zorder>
</widget>
</item>
<item>
<widget class="QListView" name="messageOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="messageInput">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
......
......@@ -532,6 +532,9 @@
<height>50</height>
</size>
</property>
<property name="clearButtonEnabled">