From ae43058520bbabb93dd33e50723b9faf986e6c19 Mon Sep 17 00:00:00 2001 From: AsamK Date: Fri, 4 Sep 2015 22:05:00 +0200 Subject: [PATCH] Make wikis compile - rsWiki->updated() doesn't exist anymore, so I ported WikiDialog to inherit from RsGxsUpdateBroadcastPage - add -lglib-2.0 to pegmarkdown.pro --- .../src/gui/WikiPoos/WikiDialog.cpp | 47 ++++++++----------- retroshare-gui/src/gui/WikiPoos/WikiDialog.h | 11 ++--- .../src/gui/WikiPoos/WikiEditDialog.cpp | 4 +- retroshare-gui/src/retroshare-gui.pro | 1 - supportlibs/pegmarkdown/pegmarkdown.pro | 2 + 5 files changed, 28 insertions(+), 37 deletions(-) diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp index b4a26dddb..a4be2189f 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp @@ -79,7 +79,7 @@ /** Constructor */ WikiDialog::WikiDialog(QWidget *parent) -: MainPage(parent) +: RsGxsUpdateBroadcastPage(rsWiki, parent) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); @@ -103,11 +103,6 @@ WikiDialog::WikiDialog(QWidget *parent) connect(ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint))); connect(ui.groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(wikiGroupChanged(QString))); - - QTimer *timer = new QTimer(this); - timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); - timer->start(1000); - /* setup TokenQueue */ mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this); @@ -118,8 +113,6 @@ WikiDialog::WikiDialog(QWidget *parent) mPopularGroups = ui.groupTreeWidget->addCategoryItem(tr("Popular Groups"), QIcon(IMAGE_FOLDERGREEN), false); mOtherGroups = ui.groupTreeWidget->addCategoryItem(tr("Other Groups"), QIcon(IMAGE_FOLDERYELLOW), false); - //Auto refresh seems not to work, temporary solution at start - insertWikiGroups(); } WikiDialog::~WikiDialog() @@ -127,20 +120,6 @@ WikiDialog::~WikiDialog() delete(mWikiQueue); } -void WikiDialog::checkUpdate() -{ - /* update */ - if (!rsWiki) - return; - - if (rsWiki->updated()) - { - insertWikiGroups(); - } - - return; -} - void WikiDialog::OpenOrShowAddPageDialog() { RsGxsGroupId groupId = getSelectedGroup(); @@ -362,11 +341,6 @@ const RsGxsGroupId& WikiDialog::getSelectedGroup() /************************** Request / Response *************************/ /*** Loading Main Index ***/ -void WikiDialog::insertWikiGroups() -{ - requestGroupMeta(); -} - void WikiDialog::requestGroupMeta() { std::cerr << "WikiDialog::requestGroupMeta()"; @@ -528,7 +502,7 @@ void WikiDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req) #define GXSGROUP_NEWGROUPID 1 case GXSGROUP_NEWGROUPID: - insertWikiGroups(); + requestGroupMeta(); break; default: std::cerr << "WikiDialog::loadRequest() ERROR: INVALID TYPE"; @@ -716,3 +690,20 @@ void WikiDialog::todo() "
  • Auto update Group trees" ""); } + +void WikiDialog::updateDisplay(bool complete) +{ + if (complete || !getGrpIds().empty() || !getGrpIdsMeta().empty()) { + /* Update group list */ + requestGroupMeta(); + } else { + /* Update all groups of changed messages */ + std::map > msgIds; + getAllMsgIds(msgIds); + + std::map >::iterator msgIt; + for (msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) { + wikiGroupChanged(QString::fromStdString(msgIt->first.toStdString())); + } + } +} diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h index f0dbd8c64..bf6a609ee 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h @@ -26,7 +26,7 @@ #include -#include "retroshare-gui/mainpage.h" +#include "gui/gxs/RsGxsUpdateBroadcastPage.h" #include "ui_WikiDialog.h" #include @@ -40,7 +40,7 @@ class WikiAddDialog; class WikiEditDialog; -class WikiDialog : public MainPage, public TokenResponse +class WikiDialog : public RsGxsUpdateBroadcastPage, public TokenResponse { Q_OBJECT @@ -52,12 +52,13 @@ public: virtual QString pageName() const { return tr("Wiki Pages") ; } //MainPage virtual QString helpText() const { return ""; } //MainPage + void loadRequest(const TokenQueue *queue, const TokenRequest &req); -void loadRequest(const TokenQueue *queue, const TokenRequest &req); +public: + virtual void updateDisplay(bool complete); private slots: - void checkUpdate(); void OpenOrShowAddPageDialog(); void OpenOrShowAddGroupDialog(); void OpenOrShowEditDialog(); @@ -69,8 +70,6 @@ private slots: void showGroupDetails(); void editGroupDetails(); - void insertWikiGroups(); - // GroupTreeWidget stuff. void groupListCustomPopupMenu(QPoint point); void subscribeToGroup(); diff --git a/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp index be5bc0721..709d0262c 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp +++ b/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp @@ -733,7 +733,7 @@ void WikiEditDialog::loadBaseHistory(const uint32_t &token) modItem->setText(WET_COL_DATE, text); modItem->setData(WET_COL_DATE, WET_ROLE_SORT, sort); } - modItem->setId(page.mMeta.mAuthorId, WET_COL_AUTHORID); + modItem->setId(page.mMeta.mAuthorId, WET_COL_AUTHORID, false); modItem->setText(WET_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId.toStdString())); ui.treeWidget_History->addTopLevelItem(modItem); @@ -847,7 +847,7 @@ void WikiEditDialog::loadEditTreeData(const uint32_t &token) modItem->setText(WET_COL_DATE, text); modItem->setData(WET_COL_DATE, WET_ROLE_SORT, sort); } - modItem->setId(snapshot.mMeta.mAuthorId, WET_COL_AUTHORID); + modItem->setId(snapshot.mMeta.mAuthorId, WET_COL_AUTHORID, false); modItem->setText(WET_COL_PAGEID, QString::fromStdString(snapshot.mMeta.mMsgId.toStdString())); /* find the parent */ diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index c3ce9f59a..1d84cff73 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -69,7 +69,6 @@ linux-* { LIBS += ../../libretroshare/src/lib/libretroshare.a LIBS *= -lX11 -lXss - #LIBS *= -lglib-2.0 LIBS *= -rdynamic -ldl DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions DEFINES *= UBUNTU diff --git a/supportlibs/pegmarkdown/pegmarkdown.pro b/supportlibs/pegmarkdown/pegmarkdown.pro index 31bda9f64..ca818cc39 100644 --- a/supportlibs/pegmarkdown/pegmarkdown.pro +++ b/supportlibs/pegmarkdown/pegmarkdown.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += staticlib +CONFIG += create_prl CONFIG -= qt TARGET = pegmarkdown @@ -15,6 +16,7 @@ debug { ################################# Linux ########################################## linux-* { DESTDIR = lib + LIBS *= -lglib-2.0 } linux-g++ {