diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index f92a864e9..a5a91d6aa 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -290,7 +290,13 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI /* Invoke the Qt Designer generated object setup routine */ ui->setupUi(this); - ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel()); + ui->list_TB->setIcon(FilesDefs::getIconFromQtResourcePath(":Posted/images/classic.png")); + ui->grid_TB->setIcon(FilesDefs::getIconFromQtResourcePath(":icons/svg/gridlayout.svg")); + + connect(ui->list_TB,SIGNAL(clicked()),this,SLOT(switchView())); + connect(ui->grid_TB,SIGNAL(clicked()),this,SLOT(switchView())); + + ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel()); ui->postsTree->setItemDelegate(mChannelPostsDelegate = new ChannelPostDelegate()); ui->postsTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // prevents bug on w10, since row size depends on widget width ui->postsTree->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);// more beautiful if we scroll at pixel level @@ -455,11 +461,17 @@ void GxsChannelPostsWidgetWithModel::switchView() { if(mChannelPostsModel->getMode() == RsGxsChannelPostsModel::TREE_MODE_GRID) { + whileBlocking(ui->list_TB)->setChecked(true); + whileBlocking(ui->grid_TB)->setChecked(false); + mChannelPostsDelegate->setWidgetGrid(false); mChannelPostsModel->setMode(RsGxsChannelPostsModel::TREE_MODE_LIST); } else { + whileBlocking(ui->list_TB)->setChecked(false); + whileBlocking(ui->grid_TB)->setChecked(true); + mChannelPostsDelegate->setWidgetGrid(true); mChannelPostsModel->setMode(RsGxsChannelPostsModel::TREE_MODE_GRID); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui index 9ad063092..bc01e768c 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui @@ -120,6 +120,26 @@ + + + + ... + + + true + + + + + + + ... + + + true + + + diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index 656cdc7fd..1360bae35 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -4,6 +4,8 @@ icons/svg/hidden.svg icons/svg/randomness.svg icons/svg/password.svg + Posted/images/classic.png + icons/svg/gridlayout.svg icons/stars/star0.png icons/stars/star1.png icons/stars/star2.png diff --git a/retroshare-gui/src/gui/icons/svg/gridlayout.svg b/retroshare-gui/src/gui/icons/svg/gridlayout.svg new file mode 100644 index 000000000..96e7089ec --- /dev/null +++ b/retroshare-gui/src/gui/icons/svg/gridlayout.svg @@ -0,0 +1,11 @@ + + + + + + + + + + +