Commit 21ceea22 authored by philippe groarke's avatar philippe groarke

More interface ideas.

parent bff3ad22
......@@ -15,5 +15,8 @@
<file>data/light/ic_action_search.png</file>
<file>data/light/ic_action_accept.png</file>
<file>data/dark/ic_action_accept.png</file>
<file>data/symbol_black.png</file>
<file>data/symbol_blue.png</file>
<file>data/symbol_dark.png</file>
</qresource>
</RCC>
......@@ -10,6 +10,10 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
ui->contact_list->setAttribute(Qt::WA_MacShowFocusRect, false);
// Setup hidden stuff.
ui->answer_bar->hide();
ui->hangup_button->hide();
//setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint);
//setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
......@@ -83,7 +87,84 @@ void MainWindow::connectSlots()
pollTimer_.start(1000);
}
void MainWindow::showAnswerBar()
{
// Make sure everything is ok:
ui->answer_button->show();
ui->decline_button->show();
ui->hangup_button->hide();
// Animatate bar
ui->answer_bar->resize(ui->content_area->width(), 80);
ui->answer_bar->move(0, ui->content_area->height() + ui->answer_bar->height());
QPoint goingTo(0, ui->content_area->height() - ui->answer_bar->height());
ui->answer_bar->show();
QPropertyAnimation* myAnim = new QPropertyAnimation(ui->answer_bar,
"pos",
ui->content_area);
myAnim->setDuration(500);
myAnim->setStartValue(ui->answer_bar->pos());
myAnim->setEasingCurve(QEasingCurve::OutQuart);
myAnim->setEndValue(goingTo);
myAnim->start(QPropertyAnimation::DeleteWhenStopped);
}
void MainWindow::hideAnswerBar()
{
// Move down
QPoint goingTo(0, ui->content_area->height() + ui->answer_bar->height());
QPropertyAnimation* myAnim = new QPropertyAnimation(ui->answer_bar,
"pos",
ui->content_area);
myAnim->setDuration(500);
myAnim->setStartValue(ui->answer_bar->pos());
myAnim->setEasingCurve(QEasingCurve::InQuart);
myAnim->setEndValue(goingTo);
myAnim->start(QPropertyAnimation::DeleteWhenStopped);
}
void MainWindow::transformAnswerBar()
{
QSize answerSize = ui->answer_button->size();
QPoint answerPos = ui->answer_button->pos();
QSize declineSize = ui->decline_button->size();
QPoint declinePos = ui->decline_button->pos();
QPropertyAnimation* answAnim = new QPropertyAnimation(ui->answer_button,
"pos",
ui->answer_bar);
answAnim->setDuration(200);
answAnim->setStartValue(answerPos);
answAnim->setEasingCurve(QEasingCurve::InCubic);
answAnim->setEndValue(QPoint(ui->answer_bar->width() + ui->answer_button->width(),
ui->answer_button->pos().y()));
QObject::connect(answAnim, &QPropertyAnimation::finished, [=]() {
ui->answer_button->hide();
ui->answer_button->resize(answerSize);
});
// Move decline button to center
QPoint center(ui->answer_bar->width() / 2 - ui->hangup_button->width() / 2,
ui->answer_button->pos().y());
QPropertyAnimation* declAnim = new QPropertyAnimation(ui->decline_button,
"pos",
ui->answer_bar);
declAnim->setDuration(200);
declAnim->setStartValue(ui->decline_button->pos());
declAnim->setEasingCurve(QEasingCurve::InOutCubic);
declAnim->setEndValue(center);
QObject::connect(declAnim, &QPropertyAnimation::finished, [=]() {
ui->decline_button->hide();
ui->hangup_button->show();
ui->decline_button->resize(declineSize);
ui->decline_button->move(declinePos);
});
answAnim->start(QPropertyAnimation::DeleteWhenStopped);
declAnim->start(QPropertyAnimation::DeleteWhenStopped);
}
//// SLOTS ////
......@@ -95,7 +176,7 @@ void MainWindow::state_changed(Call *call, Call::State previousState)
void MainWindow::incoming_call(Call *call)
{
qDebug() << "incoming call!";
showAnswerBar();
mainCall_ = call;
}
......@@ -110,6 +191,16 @@ void MainWindow::on_hangup_button_clicked()
{
if (mainCall_)
mainCall_->performAction(Call::Action::REFUSE);
hideAnswerBar();
}
void MainWindow::on_answer_button_clicked()
{
if (mainCall_) {
mainCall_->performAction(Call::Action::ACCEPT);
}
transformAnswerBar();
}
void MainWindow::pollEvents()
......@@ -119,10 +210,11 @@ void MainWindow::pollEvents()
}
void MainWindow::on_answer_button_clicked()
void MainWindow::on_decline_button_clicked()
{
if (mainCall_) {
mainCall_->performAction(Call::Action::ACCEPT);
mainCall_->performAction((Call::Action::REFUSE));
}
hideAnswerBar();
}
......@@ -38,6 +38,9 @@ protected:
private:
void connectSlots();
void showAnswerBar();
void hideAnswerBar();
void transformAnswerBar();
private slots:
void state_changed(Call* call, Call::State previousState);
......@@ -49,6 +52,8 @@ private slots:
void on_answer_button_clicked();
void on_decline_button_clicked();
private:
Ui::MainWindow *ui;
CallModel* callModel_{nullptr};
......
......@@ -97,7 +97,7 @@ color: rgb(160, 160, 160);
<set>Qt::AlignCenter</set>
</property>
<property name="placeholderText">
<string>Search</string>
<string>Enter a number, name, or email</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
......@@ -231,36 +231,12 @@ color: rgb(160, 160, 160);
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="hangup_button">
<property name="text">
<string>Hang up</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="answer_button">
<property name="text">
<string>Answer</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<widget class="QWidget" name="content_area" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
......@@ -274,12 +250,211 @@ color: rgb(160, 160, 160);
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255,255,255);
<string notr="true">QWidget#content_area {
background-color: rgb(255,255,255);
background-image:url(:/data/background_tile.png);
background-repeat: repeat-x;
background-position: bottom;</string>
background-position: bottom;
}</string>
</property>
<widget class="QWidget" name="answer_bar" native="true">
<property name="geometry">
<rect>
<x>-10</x>
<y>380</y>
<width>561</width>
<height>91</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#answer_bar {
background-color: rgba(50, 50, 50, 0.5);
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="answer_bar_layout">
<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>
<item>
<widget class="QToolButton" name="decline_button">
<property name="minimumSize">
<size>
<width>0</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>48</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: white;
background-color:transparent;</string>
</property>
<property name="text">
<string>Decline</string>
</property>
<property name="icon">
<iconset resource="data.qrc">
<normaloff>:/data/symbol_dark.png</normaloff>:/data/symbol_dark.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="hangup_button">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>48</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: white;
background-color:transparent;</string>
</property>
<property name="text">
<string>Hang Up</string>
</property>
<property name="icon">
<iconset resource="data.qrc">
<normaloff>:/data/symbol_dark.png</normaloff>:/data/symbol_dark.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="answer_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>48</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: white;
background-color:transparent;</string>
</property>
<property name="text">
<string>Accept</string>
</property>
<property name="icon">
<iconset resource="data.qrc">
<normaloff>:/data/symbol_blue.png</normaloff>:/data/symbol_blue.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::DelayedPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</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>
</widget>
</item>
</layout>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment