[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdevplatform/1=2E2=5D_plugins/projectmanagerview=3A?=
From:       Milian Wolff <mail () milianw ! de>
Date:       2011-02-27 16:18:05
Message-ID: 20110227161805.663AEA609B () git ! kde ! org
[Download RAW message or body]

Git commit eae6d08676cbb4f3a081ad56eb175f53c52414d3 by Milian Wolff. on behalf of \
Sergey Vidyuk Committed on 06/02/2011 at 09:25.
Pushed by mwolff into branch '1.2'.

ProjectManagerView state save/restore

Added saving the state ot the splitter controlling sizes of the
ProjectTreeView and ProjectBuildSet into a session.

Added default strach factors for this splitter items: 75% for the
ProjectTreeView and 25% for the ProjectBuildSet.

Theoretically this is not the correct fix but rather a workaround
that just happens to work for most users.

REVIEW: 100584

M  +18   -0    plugins/projectmanagerview/projectmanagerview.cpp     

http://commits.kde.org/kdevplatform/eae6d08676cbb4f3a081ad56eb175f53c52414d3

diff --git a/plugins/projectmanagerview/projectmanagerview.cpp \
b/plugins/projectmanagerview/projectmanagerview.cpp index 3dc05a2..13b24ed 100644
--- a/plugins/projectmanagerview/projectmanagerview.cpp
+++ b/plugins/projectmanagerview/projectmanagerview.cpp
@@ -42,6 +42,7 @@
 #include <interfaces/iselectioncontroller.h>
 #include <interfaces/context.h>
 #include <interfaces/icore.h>
+#include <interfaces/isession.h>
 #include <interfaces/iprojectcontroller.h>
 #include <interfaces/iuicontroller.h>
 #include <interfaces/iruncontroller.h>
@@ -85,6 +86,11 @@ QWidget* ProjectManagerFilterAction::createWidget( QWidget* parent \
)  
 //END ProjectManagerFilterAction
 
+static const char* sessionConfigGroup = "ProjectManagerView";
+static const char* splitterStateConfigKey = "splitterState";
+static const int projectTreeViewStrechFactor = 75; // %
+static const int projectBuildSetStrechFactor = 25; // %
+
 ProjectManagerView::ProjectManagerView( ProjectManagerViewPlugin* plugin, QWidget \
                *parent )
         : QWidget( parent ), m_ui(new Ui::ProjectManagerView), m_plugin(plugin)
 {
@@ -92,6 +98,15 @@ ProjectManagerView::ProjectManagerView( ProjectManagerViewPlugin* \
plugin, QWidge  
     setWindowIcon( SmallIcon( "project-development" ) );
 
+    KConfigGroup pmviewConfig(ICore::self()->activeSession()->config(), \
sessionConfigGroup); +    if (pmviewConfig.hasKey(splitterStateConfigKey)) {
+        QByteArray geometry = \
pmviewConfig.readEntry<QByteArray>(splitterStateConfigKey, QByteArray()); +        \
m_ui->splitter->restoreState(geometry); +    } else {
+        m_ui->splitter->setStretchFactor(0, projectTreeViewStrechFactor);
+        m_ui->splitter->setStretchFactor(1, projectBuildSetStrechFactor);
+    }
+
     m_syncAction = plugin->actionCollection()->action("locate_document");
     Q_ASSERT(m_syncAction);
     m_syncAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
@@ -163,6 +178,9 @@ void ProjectManagerView::updateSyncAction()
 
 ProjectManagerView::~ProjectManagerView()
 {
+    KConfigGroup pmviewConfig(ICore::self()->activeSession()->config(), \
sessionConfigGroup); +    pmviewConfig.writeEntry(splitterStateConfigKey, \
m_ui->splitter->saveState()); +    pmviewConfig.sync();
 }
 
 QList<KDevelop::ProjectBaseItem*> ProjectManagerView::selectedItems() const


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic