"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gmic-qt/src/FilterSelector/FavesModelWriter.cpp" between
gmic_2.8.1.tar.gz and gmic_2.8.2.tar.gz

About: G’MIC (GREY’s Magic for Image Computing) is a framework for image processing. It provides several different user interfaces to convert/manipulate/filter/ visualize generic image datasets (usable standalone or as plug-in for GIMP and Krita).

FavesModelWriter.cpp  (gmic_2.8.1):FavesModelWriter.cpp  (gmic_2.8.2)
skipping to change at line 33 skipping to change at line 33
* *
*/ */
#include "FavesModelWriter.h" #include "FavesModelWriter.h"
#include <QFile> #include <QFile>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include <iostream> #include <iostream>
#include "Logger.h"
#include "Utils.h" #include "Utils.h"
FavesModelWriter::FavesModelWriter(const FavesModel & model) : _model(model) {} FavesModelWriter::FavesModelWriter(const FavesModel & model) : _model(model) {}
FavesModelWriter::~FavesModelWriter() = default; FavesModelWriter::~FavesModelWriter() = default;
void FavesModelWriter::writeFaves() void FavesModelWriter::writeFaves()
{ {
QString jsonFilename(QString("%1%2").arg(GmicQt::path_rc(true)).arg("gmic_qt_f aves.json")); QString jsonFilename(QString("%1%2").arg(GmicQt::path_rc(true)).arg("gmic_qt_f aves.json"));
// Create JSON array // Create JSON array
skipping to change at line 64 skipping to change at line 65
QFile jsonFile(jsonFilename); QFile jsonFile(jsonFilename);
if (jsonFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { if (jsonFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
QJsonDocument jsonDoc(array); QJsonDocument jsonDoc(array);
if (jsonFile.write(jsonDoc.toJson()) != -1) { if (jsonFile.write(jsonDoc.toJson()) != -1) {
// Cleanup 2.0.0 pre-release files // Cleanup 2.0.0 pre-release files
QString obsoleteFilename(QString("%1%2").arg(GmicQt::path_rc(false)).arg(" gmic_qt_faves")); QString obsoleteFilename(QString("%1%2").arg(GmicQt::path_rc(false)).arg(" gmic_qt_faves"));
QFile::remove(obsoleteFilename); QFile::remove(obsoleteFilename);
QFile::remove(obsoleteFilename + ".bak"); QFile::remove(obsoleteFilename + ".bak");
} }
} else { } else {
std::cerr << "[gmic_qt] Error: cannot open/create file " << jsonFilename.toS tdString() << std::endl; Logger::error("Cannot open/create file " + jsonFilename);
} }
} }
QJsonObject FavesModelWriter::faveToJsonObject(const FavesModel::Fave & fave) QJsonObject FavesModelWriter::faveToJsonObject(const FavesModel::Fave & fave)
{ {
QJsonObject object; QJsonObject object;
object["Name"] = fave.name(); object["Name"] = fave.name();
object["originalName"] = fave.originalName(); object["originalName"] = fave.originalName();
object["command"] = fave.command(); object["command"] = fave.command();
object["preview"] = fave.previewCommand(); object["preview"] = fave.previewCommand();
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)