GUI: add the cfg files in the resources. use these as fallback when normal loading fails.
This commit is contained in:
parent
4e7e56df9f
commit
f0743d3bc4
|
@ -26,5 +26,11 @@
|
||||||
<file>images/go-previous.png</file>
|
<file>images/go-previous.png</file>
|
||||||
<file>images/applications-development.png</file>
|
<file>images/applications-development.png</file>
|
||||||
<file>images/applications-system.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>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
#include <QFile>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "cppcheck.h"
|
#include "cppcheck.h"
|
||||||
#include "applicationlist.h"
|
#include "applicationlist.h"
|
||||||
|
@ -531,6 +532,14 @@ bool MainWindow::LoadLibrary(Library *library, QString filename)
|
||||||
if (library->load(NULL, (path+"/"+filename).toLatin1()))
|
if (library->load(NULL, (path+"/"+filename).toLatin1()))
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue