automatically select the system monitor profile if the preferences say so

Fix for issue #3821
This commit is contained in:
Alberto Griggio
2017-04-12 16:20:03 +02:00
parent 239476cc3a
commit ecae94f17c
7 changed files with 70 additions and 4 deletions

View File

@@ -160,7 +160,12 @@ private:
Glib::ustring defprofname;
if (find_default_monitor_profile(profileBox.get_root_window()->gobj(), defprof, defprofname)) {
profileBox.append (M ("MONITOR_PROFILE_SYSTEM") + " (" + defprofname + ")");
profileBox.set_active (options.rtSettings.autoMonitorProfile ? 1 : 0);
if (options.rtSettings.autoMonitorProfile) {
rtengine::ICCStore::getInstance()->setDefaultMonitorProfileName(defprof);
profileBox.set_active(1);
} else {
profileBox.set_active(0);
}
} else {
profileBox.set_active (0);
}
@@ -402,7 +407,7 @@ public:
ConnectionBlocker profileBlocker (profileConn);
if (!defprof.empty() && options.rtSettings.autoMonitorProfile) {
setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 1);
profileBox.set_active(1);
} else {
setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 0);
}
@@ -426,6 +431,23 @@ public:
updateParameters ();
}
void defaultMonitorProfileChanged(const Glib::ustring &profile_name, bool auto_monitor_profile)
{
ConnectionBlocker profileBlocker (profileConn);
if (auto_monitor_profile && !defprof.empty()) {
rtengine::ICCStore::getInstance()->setDefaultMonitorProfileName(defprof);
#ifndef __APPLE__
profileBox.set_active(1);
#endif
} else {
rtengine::ICCStore::getInstance()->setDefaultMonitorProfileName(profile_name);
#ifndef __APPLE__
setActiveTextOrIndex(profileBox, profile_name, 0);
#endif
}
}
};
EditorPanel::EditorPanel (FilePanel* filePanel)
@@ -2214,3 +2236,10 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition)
iareapanel->imageArea->setPointerMotionHListener (histogramPanel);
}
void EditorPanel::defaultMonitorProfileChanged(const Glib::ustring &profile_name, bool auto_monitor_profile)
{
colorMgmtToolBar->defaultMonitorProfileChanged(profile_name, auto_monitor_profile);
}

View File

@@ -129,6 +129,8 @@ public:
void updateTabsUsesIcons (bool useIcons);
void updateHistogramPosition (int oldPosition, int newPosition);
void defaultMonitorProfileChanged(const Glib::ustring &profile_name, bool auto_monitor_profile);
Gtk::Paned* catalogPane;
private:

View File

@@ -742,7 +742,9 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
const std::vector<Glib::ustring> profiles = rtengine::ICCStore::getInstance ()->getProfiles (rtengine::ICCStore::ProfileType::MONITOR);
for (const auto profile : profiles) {
monProfile->append (profile);
if (profile.find("file:") != 0) {
monProfile->append (profile);
}
}
// same order as the enum

View File

@@ -657,6 +657,12 @@ void RTWindow::showPreferences ()
delete pref;
fpanel->optionsChanged ();
if (epanel) {
epanel->defaultMonitorProfileChanged(options.rtSettings.monitorProfile, options.rtSettings.autoMonitorProfile);
}
for (const auto &p : epanels) {
p.second->defaultMonitorProfileChanged(options.rtSettings.monitorProfile, options.rtSettings.autoMonitorProfile);
}
}
void RTWindow::setProgress (double p)