diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index c164abc0d..85954abfa 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5653,7 +5653,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double double ImProcFunctions::getAutoDistor (const Glib::ustring &fname, int thumb_size) { - if (fname != "") { + if (!fname.empty()) { rtengine::RawMetaDataLocation ri; int w_raw = -1, h_raw = thumb_size; int w_thumb = -1, h_thumb = thumb_size; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 81de080bd..cb27fc2b3 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -39,11 +39,11 @@ namespace Glib::ustring expandRelativePath(const Glib::ustring &procparams_fname, const Glib::ustring &prefix, Glib::ustring embedded_fname) { - if (embedded_fname == "" || !Glib::path_is_absolute(procparams_fname)) { + if (embedded_fname.empty() || !Glib::path_is_absolute(procparams_fname)) { return embedded_fname; } - if (prefix != "") { + if (!prefix.empty()) { if (embedded_fname.length() < prefix.length() || embedded_fname.substr(0, prefix.length()) != prefix) { return embedded_fname; } @@ -61,7 +61,7 @@ Glib::ustring expandRelativePath(const Glib::ustring &procparams_fname, const Gl Glib::ustring relativePathIfInside(const Glib::ustring &procparams_fname, bool fnameAbsolute, Glib::ustring embedded_fname) { - if (fnameAbsolute || embedded_fname == "" || !Glib::path_is_absolute(procparams_fname)) { + if (fnameAbsolute || embedded_fname.empty() || !Glib::path_is_absolute(procparams_fname)) { return embedded_fname; } diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 3b2738405..9f310508f 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -3824,7 +3824,7 @@ bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embed return false; } - if (inProfile == "(embedded)" && embedded) { + if (embedded && inProfile == "(embedded)") { in = embedded; } else if (inProfile == "(cameraICC)") { // DCPs have higher quality, so use them first @@ -3833,7 +3833,7 @@ bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embed if (*dcpProf == nullptr) { in = ICCStore::getInstance()->getStdProfile(camName); } - } else if (inProfile != "(camera)" && inProfile != "") { + } else if (inProfile != "(camera)" && !inProfile.empty()) { Glib::ustring normalName = inProfile; if (!inProfile.compare (0, 5, "file:")) { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 4bdaa6ff1..2d594e0af 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1326,7 +1326,7 @@ private: } else { // use the selected output profile if present, otherwise use LCMS2 profile generate by lab2rgb16 w/ gamma - if (params.icm.outputProfile != "" && params.icm.outputProfile != ColorManagementParams::NoICMString) { + if (!params.icm.outputProfile.empty() && params.icm.outputProfile != ColorManagementParams::NoICMString) { // if ICCStore::getInstance()->getProfile send back an object, then ICCStore::getInstance()->getContent will do too cmsHPROFILE jprof = ICCStore::getInstance()->getProfile (params.icm.outputProfile); //get outProfile diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 6ca3091a3..e5c98a93a 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -224,7 +224,7 @@ void StdImageSource::colorSpaceConversion (Imagefloat* im, const ColorManagement cmsHPROFILE in = nullptr; cmsHPROFILE out = ICCStore::getInstance()->workingSpace (cmp.workingProfile); - if (cmp.inputProfile == "(embedded)" || cmp.inputProfile == "" || cmp.inputProfile == "(camera)" || cmp.inputProfile == "(cameraICC)") { + if (cmp.inputProfile == "(embedded)" || cmp.inputProfile.empty() || cmp.inputProfile == "(camera)" || cmp.inputProfile == "(cameraICC)") { if (embedded) { in = embedded; } else { diff --git a/rtexif/nikonattribs.cc b/rtexif/nikonattribs.cc index b2066150d..1c6ead006 100644 --- a/rtexif/nikonattribs.cc +++ b/rtexif/nikonattribs.cc @@ -257,65 +257,18 @@ public: std::ostringstream af; - if (aff & 1) - if (af.str() == "") { - af << "Center"; - } else { - af << ", Center"; - } else if (aff & 2) - if (af.str() == "") { - af << "Top"; - } else { - af << ", Top"; - } else if (aff & 4) - if (af.str() == "") { - af << "Bottom"; - } else { - af << ", Bottom"; - } else if (aff & 8) - if (af.str() == "") { - af << "Left"; - } else { - af << ", Left"; - } else if (aff & 16) - if (af.str() == "") { - af << "Right"; - } else { - af << ", Right"; - } else if (aff & 32) - if (af.str() == "") { - af << "Upper-left"; - } else { - af << ", Upper-left"; - } else if (aff & 64) - if (af.str() == "") { - af << "Upper-right"; - } else { - af << ", Upper-right"; - } else if (aff & 128) - if (af.str() == "") { - af << " Lower-left"; - } else { - af << ", Lower-left"; - } else if (aff & 256) - if (af.str() == "") { - af << "Lower-right"; - } else { - af << ", Lower-right"; - } else if (aff & 512) - if (af.str() == "") { - af << "Far Left"; - } else { - af << ", Far Left"; - } else if (aff & 1024) { - if (af.str() == "") { - af << "Far Right"; - } else { - af << ", Far Right"; + if (aff) { + for (size_t i = 0; i < afpchoices.size(); ++i) { + if (aff & (1 << i)) { + if (!af.str().empty()) { + af << ", "; + } + af << afpchoices.at(i); + } } } - str << "AFPointsInFocus = " << af.str(); + str << "AFPointsInFocus = " << (af.str().empty() ? "None" : af.str()); return str.str(); } }; @@ -553,7 +506,7 @@ public: std::map::const_iterator r = lenses.find (lid.str()); if (r != lenses.end()) { - if (r == lenses.begin() && EffectiveMaxApertureString != "") { // first entry is for unchipped lenses + if (r == lenses.begin() && !EffectiveMaxApertureString.empty()) { // first entry is for unchipped lenses Tag *FLTag = t->getParent()->getRoot()->findTag ("FocalLength"); ld << "Lens = MF "; diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 7222be05d..239057b87 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -667,7 +667,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady(rtengine::IImagefloat* img) Glib::ustring fname; SaveFormat saveFormat; - if (processing->outFileName == "") { // auto file name + if (processing->outFileName.empty()) { // auto file name Glib::ustring s = calcAutoFileNameBase (processing->filename, processing->sequence); saveFormat = options.saveFormatBatch; fname = autoCompleteFileName (s, saveFormat.format); @@ -686,7 +686,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady(rtengine::IImagefloat* img) //printf ("fname=%s, %s\n", fname.c_str(), removeExtension(fname).c_str()); - if (img && fname != "") { + if (img && !fname.empty()) { int err = 0; if (saveFormat.format == "tif") { diff --git a/rtgui/darkframe.cc b/rtgui/darkframe.cc index 77e9c53a6..8ffca7544 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -125,7 +125,7 @@ void DarkFrame::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi Glib::ustring fname = Glib::path_get_basename(dfp->GetCurrentImageFilePath()); Glib::ustring filetype; - if (fname != "") { + if (!fname.empty()) { // get image filetype, set filter to the same as current image's filetype std::string::size_type idx; idx = fname.rfind('.'); diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index c5036798e..6c196e575 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -496,7 +496,7 @@ void ExifPanel::addPressed () Glib::ustring sel = getSelection (true); - if (sel == "") { + if (sel.empty()) { tcombo->set_active_text ("Exif.UserComment"); } else { tcombo->set_active_text (sel); @@ -658,7 +658,7 @@ Glib::ustring ExifPanel::getSelection (bool onlyeditable) void ExifPanel::updateChangeList (Gtk::TreeModel::Children root, std::string prefix) { - if (prefix != "") { + if (!prefix.empty()) { prefix = prefix + "."; } diff --git a/rtgui/favoritbrowser.cc b/rtgui/favoritbrowser.cc index 379ce26e6..0e1b4490b 100644 --- a/rtgui/favoritbrowser.cc +++ b/rtgui/favoritbrowser.cc @@ -97,7 +97,7 @@ void FavoritBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustr void FavoritBrowser::addPressed () { - if (lastSelectedDir == "") { + if (lastSelectedDir.empty()) { return; } diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 5a344c8ba..da33caddf 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -358,7 +358,7 @@ void FilePanel::saveOptions () options.browserToolPanelWidth = winW - get_position(); options.browserToolPanelHeight = tpcPaned->get_position (); - if (options.startupDir == STARTUPDIR_LAST && fileCatalog->lastSelectedDir () != "") { + if (options.startupDir == STARTUPDIR_LAST && !fileCatalog->lastSelectedDir().empty()) { options.startupPath = fileCatalog->lastSelectedDir (); } diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 3cbd7acf1..25482909e 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -192,7 +192,7 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi Glib::ustring fname = Glib::path_get_basename(ffp->GetCurrentImageFilePath()); Glib::ustring filetype; - if (fname != "") { + if (!fname.empty()) { // get image filetype, set filter to the same as current image's filetype std::string::size_type idx; idx = fname.rfind('.'); diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index ca025ec75..e7efa20e9 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -504,7 +504,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) if (pp->icm.inputProfile == "(none)") { inone->set_active(true); updateDCP(pp->icm.dcpIlluminant, ""); - } else if (pp->icm.inputProfile == "(embedded)" || ((pp->icm.inputProfile == "(camera)" || pp->icm.inputProfile == "") && icamera->get_state() == Gtk::STATE_INSENSITIVE)) { + } else if (pp->icm.inputProfile == "(embedded)" || ((pp->icm.inputProfile == "(camera)" || pp->icm.inputProfile.empty()) && icamera->get_state() == Gtk::STATE_INSENSITIVE)) { iembedded->set_active(true); updateDCP(pp->icm.dcpIlluminant, ""); } else if ((pp->icm.inputProfile == "(cameraICC)") && icameraICC->get_state() != Gtk::STATE_INSENSITIVE) { @@ -519,7 +519,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) // If neither (camera) nor (cameraICC) are available, as is the case when loading a non-raw, activate (embedded). iembedded->set_active(true); updateDCP(pp->icm.dcpIlluminant, "(cameraICC)"); - } else if ((pp->icm.inputProfile == "(camera)" || pp->icm.inputProfile == "") && icamera->get_state() != Gtk::STATE_INSENSITIVE) { + } else if ((pp->icm.inputProfile == "(camera)" || pp->icm.inputProfile.empty()) && icamera->get_state() != Gtk::STATE_INSENSITIVE) { icamera->set_active(true); updateDCP(pp->icm.dcpIlluminant, ""); } else { @@ -949,7 +949,7 @@ void ICMPanel::setRawMeta(bool raw, const rtengine::FramesData* pMeta) void ICMPanel::ipSelectionChanged() { - if (ipDialog->get_filename() == "") { + if (ipDialog->get_filename().empty()) { return; } diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index dd891b351..886d9ff5b 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -247,7 +247,7 @@ bool ImageArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) (*i)->expose (cr); } - if (options.showInfo && infotext != "") { + if (options.showInfo && !infotext.empty()) { iBackBuffer.copySurface(cr); } diff --git a/rtgui/inspector.cc b/rtgui/inspector.cc index 06e2272e7..a183a3419 100644 --- a/rtgui/inspector.cc +++ b/rtgui/inspector.cc @@ -34,7 +34,7 @@ InspectorBuffer::InspectorBuffer(const Glib::ustring &imagePath) : currTransform // generate thumbnail image Glib::ustring ext = getExtension (imagePath); - if (ext == "") { + if (ext.empty()) { imgPath.clear(); return; } diff --git a/rtgui/lwbutton.cc b/rtgui/lwbutton.cc index 02041ea0c..3c97ff6bb 100644 --- a/rtgui/lwbutton.cc +++ b/rtgui/lwbutton.cc @@ -45,6 +45,12 @@ void LWButton::setPosition (int x, int y) ypos = y; } +void LWButton::addPosition (int x, int y) +{ + xpos += x; + ypos += y; +} + void LWButton::getPosition (int& x, int& y) const { @@ -219,15 +225,11 @@ void LWButton::getAlignment (Alignment& ha, Alignment& va) const Glib::ustring LWButton::getToolTip (int x, int y) const { - if (inside(x, y)) { - if (toolTip) { - return *toolTip; - } else { - return ""; - } - } else { - return ""; - } + if (inside(x, y) && toolTip) { + return *toolTip; + } else { + return {}; + } } void LWButton::setToolTip (Glib::ustring* tooltip) diff --git a/rtgui/lwbutton.h b/rtgui/lwbutton.h index aec875d55..12dbb6346 100644 --- a/rtgui/lwbutton.h +++ b/rtgui/lwbutton.h @@ -57,6 +57,7 @@ public: void getSize (int& minw, int& minh) const; void getAlignment (Alignment& ha, Alignment& va) const; void setPosition (int x, int y); + void addPosition (int x, int y); void getPosition (int& x, int& y) const; bool inside (int x, int y) const; void setIcon (Cairo::RefPtr i); diff --git a/rtgui/lwbuttonset.cc b/rtgui/lwbuttonset.cc index 99d3dce7c..d4d39bfe3 100644 --- a/rtgui/lwbuttonset.cc +++ b/rtgui/lwbuttonset.cc @@ -24,21 +24,18 @@ LWButtonSet::LWButtonSet () : aw(0), ah(0), ax(-1), ay(-1) LWButtonSet::~LWButtonSet () { - - for (size_t i = 0; i < buttons.size(); i++) { - delete buttons[i]; + for (const auto entry : buttons) { + delete entry; } } void LWButtonSet::add (LWButton* b) { - buttons.push_back (b); } -void LWButtonSet::getMinimalDimensions (int& w, int& h) +void LWButtonSet::getMinimalDimensions (int& w, int& h) const { - w = 0; h = 0; @@ -104,108 +101,86 @@ void LWButtonSet::arrangeButtons (int x, int y, int w, int h) void LWButtonSet::move (int nx, int ny) { - - for (size_t i = 0; i < buttons.size(); i++) { - int x, y; - buttons[i]->getPosition (x, y); - buttons[i]->setPosition (x + nx - ax, y + ny - ay); + for (const auto entry : buttons) { + entry->addPosition(nx - ax, ny - ay); } - ax = nx; ay = ny; } void LWButtonSet::redraw (Cairo::RefPtr context) { - - for (size_t i = 0; i < buttons.size(); i++) { - buttons[i]->redraw (context); + for (const auto entry : buttons) { + entry->redraw(context); } } bool LWButtonSet::motionNotify (int x, int y) { - bool res = false; - - for (size_t i = 0; i < buttons.size(); i++) { - bool handled = buttons[i]->motionNotify (x, y); - res = res || handled; + for (const auto entry : buttons) { + res = entry->motionNotify(x, y) || res; } - return res; } bool LWButtonSet::pressNotify (int x, int y) { - bool res = false; - - for (size_t i = 0; i < buttons.size(); i++) { - bool handled = buttons[i]->pressNotify (x, y); - res = res || handled; + for (const auto entry : buttons) { + res = entry->pressNotify(x, y) || res; } - return res; } bool LWButtonSet::releaseNotify (int x, int y) { - bool res = false; - - for (size_t i = 0; i < buttons.size(); i++) { - bool handled = buttons[i]->releaseNotify (x, y); - res = res || handled; + for (const auto entry : buttons) { + res = entry->releaseNotify(x, y) || res; } - return res; } -bool LWButtonSet::inside (int x, int y) +bool LWButtonSet::inside (int x, int y) const { - for (size_t i = 0; i < buttons.size(); i++) - if (buttons[i]->inside (x, y)) { + for (const auto entry : buttons) { + if (entry->inside(x, y)) { return true; } - + } return false; } void LWButtonSet::setButtonListener (LWButtonListener* bl) { - - for (size_t i = 0; i < buttons.size(); i++) { - buttons[i]->setButtonListener (bl); + for (const auto entry : buttons) { + entry->setButtonListener(bl); } } -void LWButtonSet::getAllocatedDimensions (int& w, int& h) +void LWButtonSet::getAllocatedDimensions (int& w, int& h) const { - w = aw; h = ah; } void LWButtonSet::setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg) { - - for (size_t i = 0; i < buttons.size(); i++) { - buttons[i]->setColors (bg, fg); + for (const auto entry : buttons) { + entry->setColors(bg, fg); } } -Glib::ustring LWButtonSet::getToolTip (int x, int y) +Glib::ustring LWButtonSet::getToolTip (int x, int y) const { + for (const auto entry : buttons) { + const auto ttip = entry->getToolTip(x, y); - for (size_t i = 0; i < buttons.size(); i++) { - Glib::ustring ttip = buttons[i]->getToolTip (x, y); - - if (ttip != "") { + if (!ttip.empty()) { return ttip; } } - - return ""; + return {}; } diff --git a/rtgui/lwbuttonset.h b/rtgui/lwbuttonset.h index 5452fa434..fa33620ae 100644 --- a/rtgui/lwbuttonset.h +++ b/rtgui/lwbuttonset.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _LWBUTTONSET_ -#define _LWBUTTONSET_ +#pragma once #include #include "lwbutton.h" @@ -35,20 +34,18 @@ public: void add (LWButton* b); - void getMinimalDimensions (int& w, int& h); - void getAllocatedDimensions (int& w, int& h); + void getMinimalDimensions (int& w, int& h) const; + void getAllocatedDimensions (int& w, int& h) const; void arrangeButtons (int x, int y, int w, int h); void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg); bool motionNotify (int x, int y); bool pressNotify (int x, int y); bool releaseNotify (int x, int y); void move (int nx, int ny); - bool inside (int x, int y); + bool inside (int x, int y) const; - Glib::ustring getToolTip (int x, int y); + Glib::ustring getToolTip (int x, int y) const; void setButtonListener (LWButtonListener* bl); void redraw (Cairo::RefPtr context); }; - -#endif diff --git a/rtgui/placesbrowser.cc b/rtgui/placesbrowser.cc index 0d20e9bad..9935064ee 100644 --- a/rtgui/placesbrowser.cc +++ b/rtgui/placesbrowser.cc @@ -309,7 +309,7 @@ void PlacesBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustri void PlacesBrowser::addPressed () { - if (lastSelectedDir == "") { + if (lastSelectedDir.empty()) { return; } diff --git a/rtgui/renamedlg.cc b/rtgui/renamedlg.cc index f03df455f..14931817f 100644 --- a/rtgui/renamedlg.cc +++ b/rtgui/renamedlg.cc @@ -88,159 +88,3 @@ Glib::ustring RenameDialog::getNewName () return newName->get_text (); } -//void RenameDialog::fillTemplateList () -//{ -// -// templateModel->clear (); -// -// for (size_t i = 0; i < options.renameTemplates.size(); i++) { -// Gtk::TreeModel::iterator iter = templateModel->append (); -// iter->set_value (templateColumns.tmplName, options.renameTemplates[i]); -// iter->set_value (templateColumns.rowSeparator, false); -// } -// -// // append separator and the manage... item -// Gtk::TreeModel::iterator iter = templateModel->append (); -// iter->set_value (templateColumns.tmplName, Glib::ustring("")); -// iter->set_value (templateColumns.rowSeparator, true); -// iter = templateModel->append (); -// iter->set_value (templateColumns.tmplName, Glib::ustring(M("FILEBROWSER_ADDDELTEMPLATE"))); -// iter->set_value (templateColumns.rowSeparator, false); -//} - -//bool RenameDialog::rowSeparatorFunc (const Glib::RefPtr& model, const Gtk::TreeModel::iterator& iter) -//{ -// -// return iter->get_value (templateColumns.rowSeparator); -//} - -//void RenameDialog::useTemplToggled () -//{ -// -// templates->set_sensitive (useTmpl->get_active ()); -// -// if (useTmpl->get_active () && isTemplSelected ()) { -// all->set_sensitive (true); -// newName->set_text (applyTemplate (oldName->get_text(), imageData, getActiveTemplate())); -// } else { -// all->set_sensitive (false); -// } -// -// newName->select_region (0, newName->get_text().size()); -//} - -//bool RenameDialog::isTemplSelected () -//{ -// -// Gtk::TreeModel::iterator iter = templates->get_active(); -// return iter && iter->get_value (templateColumns.tmplName) != M("FILEBROWSER_ADDDELTEMPLATE"); -//} - -//Glib::ustring RenameDialog::getActiveTemplate () -//{ -// -// Gtk::TreeModel::iterator iter = templates->get_active(); -// -// if (iter && iter->get_value (templateColumns.tmplName) != M("FILEBROWSER_ADDDELTEMPLATE")) { -// return iter->get_value (templateColumns.tmplName); -// } else { -// return ""; -// } -//} - -//void RenameDialog::tmplSelectionChanged () -//{ -// -// Gtk::TreeModel::iterator iter = templates->get_active(); -// -// if (iter && iter->get_value (templateColumns.tmplName) == M("FILEBROWSER_ADDDELTEMPLATE")) { -// RenameTemplateEditor* rte = new RenameTemplateEditor (p); -// -// if (rte->run() == Gtk::RESPONSE_OK) { -// fillTemplateList (); -// } -// -// delete rte; -// // show add/del template dialog -// } else { -// useTemplToggled (); -// } -//} - -//RenameTemplateEditor::RenameTemplateEditor (Gtk::Window* parent) -// : Gtk::Dialog ("Edit rename templates", *parent, true) -//{ -// -// list = Gtk::manage (new Gtk::ListViewText (1, false, Gtk::SELECTION_MULTIPLE)); -// list->set_headers_visible (false); -// get_content_area ()->pack_start (*list); -// -// Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ()); -// templ = Gtk::manage (new Gtk::Entry ()); -// Gtk::Button* add = Gtk::manage (new Gtk::Button ()); -// Gtk::Button* del = Gtk::manage (new Gtk::Button ()); -// add->add (*Gtk::manage (new RTImage ("add-small.png"))); -// del->add (*Gtk::manage (new RTImage ("remove-small.png"))); -// hb->pack_start (*templ); -// hb->pack_start (*add, Gtk::PACK_SHRINK, 2); -// hb->pack_start (*del, Gtk::PACK_SHRINK, 2); -// -// get_content_area ()->pack_start (*hb, Gtk::PACK_SHRINK, 4); -// -// add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); -// -// refreshTemplateList (); -// -// add->signal_pressed().connect( sigc::mem_fun(*this, &RenameTemplateEditor::addPressed) ); -// del->signal_pressed().connect( sigc::mem_fun(*this, &RenameTemplateEditor::delPressed) ); -// -// show_all_children (); -// -// set_size_request (-1, 250); -//} -// -//void RenameTemplateEditor::refreshTemplateList () -//{ -// -// list->remove_all_columns(); -// -// for (size_t i = 0; i < options.renameTemplates.size(); i++) { -// list->append (options.renameTemplates[i]); -// } -//} -// -//void RenameTemplateEditor::addPressed () -//{ -// -// if (templ->get_text() != "") { -// options.renameTemplates.push_back (templ->get_text ()); -// refreshTemplateList (); -// templ->set_text(""); -// } -//} -// -//void RenameTemplateEditor::delPressed () -//{ -// -// std::vector sel = list->get_selected (); -// -// for (size_t i = 0; i < sel.size(); i++) { -// Glib::ustring toDel = list->get_text (sel[i]); -// std::vector::iterator f = std::find (options.renameTemplates.begin(), options.renameTemplates.end(), toDel); -// -// if (f != options.renameTemplates.end()) { -// options.renameTemplates.erase (f); -// } -// } -// -// refreshTemplateList (); -//} - -//Glib::ustring RenameDialog::applyTemplate (const Glib::ustring& oName, const CacheImageData* cid, const Glib::ustring& templ) -//{ -// -// return Glib::ustring ("szeva"); -// -//} - - diff --git a/rtgui/renamedlg.h b/rtgui/renamedlg.h index 94972d575..ab51a43c6 100644 --- a/rtgui/renamedlg.h +++ b/rtgui/renamedlg.h @@ -30,62 +30,19 @@ class RenameDialog : public Gtk::Dialog protected: -// class TemplateColumns : public Gtk::TreeModel::ColumnRecord -// { -// public: -// Gtk::TreeModelColumn tmplName; -// Gtk::TreeModelColumn rowSeparator; -// TemplateColumns() -// { -// add(tmplName); -// add(rowSeparator); -// } -// }; -// TemplateColumns templateColumns; -// Glib::RefPtr templateModel; Gtk::Window* p; Gtk::Label* oldName; Gtk::Entry* newName; -// Gtk::CheckButton* useTmpl; -// MyComboBox* templates; -// Gtk::Button* all; const CacheImageData* imageData; -// void fillTemplateList (); - public: explicit RenameDialog (Gtk::Window* parent); void initName (const Glib::ustring& iname, const CacheImageData* cid); Glib::ustring getNewName (); -// bool rowSeparatorFunc (const Glib::RefPtr& model, const Gtk::TreeModel::iterator& iter); -// void tmplSelectionChanged (); -// void useTemplToggled (); - -// bool isTemplSelected (); -// Glib::ustring getActiveTemplate (); - -// static Glib::ustring applyTemplate (const Glib::ustring& oName, const CacheImageData* cid, const Glib::ustring& templ); }; -//class RenameTemplateEditor : public Gtk::Dialog -//{ -// -//protected: -// Gtk::ListViewText* list; -// Gtk::Entry* templ; -// -// void refreshTemplateList (); -//public: -// explicit RenameTemplateEditor (Gtk::Window* parent); -// -// Glib::ustring getSelectedTemplate (); -// -// void addPressed (); -// void delPressed (); -//}; - #endif diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 1ae0cdf98..cf3b36d03 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -748,7 +748,7 @@ bool ThumbBrowserBase::Internal::on_query_tooltip (int x, int y, bool keyboard_t } } - if (ttip != "") { + if (!ttip.empty()) { tooltip->set_markup (ttip); return true; } else { diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index 2960ccf70..f9e2b41b5 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -401,7 +401,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () // draw date/time label int tpos = fnlabh; - if (options.fbShowDateTime && datetimeline != "") { + if (options.fbShowDateTime && !datetimeline.empty()) { fn = w->create_pango_layout (datetimeline); fn->set_width (textw * Pango::SCALE); fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); @@ -412,7 +412,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () } // draw basic exif info - if (options.fbShowBasicExif && exifline != "") { + if (options.fbShowBasicExif && !exifline.empty()) { fn = w->create_pango_layout (exifline); fn->set_width (textw * Pango::SCALE); fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 39f4ca093..55e69ab21 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -117,9 +117,9 @@ void Thumbnail::_generateThumbnailImage () imgRatio = -1.; // generate thumbnail image - Glib::ustring ext = getExtension (fname); + const std::string ext = getExtension(fname).lowercase(); - if (ext == "") { + if (ext.empty()) { return; } @@ -127,20 +127,20 @@ void Thumbnail::_generateThumbnailImage () cfs.exifValid = false; cfs.timeValid = false; - if (ext.lowercase() == "jpg" || ext.lowercase() == "jpeg") { + if (ext == "jpg" || ext == "jpeg") { infoFromImage (fname); tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal); if (tpp) { cfs.format = FT_Jpeg; } - } else if (ext.lowercase() == "png") { + } else if (ext == "png") { tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal); if (tpp) { cfs.format = FT_Png; } - } else if (ext.lowercase() == "tif" || ext.lowercase() == "tiff") { + } else if (ext == "tif" || ext == "tiff") { infoFromImage (fname); tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal); @@ -716,7 +716,7 @@ void Thumbnail::generateExifDateTimeStrings () exifString = Glib::ustring::compose ("f/%1 %2s %3%4 %5mm", Glib::ustring(rtengine::FramesData::apertureToString(cfs.fnumber)), Glib::ustring(rtengine::FramesData::shutterToString(cfs.shutter)), M("QINFO_ISO"), cfs.iso, Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(2), cfs.focalLen)); - if (options.fbShowExpComp && cfs.expcomp != "0.00" && cfs.expcomp != "") { // don't show exposure compensation if it is 0.00EV;old cache iles do not have ExpComp, so value will not be displayed. + if (options.fbShowExpComp && cfs.expcomp != "0.00" && !cfs.expcomp.empty()) { // don't show exposure compensation if it is 0.00EV;old cache iles do not have ExpComp, so value will not be displayed. exifString = Glib::ustring::compose ("%1 %2EV", exifString, cfs.expcomp); // append exposure compensation to exifString }