"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gmic-qt/src/FilterSelector/FiltersModelReader.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).

FiltersModelReader.cpp  (gmic_2.8.1):FiltersModelReader.cpp  (gmic_2.8.2)
skipping to change at line 109 skipping to change at line 109
filterPath.push_back(folderName); filterPath.push_back(folderName);
} }
buffer = readBufferLine(stdlib); buffer = readBufferLine(stdlib);
} else if (filterRegexpNoLanguage.exactMatch(line) || filterRegexpLanguage .exactMatch(line)) { } else if (filterRegexpNoLanguage.exactMatch(line) || filterRegexpLanguage .exactMatch(line)) {
// //
// A filter // A filter
// //
QString filterName = line; QString filterName = line;
filterName.replace(QRegExp("[ ]*:.*$"), ""); filterName.replace(QRegExp("[ ]*:.*$"), "");
filterName.replace(QRegExp("^\\s*#@gui[_a-zA-Z]{0,3}[ ]"), ""); filterName.replace(QRegExp("^\\s*#@gui[_a-zA-Z]{0,3}[ ]"), "");
const bool warning = filterName.startsWith(WarningPrefix); const bool warning = filterName.startsWith(WarningPrefix);
if (warning) { if (warning) {
filterName.remove(0, 1); filterName.remove(0, 1);
} }
QString filterCommands = line; QString filterCommands = line;
filterCommands.replace(QRegExp("^\\s*#@gui[_a-zA-Z]{0,3}[ ][^:]+[ ]*:[ ] *"), ""); filterCommands.replace(QRegExp("^\\s*#@gui[_a-zA-Z]{0,3}[ ][^:]+[ ]*:[ ] *"), "");
QList<QString> commands = filterCommands.split(","); // Extract default input mode
GmicQt::InputMode defaultInputMode = GmicQt::UnspecifiedInputMode;
QRegExp reInputMode("\\s*:\\s*([xX.*+vViI-])\\s*$");
if (reInputMode.indexIn(filterCommands) != -1) {
QString mode = reInputMode.cap(1);
filterCommands.remove(reInputMode);
defaultInputMode = symbolToInputMode(mode);
}
QList<QString> commands = filterCommands.split(",");
QString filterCommand = commands[0].trimmed(); QString filterCommand = commands[0].trimmed();
if (commands.isEmpty()) { if (commands.isEmpty()) {
commands.push_back("_none_"); commands.push_back("_none_");
} }
if (commands.size() == 1) { if (commands.size() == 1) {
commands.push_back(commands.front()); commands.push_back(commands.front());
} }
QList<QString> preview = commands[1].trimmed().split("("); QList<QString> preview = commands[1].trimmed().split("(");
float previewFactor = GmicQt::PreviewFactorAny; float previewFactor = GmicQt::PreviewFactorAny;
bool accurateIfZoomed = true; bool accurateIfZoomed = true;
skipping to change at line 172 skipping to change at line 179
} while (!stdlib.atEnd() // } while (!stdlib.atEnd() //
&& !folderRegexpNoLanguage.exactMatch(buffer) // && !folderRegexpNoLanguage.exactMatch(buffer) //
&& !folderRegexpLanguage.exactMatch(buffer) // && !folderRegexpLanguage.exactMatch(buffer) //
&& !filterRegexpNoLanguage.exactMatch(buffer) // && !filterRegexpNoLanguage.exactMatch(buffer) //
&& !filterRegexpLanguage.exactMatch(buffer)); && !filterRegexpLanguage.exactMatch(buffer));
FiltersModel::Filter filter; FiltersModel::Filter filter;
filter.setName(filterName); filter.setName(filterName);
filter.setCommand(filterCommand); filter.setCommand(filterCommand);
filter.setPreviewCommand(filterPreviewCommand); filter.setPreviewCommand(filterPreviewCommand);
filter.setDefaultInputMode(defaultInputMode);
filter.setPreviewFactor(previewFactor); filter.setPreviewFactor(previewFactor);
filter.setAccurateIfZoomed(accurateIfZoomed); filter.setAccurateIfZoomed(accurateIfZoomed);
filter.setParameters(parameters); filter.setParameters(parameters);
filter.setPath(filterPath); filter.setPath(filterPath);
filter.setWarningFlag(warning); filter.setWarningFlag(warning);
filter.build(); filter.build();
_model.addFilter(filter); _model.addFilter(filter);
} else { } else {
buffer = readBufferLine(stdlib); buffer = readBufferLine(stdlib);
} }
skipping to change at line 193 skipping to change at line 201
buffer = readBufferLine(stdlib); buffer = readBufferLine(stdlib);
} }
} while (!buffer.isEmpty()); } while (!buffer.isEmpty());
// Remove hidden filters from the model // Remove hidden filters from the model
for (const QString & path : hiddenPaths) { for (const QString & path : hiddenPaths) {
const size_t count = _model.filterCount(); const size_t count = _model.filterCount();
QList<QString> pathList = path.split("/", QString::SkipEmptyParts); QList<QString> pathList = path.split("/", QString::SkipEmptyParts);
_model.removePath(pathList); _model.removePath(pathList);
if (_model.filterCount() == count) { if (_model.filterCount() == count) {
Logger::log(QString("[%1]./warning/ While hiding filter, name or path not found: \"%2\"\n").arg(GmicQt::pluginCodeName()).arg(path)); Logger::warning(QString("While hiding filter, name or path not found: \"%1 \"").arg(path));
} }
} }
TIMING; TIMING;
} }
bool FiltersModelReader::textIsPrecededBySpacesInSomeLineOfArray(const QByteArra y & text, const QByteArray & array) bool FiltersModelReader::textIsPrecededBySpacesInSomeLineOfArray(const QByteArra y & text, const QByteArray & array)
{ {
if (text.isEmpty()) { if (text.isEmpty()) {
return false; return false;
} }
skipping to change at line 220 skipping to change at line 228
--index; --index;
} }
if ((index < 0) || (data[index] == '\n')) { if ((index < 0) || (data[index] == '\n')) {
return true; return true;
} }
from = position + 1; from = position + 1;
} }
return false; return false;
} }
GmicQt::InputMode FiltersModelReader::symbolToInputMode(const QString & str)
{
if (str.length() != 1) {
Logger::warning(QString("'%1' is not recognized as a default input mode (sho
uld be a single symbol/letter)").arg(str));
return GmicQt::UnspecifiedInputMode;
}
switch (str.toLocal8Bit()[0]) {
case 'x':
case 'X':
return GmicQt::NoInput;
case '.':
return GmicQt::Active;
case '*':
return GmicQt::All;
case '-':
return GmicQt::ActiveAndAbove;
case '+':
return GmicQt::ActiveAndBelow;
case 'V':
case 'v':
return GmicQt::AllVisibles;
case 'I':
case 'i':
return GmicQt::AllInvisibles;
default:
Logger::warning(QString("'%1' is not recognized as a default input mode").ar
g(str));
return GmicQt::UnspecifiedInputMode;
}
}
QString FiltersModelReader::readBufferLine(QBuffer & buffer) QString FiltersModelReader::readBufferLine(QBuffer & buffer)
{ {
// QBuffer::readline(max_size) may be very slow, in debug mode, when max_size // QBuffer::readline(max_size) may be very slow, in debug mode, when max_size
// is too big (e.g. 1MB). We read large lines in multiple calls. // is too big (e.g. 1MB). We read large lines in multiple calls.
QString result; QString result;
QString text; QString text;
QRegExp commentStart("^\\s*#"); QRegExp commentStart("^\\s*#");
do { do {
text = buffer.readLine(1024); text = buffer.readLine(1024);
result.append(text); result.append(text);
 End of changes. 6 change blocks. 
3 lines changed or deleted 43 lines changed or added

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