"Fossies" - the Fresh Open Source Software Archive  

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

FiltersPresenter.cpp  (gmic_2.8.1):FiltersPresenter.cpp  (gmic_2.8.2)
skipping to change at line 143 skipping to change at line 143
FiltersModel::const_iterator itFilter = _filtersModel.cbegin(); FiltersModel::const_iterator itFilter = _filtersModel.cbegin();
while ((itFilter != _filtersModel.cend()) && (itFilter->hash236() != fave. originalHash())) { while ((itFilter != _filtersModel.cend()) && (itFilter->hash236() != fave. originalHash())) {
++itFilter; ++itFilter;
} }
if (itFilter != _filtersModel.cend()) { if (itFilter != _filtersModel.cend()) {
_favesModel.removeFave(fave.hash()); _favesModel.removeFave(fave.hash());
FavesModel::Fave newFave = fave; FavesModel::Fave newFave = fave;
newFave.setOriginalHash(itFilter->hash()); newFave.setOriginalHash(itFilter->hash());
newFave.setOriginalName(itFilter->name()); newFave.setOriginalName(itFilter->name());
_favesModel.addFave(newFave); _favesModel.addFave(newFave);
QString message = QString("\n[%1]./information/ Fave '%2' has been relin QString message = QString("Fave '%1' has been relinked to filter '%2'").
ked to filter '%3'\n").arg(GmicQt::pluginCodeName()).arg(fave.name()).arg(itFilt arg(fave.name()).arg(itFilter->name());
er->name()); Logger::log(message, "information", true);
Logger::log(message);
someFavesHaveBeenRelinked = true; someFavesHaveBeenRelinked = true;
} else { } else {
QString message = QString("\n[%1]./warning/ Could not associate Fave '%2 QString message = QString("Could not associate Fave '%1' to an existing
' to an existing filter\n").arg(GmicQt::pluginCodeName()).arg(fave.name()); filter").arg(fave.name());
Logger::log(message); Logger::warning(message, true);
} }
} }
++itFormerFave; ++itFormerFave;
} }
if (someFavesHaveBeenRelinked) { if (someFavesHaveBeenRelinked) {
saveFaves(); saveFaves();
} }
} }
void FiltersPresenter::importGmicGTKFaves() void FiltersPresenter::importGmicGTKFaves()
skipping to change at line 203 skipping to change at line 203
fave.setOriginalHash(originalFave.originalHash()); fave.setOriginalHash(originalFave.originalHash());
fave.setOriginalName(originalFave.originalName()); fave.setOriginalName(originalFave.originalName());
} }
} }
fave.build(); fave.build();
FiltersVisibilityMap::setVisibility(fave.hash(), true); FiltersVisibilityMap::setVisibility(fave.hash(), true);
_favesModel.addFave(fave); _favesModel.addFave(fave);
ParametersCache::setValues(fave.hash(), defaultValues); ParametersCache::setValues(fave.hash(), defaultValues);
ParametersCache::setVisibilityStates(fave.hash(), visibilityStates); ParametersCache::setVisibilityStates(fave.hash(), visibilityStates);
ParametersCache::setInputOutputState(fave.hash(), inOutState); ParametersCache::setInputOutputState(fave.hash(), inOutState, _currentFilter.d efaultInputMode);
_filtersView->addFave(fave.name(), fave.hash()); _filtersView->addFave(fave.name(), fave.hash());
_filtersView->sortFaves(); _filtersView->sortFaves();
_filtersView->selectFave(fave.hash()); _filtersView->selectFave(fave.hash());
onFilterChanged(fave.hash()); onFilterChanged(fave.hash());
saveFaves(); saveFaves();
} }
void FiltersPresenter::applySearchCriterion(const QString & text) void FiltersPresenter::applySearchCriterion(const QString & text)
{ {
static QString previousText; static QString previousText;
skipping to change at line 319 skipping to change at line 319
void FiltersPresenter::editSelectedFaveName() void FiltersPresenter::editSelectedFaveName()
{ {
_filtersView->editSelectedFaveName(); _filtersView->editSelectedFaveName();
} }
void FiltersPresenter::onFaveRenamed(const QString & hash, const QString & name) void FiltersPresenter::onFaveRenamed(const QString & hash, const QString & name)
{ {
Q_ASSERT_X(_favesModel.contains(hash), "onFaveRenamed()", "Hash not found"); Q_ASSERT_X(_favesModel.contains(hash), "onFaveRenamed()", "Hash not found");
FavesModel::Fave fave = _favesModel.getFaveFromHash(hash); FavesModel::Fave fave = _favesModel.getFaveFromHash(hash);
_favesModel.removeFave(hash); _favesModel.removeFave(hash);
GmicQt::InputMode defaultInputMode = GmicQt::UnspecifiedInputMode;
if (_filtersModel.contains(fave.originalHash())) {
const FiltersModel::Filter & originalFilter = _filtersModel.getFilterFromHas
h(fave.originalHash());
defaultInputMode = originalFilter.defaultInputMode();
}
QString newName = name; QString newName = name;
if (newName.isEmpty()) { if (newName.isEmpty()) {
if (_filtersModel.contains(fave.originalHash())) { if (_filtersModel.contains(fave.originalHash())) {
const FiltersModel::Filter & originalFilter = _filtersModel.getFilterFromH ash(fave.originalHash()); const FiltersModel::Filter & originalFilter = _filtersModel.getFilterFromH ash(fave.originalHash());
newName = _favesModel.uniqueName(originalFilter.name(), QString()); newName = _favesModel.uniqueName(originalFilter.name(), QString());
} else { } else {
newName = _favesModel.uniqueName("Unknown filter", QString()); newName = _favesModel.uniqueName("Unknown filter", QString());
} }
} else { } else {
newName = _favesModel.uniqueName(newName, QString()); newName = _favesModel.uniqueName(newName, QString());
} }
fave.setName(newName); fave.setName(newName);
fave.build(); fave.build();
// Move parameters // Move parameters
QList<QString> values = ParametersCache::getValues(hash); QList<QString> values = ParametersCache::getValues(hash);
QList<int> visibilityStates = ParametersCache::getVisibilityStates(hash); QList<int> visibilityStates = ParametersCache::getVisibilityStates(hash);
GmicQt::InputOutputState inOutState = ParametersCache::getInputOutputState(has h); GmicQt::InputOutputState inOutState = ParametersCache::getInputOutputState(has h);
ParametersCache::remove(hash); ParametersCache::remove(hash);
ParametersCache::setValues(fave.hash(), values); ParametersCache::setValues(fave.hash(), values);
ParametersCache::setVisibilityStates(fave.hash(), visibilityStates); ParametersCache::setVisibilityStates(fave.hash(), visibilityStates);
ParametersCache::setInputOutputState(fave.hash(), inOutState); ParametersCache::setInputOutputState(fave.hash(), inOutState, defaultInputMode );
_favesModel.addFave(fave); _favesModel.addFave(fave);
_filtersView->updateFaveItem(hash, fave.hash(), fave.name()); _filtersView->updateFaveItem(hash, fave.hash(), fave.name());
_filtersView->sortFaves(); _filtersView->sortFaves();
saveFaves(); saveFaves();
} }
void FiltersPresenter::toggleSelectionMode(bool on) void FiltersPresenter::toggleSelectionMode(bool on)
{ {
if (on) { if (on) {
skipping to change at line 401 skipping to change at line 407
if (hash.isEmpty()) { if (hash.isEmpty()) {
_currentFilter.clear(); _currentFilter.clear();
} else if (_favesModel.contains(hash)) { } else if (_favesModel.contains(hash)) {
const FavesModel::Fave & fave = _favesModel.getFaveFromHash(hash); const FavesModel::Fave & fave = _favesModel.getFaveFromHash(hash);
const QString & originalHash = fave.originalHash(); const QString & originalHash = fave.originalHash();
if (_filtersModel.contains(originalHash)) { if (_filtersModel.contains(originalHash)) {
const FiltersModel::Filter & filter = _filtersModel.getFilterFromHash(orig inalHash); const FiltersModel::Filter & filter = _filtersModel.getFilterFromHash(orig inalHash);
_currentFilter.command = fave.command(); _currentFilter.command = fave.command();
_currentFilter.defaultParameterValues = fave.defaultValues(); _currentFilter.defaultParameterValues = fave.defaultValues();
_currentFilter.defaultVisibilityStates = fave.defaultVisibilityStates(); _currentFilter.defaultVisibilityStates = fave.defaultVisibilityStates();
_currentFilter.defaultInputMode = filter.defaultInputMode();
_currentFilter.hash = hash; _currentFilter.hash = hash;
_currentFilter.isAFave = true; _currentFilter.isAFave = true;
_currentFilter.name = fave.name(); _currentFilter.name = fave.name();
_currentFilter.plainTextName = fave.plainText(); _currentFilter.plainTextName = fave.plainText();
_currentFilter.parameters = filter.parameters(); _currentFilter.parameters = filter.parameters();
_currentFilter.previewCommand = fave.previewCommand(); _currentFilter.previewCommand = fave.previewCommand();
_currentFilter.isAccurateIfZoomed = filter.isAccurateIfZoomed(); _currentFilter.isAccurateIfZoomed = filter.isAccurateIfZoomed();
_currentFilter.previewFactor = filter.previewFactor(); _currentFilter.previewFactor = filter.previewFactor();
} else { } else {
setInvalidFilter(); setInvalidFilter();
_errorMessage = tr("Cannot find this fave's original filter\n"); _errorMessage = tr("Cannot find this fave's original filter\n");
} }
} else if (_filtersModel.contains(hash)) { } else if (_filtersModel.contains(hash)) {
const FiltersModel::Filter & filter = _filtersModel.getFilterFromHash(hash); const FiltersModel::Filter & filter = _filtersModel.getFilterFromHash(hash);
_currentFilter.command = filter.command(); _currentFilter.command = filter.command();
_currentFilter.defaultParameterValues = ParametersCache::getValues(hash); _currentFilter.defaultParameterValues = ParametersCache::getValues(hash);
_currentFilter.defaultVisibilityStates = ParametersCache::getVisibilityState s(hash); _currentFilter.defaultVisibilityStates = ParametersCache::getVisibilityState s(hash);
_currentFilter.defaultInputMode = filter.defaultInputMode();
_currentFilter.hash = hash; _currentFilter.hash = hash;
_currentFilter.isAFave = false; _currentFilter.isAFave = false;
_currentFilter.name = filter.name(); _currentFilter.name = filter.name();
_currentFilter.plainTextName = filter.plainText(); _currentFilter.plainTextName = filter.plainText();
_currentFilter.parameters = filter.parameters(); _currentFilter.parameters = filter.parameters();
_currentFilter.previewCommand = filter.previewCommand(); _currentFilter.previewCommand = filter.previewCommand();
_currentFilter.isAccurateIfZoomed = filter.isAccurateIfZoomed(); _currentFilter.isAccurateIfZoomed = filter.isAccurateIfZoomed();
_currentFilter.previewFactor = filter.previewFactor(); _currentFilter.previewFactor = filter.previewFactor();
} else { } else {
_currentFilter.clear(); _currentFilter.clear();
skipping to change at line 441 skipping to change at line 449
void FiltersPresenter::Filter::clear() void FiltersPresenter::Filter::clear()
{ {
name.clear(); name.clear();
command.clear(); command.clear();
previewCommand.clear(); previewCommand.clear();
parameters.clear(); parameters.clear();
defaultParameterValues.clear(); defaultParameterValues.clear();
hash.clear(); hash.clear();
plainTextName.clear(); plainTextName.clear();
previewFactor = GmicQt::PreviewFactorAny; previewFactor = GmicQt::PreviewFactorAny;
defaultInputMode = GmicQt::UnspecifiedInputMode;
isAFave = false; isAFave = false;
} }
void FiltersPresenter::Filter::setInvalid() void FiltersPresenter::Filter::setInvalid()
{ {
clear(); clear();
command = "skip"; command = "skip";
previewCommand = "skip"; previewCommand = "skip";
} }
 End of changes. 9 change blocks. 
10 lines changed or deleted 19 lines changed or added

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