From 4ae61ddbca3298453e23a4f642a14a904b89c7dc Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 25 Sep 2020 23:18:01 +0200 Subject: [PATCH] renamed BoardPostDisplayWidget into BoardPostDisplayWidget_compact --- .../src/gui/Posted/BoardPostDisplayWidget.cpp | 38 +++++++++---------- .../src/gui/Posted/BoardPostDisplayWidget.h | 6 +-- .../gui/Posted/PostedListWidgetWithModel.cpp | 28 +++++++------- .../gui/Posted/PostedListWidgetWithModel.h | 8 ++-- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp index 10c45dcbd..a3f2b592d 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp @@ -45,7 +45,7 @@ /** Constructor */ -const char *BoardPostDisplayWidget::DEFAULT_BOARD_IMAGE = ":/icons/png/newsfeed2.png"; +const char *BoardPostDisplayWidget_compact::DEFAULT_BOARD_IMAGE = ":/icons/png/newsfeed2.png"; //=================================================================================================================================== //== Base class BoardPostDisplayWidgetBase == @@ -107,7 +107,7 @@ void BoardPostDisplayWidgetBase::setReadStatus(bool isNew, bool isUnread) newLabel()->setVisible(isNew); } -void BoardPostDisplayWidget::doExpand(bool e) +void BoardPostDisplayWidget_compact::doExpand(bool e) { std::cerr << "Expanding" << std::endl; if(e) @@ -299,7 +299,7 @@ void BoardPostDisplayWidgetBase::setup() //== class BoardPostDisplayWidget == //=================================================================================================================================== -BoardPostDisplayWidget::BoardPostDisplayWidget(const RsPostedPost& post, uint8_t display_flags,QWidget *parent=nullptr) +BoardPostDisplayWidget_compact::BoardPostDisplayWidget_compact(const RsPostedPost& post, uint8_t display_flags,QWidget *parent=nullptr) : BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_compact()) { ui->setupUi(this); @@ -315,12 +315,12 @@ BoardPostDisplayWidget::BoardPostDisplayWidget(const RsPostedPost& post, uint8_t adjustSize(); } -BoardPostDisplayWidget::~BoardPostDisplayWidget() +BoardPostDisplayWidget_compact::~BoardPostDisplayWidget_compact() { delete ui; } -void BoardPostDisplayWidget::setup() +void BoardPostDisplayWidget_compact::setup() { BoardPostDisplayWidgetBase::setup(); @@ -384,7 +384,7 @@ void BoardPostDisplayWidget::setup() #endif } -void BoardPostDisplayWidget::viewPicture() +void BoardPostDisplayWidget_compact::viewPicture() { if(mPost.mImage.mData == NULL) return; @@ -408,19 +408,19 @@ void BoardPostDisplayWidget::viewPicture() /* window will destroy itself! */ } -QToolButton *BoardPostDisplayWidget::voteUpButton() { return ui->voteUpButton; } -QToolButton *BoardPostDisplayWidget::commentButton() { return ui->commentButton; } -QToolButton *BoardPostDisplayWidget::voteDownButton() { return ui->voteDownButton; } -QLabel *BoardPostDisplayWidget::newLabel() { return ui->newLabel; } -QToolButton *BoardPostDisplayWidget::readButton() { return ui->readButton; } -QLabel *BoardPostDisplayWidget::siteLabel() { return ui->siteLabel; } -GxsIdLabel *BoardPostDisplayWidget::fromLabel() { return ui->fromLabel; } -QLabel *BoardPostDisplayWidget::dateLabel() { return ui->dateLabel; } -QLabel *BoardPostDisplayWidget::titleLabel() { return ui->titleLabel; } -QLabel *BoardPostDisplayWidget::scoreLabel() { return ui->scoreLabel; } -QLabel *BoardPostDisplayWidget::notes() { return ui->notes; } -QPushButton *BoardPostDisplayWidget::shareButton() { return ui->shareButton; } -QLabel *BoardPostDisplayWidget::pictureLabel() { return ui->pictureLabel; } +QToolButton *BoardPostDisplayWidget_compact::voteUpButton() { return ui->voteUpButton; } +QToolButton *BoardPostDisplayWidget_compact::commentButton() { return ui->commentButton; } +QToolButton *BoardPostDisplayWidget_compact::voteDownButton() { return ui->voteDownButton; } +QLabel *BoardPostDisplayWidget_compact::newLabel() { return ui->newLabel; } +QToolButton *BoardPostDisplayWidget_compact::readButton() { return ui->readButton; } +QLabel *BoardPostDisplayWidget_compact::siteLabel() { return ui->siteLabel; } +GxsIdLabel *BoardPostDisplayWidget_compact::fromLabel() { return ui->fromLabel; } +QLabel *BoardPostDisplayWidget_compact::dateLabel() { return ui->dateLabel; } +QLabel *BoardPostDisplayWidget_compact::titleLabel() { return ui->titleLabel; } +QLabel *BoardPostDisplayWidget_compact::scoreLabel() { return ui->scoreLabel; } +QLabel *BoardPostDisplayWidget_compact::notes() { return ui->notes; } +QPushButton *BoardPostDisplayWidget_compact::shareButton() { return ui->shareButton; } +QLabel *BoardPostDisplayWidget_compact::pictureLabel() { return ui->pictureLabel; } //=================================================================================================================================== //== class BoardPostDisplayWidget_card == diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h index af45a30a0..45e24a005 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h @@ -99,13 +99,13 @@ protected: uint8_t mDisplayFlags; }; -class BoardPostDisplayWidget : public BoardPostDisplayWidgetBase +class BoardPostDisplayWidget_compact : public BoardPostDisplayWidgetBase { Q_OBJECT public: - BoardPostDisplayWidget(const RsPostedPost& post, uint8_t display_flags, QWidget *parent); - virtual ~BoardPostDisplayWidget(); + BoardPostDisplayWidget_compact(const RsPostedPost& post, uint8_t display_flags, QWidget *parent); + virtual ~BoardPostDisplayWidget_compact(); static const char *DEFAULT_BOARD_IMAGE; diff --git a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp index 27f37a4a1..9ef923386 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp @@ -94,9 +94,9 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem & QPixmap pixmap(option.rect.size()); pixmap.fill(QRgb(0x00f0f0f0)); // choose a fully transparent background - if(mDisplayMode == BoardPostDisplayWidget::DISPLAY_MODE_COMPACT) + if(mDisplayMode == BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT) { - BoardPostDisplayWidget w(post,displayFlags(post.mMeta.mMsgId),nullptr); + BoardPostDisplayWidget_compact w(post,displayFlags(post.mMeta.mMsgId),nullptr); w.setFixedSize(option.rect.size()); w.adjustSize(); @@ -141,9 +141,9 @@ QSize PostedPostDelegate::sizeHint(const QStyleOptionViewItem& option, const QMo RsPostedPost post = index.data(Qt::UserRole).value() ; - if(mDisplayMode == BoardPostDisplayWidget::DISPLAY_MODE_COMPACT) + if(mDisplayMode == BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT) { - BoardPostDisplayWidget w(post,displayFlags(post.mMeta.mMsgId),nullptr); + BoardPostDisplayWidget_compact w(post,displayFlags(post.mMeta.mMsgId),nullptr); w.adjustSize(); return w.size(); } @@ -170,10 +170,10 @@ uint8_t PostedPostDelegate::displayFlags(const RsGxsMessageId &id) const uint8_t flags=0; if(mExpandedItems.find(id) != mExpandedItems.end()) - flags |= BoardPostDisplayWidget::SHOW_NOTES; + flags |= BoardPostDisplayWidget_compact::SHOW_NOTES; if(mShowCommentItems.find(id) != mShowCommentItems.end()) - flags |= BoardPostDisplayWidget::SHOW_COMMENTS; + flags |= BoardPostDisplayWidget_compact::SHOW_COMMENTS; return flags; } @@ -186,8 +186,8 @@ QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionVie { QWidget *w ; - if(mDisplayMode==BoardPostDisplayWidget::DISPLAY_MODE_COMPACT) - w = new BoardPostDisplayWidget(post,displayFlags(post.mMeta.mMsgId),parent); + if(mDisplayMode==BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT) + w = new BoardPostDisplayWidget_compact(post,displayFlags(post.mMeta.mMsgId),parent); else w = new BoardPostDisplayWidget_card(post,displayFlags(post.mMeta.mMsgId),parent); @@ -278,7 +278,7 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI settingsChanged(); setGroupId(postedId); - mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget::DISPLAY_MODE_CARD); + mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget_compact::DISPLAY_MODE_CARD); switchDisplayMode(); // makes everything consistent and chooses classic view as default updateSorting(ui->sortStrategy_CB->currentIndex()); @@ -293,19 +293,19 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI void PostedListWidgetWithModel::switchDisplayMode() { - if(mPostedPostsDelegate->getDisplayMode() == BoardPostDisplayWidget::DISPLAY_MODE_CARD) + if(mPostedPostsDelegate->getDisplayMode() == BoardPostDisplayWidget_compact::DISPLAY_MODE_CARD) { ui->viewModeButton->setIcon(FilesDefs::getIconFromQtResourcePath(":images/classic.png")); ui->viewModeButton->setToolTip(tr("Click to switch to card view")); - mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget::DISPLAY_MODE_COMPACT); + mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT); } else { ui->viewModeButton->setIcon(FilesDefs::getIconFromQtResourcePath(":images/card.png")); ui->viewModeButton->setToolTip(tr("Click to switch to compact view")); - mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget::DISPLAY_MODE_CARD); + mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget_compact::DISPLAY_MODE_CARD); } mPostedPostsModel->triggerRedraw(); } @@ -651,7 +651,7 @@ QIcon PostedListWidgetWithModel::groupIcon() if (mGroup.mGroupImage.mData != NULL) GxsIdDetails::loadPixmapFromData(mGroup.mGroupImage.mData, mGroup.mGroupImage.mSize, postedImage,GxsIdDetails::ORIGINAL); else - postedImage = FilesDefs::getPixmapFromQtResourcePath(BoardPostDisplayWidget::DEFAULT_BOARD_IMAGE); + postedImage = FilesDefs::getPixmapFromQtResourcePath(BoardPostDisplayWidget_compact::DEFAULT_BOARD_IMAGE); return QIcon(postedImage); } @@ -729,7 +729,7 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group) if (group.mGroupImage.mData != NULL) { GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, chanImage,GxsIdDetails::ORIGINAL); } else { - chanImage = QPixmap(BoardPostDisplayWidget::DEFAULT_BOARD_IMAGE); + chanImage = QPixmap(BoardPostDisplayWidget_compact::DEFAULT_BOARD_IMAGE); } if(group.mMeta.mGroupName.empty()) ui->namelabel->setText(tr("[No name]")); diff --git a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.h b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.h index 44565d953..c07311e4d 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.h +++ b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.h @@ -45,7 +45,7 @@ class PostedPostDelegate: public QAbstractItemDelegate Q_OBJECT public: - PostedPostDelegate(PostedListWidgetWithModel *p,QObject *parent=0) : QAbstractItemDelegate(parent),mCellWidthPix(100),mPostListWidget(p),mDisplayMode(BoardPostDisplayWidget::DISPLAY_MODE_COMPACT){} + PostedPostDelegate(PostedListWidgetWithModel *p,QObject *parent=0) : QAbstractItemDelegate(parent),mCellWidthPix(100),mPostListWidget(p),mDisplayMode(BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT){} virtual ~PostedPostDelegate(){} void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const override; @@ -54,8 +54,8 @@ public: QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; void setCellWidth(int pix) { mCellWidthPix = pix; } - void setDisplayMode(BoardPostDisplayWidget::DisplayMode dm) { mDisplayMode = dm; } - BoardPostDisplayWidget::DisplayMode getDisplayMode() const { return mDisplayMode; } + void setDisplayMode(BoardPostDisplayWidget_compact::DisplayMode dm) { mDisplayMode = dm; } + BoardPostDisplayWidget_compact::DisplayMode getDisplayMode() const { return mDisplayMode; } public slots: void expandItem(RsGxsMessageId msgId,bool expanded); @@ -69,7 +69,7 @@ private: int mCellWidthPix; PostedListWidgetWithModel *mPostListWidget; // used for sending vote signals and so on. - BoardPostDisplayWidget::DisplayMode mDisplayMode; + BoardPostDisplayWidget_compact::DisplayMode mDisplayMode; std::set mExpandedItems; std::set mShowCommentItems; };