Mercurial > hg > octave-lyh
changeset 15462:e8b117b405f9
Merge in Torsten's changes
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Mon, 01 Oct 2012 09:02:03 -0400 |
parents | abf34bbcd053 (current diff) 1e64aff609c3 (diff) |
children | 6a05cad5b694 |
files | |
diffstat | 3 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/files-dockwidget.cc +++ b/libgui/src/files-dockwidget.cc @@ -33,6 +33,7 @@ #include <QSettings> #include <QProcess> #include <QDebug> +#include <QHeaderView> files_dock_widget::files_dock_widget (QWidget *p) : QDockWidget (p) @@ -81,6 +82,15 @@ _file_tree_view->setColumnHidden (3, true); _file_tree_view->setStatusTip (tr ("Doubleclick a file to open it.")); + // get sort column and order as well as cloumn state (order and width) + QSettings *settings = resource_manager::get_settings (); + // FIXME -- what should happen if settings is 0? + _file_tree_view->sortByColumn ( + settings->value ("filesdockwidget/sort_files_by_column",0).toInt (), + static_cast<Qt::SortOrder>(settings->value ("filesdockwidget/sort_files_by_order",Qt::AscendingOrder).toUInt ()) + ); + _file_tree_view->header ()->restoreState (settings->value ("filesdockwidget/column_state").toByteArray ()); + _current_directory->setText(_file_system_model->fileInfo (rootPathIndex). absoluteFilePath ()); @@ -109,6 +119,16 @@ setFocusProxy (_current_directory); } +files_dock_widget::~files_dock_widget () +{ + QSettings *settings = resource_manager::get_settings (); + int sort_column = _file_tree_view->header ()->sortIndicatorSection (); + Qt::SortOrder sort_order = _file_tree_view->header ()->sortIndicatorOrder (); + settings->setValue ("filesdockwidget/sort_files_by_column", sort_column); + settings->setValue ("filesdockwidget/sort_files_by_order", sort_order); + settings->setValue ("filesdockwidget/column_state", _file_tree_view->header ()->saveState ()); +} + void files_dock_widget::item_double_clicked (const QModelIndex & index) {
--- a/libgui/src/files-dockwidget.h +++ b/libgui/src/files-dockwidget.h @@ -48,6 +48,7 @@ public: /** Constructs a new files_dock_widget. */ files_dock_widget (QWidget *parent = 0); + ~files_dock_widget (); public slots: /** Slot for handling a change in directory via double click. */
--- a/libgui/src/workspace-view.cc +++ b/libgui/src/workspace-view.cc @@ -26,6 +26,7 @@ #include "workspace-view.h" #include "resource-manager.h" +#include <QHeaderView> #include <QHBoxLayout> #include <QVBoxLayout> #include <QPushButton> @@ -68,6 +69,10 @@ _explicit_collapse.global = settings->value ("workspaceview/global_collapsed", false).toBool ();; _explicit_collapse.persistent = settings->value ("workspaceview/persistent_collapsed", false).toBool ();; + // Initialize column order and width of the workspace + + _workspace_tree_view->header ()->restoreState (settings->value("workspaceview/column_state").toByteArray ()); + // Connect signals and slots. connect (this, SIGNAL (visibilityChanged (bool)), this, SLOT(handle_visibility_changed (bool))); @@ -94,6 +99,7 @@ settings->setValue("workspaceview/local_collapsed", _explicit_collapse.local); settings->setValue("workspaceview/global_collapsed", _explicit_collapse.global); settings->setValue("workspaceview/persistent_collapsed", _explicit_collapse.persistent); + settings->setValue("workspaceview/column_state", _workspace_tree_view->header ()->saveState ()); } void