diff options
author | 2021-05-12 19:03:54 +0530 | |
---|---|---|
committer | 2021-05-12 19:03:54 +0530 | |
commit | c13e84957e0aefd96b57f98ca1128c93901f587d (patch) | |
tree | e1c0d00684aa51a14f95f3e9f820d9c57ab6b3c1 | |
parent | 3c9309d9f266f32eb71fee1a74808b5bc1ea1c67 (diff) | |
download | whatsie-c13e84957e0aefd96b57f98ca1128c93901f587d.tar.gz whatsie-c13e84957e0aefd96b57f98ca1128c93901f587d.zip |
updated rate widget backend
-rw-r--r-- | src/rateapp.cpp | 13 | ||||
-rw-r--r-- | src/rateapp.h | 4 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/rateapp.cpp b/src/rateapp.cpp index cd29c06..ead9508 100644 --- a/src/rateapp.cpp +++ b/src/rateapp.cpp @@ -73,6 +73,9 @@ bool RateApp::shouldShow() qint64 installed_date_time = settings.value("app_install_time").toLongLong(); bool ratedAlready = settings.value("rated_already",false).toBool(); + if(ratedAlready) //return false if already reated; + return false; + shouldShow = (((currentDateTime - installed_date_time > app_install_days * 86400) || app_launched_count >= this->app_launch_count) && ratedAlready == false); @@ -91,8 +94,7 @@ RateApp::~RateApp() void RateApp::on_rateNowBtn_clicked() { QDesktopServices::openUrl(QUrl(app_rating_url)); - settings.setValue("app_launched_count",0); - settings.setValue("app_install_time",QDateTime::currentSecsSinceEpoch()); + this->reset(); this->close(); } @@ -104,16 +106,13 @@ void RateApp::on_alreadyDoneBtn_clicked() void RateApp::on_laterBtn_clicked() { - settings.setValue("rated_already",false); - settings.setValue("app_launched_count",0); - settings.setValue("app_install_time",QDateTime::currentSecsSinceEpoch()); + this->reset(); this->close(); } -void RateApp::closeEvent(QCloseEvent *event) +void RateApp::reset() { settings.setValue("rated_already",false); settings.setValue("app_launched_count",0); settings.setValue("app_install_time",QDateTime::currentSecsSinceEpoch()); - QWidget::closeEvent(event); } diff --git a/src/rateapp.h b/src/rateapp.h index 7b23214..e296080 100644 --- a/src/rateapp.h +++ b/src/rateapp.h @@ -26,8 +26,7 @@ public: public slots: void delayShowEvent(); -protected slots: - void closeEvent(QCloseEvent *event); + private slots: void on_rateNowBtn_clicked(); @@ -36,6 +35,7 @@ private slots: void on_laterBtn_clicked(); bool shouldShow(); + void reset(); private: Ui::RateApp *ui; QString app_rating_url; |