diff --git a/plugins/FeedReader/services/p3FeedReaderThread.cc b/plugins/FeedReader/services/p3FeedReaderThread.cc index 01e449323..845b5c82b 100644 --- a/plugins/FeedReader/services/p3FeedReaderThread.cc +++ b/plugins/FeedReader/services/p3FeedReaderThread.cc @@ -1151,10 +1151,10 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe if (isRunning()) { /* process description */ - bool processPostedFirstImage = (feed.flag & RS_FEED_FLAG_POSTED_FIRST_IMAGE) ? TRUE : FALSE; + bool processPostedFirstImage = (feed.flag & RS_FEED_FLAG_POSTED_FIRST_IMAGE) ? true : false; if (!msg->attachmentBinary.empty()) { /* use attachment as image */ - processPostedFirstImage = FALSE; + processPostedFirstImage = false; } //long todo; // encoding diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 1dab369e2..7c2b3fd14 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -83,7 +83,7 @@ NetworkDialog::NetworkDialog(QWidget */*parent*/) ui.connectTreeWidget->setUpdatesEnabled(true); ui.connectTreeWidget->setSortingEnabled(true); ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - ui.connectTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); + ui.connectTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) ); connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails())); @@ -117,24 +117,12 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ ) { return; } - QMenu *contextMnu = new QMenu; - RsPgpId peer_id(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), pgpid_item_model::PGP_ITEM_MODEL_COLUMN_PEERID)).toString().toStdString()) ; - - // That's what context menus are made for - RsPeerDetails detail; - if(!rsPeers->getGPGDetails(peer_id, detail)) // that is not suppose to fail. - return ; - - //if(peer_id == rsPeers->getGPGOwnId()) - // contextMnu->addAction(QIcon(), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated())); - contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails())); contextMnu->addSeparator() ; contextMnu->addAction(QIcon(), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys())); contextMnu->addAction(QIcon(), tr("Remove this key"), this, SLOT(removeSelectedKeys())); - contextMnu->exec(QCursor::pos()); } @@ -177,11 +165,34 @@ void NetworkDialog::removeSelectedKeys() QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes(); if(l.empty()) return; - std::set selected; - selected.insert(RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), pgpid_item_model::PGP_ITEM_MODEL_COLUMN_PEERID)).toString().toStdString())); - removeKeys(selected); + std::set friends; + for (int i = 0; i < l.size(); i++) + { + RsPgpId peer_id = RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l[i].row(), pgpid_item_model::PGP_ITEM_MODEL_COLUMN_PEERID)).toString().toStdString()); + RsPeerDetails details ; + if(rsPeers->getGPGDetails(peer_id,details)) + { + if(details.accept_connection) + friends.insert(peer_id); + else + selected.insert(peer_id); + } + } + if(!friends.empty()) + { + if ((QMessageBox::question(this, "RetroShare", tr("You have selected %1 accepted peers among others,\n Are you sure you want to un-friend them?").arg(friends.size()), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)) == QMessageBox::Yes) + { + for(std::set::const_iterator it(friends.begin());it!=friends.end();++it) + rsPeers->removeFriend(*it); + selected.insert(friends.begin(),friends.end()); + } + } + if(!selected.empty()) + removeKeys(selected); + + updateDisplay(); } void NetworkDialog::removeKeys(std::set selected) diff --git a/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp b/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp index 4ef0b6512..475c74034 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp @@ -26,6 +26,7 @@ #include "PulseViewGroup.h" #include "CustomFrame.h" +#include "WireGroupDialog.h" #include "gui/gxs/GxsIdDetails.h" #include "gui/common/FilesDefs.h" #include "util/DateTime.h" @@ -40,6 +41,9 @@ PulseViewGroup::PulseViewGroup(PulseViewHolder *holder, RsWireGroupSPtr group) setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); setup(); + + connect(editButton, SIGNAL(clicked()), this, SLOT(editProfile())); + } void PulseViewGroup::setup() @@ -89,14 +93,14 @@ void PulseViewGroup::setup() mGroup->mHeadshot.mSize, pixmap,GxsIdDetails::ORIGINAL)) { - pixmap = pixmap.scaled(100,100); + pixmap = pixmap.scaled(100,100, Qt::KeepAspectRatio, Qt::SmoothTransformation); label_headshot->setPixmap(pixmap); } } else { // default. - QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/png/posted.png").scaled(100,100); + QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/wire.png").scaled(100,100, Qt::KeepAspectRatio, Qt::SmoothTransformation); label_headshot->setPixmap(pixmap); } @@ -121,6 +125,23 @@ void PulseViewGroup::setup() widget_replies->setVisible(false); } } + + setGroupSet(); +} + +void PulseViewGroup::setGroupSet() +{ + if (mGroup->mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) { + editButton->show(); + } + else if (mGroup->mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) + { + editButton->hide(); + } + else + { + editButton->hide(); + } } void PulseViewGroup::actionFollow() @@ -135,3 +156,17 @@ void PulseViewGroup::actionFollow() } } +void PulseViewGroup::editProfile() +{ + RsGxsGroupId groupId = mGroup->mMeta.mGroupId; + if (groupId.isNull()) + { + std::cerr << "PulseViewGroup::editProfile() No Group selected"; + std::cerr << std::endl; + return; + } + + WireGroupDialog wireEdit(GxsGroupDialog::MODE_EDIT, groupId, this); + wireEdit.exec (); +} + diff --git a/retroshare-gui/src/gui/TheWire/PulseViewGroup.h b/retroshare-gui/src/gui/TheWire/PulseViewGroup.h index 4d00090ca..62da0a228 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewGroup.h +++ b/retroshare-gui/src/gui/TheWire/PulseViewGroup.h @@ -35,10 +35,13 @@ public: private slots: void actionFollow(); + void editProfile(); protected: void setup(); +private: + void setGroupSet(); protected: RsWireGroupSPtr mGroup; diff --git a/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui b/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui index 96f717656..79d9964f6 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui +++ b/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui @@ -136,38 +136,6 @@ - - - - Qt::Horizontal - - - - 518 - 58 - - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - <html><head/><body><p><span style=" color:#555753;">@sidler_here</span></p></body></html> - - - @@ -203,6 +171,45 @@ + + + + + 0 + 0 + + + + + 0 + 20 + + + + <html><head/><body><p><span style=" color:#555753;">@sidler_here</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 518 + 58 + + + + + + + + Edit profile + + + @@ -227,41 +234,6 @@ - - - - - 0 - 0 - - - - - 0 - 20 - - - - <html><head/><body><p><span style=" color:#2e3436;">3:58 AM · Apr 13, 2020 ·</span></p></body></html> - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - @@ -281,19 +253,6 @@ - - - - Qt::Horizontal - - - - 2000 - 20 - - - - @@ -313,6 +272,54 @@ + + + + + 0 + 0 + + + + + 0 + 20 + + + + <html><head/><body><p><span style=" color:#2e3436;">3:58 AM · Apr 13, 2020 ·</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 2000 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + @@ -530,6 +537,7 @@ 12 + 75 true diff --git a/retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp b/retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp index b6a1c5440..8ed6d4d4b 100644 --- a/retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp +++ b/retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp @@ -34,13 +34,19 @@ WireGroupExtra::~WireGroupExtra() void WireGroupExtra::setUp() { - connect(ui.pushButton_masthead, SIGNAL(clicked() ), this , SLOT(addMasthead())); -} + connect(ui.pushButton_masthead, SIGNAL(clicked() ), this , SLOT(addMasthead())); + int desired_height = ui.pushButton_masthead->height() + ui.removeButton->height() + ui.lineEdit_Tagline->height(); + int desired_width = 3/1.0 * desired_height + ui.lineEdit_Tagline->width(); + + ui.label_masthead->setFixedSize(desired_width, desired_height); + + setMasthead(QPixmap()); +} void WireGroupExtra::addMasthead() { - QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Masthead"), 400, 100); + QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Masthead"), 800, 600); if (img.isNull()) return; @@ -48,7 +54,6 @@ void WireGroupExtra::addMasthead() setMasthead(img); } - void WireGroupExtra::setTagline(const std::string &str) { ui.lineEdit_Tagline->setText(QString::fromStdString(str)); @@ -61,8 +66,21 @@ void WireGroupExtra::setLocation(const std::string &str) void WireGroupExtra::setMasthead(const QPixmap &pixmap) { - mMasthead = pixmap; - ui.label_masthead->setPixmap(mMasthead); + mMasthead = pixmap; + + if (!mMasthead.isNull()) { + ui.label_masthead->setPicture(mMasthead); + ui.label_masthead->setToolTip(tr("Use the mouse to zoom and adjust the image for your background.")); + } else { + ui.label_masthead->setPicture(QPixmap()); + ui.label_masthead->setText(tr("MastHead background Image")); + } +} + +void WireGroupExtra::on_removeButton_clicked() +{ + ui.label_masthead->setPicture(QPixmap()); + ui.label_masthead->setText(tr("MastHead background Image")); } std::string WireGroupExtra::getTagline() @@ -77,7 +95,5 @@ std::string WireGroupExtra::getLocation() QPixmap WireGroupExtra::getMasthead() { - return mMasthead; + return ui.label_masthead->extractCroppedScaledPicture(); } - - diff --git a/retroshare-gui/src/gui/TheWire/WireGroupExtra.h b/retroshare-gui/src/gui/TheWire/WireGroupExtra.h index ce606feb3..429be088b 100644 --- a/retroshare-gui/src/gui/TheWire/WireGroupExtra.h +++ b/retroshare-gui/src/gui/TheWire/WireGroupExtra.h @@ -34,7 +34,6 @@ public: void setMasthead(const QPixmap &pixmap); QPixmap getMasthead(); - void setTagline(const std::string &str); void setLocation(const std::string &str); @@ -43,7 +42,7 @@ public: private slots: void addMasthead(); - + void on_removeButton_clicked(); private: void setUp(); private: diff --git a/retroshare-gui/src/gui/TheWire/WireGroupExtra.ui b/retroshare-gui/src/gui/TheWire/WireGroupExtra.ui index fb1da5e73..4c03b8fe8 100644 --- a/retroshare-gui/src/gui/TheWire/WireGroupExtra.ui +++ b/retroshare-gui/src/gui/TheWire/WireGroupExtra.ui @@ -7,7 +7,7 @@ 0 0 516 - 199 + 133 @@ -19,50 +19,127 @@ Form - + + + 0 + + + 0 + - - - Masthead - - - - - - - MastHead background Image - - + + + + + + + + Tagline: + + + + + + + + + + Remove + + + + + + + Location: + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + Select Image + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + QFrame::Plain + + + 1 + + + MastHead background Image + + + Qt::PlainText + + + false + + + Qt::AlignCenter + + + + - - - Select Image + + + Qt::Vertical - - - - - - Tagline: + + + 20 + 10 + - - - - - - - - - Location: - - - - - + + + + ZoomableLabel + QLabel +
gui/gxschannels/GxsChannelPostThumbnail.h
+
+
diff --git a/retroshare-gui/src/gui/TheWire/WireGroupItem.cpp b/retroshare-gui/src/gui/TheWire/WireGroupItem.cpp index c8abe3886..199800581 100644 --- a/retroshare-gui/src/gui/TheWire/WireGroupItem.cpp +++ b/retroshare-gui/src/gui/TheWire/WireGroupItem.cpp @@ -92,14 +92,14 @@ void WireGroupItem::setup() QImage circleImage = getCirclePhoto(orginalImage,orginalImage.size().width()); pixmap.convertFromImage(circleImage); - pixmap = pixmap.scaled(40,40); + pixmap = pixmap.scaled(40,40, Qt::KeepAspectRatio, Qt::SmoothTransformation); label_headshot->setPixmap(pixmap); } } else { // default. - QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/wire.png").scaled(32,32); + QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/wire.png").scaled(32,32, Qt::KeepAspectRatio, Qt::SmoothTransformation); label_headshot->setPixmap(pixmap); } diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index 05ce9bda6..bc2f5d960 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -35,6 +35,7 @@ #include "util/rsdir.h" #include "util/qtthreadsutils.h" #include "util/RichTextEdit.h" +#include "util/imageutil.h" #include @@ -607,11 +608,13 @@ bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){ if(imageBuffer == NULL) return false; - QImage tNail(imageBuffer, width, height, QImage::Format_RGB32); + QImage tNail(imageBuffer, width, height, QImage::Format_RGBA32); QByteArray ba; QBuffer buffer(&ba); + bool has_transparency = ImageUtil::hasAlphaContent(tNail.toImage()); + buffer.open(QIODevice::WriteOnly); - tNail.save(&buffer, "JPG"); + tNail.save(&buffer, has_transparency?"PNG":"JPG"); QPixmap img; img.loadFromData(ba, "PNG"); img = img.scaled(thumbnail_label->width(), thumbnail_label->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -797,15 +800,19 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str QByteArray ba; QBuffer buffer(&ba); - RsGxsImage image; + RsGxsImage image; + QPixmap pixmap; + pixmap = preview_W->getCroppedScaledPicture(); + QImage qimg = pixmap.toImage(); + bool has_transparency = ImageUtil::hasAlphaContent(qimg); if(!picture.isNull()) { // send chan image buffer.open(QIODevice::WriteOnly); - preview_W->getCroppedScaledPicture().save(&buffer, "JPG"); // writes image into ba in PNG format - image.copy((uint8_t *) ba.data(), ba.size()); + preview_W->getCroppedScaledPicture().save(&buffer, has_transparency?"PNG":"JPG"); // writes image into ba in PNG format + image.copy((uint8_t *) ba.data(), ba.size()); } std::string error_string; diff --git a/retroshare-gui/src/gui/icons/svg/wire-notify.svg b/retroshare-gui/src/gui/icons/svg/wire-notify.svg new file mode 100644 index 000000000..7d4d6ccce --- /dev/null +++ b/retroshare-gui/src/gui/icons/svg/wire-notify.svg @@ -0,0 +1,56 @@ + + + +image/svg+xml diff --git a/retroshare-gui/src/gui/icons/svg/wire.svg b/retroshare-gui/src/gui/icons/svg/wire.svg new file mode 100644 index 000000000..9a8029016 --- /dev/null +++ b/retroshare-gui/src/gui/icons/svg/wire.svg @@ -0,0 +1,56 @@ + + + +image/svg+xml diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss index ee320a012..7497440c5 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss @@ -2552,3 +2552,10 @@ OpModeStatus[opMode="Minimal"] { [WrongValue="true"] { background-color: #702020; } + +/**** The Wire ****/ + +QLabel#label_masthead{ + border: 2px solid #CCCCCC; + border-radius: 4px; +} diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss index 923477e11..061ca0518 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss @@ -2687,6 +2687,11 @@ PulseReply QLabel#label_groupName{ color: #5b7083; } +QLabel#label_masthead{ + border: 2px solid #CCCCCC; + border-radius: 4px; +} + /**** PhotoShare ****/ AlbumItem QFrame#albumFrame { border: 2px solid #CCCCCC; diff --git a/retroshare-gui/src/qss/retroclassic.qss b/retroshare-gui/src/qss/retroclassic.qss index 02da3c18f..df8802f3a 100644 --- a/retroshare-gui/src/qss/retroclassic.qss +++ b/retroshare-gui/src/qss/retroclassic.qss @@ -178,3 +178,9 @@ IdDialog QWidget#idTreeWidget { selection-background-color: #9FCBFF; show-decoration-selected: 1; } + +/* Wire */ +QLabel#label_masthead{ + border: 2px solid #CCCCCC; + border-radius: 4px; +}