Commit ca85029d authored by Nicolas Jager's avatar Nicolas Jager Committed by Edric Milaret

ui: add sliding animation

- instant messaging and welcome pages are now sliding.

Tuleap: #148
Change-Id: Ie0849191190861de1b624b8b1d5a2640928215d0
parent 540a5114
......@@ -62,6 +62,9 @@ CallWidget::CallWidget(QWidget* parent) :
ui->setupUi(this);
welcomePageAnim_ = new QPropertyAnimation(ui->welcomePage, "pos", this);
messagingPageAnim_ = new QPropertyAnimation(ui->messagingPage, "pos", this);
// TODO : add this in style sheet forms
QPalette palette;
palette.setColor(QPalette::WindowText, QColor(255,255,255));
......@@ -190,6 +193,8 @@ CallWidget::~CallWidget()
delete menu_;
delete contactDelegate_;
delete imDelegate_;
delete welcomePageAnim_;
delete messagingPageAnim_;
}
void
......@@ -562,8 +567,7 @@ CallWidget::showIMOutOfCall()
foreach (const ContactMethod* cm, cmVector) {
ui->contactMethodComboBox->addItem(cm->uri());
}
ui->stackedWidget->setCurrentWidget(ui->messagingPage);
slideToRight(messagingPageAnim_, ui->messagingPage);
}
void
......@@ -621,7 +625,30 @@ CallWidget::on_ringContactLineEdit_textEdited(const QString& text)
RecentModel::instance().peopleProxy()->setFilterWildcard(text);
}
void CallWidget::on_imBackButton_clicked()
void
CallWidget::on_imBackButton_clicked()
{
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
slideToLeft(welcomePageAnim_, ui->welcomePage);
}
void
CallWidget::slideToLeft(QPropertyAnimation* anim, QWidget* widget)
{
ui->stackedWidget->setCurrentWidget(widget);
anim->setDuration(animDuration_);
anim->setStartValue(QPoint(widget->width(), widget->y()));
anim->setEndValue(QPoint(widget->x(), widget->y()));
anim->setEasingCurve(QEasingCurve::OutQuad);
anim->start();
}
void
CallWidget::slideToRight(QPropertyAnimation* anim, QWidget* widget)
{
ui->stackedWidget->setCurrentWidget(widget);
anim->setDuration(animDuration_);
anim->setStartValue(QPoint(-widget->width(), widget->y()));
anim->setEndValue(QPoint(widget->x(), widget->y()));
anim->setEasingCurve(QEasingCurve::OutQuad);
anim->start();
}
......@@ -38,6 +38,7 @@ class ContactDelegate;
class HistoryDelegate;
class SmartListDelegate;
class ImDelegate;
class QPropertyAnimation;
namespace Ui {
class CallWidget;
......@@ -100,6 +101,10 @@ private:
QModelIndex highLightedIndex_;
ImDelegate* imDelegate_;
QMetaObject::Connection imConnection_;
QPropertyAnimation* messagingPageAnim_;
QPropertyAnimation* welcomePageAnim_;
constexpr static int animDuration_ = 200; //msecs
private:
void findRingAccount();
......@@ -107,5 +112,7 @@ private:
void placeCall();
void setupOutOfCallIM();
void setupSmartListMenu();
void slideToLeft(QPropertyAnimation* anim, QWidget* widget);
void slideToRight(QPropertyAnimation* anim, QWidget* widget);
};
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