Some minor cleanups
This commit is contained in:
parent
6bcac40306
commit
9b5ffaf4aa
@ -307,10 +307,10 @@ std::shared_ptr<rtengine::HaldCLUT> rtengine::CLUTStore::getClut(const Glib::ust
|
||||
{
|
||||
std::shared_ptr<rtengine::HaldCLUT> result;
|
||||
|
||||
Glib::ustring full_filename = filename;
|
||||
if ( !Glib::path_is_absolute(full_filename) ) {
|
||||
full_filename = Glib::build_filename(options.clutsDir, filename);
|
||||
}
|
||||
const Glib::ustring full_filename =
|
||||
!Glib::path_is_absolute(filename)
|
||||
? Glib::ustring(Glib::build_filename(options.clutsDir, filename))
|
||||
: filename;
|
||||
|
||||
if (!cache.get(full_filename, result)) {
|
||||
std::unique_ptr<rtengine::HaldCLUT> clut(new rtengine::HaldCLUT);
|
||||
|
@ -11,45 +11,45 @@ using namespace rtengine::procparams;
|
||||
namespace
|
||||
{
|
||||
|
||||
Glib::ustring stripPrefixDir(const Glib::ustring &filename,
|
||||
Glib::ustring dir)
|
||||
Glib::ustring stripPrefixDir(const Glib::ustring& filename, const Glib::ustring& dir)
|
||||
{
|
||||
if (!Glib::str_has_suffix(dir, G_DIR_SEPARATOR_S)) {
|
||||
dir += G_DIR_SEPARATOR_S;
|
||||
}
|
||||
if (Glib::str_has_prefix(filename, dir)) {
|
||||
return filename.substr(dir.size());
|
||||
}
|
||||
return filename;
|
||||
const Glib::ustring full_dir =
|
||||
!Glib::str_has_suffix(dir, G_DIR_SEPARATOR_S)
|
||||
? dir + G_DIR_SEPARATOR_S
|
||||
: dir;
|
||||
return
|
||||
Glib::str_has_prefix(filename, full_dir)
|
||||
? filename.substr(full_dir.size())
|
||||
: filename;
|
||||
}
|
||||
|
||||
bool notifySlowParseDir (const std::chrono::system_clock::time_point& startedAt)
|
||||
{
|
||||
static enum
|
||||
{
|
||||
Undecided,
|
||||
Cancel,
|
||||
Continue
|
||||
}
|
||||
decision = Undecided;
|
||||
enum Decision {
|
||||
UNDECIDED,
|
||||
CANCEL,
|
||||
CONTINUE
|
||||
};
|
||||
|
||||
if (decision == Cancel) {
|
||||
static Decision decision = UNDECIDED;
|
||||
|
||||
if (decision == CANCEL) {
|
||||
return false;
|
||||
} else if (decision == Continue) {
|
||||
} else if (decision == CONTINUE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto now = std::chrono::system_clock::now ();
|
||||
if (now - startedAt < std::chrono::seconds (10)) {
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
if (now - startedAt < std::chrono::seconds(10)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Gtk::MessageDialog dialog (M ("TP_FILMSIMULATION_SLOWPARSEDIR"), false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
|
||||
if (dialog.run () == Gtk::RESPONSE_YES) {
|
||||
decision = Cancel;
|
||||
Gtk::MessageDialog dialog(M("TP_FILMSIMULATION_SLOWPARSEDIR"), false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
|
||||
if (dialog.run() == Gtk::RESPONSE_YES) {
|
||||
decision = CANCEL;
|
||||
return false;
|
||||
} else {
|
||||
decision = Continue;
|
||||
decision = CONTINUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -123,37 +123,40 @@ void FilmSimulation::read( const rtengine::procparams::ProcParams* pp, const Par
|
||||
{
|
||||
//copypasted from lensprofile.cc & sharpening.cc
|
||||
disableListener();
|
||||
updateDisable( true );
|
||||
updateDisable(true);
|
||||
|
||||
setEnabled (pp->filmSimulation.enabled);
|
||||
setEnabled(pp->filmSimulation.enabled);
|
||||
|
||||
if ( !pp->filmSimulation.clutFilename.empty() ) {
|
||||
Glib::ustring full_filename(pp->filmSimulation.clutFilename);
|
||||
if ( !Glib::path_is_absolute(full_filename) ) {
|
||||
full_filename = Glib::build_filename(options.clutsDir,
|
||||
full_filename);
|
||||
}
|
||||
m_clutComboBox->setSelectedClut( full_filename );
|
||||
if (!pp->filmSimulation.clutFilename.empty()) {
|
||||
m_clutComboBox->setSelectedClut(
|
||||
!Glib::path_is_absolute(pp->filmSimulation.clutFilename)
|
||||
? Glib::ustring(Glib::build_filename(options.clutsDir, pp->filmSimulation.clutFilename))
|
||||
: pp->filmSimulation.clutFilename
|
||||
);
|
||||
}
|
||||
|
||||
m_strength->setValue( pp->filmSimulation.strength );
|
||||
m_strength->setValue(pp->filmSimulation.strength);
|
||||
|
||||
if (pedited) {
|
||||
set_inconsistent (multiImage && !pedited->filmSimulation.enabled);
|
||||
m_strength->setEditedState (pedited->filmSimulation.strength ? Edited : UnEdited);
|
||||
m_strength->setEditedState(
|
||||
pedited->filmSimulation.strength
|
||||
? Edited
|
||||
: UnEdited
|
||||
);
|
||||
|
||||
if ( !pedited->filmSimulation.clutFilename ) {
|
||||
if (!pedited->filmSimulation.clutFilename) {
|
||||
m_clutComboBox->setSelectedClut("NULL");
|
||||
}
|
||||
}
|
||||
|
||||
if ( !get_inconsistent() && !pp->filmSimulation.enabled ) {
|
||||
if (!get_inconsistent() && !pp->filmSimulation.enabled) {
|
||||
if (options.clutCacheSize == 1) {
|
||||
CLUTStore::getInstance().clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
updateDisable( false );
|
||||
updateDisable(false);
|
||||
enableListener();
|
||||
}
|
||||
|
||||
@ -164,18 +167,17 @@ void FilmSimulation::updateDisable( bool value )
|
||||
|
||||
void FilmSimulation::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited )
|
||||
{
|
||||
if ( pedited ) {
|
||||
pedited->filmSimulation.enabled = !get_inconsistent();
|
||||
pedited->filmSimulation.strength = m_strength->getEditedState ();
|
||||
if (pedited) {
|
||||
pedited->filmSimulation.enabled = !get_inconsistent();
|
||||
pedited->filmSimulation.strength = m_strength->getEditedState();
|
||||
pedited->filmSimulation.clutFilename = m_clutComboBox->getSelectedClut() != "NULL";
|
||||
}
|
||||
|
||||
pp->filmSimulation.enabled = getEnabled();
|
||||
Glib::ustring clutFName = m_clutComboBox->getSelectedClut();
|
||||
const Glib::ustring clutFName = m_clutComboBox->getSelectedClut();
|
||||
|
||||
if ( clutFName != "NULL" ) { // We do not want to set "NULL" in clutFilename, even if "unedited"
|
||||
pp->filmSimulation.clutFilename = stripPrefixDir(clutFName,
|
||||
options.clutsDir);
|
||||
if (clutFName != "NULL") { // We do not want to set "NULL" in clutFilename, even if "unedited"
|
||||
pp->filmSimulation.clutFilename = stripPrefixDir(clutFName, options.clutsDir);
|
||||
}
|
||||
|
||||
pp->filmSimulation.strength = m_strength->getValue();
|
||||
|
Loading…
x
Reference in New Issue
Block a user