Commit 7548e73b authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Sébastien Blin

remove incorrectly functioning widgets/views based on old lrc

- Removes callutilsdialog and contactpicker used as a filtered
  smartlist proxy for selecting contacts when transferring SIP
  calls or adding to a conference.

- Removes some other widgets that were not being used.

- Diminishes use of old lrc models.

Change-Id: I17847c87a67d117e47dd5db9ca35b2139159312c
Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
parent 7a9dd452
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2015-2017 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 *
* 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>
#include <QMap>
#include <QTableWidgetItem>
#include "accountmodel.h"
#include "codecmodel.h"
#include "account.h"
class QPushButton;
namespace Ui {
class AccountDetails;
}
class AccountDetails : public QWidget
{
Q_OBJECT
public:
explicit AccountDetails(QWidget* parent = 0);
~AccountDetails();
void setAccount(Account* currentAccount);
void save();
//UI SLOTS
private slots:
void on_upAudioButton_clicked();
void on_downAudioButton_clicked();
void on_upVideoButton_clicked();
void on_downVideoButton_clicked();
void on_playButton_clicked();
void on_addDeviceButton_clicked();
void on_cancelButton_clicked();
void on_exportOnRingButton_clicked();
void on_exportEndedOkButton_clicked();
void on_cancelAddButton_clicked();
void on_devicesStackedWidget_currentChanged(int arg1);
void on_registerButton_clicked();
private slots:
void onCertButtonClicked();
void ringtonesBoxCurrentIndexChanged(int index);
void audioCodecSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
void videoCodecSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
void exportOnRingEnded(Account::ExportOnRingStatus state, const QString& pin);
void handle_nameRegistrationEnded(NameDirectory::RegisterNameStatus status, const QString& name);
void on_changePassBtn_clicked();
void on_confirmChangeBtn_clicked();
void on_cancelChangeBtn_clicked();
private:
Ui::AccountDetails* ui;
CodecModel* codecModel_;
Account* currentAccount_;
typedef void (Account::*ACC_PTR)(const QString&);
QMap<QString, ACC_PTR > certMap_;
void stopRingtone();
void resetPasswordChangeUI();
};
This source diff could not be displayed because it is too large. You can view the blob instead.
/***************************************************************************
* Copyright (C) 2015-2017 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 *
* 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 "accountstatedelegate.h"
#include "accountmodel.h"
#include "account.h"
AccountStateDelegate::AccountStateDelegate(QObject* parent) :
QStyledItemDelegate(parent)
{}
void
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();
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget);
auto rect = opt.rect;
auto font = painter->font();
font.setPointSize(12);
painter->setFont(font);
painter->setOpacity(1.0);
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
{
QSize result = QStyledItemDelegate::sizeHint(option, index);
return result;
}
/***************************************************************************
* Copyright (C) 2015-2017 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 *
* 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 <QObject>
#include <QString>
#include <QPainter>
#include <QApplication>
#include <QStyledItemDelegate>
class AccountStateDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit AccountStateDelegate(QObject *parent = 0);
protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
/***************************************************************************
* Copyright (C) 2015-2017 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 *
* 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 "callutilsdialog.h"
#include "ui_callutilsdialog.h"
#include <QBitmap>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#include <QScrollBar>
#include "callmodel.h"
#include "phonedirectorymodel.h"
#include "recentmodel.h"
#include "contactmethod.h"
#include "person.h"
CallUtilsDialog::CallUtilsDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::CallUtilsDialog),
confMode_(false),
conversationItemDelegate_(nullptr),
notCurrentProxyModel_(nullptr),
spikeMask_(new QPixmap(":/images/spikeMask.png"))
{
ui->setupUi(this);
this->setWindowFlags(Qt::CustomizeWindowHint);
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 conversationItemDelegate_;
delete notCurrentProxyModel_;
delete ui;
}
void
CallUtilsDialog::showEvent(QShowEvent* event)
{
Q_UNUSED(event)
ui->numberBar->clear();
if (not notCurrentProxyModel_) {
notCurrentProxyModel_ = new NotCurrentProxyModel(&RecentModel::instance());
}
ui->contactView->setModel(notCurrentProxyModel_);
if (not conversationItemDelegate_) {
conversationItemDelegate_ = new ConversationItemDelegate();
}
ui->contactView->setItemDelegate(conversationItemDelegate_);
emit(isVisible(true));
fadeAnim_->setDirection(QAbstractAnimation::Forward);
fadeAnim_->start();
}
void CallUtilsDialog::removeProxyModel()
{
ui->contactView->setModel(nullptr);
}
void CallUtilsDialog::closeEvent(QCloseEvent* event)
{
//This prevent a crash happening in Qt5.5 in QSortFilterProxyModel
Q_UNUSED(event)
removeProxyModel();
emit(isVisible(false));
}
void
CallUtilsDialog::on_doTransferButton_clicked()
{
auto callList = CallModel::instance().getActiveCalls();
for (auto c : callList) {
if (c->state() == Call::State::CURRENT) {
if (not ui->numberBar->text().isEmpty()) {
auto number = PhoneDirectoryModel::instance().getNumber(ui->numberBar->text());
CallModel::instance().transfer(c, number);
}
removeProxyModel();
this->close();
return;
}
}
}
void
CallUtilsDialog::setConfMode(bool active)
{
confMode_ = active;
ui->doTransferButton->setVisible(not active);
ui->numberBar->setVisible(not active);
}
void
CallUtilsDialog::on_contactView_doubleClicked(const QModelIndex& index)
{
removeProxyModel();
if (not index.isValid())
return;
auto realIdx = notCurrentProxyModel_->mapToSource(index);
if (not RecentModel::instance().hasActiveCall(realIdx)) {
ContactMethod* m = nullptr;
if (auto cm = realIdx.data(static_cast<int>(Call::Role::ContactMethod)).value<ContactMethod*>()) {
m = cm;
} else {
if (auto person = realIdx.data(static_cast<int>(Person::Role::Object)).value<Person*>()) {
m = person->phoneNumbers().first();
}
}
if (confMode_) {
if (m && !RecentModel::instance().index(0, 0, realIdx).isValid()) {
Call* c = CallModel::instance().dialingCall(m, CallModel::instance().selectedCall());
c->performAction(Call::Action::ACCEPT);
}
} else {
if (m) {
auto activeCall = CallModel::instance().selectedCall();
CallModel::instance().transfer(activeCall, m);
}
}
} else {
auto activeCall = CallModel::instance().selectedCall();
auto call = RecentModel::instance().getActiveCall(realIdx);
if (not confMode_)
CallModel::instance().attendedTransfer(activeCall, call);
else
CallModel::instance().createJoinOrMergeConferenceFromCall(activeCall, call);
}
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-2017 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 *
* 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 <QDialog>
#include <QSortFilterProxyModel>
#include "callmodel.h"
#include "recentmodel.h"
#include "conversationitemdelegate.h"
#include <ciso646>
class QPropertyAnimation;
class QGraphicsOpacityEffect;
namespace Ui {
class CallUtilsDialog;
}
class NotCurrentProxyModel : public QSortFilterProxyModel
{
public:
explicit NotCurrentProxyModel(QAbstractItemModel* parent) : QSortFilterProxyModel(parent)
{
setSourceModel(parent);
}
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
{
if (not sourceModel() || source_parent.isValid())
return false;
auto idx = sourceModel()->index(source_row,0,source_parent);
if (not idx.isValid())
return false;
auto call = RecentModel::instance().getActiveCall(idx);
return not call || not (call->state() == Call::State::CURRENT);
}
};
class CallUtilsDialog : public QDialog
{
Q_OBJECT
public:
explicit CallUtilsDialog(QWidget* parent = 0);
~CallUtilsDialog();
void setConfMode(bool active);
protected:
void enterEvent(QEvent* event);
void leaveEvent(QEvent* event);
//UI SLOTS
protected slots:
void showEvent(QShowEvent* event);
void closeEvent(QCloseEvent* event);
private slots:
void on_doTransferButton_clicked();
void on_contactView_doubleClicked(const QModelIndex& index);
private:
Ui::CallUtilsDialog* ui;
bool confMode_;
ConversationItemDelegate* conversationItemDelegate_;
NotCurrentProxyModel* notCurrentProxyModel_;
QPixmap* spikeMask_;
QPropertyAnimation* fadeAnim_;
constexpr static int fadeOverlayTime_ = 250; //msec
QGraphicsOpacityEffect* effect_;
void removeProxyModel();
signals:
void isVisible(bool visible);
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CallUtilsDialog</class>
<widget class="QDialog" name="CallUtilsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<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="toolTip">
<string>existing contacts list</string>
</property>
<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="toolTip">
<string>contact transfer number text entry</string>
</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="toolTip">
<string>Transfer call button</string>
</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>
<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>
<resources/>
<connections/>
</ui>
......@@ -46,7 +46,6 @@
// client
#include "wizarddialog.h"
#include "windowscontactbackend.h"
#include "contactpicker.h"
#include "globalsystemtray.h"
#include "conversationitemdelegate.h"
#include "pixbufmanipulator.h"
......@@ -505,7 +504,7 @@ void
CallWidget::settingsButtonClicked()
{
emit setLeftSizeWidget(ui->currentAccountComboBox->width());
emit NavigationRequested(ScreenEnum::ConfScreen);
emit NavigationRequested(ScreenEnum::SetttingsScreen);
}
void
......
This diff is collapsed.
/**************************************************************************
* Copyright (C) 2015-2017 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* Author: Anthony Léonard <anthony.leonard@savoirfairelinux.com> *
* Author: Olivier Soldano <olivier.soldano@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>
#include <QItemSelection>
#include <QSettings>
#include <QErrorMessage>
#include "navwidget.h"
#include "accountdetails.h"
#include "accountstatedelegate.h"
#include "accountmodel.h"
#include "video/devicemodel.h"
#include "codecmodel.h"
namespace Ui {
class ConfigurationWidget;
}
class ConfigurationWidget : public NavWidget
{
Q_OBJECT
public:
explicit ConfigurationWidget(QWidget *parent = 0);
~ConfigurationWidget();
protected:
void showEvent(QShowEvent *event);
//UI SLOTS
private slots:
void on_deviceBox_currentIndexChanged(int index);
void on_sizeBox_currentIndexChanged(int index);
void on_addAccountButton_clicked();
void on_startupBox_toggled(bool checked);
void on_clearHistoryButton_clicked();
void on_historyDaySettingsSpinBox_valueChanged(int limit);
void on_closeOrMinCheckBox_toggled(bool checked);
void on_checkUpdateButton_clicked();