GUI: add the cfg files in the resources. use these as fallback when normal loading fails.

This commit is contained in:
Daniel Marjamäki 2014-01-11 08:38:26 +01:00
parent 4e7e56df9f
commit f0743d3bc4
2 changed files with 15 additions and 0 deletions

View File

@ -26,5 +26,11 @@
<file>images/go-previous.png</file>
<file>images/applications-development.png</file>
<file>images/applications-system.png</file>
<file alias="cfg/gtk.cfg">../cfg/gtk.cfg</file>
<file alias="cfg/qt.cfg">../cfg/qt.cfg</file>
<file alias="cfg/posix.cfg">../cfg/posix.cfg</file>
<file alias="cfg/std.cfg">../cfg/std.cfg</file>
<file alias="cfg/windows.cfg">../cfg/windows.cfg</file>
</qresource>
</RCC>

View File

@ -25,6 +25,7 @@
#include <QUrl>
#include <QAction>
#include <QActionGroup>
#include <QFile>
#include "mainwindow.h"
#include "cppcheck.h"
#include "applicationlist.h"
@ -531,6 +532,14 @@ bool MainWindow::LoadLibrary(Library *library, QString filename)
if (library->load(NULL, (path+"/"+filename).toLatin1()))
return true;
// Try to load resource..
QFile f(":/cfg/" + filename);
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString data = f.readAll();
if (library->loadxmldata(data.toLatin1(), data.length()))
return true;
}
return false;
}