Mercurial > octave
view libgui/src/color-picker.h @ 29484:bed2fd5b8263
allow a second color theme for the console window (dark mode)
* QTerminal.cc (notice_settings): use new method color_value for reading
the terminal colors from the gui_settings
* color-picker.cc/.h (set_color): new method for updating the current
color of a color picker
* gui-preferences-cs.h: using the extensions for color preference keys
of different color modes, define the keys for new mode, define preference
for the selected modes
* gui-settings.cc (color_value): new method for reading color values
from the settings taking the mode into consideration and computing
the default value from standard mode defaults, also allowing defaults
given as QColor or ColorRoles;
(set_color_value): new method for writing a color to the settings key,
where the key name is determined depending on the key
* gui-settings.h: new methods color_value, set_color_value, definition
of some constant strings related to color modes
* settings-dialog.cc (settings_dialog): reorder some action;
(write_changed_settings): reorder some action;
(read_terminal_colors): add checkbox for second color mode, connect
trigger signal of this checkbos to new slot update_terminal_colors,
use new method color_value for reading colors from the settings;
(update_terminal_colors): slot for updating the current color picker
colors depending on selected color mode;
(write_terminal_colors): use new method set_color_value for writing
colors to settings depending on color mode
* settings-dialog.h: new slot update_terminal_colors
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Fri, 02 Apr 2021 16:54:42 +0200 |
parents | 0a5b15007766 |
children | 796f54d4ddbf |
line wrap: on
line source
//////////////////////////////////////////////////////////////////////// // // This class provides a simple color picker based on tQColorButton // by Harald Jedele, 23.03.01, GPL version 2 or any later version. // // Copyright (C) 2013-2021 The Octave Project Developers // // See the file COPYRIGHT.md in the top-level directory of this // distribution or <https://octave.org/copyright/>. // // This file is part of Octave. // // Octave is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Octave is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Octave; see the file COPYING. If not, see // <https://www.gnu.org/licenses/>. // //////////////////////////////////////////////////////////////////////// #if ! defined (octave_color_picker_h) #define octave_color_picker_h 1 #include <QColorDialog> #include <QPushButton> namespace octave { class color_picker : public QPushButton { Q_OBJECT public: color_picker (QColor color = QColor (0, 0, 0), QWidget *parent = nullptr); QColor color (void) const { return m_color; } void set_color (QColor new_color); private slots: void select_color (void); private: virtual void update_button (void); QColor m_color; }; } #endif