3.0
Line | |
---|
1 | #ifndef BCACCOUNTLOADTHREAD_H_ |
---|
2 | #define BCACCOUNTLOADTHREAD_H_ |
---|
3 | |
---|
4 | #include <QThread> |
---|
5 | #include <QMetaType> |
---|
6 | |
---|
7 | #include <iaccount.h> |
---|
8 | |
---|
9 | #include <StdExceptions.h> |
---|
10 | |
---|
11 | enum AccountLoadState { |
---|
12 | Unloaded, |
---|
13 | Loading, |
---|
14 | Loaded, |
---|
15 | Cancelling, |
---|
16 | Cancelled, |
---|
17 | Failed |
---|
18 | }; |
---|
19 | Q_DECLARE_METATYPE(AccountLoadState); |
---|
20 | |
---|
21 | class BCAccountLoadThread : public QThread { |
---|
22 | Q_OBJECT |
---|
23 | |
---|
24 | public: |
---|
25 | BCAccountLoadThread(IAccount* account, QObject* parent = 0); |
---|
26 | |
---|
27 | virtual AccountLoadState loadState(); |
---|
28 | virtual IAccount* account(); |
---|
29 | |
---|
30 | virtual void cancelLoading(); |
---|
31 | |
---|
32 | signals: |
---|
33 | void loadStateChanged(IAccount* account, AccountLoadState state); |
---|
34 | void loaded(IAccount* account); |
---|
35 | void loadingFinished(IAccount* account, AccountLoadState state); |
---|
36 | void loadingFailed(IAccount* account, EException* exception); |
---|
37 | |
---|
38 | |
---|
39 | protected: |
---|
40 | void run(); |
---|
41 | void setLoadState(AccountLoadState loadState); |
---|
42 | |
---|
43 | private: |
---|
44 | IAccount* account_; |
---|
45 | AccountLoadState loadState_; |
---|
46 | }; |
---|
47 | |
---|
48 | #endif /*BCACCOUNTLOADTHREAD_H_*/ |
---|
Note: See
TracBrowser
for help on using the repository browser.