From 00d6ec3c1f7322639d84346b3546335d0347c595 Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 30 May 2011 23:06:22 +0000 Subject: [PATCH] Added to store splitter position on TurtleRouterDialog git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4226 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/TurtleRouterDialog.cpp | 40 +++++++++++++++++++ retroshare-gui/src/gui/TurtleRouterDialog.h | 6 ++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/TurtleRouterDialog.cpp index 3abaaa4ab..b1a337757 100644 --- a/retroshare-gui/src/gui/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/TurtleRouterDialog.cpp @@ -7,6 +7,8 @@ #include #include +#include "gui/settings/rsharesettings.h" + static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; class TRHistogram @@ -135,6 +137,8 @@ TurtleRouterDialog::TurtleRouterDialog(QWidget *parent) : RsAutoUpdatePage(2000,parent) { setupUi(this) ; + + m_bProcessSettings = false; // Init the basic setup. // @@ -160,8 +164,44 @@ TurtleRouterDialog::TurtleRouterDialog(QWidget *parent) _tunnel_statistics_F->viewport()->setBackgroundRole(QPalette::NoRole); _tunnel_statistics_F->setFrameStyle(QFrame::NoFrame); _tunnel_statistics_F->setFocusPolicy(Qt::NoFocus); + + // load settings + processSettings(true); } +TurtleRouterDialog::~TurtleRouterDialog() +{ + + // save settings + processSettings(false); +} + +void TurtleRouterDialog::processSettings(bool bLoad) +{ + m_bProcessSettings = true; + + Settings->beginGroup(QString("TurtleRouterDialog")); + + if (bLoad) { + // load settings + + // state of splitter + splitter->restoreState(Settings->value("Splitter").toByteArray()); + } else { + // save settings + + // state of splitter + Settings->setValue("Splitter", splitter->saveState()); + + } + + Settings->endGroup(); + + m_bProcessSettings = false; + +} + + void TurtleRouterDialog::updateDisplay() { std::vector > hashes_info ; diff --git a/retroshare-gui/src/gui/TurtleRouterDialog.h b/retroshare-gui/src/gui/TurtleRouterDialog.h index 02e63a06b..e1c32e62f 100644 --- a/retroshare-gui/src/gui/TurtleRouterDialog.h +++ b/retroshare-gui/src/gui/TurtleRouterDialog.h @@ -11,7 +11,8 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog { public: TurtleRouterDialog(QWidget *parent = NULL) ; - + ~TurtleRouterDialog(); + // Cache for peer names. static QString getPeerName(const std::string& peer_id) ; @@ -20,6 +21,9 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog const std::vector > >&, const std::vector&, const std::vector&) ; + + void processSettings(bool bLoad); + bool m_bProcessSettings; virtual void updateDisplay() ; QTreeWidgetItem *findParentHashItem(const std::string& hash) ;