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

List:       kde-commits
Subject:    [konsole] src: A QSet is sufficient here. QSet is also hash-based.
From:       Andreas Hartmetz <ahartmetz () gmail ! com>
Date:       2016-10-08 19:41:09
Message-ID: E1bsxUb-0004Wq-11 () code ! kde ! org
[Download RAW message or body]

Git commit 1b8c9ca40ac7aff0d37eb3c26ade41c74d44a5c9 by Andreas Hartmetz.
Committed on 08/10/2016 at 19:40.
Pushed by ahartmetz into branch 'master'.

A QSet is sufficient here. QSet is also hash-based.

M  +6    -4    src/ViewManager.cpp

http://commits.kde.org/konsole/1b8c9ca40ac7aff0d37eb3c26ade41c74d44a5c9

diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index e31041c..0f14ca0 100644
--- a/src/ViewManager.cpp
+++ b/src/ViewManager.cpp
@@ -901,7 +901,7 @@ void ViewManager::saveSessions(KConfigGroup& group)
 {
     // find all unique session restore IDs
     QList<int> ids;
-    QHash<Session*, int> unique;
+    QSet<Session*> unique;
 
     // first: sessions in the active container, preserving the order
     ViewContainer* container = _viewSplitter->activeContainer();
@@ -915,8 +915,10 @@ void ViewManager::saveSessions(KConfigGroup& group)
         Q_ASSERT(view);
         Session* session = _sessionMap[view];
         ids << SessionManager::instance()->getRestoreId(session);
-        if (view == activeview) group.writeEntry("Active", tab);
-        unique.insert(session, 1);
+        unique.insert(session);
+        if (view == activeview) {
+            group.writeEntry("Active", tab);
+        }
         tab++;
     }
 
@@ -925,7 +927,7 @@ void ViewManager::saveSessions(KConfigGroup& group)
     foreach(Session * session, _sessionMap) {
         if (!unique.contains(session)) {
             ids << SessionManager::instance()->getRestoreId(session);
-            unique.insert(session, 1);
+            unique.insert(session);
         }
     }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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