added settings to search for store the splitter position

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4043 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2011-02-17 16:30:59 +00:00
parent 5a36473a4d
commit 24b2b8ce29
2 changed files with 47 additions and 1 deletions

View File

@ -95,6 +95,8 @@ SearchDialog::SearchDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
m_bProcessSettings = false;
_queueIsAlreadyTakenCareOf = false ;
ui.lineEdit->setFocus();
ui.lineEdit->setToolTip(tr("Enter a keyword here (at least 3 char long)"));
@ -181,6 +183,9 @@ SearchDialog::SearchDialog(QWidget *parent)
ui.resetButton->hide();
ui.clearButton->hide();
// load settings
processSettings(true);
ui._ownFiles_CB->setMinimumWidth(20);
ui._friendListsearch_SB->setMinimumWidth(20);
ui._anonF2Fsearch_CB->setMinimumWidth(20);
@ -192,6 +197,43 @@ SearchDialog::SearchDialog(QWidget *parent)
#endif
}
SearchDialog::~SearchDialog()
{
// save settings
processSettings(false);
}
void SearchDialog::processSettings(bool bLoad)
{
m_bProcessSettings = true;
QHeaderView *pHeader = ui.searchSummaryWidget->header () ;
Settings->beginGroup(QString("SearchDialog"));
if (bLoad) {
// load settings
// state of SearchSummary tree
pHeader->restoreState(Settings->value("SearchSummaryTree").toByteArray());
// state of splitter
ui.splitter->restoreState(Settings->value("Splitter").toByteArray());
} else {
// save settings
// state of SearchSummary tree
Settings->setValue("SearchSummaryTree", pHeader->saveState());
// state of splitter
Settings->setValue("Splitter", ui.splitter->saveState());
}
Settings->endGroup();
m_bProcessSettings = false;
}
void SearchDialog::checkText(const QString& txt)
{
if(txt.length() < 3)

View File

@ -39,7 +39,7 @@ class SearchDialog : public MainPage
/** Default Constructor */
SearchDialog(QWidget *parent = 0);
/** Default Destructor */
~SearchDialog();
public slots:
void updateFiles(qulonglong request_id,FileDetail file) ;
@ -126,9 +126,13 @@ private:
static bool initialised;
void initialiseFileTypeMappings();
void processSettings(bool bLoad);
void FilterItems();
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int nFilterColumn);
bool m_bProcessSettings;
int nextSearchId;
/** Qt Designer generated object */