From 9d813304fafc2942e77f71232eb118747393835c Mon Sep 17 00:00:00 2001 From: konrad Date: Wed, 12 Nov 2008 16:00:53 +0000 Subject: [PATCH] add wait cursor while waiting for web git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@179 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/main.cpp | 11 +++++++++++ src/main.h | 12 ++++++++++++ src/webrequest.cpp | 2 ++ 3 files changed, 25 insertions(+), 0 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 83894a7..aa8c317 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,6 +11,7 @@ // #include +#include #include #include #include @@ -26,6 +27,16 @@ #include "main.h" #include "debug.h" +WaitCursor::WaitCursor() +{ + QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); +} + +WaitCursor::~WaitCursor() +{ + QApplication::restoreOverrideCursor(); +} + QString choseLanguage(bool warn) { QString lang=QSettings().value("lang","--").toString(); diff --git a/src/main.h b/src/main.h index fbbdcd9..bd7eee0 100644 --- a/src/main.h +++ b/src/main.h @@ -15,8 +15,20 @@ #include +/**show a dialog to change the language*/ QString choseLanguage(bool warn=true); +/**contains the directory that is used for external data storage*/ extern QString dataDir; +/**simple class to show a busy-cursor while an instance of it exists*/ +class WaitCursor +{ + public: + /**displays a wait cursor (Qt::WaitCursor)*/ + WaitCursor(); + /**restores the last normal cursor*/ + ~WaitCursor(); +}; + #endif diff --git a/src/webrequest.cpp b/src/webrequest.cpp index c6a3bcf..11c7b79 100644 --- a/src/webrequest.cpp +++ b/src/webrequest.cpp @@ -55,6 +55,8 @@ QString MWebRequest::settingsGroup()const bool MWebRequest::request(QString hreq,QByteArray data) { + //show the user we are waiting + WaitCursor wc; //set up request QEventLoop loop(this); connect(this,SIGNAL(requestFinInt()),&loop,SLOT(quit())); -- 1.7.2.5