OSDN Git Service

Some code clean-up + make it possible to cancel UpdateChecker thread.
[mutilities/MUtilities.git] / include / MUtils / UpdateChecker.h
index 8fbaa7a..99dff02 100644 (file)
@@ -76,7 +76,8 @@ namespace MUtils
                        UpdateStatus_CompletedNewVersionOlder  = 5,
                        UpdateStatus_ErrorNoConnection         = 6,
                        UpdateStatus_ErrorConnectionTestFailed = 7,
-                       UpdateStatus_ErrorFetchUpdateInfo      = 8
+                       UpdateStatus_ErrorFetchUpdateInfo      = 8,
+                       UpdateStatus_CancelledByUser           = 9
                }
                update_status_t;
 
@@ -89,6 +90,11 @@ namespace MUtils
                const int  getCurrentProgress(void)          const { return m_progress; };
                const UpdateCheckerInfo *getUpdateInfo(void) const { return m_updateInfo.data(); }
 
+               void cancel(void) { m_cancelled = true; }
+
+       public slots:
+               void start(Priority = InheritPriority);
+
        protected:
                void run(void);
                void checkForUpdates(void);
@@ -115,6 +121,7 @@ namespace MUtils
                const QString m_binaryKeys;
 
                volatile bool m_success;
+               volatile bool m_cancelled;
 
                int m_status;
                int m_progress;