PluginTools: Update version check

AfterShot Pro Plugins
Post Reply
andreas
Posts: 154
Joined: Thu Jan 12, 2012 1:53 pm
operating_system: Linux
System_Drive: X
32bit or 64bit: 64 Bit
motherboard: Asus in Workstation and Dell XPS Notebook
processor: i7-980 and i7-2720QM
ram: 12GB - 8GB
Video Card: ATI FireGL
sound_card: on board
Hard_Drive_Capacity: 4.5TB Rd10
Monitor/Display Make & Model: Samsung Syncmaster 2343sw
Location: DE - Wermelskirchen
Contact:

PluginTools: Update version check

Post by andreas »

Hi,

I found some posts in the asGPS thread on the update info functionality of asGPS. Jeff was interested in it also, but I think it was dropped in the priority list. Here is how it works:

I implemented a small service to include in a plugin. You can get it in the PluginTools package with

Code: Select all

git clone http://schrell.de/PluginTools.git
You have to compile and link it in your plugin and do some small own changes in your code:

In YourPlugin.h:

Code: Select all

#include "WebInfos.h"
public slots:
        /** Web infos are ready to use.
         * The web page we asked for the update infos is loaded, values can be obtained.
         */
        void webInfosReady();
private:
        WebInfos *m_webInfos; /**< instance for gettings version infos from the web */
In YourPlugin.cpp

Code: Select all

#include "WebInfos.h"
bool YourPlugin::finish()
{
    .....
    if (m_config->checkForUpdates()) {
        m_webInfos = new WebInfos("org.example.youPluginIdentifier", "8");  // 8 is the current SDK version
        connect(m_webInfos,
                SIGNAL(ready()),
                SLOT(webInfosReady()));
        m_webInfos->fetch();
    }
...
}

void YourPlugin::webInfosReady() {
    if (m_webInfos->isWebNewer()) {
        QString text = QString(tr("There is a newer version of %1 available. "
                               "It is version %2. You are running %3. "
                               "You can download it under the following url: <a href='%4'>%4</a>"))
                        .arg(m_webInfos->name(), m_webInfos->version(), TARGET_VERSION_STRING, m_webInfos->link());
        QMessageBox::information(NULL, m_webInfos->name(), text);
    }
    delete m_webInfos;
    m_webInfos = NULL;
}
In your Project you need

Code: Select all

QT += network
The online part are some PHP tools on my root server, which use a sqllite db to save some infos on the plugins. In the admin section you call a script and give it a link to the download package. I use the links at the Corel site. It is sensible data and should be secured. If not you have that risk that someone links to a hacked plugin. The PHP tools load the plugin archive, unpack it and analyze the included Info file. Some infos (identifier, version, sdk version, download link) are stored in the db. Currently I am the only one who has the admin rights to update the links in the database. But you are free to set up your own - ask for them if you need them, but I will give them only to plugin devs.

It would be best if Jeff could provide this service on the Corel site. It would be no problem to insert freshly uploaded/updated plugins in the database automatically, its just a call to an html link.

If a plugin is prepared in this way and if it is configured to look for updates, it fetches the WebInfos in its init part. It is asynchronously informed of the current version. With the method isWebNewer() it can test if there is a never version and inform the user.
If the other devs support asPluginManager, it would be a good idea to include it there. So the plugins would only gibe their ToolData to asPluginManager and it can display a list of all fresh plugins available on the Corel site. The forler variant would display several message boxes, the latter can display the full list at once.

Andreas
Linux - not Windows
andreas
Posts: 154
Joined: Thu Jan 12, 2012 1:53 pm
operating_system: Linux
System_Drive: X
32bit or 64bit: 64 Bit
motherboard: Asus in Workstation and Dell XPS Notebook
processor: i7-980 and i7-2720QM
ram: 12GB - 8GB
Video Card: ATI FireGL
sound_card: on board
Hard_Drive_Capacity: 4.5TB Rd10
Monitor/Display Make & Model: Samsung Syncmaster 2343sw
Location: DE - Wermelskirchen
Contact:

Re: PluginTools: Update version check

Post by andreas »

Hi,

the update version check is now integrated in asPluginManager. If you would like to use it also directly in your plugin, remember to make it configurable in your plugin. The database which is used by asPluginManager is updated every 30 minutes at the moment with the current data from the Corel's ASP plugin site.

If your plugin is not listed at the Corel site, I can add the link manually. You will not get any access to the database for your own. If you can provide a constant download link without version numbers, I can integrate it in the regular update run. Feel free to ask for further options.

Andreas
Linux - not Windows
Post Reply