Mercurial > octave-nkf
changeset 15787:b081fbe80174
provide separate icons for gui's floating widgets
* resource.qrc: add new icons to the list of resources
* settings-dialog.ui: new tab with radio buttons for icon set
* settings-dialog.cc: configure radio buttons in settings_dialog(),
write the selected icon set to settings file in write_changed_settings()
* resource-manager.h: added constasnts for the icon sets
* main-window.cc: set the icons for all dock-widgets in notice-settings()
* libgui/src/icons: added 12 icons (two sets of 6 icons)
line wrap: on
line diff
--- a/libgui/src/main-window.cc Thu Dec 13 15:58:25 2012 -0500 +++ b/libgui/src/main-window.cc Fri Dec 14 13:18:14 2012 +0100 @@ -215,6 +215,23 @@ _terminal->setCursorType(QTerminalInterface::UnderlineCursor, cursorBlinking); + // the widget's icons (when floating) + int icon_set = settings->value ("DockWidgets/widget_icon_set",0).toInt (); + QString icon_prefix = QString (WIDGET_ICON_SET_PREFIX[icon_set]); + QString icon; + foreach (QObject *obj, children ()) + { + QString name = obj->objectName (); + if (obj->inherits("QDockWidget") && ! name.isEmpty ()) + { // if children is a dockwidget with a name + QDockWidget *widget = qobject_cast<QDockWidget *> (obj); + icon = icon_prefix; // prefix or octave-logo + if (icon_set) // > 0 : each widget has individual icon + icon = icon + name + QString(".png"); + widget->setWindowIcon (QIcon (icon)); + } + } + resource_manager::update_network_settings (); }
--- a/libgui/src/resource-manager.h Thu Dec 13 15:58:25 2012 -0500 +++ b/libgui/src/resource-manager.h Fri Dec 14 13:18:14 2012 +0100 @@ -28,6 +28,19 @@ #include <QMap> #include <QSettings> +// constants for the widget's icons +enum widget_icon_set + { + NO_ICON_SET = 0, + GRAPHIC_ICON_SET, + LETTER_ICON_SET + }; +static const char* WIDGET_ICON_SET_PREFIX[] = + {":/actions/icons/logo.png", + ":/actions/icons/graphic_logo_", + ":/actions/icons/letter_logo_"}; + + class resource_manager { protected:
--- a/libgui/src/resource.qrc Thu Dec 13 15:58:25 2012 -0500 +++ b/libgui/src/resource.qrc Fri Dec 14 13:18:14 2012 +0100 @@ -36,5 +36,17 @@ <file>icons/db_step_in.png</file> <file>icons/db_step_out.png</file> <file>icons/db_stop.png</file> + <file>icons/letter_logo_FilesDockWidget.png</file> + <file>icons/letter_logo_FileEditor.png</file> + <file>icons/letter_logo_TerminalDockWidget.png</file> + <file>icons/letter_logo_HistoryDockWidget.png</file> + <file>icons/letter_logo_WorkspaceView.png</file> + <file>icons/letter_logo_DocumentationDockWidget.png</file> + <file>icons/graphic_logo_FilesDockWidget.png</file> + <file>icons/graphic_logo_FileEditor.png</file> + <file>icons/graphic_logo_TerminalDockWidget.png</file> + <file>icons/graphic_logo_HistoryDockWidget.png</file> + <file>icons/graphic_logo_WorkspaceView.png</file> + <file>icons/graphic_logo_DocumentationDockWidget.png</file> </qresource> </RCC>
--- a/libgui/src/settings-dialog.cc Thu Dec 13 15:58:25 2012 -0500 +++ b/libgui/src/settings-dialog.cc Fri Dec 14 13:18:14 2012 +0100 @@ -38,6 +38,11 @@ // FIXME -- what should happen if settings is 0? + int widget_icon_set = settings->value ("DockWidgets/widget_icon_set",0).toInt (); + ui->general_icon_octave-> setChecked (NO_ICON_SET == widget_icon_set); + ui->general_icon_graphic-> setChecked (GRAPHIC_ICON_SET == widget_icon_set); + ui->general_icon_letter-> setChecked (LETTER_ICON_SET == widget_icon_set); + ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor").toBool ()); ui->customFileEditor->setText (settings->value ("customFileEditor").toString ()); ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () ); @@ -100,6 +105,12 @@ // FIXME -- what should happen if settings is 0? + int widget_icon_set = NO_ICON_SET; + if (ui->general_icon_letter->isChecked ()) + widget_icon_set = LETTER_ICON_SET; + else if (ui->general_icon_graphic->isChecked ()) + widget_icon_set = GRAPHIC_ICON_SET; + settings->setValue ("DockWidgets/widget_icon_set",widget_icon_set); settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ()); settings->setValue ("customFileEditor", ui->customFileEditor->text ()); settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ());
--- a/libgui/src/settings-dialog.ui Thu Dec 13 15:58:25 2012 -0500 +++ b/libgui/src/settings-dialog.ui Fri Dec 14 13:18:14 2012 +0100 @@ -34,6 +34,84 @@ <property name="currentIndex"> <number>0</number> </property> + <widget class="QWidget" name="tab_4"> + <property name="enabled"> + <bool>true</bool> + </property> + <attribute name="title"> + <string>General</string> + </attribute> + <widget class="QGroupBox" name="groupBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>551</width> + <height>81</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Icon set for dock widget</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <widget class="QRadioButton" name="general_icon_octave"> + <property name="geometry"> + <rect> + <x>0</x> + <y>20</y> + <width>151</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Octave logo only</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" name="general_icon_letter"> + <property name="geometry"> + <rect> + <x>0</x> + <y>40</y> + <width>151</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Letter icons</string> + </property> + </widget> + <widget class="QRadioButton" name="general_icon_graphic"> + <property name="geometry"> + <rect> + <x>0</x> + <y>60</y> + <width>151</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Graphic icons</string> + </property> + </widget> + </widget> + </widget> <widget class="QWidget" name="tab"> <attribute name="title"> <string>Editor</string>