Added crop picture feature for wire background picture

* Added crop picture feature for wire background picture
* Fix smooth transformation for pixmaps
* Added stylesheet for label_masthead
* Edit profile on profile page feature
* New svg icons for wire
This commit is contained in:
defnax 2023-07-24 23:19:17 +02:00
parent 5c52509e27
commit 74049d1b22
12 changed files with 399 additions and 132 deletions

View File

@ -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 ();
}

View File

@ -35,10 +35,13 @@ public:
private slots:
void actionFollow();
void editProfile();
protected:
void setup();
private:
void setGroupSet();
protected:
RsWireGroupSPtr mGroup;

View File

@ -136,38 +136,6 @@
</size>
</property>
<layout class="QGridLayout" name="widget_header_GL">
<item row="0" column="1" rowspan="3">
<spacer name="widget_header_HSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>518</width>
<height>58</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_groupName">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#555753;&quot;&gt;@sidler_here&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_authorName">
<property name="sizePolicy">
@ -203,6 +171,45 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_groupName">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#555753;&quot;&gt;@sidler_here&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="3">
<spacer name="widget_header_HSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>518</width>
<height>58</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" rowspan="3">
<widget class="QPushButton" name="editButton">
<property name="text">
<string>Edit profile</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -227,41 +234,6 @@
</size>
</property>
<layout class="QGridLayout" name="widget_publish_GL">
<item row="1" column="2">
<widget class="QLabel" name="label_date">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#2e3436;&quot;&gt;3:58 AM · Apr 13, 2020 ·&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="widget_publish_LHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_location">
<property name="sizePolicy">
@ -281,19 +253,6 @@
</property>
</widget>
</item>
<item row="1" column="3">
<spacer name="widget_publish_RHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>2000</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_tagline">
<property name="sizePolicy">
@ -313,6 +272,54 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_date">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#2e3436;&quot;&gt;3:58 AM · Apr 13, 2020 ·&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="3">
<spacer name="widget_publish_RHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>2000</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<spacer name="widget_publish_LHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
@ -530,6 +537,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>

View File

@ -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();
}

View File

@ -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:

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>516</width>
<height>199</height>
<height>133</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,50 +19,127 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Masthead</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QLabel" name="label_masthead">
<property name="text">
<string>MastHead background Image</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_Location"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="captionLabel">
<property name="text">
<string>Tagline:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_Tagline"/>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_masthead">
<property name="text">
<string>Select Image</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" rowspan="3">
<widget class="ZoomableLabel" name="label_masthead">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string>MastHead background Image</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_masthead">
<property name="text">
<string>Select Image</string>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="captionLabel">
<property name="text">
<string>Tagline:</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_Tagline"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_Location"/>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -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);
}

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id="svg4155"
version="1.1"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xml:space="preserve"
width="80"
height="80"
viewBox="0 0 80 80"
sodipodi:docname="wire-notify.svg"
inkscape:export-xdpi="144"
inkscape:export-ydpi="144"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
id="metadata4161"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs4159" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="705"
id="namedview4157"
showgrid="false"
inkscape:zoom="5.11875"
inkscape:cx="35.457875"
inkscape:cy="40.927961"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g4163"
inkscape:pagecheckerboard="0" /><g
id="g4163"
inkscape:groupmode="layer"
inkscape:label="ink_ext_XXXXXX"
transform="matrix(1.25,0,0,-1.25,0,80)"><path
inkscape:connector-curvature="0"
id="path4167"
style="fill:#ff990d;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="M 64,32 C 64,14.327 49.673,0 32,0 14.327,0 0,14.327 0,32 0,49.673 14.327,64 32,64 49.673,64 64,49.673 64,32" /><path
style="fill:#ffffff;stroke:none;stroke-width:0.422421"
d="M 11.504608,50.061515 C 0.95186111,41.31166 9.91073,20.329766 22.487548,19.224797 v -0.42242 C 17.439916,16.700874 12.842245,14.816835 7.2804,14.578167 v -0.422421 c 13.723057,-5.705639 29.505712,-3.76208 38.535802,9.293259 3.987608,5.764904 3.334546,11.659532 5.649411,17.741673 1.140537,2.997245 4.589603,4.725495 6.08286,7.603575 -3.166889,0 -6.579204,-0.36248 -9.715677,0.08867 -3.52489,0.506989 -6.021355,2.241745 -9.715678,1.085368 -3.080123,-0.964134 -5.266278,-3.193206 -6.292,-6.243084 -0.395597,-1.176357 -0.200734,-3.00565 -1.144042,-3.90904 -1.225443,-1.173527 -4.184247,-0.416634 -5.659003,-0.09678 -5.829027,1.264221 -10.644877,5.188552 -13.517465,10.342128 z"
id="path1245" /></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id="svg4155"
version="1.1"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xml:space="preserve"
width="80"
height="80"
viewBox="0 0 80 80"
sodipodi:docname="wire.svg"
inkscape:export-xdpi="144"
inkscape:export-ydpi="144"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
id="metadata4161"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs4159" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="705"
id="namedview4157"
showgrid="false"
inkscape:zoom="5.11875"
inkscape:cx="35.457875"
inkscape:cy="40.927961"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g4163"
inkscape:pagecheckerboard="0" /><g
id="g4163"
inkscape:groupmode="layer"
inkscape:label="ink_ext_XXXXXX"
transform="matrix(1.25,0,0,-1.25,0,80)"><path
inkscape:connector-curvature="0"
id="path4167"
style="fill:#039bd5;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="M 64,32 C 64,14.327 49.673,0 32,0 14.327,0 0,14.327 0,32 0,49.673 14.327,64 32,64 49.673,64 64,49.673 64,32" /><path
style="fill:#ffffff;stroke:none;stroke-width:0.422421"
d="M 11.504608,50.061515 C 0.95186111,41.31166 9.91073,20.329766 22.487548,19.224797 v -0.42242 C 17.439916,16.700874 12.842245,14.816835 7.2804,14.578167 v -0.422421 c 13.723057,-5.705639 29.505712,-3.76208 38.535802,9.293259 3.987608,5.764904 3.334546,11.659532 5.649411,17.741673 1.140537,2.997245 4.589603,4.725495 6.08286,7.603575 -3.166889,0 -6.579204,-0.36248 -9.715677,0.08867 -3.52489,0.506989 -6.021355,2.241745 -9.715678,1.085368 -3.080123,-0.964134 -5.266278,-3.193206 -6.292,-6.243084 -0.395597,-1.176357 -0.200734,-3.00565 -1.144042,-3.90904 -1.225443,-1.173527 -4.184247,-0.416634 -5.659003,-0.09678 -5.829027,1.264221 -10.644877,5.188552 -13.517465,10.342128 z"
id="path1245" /></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -2552,3 +2552,10 @@ OpModeStatus[opMode="Minimal"] {
[WrongValue="true"] {
background-color: #702020;
}
/**** The Wire ****/
QLabel#label_masthead{
border: 2px solid #CCCCCC;
border-radius: 4px;
}

View File

@ -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;

View File

@ -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;
}