Commit 7fa4ad1f authored by Jan Möbius's avatar Jan Möbius
Browse files

Added Version information for plugins

Check updates on server in ini files

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@2938 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 440b1803
......@@ -135,6 +135,14 @@ class BaseInterface {
*/
virtual void noguiSupported( ) {} ;
public slots:
/** \brief Return a version string for your plugin
*
* This function will be used to determin the current version of your plugin.
* Should have the form x.x.x ( you do not need to give that many subversions )
*/
virtual QString version() { return QString("-1"); };
public :
/// Destructor
......@@ -151,6 +159,7 @@ class BaseInterface {
* This function has to return a basic description of the plugin
*/
virtual QString description() = 0;
};
Q_DECLARE_INTERFACE(BaseInterface,"OpenFlipper.BaseInterface/0.3")
......
......@@ -27,6 +27,9 @@ struct PluginInfo{
/// Description of the plugin ( requested from the plugin on load)
QString description;
/// Version of the plugin
QString version;
/// Path to the plugin ( set on load )
QString path;
......
......@@ -384,6 +384,11 @@ void Core::loadPlugin(QString filename, bool silent){
info.path = filename;
info.widget = 0;
if ( checkSlot(plugin,"version()") )
info.version = basePlugin->version();
else
info.version = QString::number(-1);
if ( OpenFlipper::Options::nogui() ) {
if ( ! checkSlot( plugin , "noguiSupported()" ) ) {
......
......@@ -351,10 +351,22 @@ void OptionsWidget::compareVersions() {
QString updatedComponents = "Updates found for ";
if ( OpenFlipper::Options::isWindows() ) {
QString systemString = "";
if ( true || OpenFlipper::Options::isWindows() ) {
systemString = "VersionWindows";
} else if (OpenFlipper::Options::isLinux()) {
systemString = "VersionLinux";
return;
} else {
std::cerr << "Unsupported platform for update" << std::endl;
return;
}
QString coreVersion;
if ( ini.get_entry(coreVersion, "Core" , "VersionWindows" )) {
if ( ini.get_entry(coreVersion, "Core" , systemString )) {
if ( isNewer( OpenFlipper::Options::coreVersion(), coreVersion ) ) {
std::cerr << "Newer Version found for Core!" << std::endl;
......@@ -362,13 +374,39 @@ void OptionsWidget::compareVersions() {
std::cerr << "Current Version is " << OpenFlipper::Options::coreVersion().toStdString() << std::endl;
newerVersionsAvailable = true;
updatedComponents += "Core " + OpenFlipper::Options::coreVersion() + " -> " + coreVersion;
updatedComponents += "Core " + OpenFlipper::Options::coreVersion() + " -> " + coreVersion ;
}
}
} else {
std::cerr << "Updates for linux not implemented yet" << std::endl;
for ( uint i = 0 ; i < plugins_.size(); ++i ) {
QString latestVersion;
if ( ini.get_entry(latestVersion, plugins_[i].name , systemString )) {
if ( isNewer( plugins_[i].version, latestVersion ) ) {
std::cerr << "Newer Version found for " << plugins_[i].name.toStdString() << std::endl;
std::cerr << "Latest Version is " << latestVersion.toStdString() << std::endl;
std::cerr << "Current Version is " << plugins_[i].version.toStdString() << std::endl;
newerVersionsAvailable = true;
updatedComponents += plugins_[i].name + " " + plugins_[i].version + " -> " + latestVersion;
}
}
// else {
//
// std::cerr << "No Version information on server for " << plugins_[i].name.toStdString()
// << ". Local Version is ";
// if ( plugins_[i].version == "-1" )
// std::cerr << "UNKNOWN (no info provided by plugin" << std::endl;
// else
// std::cerr << plugins_[i].version.toStdString() << std::endl;
// }
}
if ( newerVersionsAvailable ) {
statusLabel->setText(updatedComponents);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment