diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp index 2fcd431aa..e75ece525 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp @@ -28,7 +28,7 @@ #include "WikiDialog.h" #include "gui/WikiPoos/WikiAddDialog.h" #include "gui/WikiPoos/WikiEditDialog.h" - +#include "gui/settings/rsharesettings.h" #include "gui/gxs/WikiGroupDialog.h" #include @@ -105,6 +105,9 @@ WikiDialog::WikiDialog(QWidget *parent) : RsGxsUpdateBroadcastPage(rsWiki, paren /* setup TokenQueue */ mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this); + // Set initial size of the splitter + ui.listSplitter->setStretchFactor(0, 0); + ui.listSplitter->setStretchFactor(1, 1); /* Setup Group Tree */ mYourGroups = ui.groupTreeWidget->addCategoryItem(tr("My Groups"), QIcon(), true); @@ -112,13 +115,37 @@ WikiDialog::WikiDialog(QWidget *parent) : RsGxsUpdateBroadcastPage(rsWiki, paren mPopularGroups = ui.groupTreeWidget->addCategoryItem(tr("Popular Groups"), QIcon(), false); mOtherGroups = ui.groupTreeWidget->addCategoryItem(tr("Other Groups"), QIcon(), false); + // load settings + processSettings(true); } WikiDialog::~WikiDialog() { + // save settings + processSettings(false); + delete(mWikiQueue); } +void WikiDialog::processSettings(bool load) +{ + Settings->beginGroup("WikiDialog"); + + if (load) { + // load settings + + // state of splitter + ui.listSplitter->restoreState(Settings->value("SplitterList").toByteArray()); + } else { + // save settings + + // state of splitter + Settings->setValue("SplitterList", ui.listSplitter->saveState()); + } + + Settings->endGroup(); +} + void WikiDialog::OpenOrShowAddPageDialog() { RsGxsGroupId groupId = getSelectedGroup(); diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h index 8b78f4774..cf4154326 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h @@ -44,7 +44,7 @@ class WikiDialog : public RsGxsUpdateBroadcastPage, public TokenResponse public: WikiDialog(QWidget *parent = 0); ~WikiDialog(); - + virtual QIcon iconPixmap() const { return QIcon(IMAGE_WIKI) ; } //MainPage virtual QString pageName() const { return tr("Wiki Pages") ; } //MainPage virtual QString helpText() const { return ""; } //MainPage @@ -69,39 +69,38 @@ private slots: // GroupTreeWidget stuff. void groupListCustomPopupMenu(QPoint point); - void subscribeToGroup(); - void unsubscribeToGroup(); + void subscribeToGroup(); + void unsubscribeToGroup(); void wikiGroupChanged(const QString &groupId); - + void todo(); private: -void clearWikiPage(); -void clearGroupTree(); + void clearWikiPage(); + void clearGroupTree(); -void updateWikiPage(const RsWikiSnapshot &page); + void updateWikiPage(const RsWikiSnapshot &page); -bool getSelectedPage(RsGxsGroupId &groupId, RsGxsMessageId &pageId, RsGxsMessageId &origPageId); -std::string getSelectedPage(); -const RsGxsGroupId &getSelectedGroup(); + bool getSelectedPage(RsGxsGroupId &groupId, RsGxsMessageId &pageId, RsGxsMessageId &origPageId); + std::string getSelectedPage(); + const RsGxsGroupId &getSelectedGroup(); + // Using GroupTreeWidget. + void wikiSubscribe(bool subscribe); + void GroupMetaDataToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo); + void insertGroupsData(const std::list &wikiList); - // Using GroupTreeWidget. -void wikiSubscribe(bool subscribe); -void GroupMetaDataToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo); -void insertGroupsData(const std::list &wikiList); + void processSettings(bool load); + void requestGroupMeta(); + void loadGroupMeta(const uint32_t &token); -void requestGroupMeta(); -void loadGroupMeta(const uint32_t &token); - -void requestPages(const std::list &groupIds); -void loadPages(const uint32_t &token); - -void requestWikiPage(const RsGxsGrpMsgIdPair &msgId); -void loadWikiPage(const uint32_t &token); + void requestPages(const std::list &groupIds); + void loadPages(const uint32_t &token); + void requestWikiPage(const RsGxsGrpMsgIdPair &msgId); + void loadWikiPage(const uint32_t &token); TokenQueue *mWikiQueue; @@ -110,7 +109,7 @@ void loadWikiPage(const uint32_t &token); WikiEditDialog *mEditDialog; std::string mGroupSelected; - RsGxsMessageId mPageSelected; + RsGxsMessageId mPageSelected; std::string mModSelected; @@ -118,7 +117,7 @@ void loadWikiPage(const uint32_t &token); QTreeWidgetItem *mSubscribedGroups; QTreeWidgetItem *mPopularGroups; QTreeWidgetItem *mOtherGroups; - RsGxsGroupId mGroupId; // From GroupTreeWidget + RsGxsGroupId mGroupId; // From GroupTreeWidget /* UI - from Designer */ Ui::WikiDialog ui; diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.ui b/retroshare-gui/src/gui/WikiPoos/WikiDialog.ui index e8666ed09..f5ad5ea65 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.ui +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.ui @@ -27,7 +27,7 @@ 0 - + Qt::Horizontal