Commit 627500d9 authored by Edric Milaret's avatar Edric Milaret Committed by Guillaume Roguez

first Qt-based client version

Refs #68886

Change-Id: I69b44506dc52a18c47f102466472c68fbf08600b
parents
#-------------------------------------------------
#
# Project created by QtCreator 2015-03-23T14:30:35
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets svg
VERSION = 0.0.1
DEFINES += VERSION=\\\"$$VERSION\\\"
TARGET = RingClientWindows
TEMPLATE = app
QMAKE_CXXFLAGS += -std=c++11
CONFIG += console
SOURCES += main.cpp\
mainwindow.cpp \
callwidget.cpp \
configurationwidget.cpp \
navstack.cpp \
navbar.cpp \
mainbar.cpp \
navwidget.cpp \
accountdetails.cpp \
minimalhistorybackend.cpp \
aboutdialog.cpp \
pivotviewwidget.cpp \
pivotcontrol.cpp \
videowidget.cpp
HEADERS += mainwindow.h \
callwidget.h \
configurationwidget.h \
navstack.h \
navbar.h \
mainbar.h \
navwidget.h \
accountdetails.h \
minimalhistorybackend.h \
aboutdialog.h \
pivotviewwidget.h \
pivotcontrol.h \
videowidget.h
FORMS += mainwindow.ui \
callwidget.ui \
configurationwidget.ui \
navbar.ui \
mainbar.ui \
accountdetails.ui \
aboutdialog.ui \
pivotviewwidget.ui
INCLUDEPATH += /home/edric/Documents/CrossWorkspace/ring/binArch/include/libringclient
win32: LIBS += -L/home/edric/Documents/CrossWorkspace/ring/binArch/lib/ -lringclient
linux: LIBS += -L/usr/local/lib/ -lringclient
RESOURCES += \
ressources.qrc
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2011-2015 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 "aboutdialog.h"
#include "ui_aboutdialog.h"
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
this->setWindowFlags(Qt::CustomizeWindowHint);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(this->width(),this->height());
ui->creditsWidget->hide();
ui->clientVersionLabel->setText(
QString("<html><head/><body><p><span style=\" font-weight:600;\">Windows Ring v")
+ VERSION
+ "</span></p></body></html>");
}
AboutDialog::~AboutDialog()
{
delete ui;
}
void
AboutDialog::on_aboutButton_toggled(bool checked)
{
ui->creditsButton->setChecked(!checked);
ui->aboutWidget->setVisible(checked);
ui->creditsWidget->setVisible(!checked);
}
void
AboutDialog::on_creditsButton_clicked(bool checked)
{
ui->aboutButton->setChecked(!checked);
ui->creditsWidget->setVisible(checked);
ui->aboutWidget->setVisible(!checked);
}
void
AboutDialog::on_toolButton_clicked()
{
this->close();
}
/***************************************************************************
* Copyright (C) 2011-2015 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/>. *
**************************************************************************/
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
//UI SLOTS
private slots:
void on_aboutButton_toggled(bool checked);
void on_creditsButton_clicked(bool checked);
void on_toolButton_clicked();
private:
Ui::AboutDialog *ui;
};
#endif // ABOUTDIALOG_H
This diff is collapsed.
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2011-2015 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/>. *
**************************************************************************/
#ifndef ACCOUNTDETAILS_H
#define ACCOUNTDETAILS_H
#include <QWidget>
#include <QTableWidgetItem>
#include "accountmodel.h"
#include "audio/codecmodel.h"
namespace Ui {
class AccountDetails;
}
class AccountDetails : public QWidget
{
Q_OBJECT
private:
enum CodecType { AUDIO, VIDEO, ALL };
public:
explicit AccountDetails(QWidget *parent = 0);
~AccountDetails();
void setAccount(Account *currentAccount);
void reloadCodec(CodecType type = CodecType::ALL);
void save();
//UI SLOTS
private slots:
void on_upAudioButton_clicked();
void on_downAudioButton_clicked();
void on_upVideoButton_clicked();
void on_downVideoButton_clicked();
void on_audioCodecView_itemSelectionChanged();
void on_videoCodecView_itemSelectionChanged();
void on_hostnameEdit_editingFinished();
void on_usernameEdit_editingFinished();
void on_passwordEdit_editingFinished();
void on_proxyEdit_editingFinished();
void on_voicemailEdit_editingFinished();
void on_tabWidget_currentChanged(int index);
private slots:
void audio_codec_checked(int row, int column);
void setVideoEnabled(bool enabled);
void video_codec_checked(int row, int column);
void setAutoAnswer(bool enabled);
void aliasChanged();
void bootstrapChanged();
private:
Ui::AccountDetails *ui;
CodecModel* codecModel_;
Account* currentAccount_;
bool codecModelModified;
};
#endif // ACCOUNTDETAILS_H
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2011-2015 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 "callwidget.h"
#include "ui_callwidget.h"
#include "imconversationmanager.h"
#include "instantmessagingmodel.h"
#include "audio/settings.h"
#include "personmodel.h"
#include "fallbackpersoncollection.h"
#include "accountmodel.h"
CallWidget::CallWidget(QWidget *parent) :
NavWidget(Main ,parent),
ui(new Ui::CallWidget)
{
ui->setupUi(this);
ui->holdButton->setCheckable(true);
ui->muteMicButton->setCheckable(true);
ui->muteSpeakerButton->setCheckable(true);
ui->callInvite->setVisible(false);
actualCall_ = nullptr;
videoRenderer_ = nullptr;
try {
callModel_ = CallModel::instance();
connect(callModel_, SIGNAL(incomingCall(Call*)),
this, SLOT(callIncoming(Call*)));
connect(callModel_, SIGNAL(callAdded(Call*,Call*)),
this, SLOT(addedCall(Call*, Call*)));
connect(callModel_, SIGNAL(callStateChanged(Call*, Call::State)),
this, SLOT(callStateChanged(Call*, Call::State)));
ui->callList->setModel(callModel_);
CategorizedHistoryModel::instance()->
addCollection<MinimalHistoryBackend>(LoadOptions::FORCE_ENABLED);
ui->historyList->setModel(CategorizedHistoryModel::instance());
ui->speakerSlider->setValue(Audio::Settings::instance()->playbackVolume());
ui->micSlider->setValue(Audio::Settings::instance()->captureVolume());
findRingAccount();
} catch (...) {
qDebug() << "INIT ERROR";
}
}
CallWidget::~CallWidget()
{
delete ui;
}
void
CallWidget::findRingAccount() {
auto a_count = AccountModel::instance()->rowCount();
auto found = false;
for (int i = 0; i < a_count; ++i) {
auto idx = AccountModel::instance()->index(i, 0);
auto protocol = idx.data(static_cast<int>(Account::Role::Proto));
if ((Account::Protocol)protocol.toUInt() == Account::Protocol::RING) {
auto username = idx.data(static_cast<int>(Account::Role::Username));
ui->ringIdLabel->setText(
ui->ringIdLabel->text() + " " + username.toString());
found = true;
return;
}
}
if (!found) {
AccountModel::instance()->add("RING", Account::Protocol::RING);
AccountModel::instance()->save();
findRingAccount();
}
}
void
CallWidget::callIncoming(Call *call)
{
if (!call->account()->isAutoAnswer())
ui->callInvite->setVisible(true);
actualCall_ = call;
}
void
CallWidget::on_acceptButton_clicked()
{
if (actualCall_ != nullptr)
actualCall_->performAction(Call::Action::ACCEPT);
ui->callInvite->setVisible(false);
}
void
CallWidget::on_refuseButton_clicked()
{
if (actualCall_ == nullptr)
return;
actualCall_->performAction(Call::Action::REFUSE);
actualCall_ = nullptr;
ui->callInvite->setVisible(false);
}
void
CallWidget::on_holdButton_toggled(bool checked)
{
Q_UNUSED(checked)
if (actualCall_ == nullptr)
return;
actualCall_->performAction(Call::Action::HOLD);
}
void
CallWidget::on_hangupButton_clicked()
{
if (actualCall_ == nullptr)
return;
actualCall_->performAction(Call::Action::REFUSE);
}
void
CallWidget::addedCall(Call* call, Call* parent) {
Q_UNUSED(parent);
if (call->direction() == Call::Direction::OUTGOING) {
actualCall_ = call;
}
}
void
CallWidget::callStateChanged(Call* call, Call::State previousState) {
Q_UNUSED(previousState)
ui->callList->setCurrentIndex(callModel_->getIndex(actualCall_));
if (call->state() == Call::State::OVER) {
actualCall_ = nullptr;
ui->videoWidget->hide();
} else {
ui->videoWidget->show();
connect(actualCall_, SIGNAL(isOver(Call*)),
this, SLOT(callStateChanged(Call*,Call::State::OVER)));
ui->messageOutput->setModel(
IMConversationManager::instance()->getModel(actualCall_));
}
}
void
CallWidget::on_callList_activated(const QModelIndex &index)
{
Call *callSelected = callModel_->getCall(index);
if (actualCall_ != nullptr) {
if (callSelected == actualCall_)
return;
actualCall_->performAction(Call::Action::HOLD);
}
actualCall_ = callSelected;
actualCall_->performAction(Call::Action::HOLD);
}
void
CallWidget::on_muteSpeakerButton_toggled(bool checked)
{
Audio::Settings::instance()->mutePlayback(checked);
}
void
CallWidget::on_muteMicButton_toggled(bool checked)
{
Audio::Settings::instance()->muteCapture(checked);
}
void
CallWidget::on_speakerSlider_sliderMoved(int position)
{
outputVolume_ = position;
}
void
CallWidget::on_speakerSlider_sliderReleased()
{
emit Audio::Settings::instance()->setPlaybackVolume(outputVolume_);
}
void
CallWidget::on_micSlider_sliderMoved(int position)
{
inputVolume_ = position;
}
void
CallWidget::on_micSlider_sliderReleased()
{
emit Audio::Settings::instance()->setCaptureVolume(inputVolume_);
}
void
CallWidget::atExit() {
}
/***************************************************************************
* Copyright (C) 2011-2015 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/>. *
**************************************************************************/
#ifndef CALLWIDGET_H
#define CALLWIDGET_H
#include <QWidget>
#include "navwidget.h"
#include "callmodel.h"
#include "video/renderer.h"
#include "video/previewmanager.h"
#include "categorizedhistorymodel.h"
#include "minimalhistorybackend.h"
namespace Ui {
class CallWidget;
}
class CallWidget : public NavWidget
{
Q_OBJECT
public:
explicit CallWidget(QWidget *parent = 0);
~CallWidget();
void atExit();
//UI SLOTS
private slots:
void on_acceptButton_clicked();
void on_refuseButton_clicked();
void on_holdButton_toggled(bool checked);
void on_hangupButton_clicked();
void on_callList_activated(const QModelIndex &index);
void on_muteSpeakerButton_toggled(bool checked);
void on_muteMicButton_toggled(bool checked);
void on_speakerSlider_sliderMoved(int position);
void on_speakerSlider_sliderReleased();
void on_micSlider_sliderMoved(int position);
void on_micSlider_sliderReleased();
private slots:
void callIncoming(Call *call);
void addedCall(Call *call, Call *parent);
void callStateChanged(Call *call, Call::State previousState);
private:
Ui::CallWidget *ui;
Call* actualCall_;
Video::Renderer* videoRenderer_;
CallModel* callModel_;
int outputVolume_;
int inputVolume_;
void findRingAccount();
};
#endif // CALLWIDGET_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CallWidget</class>
<widget class="QWidget" name="CallWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>668</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QListView" name="callList">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="historyList">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="holdButton">
<property name="text">
<string>Hold/Unhold</string>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/phone-paused.png</normaloff>:/images/phone-paused.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="hangupButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hangup</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>
<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>