]> git.mxchange.org Git - simgear.git/blobdiff - simgear/package/Root.hxx
HTTP request cancellation
[simgear.git] / simgear / package / Root.hxx
index 2a06a6b1b0b13c4233d751fd01832a905b5040cc..69ac4804cbfa57d91db16051d2e51b850abfd45c 100644 (file)
@@ -62,8 +62,10 @@ public:
     
     void setLocale(const std::string& aLocale);
         
-    void setDelegate(Delegate* aDelegate);
-        
+    void addDelegate(Delegate* aDelegate);
+    
+    void removeDelegate(Delegate* aDelegate);
+    
     std::string getLocale() const;
     
     CatalogList catalogs() const;
@@ -79,19 +81,35 @@ public:
      * set yet.
      */
     void makeHTTPRequest(HTTP::Request* req);
+
+    /**
+     * Cancel an HTTP request.
+     */
+    void cancelHTTPRequest(HTTP::Request* req, const std::string& reason);
     
     /**
-     * the version string of the root. Catalogs must match this version,
+     * The catalog XML/property version in use. This is used to make incomaptible
+     * changes to the package/catalog syntax
+     */
+    int catalogVersion() const;
+
+    /**
+     * the version string of the application. Catalogs must match this version,
      * or they will be ignored / rejected.
      */
-    std::string catalogVersion() const;
-    
+    std::string applicationVersion() const;
+
     /**
      * refresh catalogs which are more than the maximum age (24 hours by default)
      * set force to true, to download all catalogs regardless of age.
      */
     void refresh(bool aForce = false);
 
+    /**
+     *
+     */
+    PackageList allPackages() const;
+    
     /**
      * retrieve packages matching a filter.
      * filter consists of required / minimum values, AND-ed together.
@@ -115,21 +133,33 @@ public:
      * from the catalog too.
      */
     bool removeCatalogById(const std::string& aId);
+    
+    /**
+     * request thumbnail data from the cache / network
+     */
+    void requestThumbnailData(const std::string& aUrl);
+    
+    bool isInstallQueued(InstallRef aInstall) const;
 private:
     friend class Install;
     friend class Catalog;    
+    friend class Package;
     
-
-    void catalogRefreshBegin(CatalogRef aCat);
-    void catalogRefreshComplete(CatalogRef aCat, Delegate::FailureCode aReason);
+    InstallRef existingInstallForPackage(PackageRef p) const;
+    
+    void catalogRefreshStatus(CatalogRef aCat, Delegate::StatusCode aReason);
         
     void startNext(InstallRef aCurrent);
     
     void startInstall(InstallRef aInstall);
     void installProgress(InstallRef aInstall, unsigned int aBytes, unsigned int aTotal);
-    void finishInstall(InstallRef aInstall);
-    void failedInstall(InstallRef aInstall, Delegate::FailureCode aReason);
-
+    void finishInstall(InstallRef aInstall, Delegate::StatusCode aReason);
+    void cancelDownload(InstallRef aInstall);
+    
+    void registerInstall(InstallRef ins);
+    void unregisterInstall(InstallRef ins);
+    
+    class ThumbnailDownloader;
     class RootPrivate;
     std::auto_ptr<RootPrivate> d;
 };