[rkward/work/workspace_browser_redesign] /: Start sorting out, which object browser settings are actually still needed, and at what level.
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Nov 6 19:45:00 UTC 2015
Git commit a637713b8dac12a6308bdcb6d1865ec4ee28333f by Thomas Friedrichsmeier.
Committed on 06/11/2015 at 19:43.
Pushed by tfry into branch 'work/workspace_browser_redesign'.
Start sorting out, which object browser settings are actually still needed, and at what level.
Also minor re-factoring.
M +1 -0 ChangeLog
M +31 -32 rkward/misc/rkobjectlistview.cpp
M +9 -5 rkward/misc/rkobjectlistview.h
M +2 -1 rkward/settings/rksettingsmodulegeneral.h
M +13 -20 rkward/settings/rksettingsmoduleobjectbrowser.cpp
M +1 -1 rkward/settings/rksettingsmoduleobjectbrowser.h
M +2 -9 rkward/windows/robjectbrowser.cpp
M +1 -2 rkward/windows/robjectbrowser.h
http://commits.kde.org/rkward/a637713b8dac12a6308bdcb6d1865ec4ee28333f
diff --git a/ChangeLog b/ChangeLog
index b691825..7ab4e1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- Separate globalenv() and other environments in the search path more clearly in workspace browser
- Fix some minor toolbar glitches
- Complete rework of <optionset> UI for better usability
- Try harder to honor system locale settings
diff --git a/rkward/misc/rkobjectlistview.cpp b/rkward/misc/rkobjectlistview.cpp
index 43f8361..a57c231 100644
--- a/rkward/misc/rkobjectlistview.cpp
+++ b/rkward/misc/rkobjectlistview.cpp
@@ -231,18 +231,17 @@ RKObjectListViewSettings::RKObjectListViewSettings (QObject* parent) : QSortFilt
action_group = new QActionGroup (this);
action_group->setExclusive (false);
- actions[ShowObjectsAllEnvironments] = new QAction (i18n ("All Environments"), action_group);
- actions[ShowObjectsContainer] = new QAction (i18n ("Objects with children"), action_group);
- actions[ShowObjectsVariable] = new QAction (i18n ("Variables"), action_group);
- actions[ShowObjectsFunction] = new QAction (i18n ("Functions"), action_group);
- actions[ShowObjectsHidden] = new QAction (i18n ("Hidden Objects"), action_group);
- actions[ShowFieldsType] = new QAction (i18n ("Type"), action_group);
- actions[ShowFieldsLabel] = new QAction (i18n ("Label"), action_group);
- actions[ShowFieldsClass] = new QAction (i18n ("Class"), action_group);
+ settings[ShowObjectsAllEnvironments].action = new QAction (i18n ("All Environments"), action_group);
+ settings[ShowObjectsContainer].action = new QAction (i18n ("Objects with children"), action_group);
+ settings[ShowObjectsVariable].action = new QAction (i18n ("Variables"), action_group);
+ settings[ShowObjectsFunction].action = new QAction (i18n ("Functions"), action_group);
+ settings[ShowObjectsHidden].action = new QAction (i18n ("Hidden Objects"), action_group);
+ settings[ShowFieldsType].action = new QAction (i18n ("Type"), action_group);
+ settings[ShowFieldsLabel].action = new QAction (i18n ("Label"), action_group);
+ settings[ShowFieldsClass].action = new QAction (i18n ("Class"), action_group);
for (int i = 0; i < SettingsCount; ++i) {
- actions[i]->setCheckable (true);
- settings_default[i] = true;
+ settings[i].action->setCheckable (true);
}
createContextMenus ();
@@ -261,8 +260,8 @@ RKObjectListViewSettings::~RKObjectListViewSettings () {
void RKObjectListViewSettings::setSetting (Settings setting, bool to) {
RK_TRACE (APP);
- settings[setting] = to;
- settings_default[setting] = false;
+ settings[setting].state = to;
+ settings[setting].is_at_default = false;
updateSelf ();
}
@@ -271,9 +270,9 @@ bool RKObjectListViewSettings::filterAcceptsColumn (int source_column, const QMo
RK_TRACE (APP);
if (source_column == RKObjectListModel::NameColumn) return true;
- if (source_column == RKObjectListModel::LabelColumn) return (settings[ShowFieldsLabel]);
- if (source_column == RKObjectListModel::TypeColumn) return (settings[ShowFieldsType]);
- if (source_column == RKObjectListModel::ClassColumn) return (settings[ShowFieldsClass]);
+ if (source_column == RKObjectListModel::LabelColumn) return (settings[ShowFieldsLabel].state);
+ if (source_column == RKObjectListModel::TypeColumn) return (settings[ShowFieldsType].state);
+ if (source_column == RKObjectListModel::ClassColumn) return (settings[ShowFieldsClass].state);
RK_ASSERT (false);
return false;
@@ -292,7 +291,7 @@ bool RKObjectListViewSettings::filterAcceptsRow (int source_row, const QModelInd
// always show global env and search path
if (!object->parentObject ()) return true;
- if (!settings[ShowObjectsHidden]) {
+ if (!settings[ShowObjectsHidden].state) {
if (object->getShortName ().startsWith ('.')) return false;
if (object == reinterpret_cast<RObject*> (RObjectList::getObjectList ()->orphanNamespacesObject ())) return false;
}
@@ -300,13 +299,13 @@ bool RKObjectListViewSettings::filterAcceptsRow (int source_row, const QModelInd
bool base_filter = QSortFilterProxyModel::filterAcceptsRow (source_row, source_parent);
if (object->isType (RObject::ToplevelEnv)) {
- return (base_filter && settings[ShowObjectsAllEnvironments]);
+ return (base_filter && settings[ShowObjectsAllEnvironments].state);
} else if (object->isType (RObject::Function)) {
- return (base_filter && settings[ShowObjectsFunction]);
+ return (base_filter && settings[ShowObjectsFunction].state);
} else if (object->isType (RObject::Container)) {
- return (base_filter && settings[ShowObjectsContainer]);
+ return (base_filter && settings[ShowObjectsContainer].state);
} else if (object->isVariable ()) {
- return (base_filter && settings[ShowObjectsVariable]);
+ return (base_filter && settings[ShowObjectsVariable].state);
}
return base_filter;
@@ -341,17 +340,17 @@ void RKObjectListViewSettings::createContextMenus () {
RK_TRACE (APP);
show_objects_menu = new QMenu (i18n ("Show Objects"), 0);
- show_objects_menu->addAction (actions[ShowObjectsAllEnvironments]);
- show_objects_menu->addAction (actions[ShowObjectsContainer]);
- show_objects_menu->addAction (actions[ShowObjectsVariable]);
- show_objects_menu->addAction (actions[ShowObjectsFunction]);
+ show_objects_menu->addAction (settings[ShowObjectsAllEnvironments].action);
+ show_objects_menu->addAction (settings[ShowObjectsContainer].action);
+ show_objects_menu->addAction (settings[ShowObjectsVariable].action);
+ show_objects_menu->addAction (settings[ShowObjectsFunction].action);
show_objects_menu->addSeparator ();
- show_objects_menu->addAction (actions[ShowObjectsHidden]);
+ show_objects_menu->addAction (settings[ShowObjectsHidden].action);
show_fields_menu = new QMenu (i18n ("Show Fields"), 0);
- show_fields_menu->addAction (actions[ShowFieldsType]);
- show_fields_menu->addAction (actions[ShowFieldsLabel]);
- show_fields_menu->addAction (actions[ShowFieldsClass]);
+ show_fields_menu->addAction (settings[ShowFieldsType].action);
+ show_fields_menu->addAction (settings[ShowFieldsLabel].action);
+ show_fields_menu->addAction (settings[ShowFieldsClass].action);
connect (action_group, SIGNAL (triggered(QAction*)), this, SLOT(settingToggled(QAction*)));
updateSelf ();
@@ -366,7 +365,7 @@ void RKObjectListViewSettings::updateSelf () {
void RKObjectListViewSettings::updateSelfNow () {
RK_TRACE (APP);
- for (int i = 0; i < SettingsCount; ++i) actions[i]->setChecked (settings[i]);
+ for (int i = 0; i < SettingsCount; ++i) settings[i].action->setChecked (settings[i].state);
invalidateFilter ();
@@ -379,8 +378,8 @@ void RKObjectListViewSettings::globalSettingsChanged (RKSettings::SettingsPage p
RK_TRACE (APP);
for (int i = 0; i < SettingsCount; ++i) {
- if (settings_default[i]) { // should only default settings be copied?
- settings[i] = RKSettingsModuleObjectBrowser::isSettingActive ((Settings) i);
+ if (settings[i].is_at_default) { // Only settings that have been left at their default are copied
+ settings[i].state = RKSettingsModuleObjectBrowser::isSettingActive ((Settings) i);
}
}
@@ -392,7 +391,7 @@ void RKObjectListViewSettings::settingToggled (QAction* which) {
int setting = -1;
for (int i = 0; i < SettingsCount; ++i) {
- if (actions[i] == which) {
+ if (settings[i].action == which) {
setting = i;
break;
}
diff --git a/rkward/misc/rkobjectlistview.h b/rkward/misc/rkobjectlistview.h
index a5b2a19..382b586 100644
--- a/rkward/misc/rkobjectlistview.h
+++ b/rkward/misc/rkobjectlistview.h
@@ -100,11 +100,11 @@ public:
ShowFieldsType,
ShowFieldsClass,
ShowFieldsLabel,
- SettingsCount=ShowFieldsLabel + 1
+ SettingsCount
};
void setSetting (Settings setting, bool to);
- bool getSetting (Settings setting) const { return settings[setting]; };
+ bool getSetting (Settings setting) const { return settings[setting].state; };
QMenu *showObjectsMenu () const { return show_objects_menu; };
QMenu *showFieldsMenu () const { return show_fields_menu; };
@@ -119,9 +119,13 @@ protected:
bool filterAcceptsColumn (int source_column, const QModelIndex& source_parent) const;
bool lessThan (const QModelIndex& left, const QModelIndex& right) const;
private:
- bool settings[SettingsCount];
- bool settings_default[SettingsCount];
- QAction* actions[SettingsCount];
+ struct Setting {
+ Setting () : is_at_default (true) {};
+ QAction *action;
+ bool is_at_default;
+ bool state;
+ };
+ Setting settings[SettingsCount];
QActionGroup* action_group;
void createContextMenus ();
diff --git a/rkward/settings/rksettingsmodulegeneral.h b/rkward/settings/rksettingsmodulegeneral.h
index 2293265..70b4583 100644
--- a/rkward/settings/rksettingsmodulegeneral.h
+++ b/rkward/settings/rksettingsmodulegeneral.h
@@ -2,7 +2,7 @@
rksettingsmodulegeneral - description
-------------------
begin : Fri Jul 30 2004
- copyright : (C) 2004-2014 by Thomas Friedrichsmeier
+ copyright : (C) 2004-2015 by Thomas Friedrichsmeier
email : thomas.friedrichsmeier at kdemail.net
***************************************************************************/
@@ -88,6 +88,7 @@ public:
RKWardConfig_0_5_7,
RKWardConfig_0_6_1,
RKWardConfig_0_6_3,
+ RKWardConfig_0_6_4,
RKWardConfig_Next, /**< add new configuration versions above / before this entry */
RKWardConfig_Latest = RKWardConfig_Next - 1
};
diff --git a/rkward/settings/rksettingsmoduleobjectbrowser.cpp b/rkward/settings/rksettingsmoduleobjectbrowser.cpp
index 9053a64..69006db 100644
--- a/rkward/settings/rksettingsmoduleobjectbrowser.cpp
+++ b/rkward/settings/rksettingsmoduleobjectbrowser.cpp
@@ -2,7 +2,7 @@
rksettingsmodule - description
-------------------
begin : Fri Apr 22 2005
- copyright : (C) 2005 by Thomas Friedrichsmeier
+ copyright : (C) 2005, 2015 by Thomas Friedrichsmeier
email : thomas.friedrichsmeier at kdemail.net
***************************************************************************/
@@ -30,6 +30,7 @@
#include "../rkglobals.h"
#include "../misc/multistringselector.h"
#include "rksettings.h"
+#include "rksettingsmodulegeneral.h"
#include "../debug.h"
// static
@@ -39,7 +40,9 @@ QStringList RKSettingsModuleObjectBrowser::getstructure_blacklist;
RKSettingsModuleObjectBrowser::RKSettingsModuleObjectBrowser (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
RK_TRACE (SETTINGS);
- checkboxes = new QCheckBox*[RKObjectListViewSettings::SettingsCount];
+ for (int i = 0; i < RKObjectListViewSettings::SettingsCount; ++i) {
+ checkboxes[i] = 0;
+ }
QVBoxLayout *layout = new QVBoxLayout (this);
@@ -47,15 +50,6 @@ RKSettingsModuleObjectBrowser::RKSettingsModuleObjectBrowser (RKSettings *gui, Q
checkboxes[RKObjectListViewSettings::ShowObjectsHidden] = new QCheckBox (i18n ("Show hidden objects"), this);
layout->addWidget (checkboxes[RKObjectListViewSettings::ShowObjectsHidden]);
- checkboxes[RKObjectListViewSettings::ShowObjectsAllEnvironments] = new QCheckBox (i18n ("Show all environments"), this);
- layout->addWidget (checkboxes[RKObjectListViewSettings::ShowObjectsAllEnvironments]);
- layout->addSpacing (2*RKGlobals::spacingHint ());
- checkboxes[RKObjectListViewSettings::ShowObjectsContainer] = new QCheckBox (i18n ("Show objects with children"), this);
- layout->addWidget (checkboxes[RKObjectListViewSettings::ShowObjectsContainer]);
- checkboxes[RKObjectListViewSettings::ShowObjectsFunction] = new QCheckBox (i18n ("Show functions"), this);
- layout->addWidget (checkboxes[RKObjectListViewSettings::ShowObjectsFunction]);
- checkboxes[RKObjectListViewSettings::ShowObjectsVariable] = new QCheckBox (i18n ("Show variables"), this);
- layout->addWidget (checkboxes[RKObjectListViewSettings::ShowObjectsVariable]);
layout->addSpacing (2*RKGlobals::spacingHint ());
@@ -71,6 +65,7 @@ RKSettingsModuleObjectBrowser::RKSettingsModuleObjectBrowser (RKSettings *gui, Q
layout->addStretch ();
for (int i = 0; i < RKObjectListViewSettings::SettingsCount; ++i) {
+ if (!checkboxes[i]) continue; // We don't provide checkboxes for all settings in this list
checkboxes[i]->setChecked (settings[i]);
connect (checkboxes[i], SIGNAL (stateChanged(int)), this, SLOT (boxChanged(int)));
}
@@ -108,7 +103,7 @@ void RKSettingsModuleObjectBrowser::applyChanges () {
RK_TRACE (SETTINGS);
for (int i = 0; i < RKObjectListViewSettings::SettingsCount; ++i) {
- settings[i] = checkboxes[i]->isChecked ();
+ if (checkboxes[i]) settings[i] = checkboxes[i]->isChecked ();
}
getstructure_blacklist = blacklist_choser->getValues();
}
@@ -129,10 +124,6 @@ void RKSettingsModuleObjectBrowser::saveSettings (KConfig *config) {
KConfigGroup cg = config->group ("Object Browser");
cg.writeEntry ("show hidden vars", settings[RKObjectListViewSettings::ShowObjectsHidden]);
- cg.writeEntry ("show all environments", settings[RKObjectListViewSettings::ShowObjectsAllEnvironments]);
- cg.writeEntry ("show container objects", settings[RKObjectListViewSettings::ShowObjectsContainer]);
- cg.writeEntry ("show function objects", settings[RKObjectListViewSettings::ShowObjectsFunction]);
- cg.writeEntry ("show variable objects", settings[RKObjectListViewSettings::ShowObjectsVariable]);
cg.writeEntry ("show label field", settings[RKObjectListViewSettings::ShowFieldsLabel]);
cg.writeEntry ("show type field", settings[RKObjectListViewSettings::ShowFieldsType]);
cg.writeEntry ("show class field", settings[RKObjectListViewSettings::ShowFieldsClass]);
@@ -145,11 +136,13 @@ void RKSettingsModuleObjectBrowser::loadSettings (KConfig *config) {
RK_TRACE (SETTINGS);
KConfigGroup cg = config->group ("Object Browser");
+ // The following are _not_ actually configurable defaults in RKWard 0.6.4. These settings here simply serve to define the static default.
+ settings[RKObjectListViewSettings::ShowObjectsAllEnvironments] = true;
+ settings[RKObjectListViewSettings::ShowObjectsVariable] = true;
+ settings[RKObjectListViewSettings::ShowObjectsContainer] = true;
+ settings[RKObjectListViewSettings::ShowObjectsFunction] = true;
+ // These defaults _are_ configurable
settings[RKObjectListViewSettings::ShowObjectsHidden] = cg.readEntry ("show hidden vars", false);
- settings[RKObjectListViewSettings::ShowObjectsAllEnvironments] = cg.readEntry ("show all environments", false);
- settings[RKObjectListViewSettings::ShowObjectsContainer] = cg.readEntry ("show container objects", true);
- settings[RKObjectListViewSettings::ShowObjectsFunction] = cg.readEntry ("show function objects", true);
- settings[RKObjectListViewSettings::ShowObjectsVariable] = cg.readEntry ("show variable objects", true);
settings[RKObjectListViewSettings::ShowFieldsLabel] = cg.readEntry ("show label field", true);
settings[RKObjectListViewSettings::ShowFieldsType] = cg.readEntry ("show type field", true);
settings[RKObjectListViewSettings::ShowFieldsClass] = cg.readEntry ("show class field", true);
diff --git a/rkward/settings/rksettingsmoduleobjectbrowser.h b/rkward/settings/rksettingsmoduleobjectbrowser.h
index 097097c..002e64c 100644
--- a/rkward/settings/rksettingsmoduleobjectbrowser.h
+++ b/rkward/settings/rksettingsmoduleobjectbrowser.h
@@ -62,7 +62,7 @@ private:
MultiStringSelector *blacklist_choser;
static QStringList getstructure_blacklist;
- QCheckBox **checkboxes;
+ QCheckBox *checkboxes[RKObjectListViewSettings::SettingsCount];
static bool settings[RKObjectListViewSettings::SettingsCount];
};
diff --git a/rkward/windows/robjectbrowser.cpp b/rkward/windows/robjectbrowser.cpp
index 44fbdc3..fe9221b 100644
--- a/rkward/windows/robjectbrowser.cpp
+++ b/rkward/windows/robjectbrowser.cpp
@@ -2,7 +2,7 @@
robjectbrowser - description
-------------------
begin : Thu Aug 19 2004
- copyright : (C) 2004, 2006, 2007, 2008, 2009, 2010, 2011 by Thomas Friedrichsmeier
+ copyright : (C) 2004 - 2015 by Thomas Friedrichsmeier
email : thomas.friedrichsmeier at kdemail.net
***************************************************************************/
@@ -303,10 +303,6 @@ RKObjectListViewSettingsWidget::RKObjectListViewSettingsWidget (RKObjectListView
connect (functions, SIGNAL(clicked(bool)), this, SLOT(modeChanged(bool)));
layout->addLayout (hbox);
- all_envirs = new QCheckBox (i18n ("Show All Environments"), this);
- connect (all_envirs, SIGNAL (clicked(bool)), this, SLOT (boxChanged(bool)));
- layout->addWidget (all_envirs);
-
hidden_objects = new QCheckBox (i18n ("Show Hidden Objects"), this);
connect (hidden_objects, SIGNAL (clicked(bool)), this, SLOT (boxChanged(bool)));
layout->addWidget (hidden_objects);
@@ -321,7 +317,6 @@ RKObjectListViewSettingsWidget::~RKObjectListViewSettingsWidget () {
void RKObjectListViewSettingsWidget::settingsChanged () {
RK_TRACE (APP);
- all_envirs->setChecked (settings->getSetting (RKObjectListViewSettings::ShowObjectsAllEnvironments));
hidden_objects->setChecked (settings->getSetting (RKObjectListViewSettings::ShowObjectsHidden));
bool functions_shown = settings->getSetting (RKObjectListViewSettings::ShowObjectsFunction);
@@ -364,9 +359,7 @@ void RKObjectListViewSettingsWidget::modeChanged (bool) {
void RKObjectListViewSettingsWidget::boxChanged (bool) {
RK_TRACE (APP);
- if (sender () == all_envirs) {
- settings->setSetting (RKObjectListViewSettings::ShowObjectsAllEnvironments, all_envirs->isChecked ());
- } else {
+ if (sender () == hidden_objects) {
settings->setSetting (RKObjectListViewSettings::ShowObjectsHidden, hidden_objects->isChecked ());
}
}
diff --git a/rkward/windows/robjectbrowser.h b/rkward/windows/robjectbrowser.h
index e50e28b..b5125f7 100644
--- a/rkward/windows/robjectbrowser.h
+++ b/rkward/windows/robjectbrowser.h
@@ -2,7 +2,7 @@
robjectbrowser - description
-------------------
begin : Thu Aug 19 2004
- copyright : (C) 2004, 2006, 2007, 2009 by Thomas Friedrichsmeier
+ copyright : (C) 2004 - 2015 by Thomas Friedrichsmeier
email : thomas.friedrichsmeier at kdemail.net
***************************************************************************/
@@ -123,7 +123,6 @@ private:
QRadioButton *all;
QRadioButton *nonfunctions;
QRadioButton *functions;
- QCheckBox *all_envirs;
QCheckBox *hidden_objects;
RKObjectListViewSettings *settings;
};
More information about the rkward-tracker
mailing list