From f0743d3bc445e128adc11d30e06862e924874450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 11 Jan 2014 08:38:26 +0100 Subject: [PATCH] GUI: add the cfg files in the resources. use these as fallback when normal loading fails. --- gui/gui.qrc | 6 ++++++ gui/mainwindow.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/gui/gui.qrc b/gui/gui.qrc index c6d12b84c..e3f930927 100644 --- a/gui/gui.qrc +++ b/gui/gui.qrc @@ -26,5 +26,11 @@ images/go-previous.png images/applications-development.png images/applications-system.png + + ../cfg/gtk.cfg + ../cfg/qt.cfg + ../cfg/posix.cfg + ../cfg/std.cfg + ../cfg/windows.cfg diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 1bef8a81a..90a5ee947 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #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; }