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 <QStylePainter>
#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<std::vector<std::string> > hashes_info ;

View File

@ -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<std::vector<std::basic_string<char> > >&,
const std::vector<TurtleRequestDisplayInfo >&,
const std::vector<TurtleRequestDisplayInfo >&) ;
void processSettings(bool bLoad);
bool m_bProcessSettings;
virtual void updateDisplay() ;
QTreeWidgetItem *findParentHashItem(const std::string& hash) ;