Skip to content
Permalink
Browse files
Warn if loading a project file from an older version of qgis (prompted
by ticket #314)


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6028 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Oct 28, 2006
1 parent 9a79437 commit 98fa67ad4ee287d5381afc6b8e62bde52c0ee69a
Showing with 25 additions and 1 deletion.
  1. +25 −1 src/gui/qgsproject.cpp
@@ -31,6 +31,7 @@ using namespace std;
#include "qgsexception.h"
#include "qgsprojectproperty.h"
#include "qgsmapcanvas.h"
#include "qgslogger.h"

#include <QApplication>
#include <QFileInfo>
@@ -1084,7 +1085,30 @@ bool QgsProject::read()
QgsDebug( QString("project file has version " + fileVersion).ascii() );
}

// XXX some day insert version checking
QStringList fileVersionParts = fileVersion.split(".");
QStringList qgisVersionParts = QString(QGis::qgisVersion).split(".");

bool older = false;

if (fileVersionParts.size() != 3 || qgisVersionParts.size() != 3)
older = false; // probably an older version
else
{
if (fileVersionParts.at(0) < qgisVersionParts.at(0))
older = true;
else if (fileVersionParts.at(1) < qgisVersionParts.at(1))
older = true;
else if (fileVersionParts.at(2) < qgisVersionParts.at(2))
older = true;
}

if (older)
{
QgsLogger::warning("Loading a file that was saved with an older "
"version of qgis (saved in " + fileVersion +
", loaded in " + QGis::qgisVersion +
"). Problems may occur.");
}

#ifdef QGISDEBUG
qDebug(("Project title: " + imp_->title).toLocal8Bit().data());

0 comments on commit 98fa67a

Please sign in to comment.