diff libgui/src/workspace-model.cc @ 25974:c3cd63006870

add preference for disabling workspace colors for different attributes * gui-preferences.h: add new and mive existing preferences for the workspace view * settings-dialog.cc (settings_dialog, write_changed_settings): remove use of workspace prefs here; (read_workspace_colors): construct all elements of the workspace tab by code instead of the designer file; (write_workspace_colors): store the values of the check boxes for workspace preferences * settings-dialog.h: add check boxes of workspace view, that are removed from the designer file and now constructed in the code, as class variables; * settings-dialog.ui: clear the workspace tab, all elements are now constructed and laid out in the the code * workspace-model.cc (data): set background color only if attribute colors are desired * workspace-model.h: new class variable holding whether colors are used or not * workspace-view.cc (notice_settings): use constants from gui-preferences.h for key names and default values instead of hard coded values and store preference for using attribute colors
author Torsten <mttl@mailbox.org>
date Sun, 28 Oct 2018 20:31:08 +0100
parents 6652d3823428
children a6df420457ac
line wrap: on
line diff
--- a/libgui/src/workspace-model.cc	Sat Oct 27 06:54:47 2018 -0400
+++ b/libgui/src/workspace-model.cc	Sun Oct 28 20:31:08 2018 +0100
@@ -32,6 +32,7 @@
 #include "utils.h"
 
 #include "resource-manager.h"
+#include "gui-preferences.h"
 #include "workspace-model.h"
 
 namespace octave
@@ -131,7 +132,7 @@
 
     if (idx.isValid ())
       {
-        if (role == Qt::BackgroundColorRole)
+        if (role == Qt::BackgroundColorRole && m_enable_colors)
           {
             QString class_chars = resource_manager::storage_class_chars ();
             int actual_class
@@ -254,6 +255,9 @@
       resource_manager::storage_class_default_colors ();
     QString class_chars = resource_manager::storage_class_chars ();
 
+    m_enable_colors =
+        settings->value (ws_enable_colors.key, ws_enable_colors.key).toBool ();
+
     for (int i = 0; i < class_chars.length (); i++)
       {
         QVariant default_var = default_colors.at (i);