From 5b70f50a905bbd4df810d67e079a9a791c1c7ce6 Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 2 Mar 2011 17:54:12 +0100 Subject: [PATCH] Animation on hiding "Save password" question --- src/autofill/autofillwidget.cpp | 26 +++++++++++++++++++++----- src/autofill/autofillwidget.h | 5 +++++ src/autofill/autofillwidget.ui | 9 +++++++++ src/webview/webtab.cpp | 1 + 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/autofill/autofillwidget.cpp b/src/autofill/autofillwidget.cpp index 81ecd109d..5e06f9f12 100644 --- a/src/autofill/autofillwidget.cpp +++ b/src/autofill/autofillwidget.cpp @@ -23,21 +23,37 @@ AutoFillWidget::AutoFillWidget(QUrl url, QByteArray data, QString pass, QWidget connect(ui->remember, SIGNAL(clicked()), this, SLOT(remember())); connect(ui->never, SIGNAL(clicked()), this, SLOT(never())); - connect(ui->notnow, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->notnow, SIGNAL(clicked()), this, SLOT(hide())); + connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); +} + +void AutoFillWidget::hide() +{ + m_animation = new QTimeLine(300, this); + m_animation->setFrameRange(0, 35); + m_animation->setDirection(QTimeLine::Backward); + + m_animation->start(); + connect(m_animation, SIGNAL(finished()), this, SLOT(close())); + connect(m_animation, SIGNAL(frameChanged(int)),this, SLOT(frameChanged(int))); +} + +void AutoFillWidget::frameChanged(int frame) +{ + setMinimumHeight(frame); + setMaximumHeight(frame); } -// addEntry(request.url(), outgoingData, pass); void AutoFillWidget::never() { MainApplication::getInstance()->autoFill()->blockStoringfor(m_url); - close(); + hide(); } void AutoFillWidget::remember() { MainApplication::getInstance()->autoFill()->addEntry(m_url, m_data, m_pass); - close(); + hide(); } AutoFillWidget::~AutoFillWidget() diff --git a/src/autofill/autofillwidget.h b/src/autofill/autofillwidget.h index 3f03adc8b..9cf3d0579 100644 --- a/src/autofill/autofillwidget.h +++ b/src/autofill/autofillwidget.h @@ -3,6 +3,7 @@ #include #include +#include namespace Ui { class AutoFillWidget; @@ -17,14 +18,18 @@ public: ~AutoFillWidget(); private slots: + void frameChanged(int frame); void remember(); void never(); + void hide(); + private: Ui::AutoFillWidget *ui; QUrl m_url; QByteArray m_data; QString m_pass; + QTimeLine* m_animation; }; #endif // AUTOFILLWIDGET_H diff --git a/src/autofill/autofillwidget.ui b/src/autofill/autofillwidget.ui index 656691efb..180c0c291 100644 --- a/src/autofill/autofillwidget.ui +++ b/src/autofill/autofillwidget.ui @@ -74,6 +74,9 @@ 0 + + Qt::NoFocus + Remember @@ -87,6 +90,9 @@ 0 + + Qt::NoFocus + Never For This Site @@ -100,6 +106,9 @@ 0 + + Qt::NoFocus + Not Now diff --git a/src/webview/webtab.cpp b/src/webview/webtab.cpp index 3b42f3d88..d873a275e 100644 --- a/src/webview/webtab.cpp +++ b/src/webview/webtab.cpp @@ -25,6 +25,7 @@ void WebTab::showNotification(QWidget *notif) delete m_layout->itemAt(0)->widget(); m_layout->insertWidget(0, notif); + notif->show(); } WebTab::~WebTab()