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
This commit is contained in:
defnax 2011-05-30 23:06:22 +00:00
parent 68e679873d
commit 00d6ec3c1f
2 changed files with 45 additions and 1 deletions

View File

@ -7,6 +7,8 @@
#include <QPainter> #include <QPainter>
#include <QStylePainter> #include <QStylePainter>
#include "gui/settings/rsharesettings.h"
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
class TRHistogram class TRHistogram
@ -136,6 +138,8 @@ TurtleRouterDialog::TurtleRouterDialog(QWidget *parent)
{ {
setupUi(this) ; setupUi(this) ;
m_bProcessSettings = false;
// Init the basic setup. // Init the basic setup.
// //
QStringList stl ; QStringList stl ;
@ -160,8 +164,44 @@ TurtleRouterDialog::TurtleRouterDialog(QWidget *parent)
_tunnel_statistics_F->viewport()->setBackgroundRole(QPalette::NoRole); _tunnel_statistics_F->viewport()->setBackgroundRole(QPalette::NoRole);
_tunnel_statistics_F->setFrameStyle(QFrame::NoFrame); _tunnel_statistics_F->setFrameStyle(QFrame::NoFrame);
_tunnel_statistics_F->setFocusPolicy(Qt::NoFocus); _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() void TurtleRouterDialog::updateDisplay()
{ {
std::vector<std::vector<std::string> > hashes_info ; std::vector<std::vector<std::string> > hashes_info ;

View File

@ -11,6 +11,7 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog
{ {
public: public:
TurtleRouterDialog(QWidget *parent = NULL) ; TurtleRouterDialog(QWidget *parent = NULL) ;
~TurtleRouterDialog();
// Cache for peer names. // Cache for peer names.
static QString getPeerName(const std::string& peer_id) ; static QString getPeerName(const std::string& peer_id) ;
@ -21,6 +22,9 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog
const std::vector<TurtleRequestDisplayInfo >&, const std::vector<TurtleRequestDisplayInfo >&,
const std::vector<TurtleRequestDisplayInfo >&) ; const std::vector<TurtleRequestDisplayInfo >&) ;
void processSettings(bool bLoad);
bool m_bProcessSettings;
virtual void updateDisplay() ; virtual void updateDisplay() ;
QTreeWidgetItem *findParentHashItem(const std::string& hash) ; QTreeWidgetItem *findParentHashItem(const std::string& hash) ;