Diffstat (limited to 'pwmanager/pwmanager/spinforsignal.h') (more/less context) (show whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/spinforsignal.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/spinforsignal.h b/pwmanager/pwmanager/spinforsignal.h new file mode 100644 index 0000000..ec6103b --- a/dev/null +++ b/pwmanager/pwmanager/spinforsignal.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2003, 2004 by Michael Buesch * | ||
4 | * email: mbuesch@freenet.de * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License version 2 * | ||
8 | * as published by the Free Software Foundation. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | |||
12 | /*************************************************************************** | ||
13 | * copyright (C) 2004 by Ulf Schenk | ||
14 | * This file is originaly based on version 1.0.1 of pwmanager | ||
15 | * and was modified to run on embedded devices that run microkde | ||
16 | * | ||
17 | * $Id$ | ||
18 | **************************************************************************/ | ||
19 | |||
20 | #ifndef SPINFORSIGNAL_H | ||
21 | #define SPINFORSIGNAL_H | ||
22 | |||
23 | #include <qobject.h> | ||
24 | |||
25 | #include <stdint.h> | ||
26 | #include <string> | ||
27 | using std::string; | ||
28 | |||
29 | /** non-ui-blocking spin for a QT-signal */ | ||
30 | class SpinForSignal : public QObject | ||
31 | { | ||
32 | Q_OBJECT | ||
33 | public: | ||
34 | SpinForSignal(); | ||
35 | ~SpinForSignal() {} | ||
36 | |||
37 | /** do spin for signal */ | ||
38 | void spin(uint32_t *u32, string *str); | ||
39 | /** cancel spinning */ | ||
40 | void cancelSpin(); | ||
41 | |||
42 | public slots: | ||
43 | void u32_str_slot(uint32_t u32, const string &str); | ||
44 | |||
45 | protected: | ||
46 | volatile bool doSpin; | ||
47 | uint32_t u32_storage; | ||
48 | string str_storage; | ||
49 | |||
50 | protected: | ||
51 | inline void spinSleep(); | ||
52 | void _spin(); | ||
53 | }; | ||
54 | |||
55 | #endif | ||