Merge pull request #2187 from defnax/wire-ui-fixes-4

[Wire] Improved the Pulse Composer & the layout
This commit is contained in:
defnax 2020-12-28 14:33:20 +01:00 committed by GitHub
commit 918513671a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 341 additions and 97 deletions

View File

@ -22,6 +22,7 @@
#include <QtGui>
#include "PulseReply.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/common/FilesDefs.h"
#include "PulseAddDialog.h"
@ -39,6 +40,10 @@ PulseAddDialog::PulseAddDialog(QWidget *parent)
connect(ui.pushButton_ClearDisplayAs, SIGNAL( clicked( void ) ), this, SLOT( clearDisplayAs( void ) ) );
connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelPulse( void ) ) );
connect(ui.textEdit_Pulse, SIGNAL( textChanged( void ) ), this, SLOT( pulseTextChanged( void ) ) );
connect(ui.pushButton_picture, SIGNAL(clicked()), this, SLOT( toggle()));
ui.pushButton_picture->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/photo.png")));
ui.frame_picture->hide();
setAcceptDrops(true);
}
@ -47,6 +52,26 @@ void PulseAddDialog::setGroup(RsWireGroup &group)
{
ui.label_groupName->setText(QString::fromStdString(group.mMeta.mGroupName));
ui.label_idName->setText(QString::fromStdString(group.mMeta.mAuthorId.toStdString()));
if (mGroup.mHeadshot.mData )
{
QPixmap pixmap;
if (GxsIdDetails::loadPixmapFromData(
mGroup.mHeadshot.mData,
mGroup.mHeadshot.mSize,
pixmap,GxsIdDetails::ORIGINAL))
{
pixmap = pixmap.scaled(50,50);
ui.headshot->setPixmap(pixmap);
}
}
else
{
// default.
QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/wire.png").scaled(50,50);
ui.headshot->setPixmap(pixmap);
}
mGroup = group;
}
@ -62,6 +87,8 @@ void PulseAddDialog::setGroup(const RsGxsGroupId &grpId)
void PulseAddDialog::cleanup()
{
resize(700, 400 );
if (mIsReply)
{
std::cerr << "PulseAddDialog::cleanup() cleaning up old replyto";
@ -90,6 +117,7 @@ void PulseAddDialog::cleanup()
delete layout;
mIsReply = false;
}
ui.frame_reply->setVisible(false);
ui.comboBox_sentiment->setCurrentIndex(0);
ui.lineEdit_URL->setText("");
@ -97,28 +125,34 @@ void PulseAddDialog::cleanup()
ui.textEdit_Pulse->setPlainText("");
// disable URL until functionality finished.
ui.frame_URL->setEnabled(false);
ui.frame_URL->hide();
ui.pushButton_Post->setEnabled(false);
ui.pushButton_Post->setText("Post");
ui.pushButton_Post->setText(tr("Post"));
ui.frame_input->setVisible(true);
ui.widget_sentiment->setVisible(true);
ui.pushButton_picture->show();
// cleanup images.
mImage1.clear();
ui.label_image1->clear();
ui.label_image1->setText("Drag and Drop Image");
ui.label_image1->setText(tr("Drag and Drop Image"));
mImage2.clear();
ui.label_image2->clear();
ui.label_image2->setText("Drag and Drop Image");
ui.label_image2->setText(tr("Drag and Drop Image"));
mImage3.clear();
ui.label_image3->clear();
ui.label_image3->setText("Drag and Drop Image");
ui.label_image3->setText(tr("Drag and Drop Image"));
mImage4.clear();
ui.label_image4->clear();
ui.label_image4->setText("Drag and Drop Image");
ui.label_image4->setText(tr("Drag and Drop Image"));
// Hide Drag & Drop Frame
ui.frame_picture->hide();
ui.pushButton_picture->setChecked(false);
}
void PulseAddDialog::pulseTextChanged()
@ -136,6 +170,7 @@ void PulseAddDialog::setReplyTo(RsWirePulse &pulse, RsWirePulseSPtr pPulse, std:
mReplyToPulse = pulse;
mReplyType = replyType;
ui.frame_reply->setVisible(true);
ui.pushButton_picture->show();
{
PulseReply *reply = new PulseReply(NULL, pPulse);
@ -151,7 +186,8 @@ void PulseAddDialog::setReplyTo(RsWirePulse &pulse, RsWirePulseSPtr pPulse, std:
if (mReplyType & WIRE_PULSE_TYPE_REPLY)
{
ui.pushButton_Post->setText("Reply to Pulse");
ui.pushButton_Post->setText(tr("Reply to Pulse"));
ui.textEdit_Pulse->setPlaceholderText(tr("Pulse your reply"));
}
else
{
@ -160,10 +196,12 @@ void PulseAddDialog::setReplyTo(RsWirePulse &pulse, RsWirePulseSPtr pPulse, std:
ui.frame_input->setVisible(false);
ui.widget_sentiment->setVisible(false);
if (mReplyType & WIRE_PULSE_TYPE_REPUBLISH) {
ui.pushButton_Post->setText("Republish Pulse");
ui.pushButton_Post->setText(tr("Republish Pulse"));
ui.pushButton_picture->hide();
}
else if (mReplyType & WIRE_PULSE_TYPE_LIKE) {
ui.pushButton_Post->setText("Like Pulse");
ui.pushButton_Post->setText(tr("Like Pulse"));
ui.pushButton_picture->hide();
}
}
@ -464,3 +502,16 @@ void PulseAddDialog::addImage(const QString &path)
}
}
void PulseAddDialog::toggle()
{
if (ui.pushButton_picture->isChecked())
{
ui.frame_picture->show();
ui.pushButton_picture->setToolTip(tr("Hide Pictures"));
}
else
{
ui.frame_picture->hide();
ui.pushButton_picture->setToolTip(tr("Add Pictures"));
}
}

View File

@ -52,6 +52,7 @@ private slots:
void cancelPulse();
void clearDialog();
void pulseTextChanged();
void toggle();
private:
// OLD VERSIONs, private now.

View File

@ -7,13 +7,16 @@
<x>0</x>
<y>0</y>
<width>720</width>
<height>493</height>
<height>449</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
@ -94,12 +97,68 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget_replyto" native="true"/>
</item>
<item>
<widget class="QWidget" name="widget_sentiment" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>20</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="headshot">
<property name="minimumSize">
<size>
<width>50</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>Head Shot</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>238</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
@ -143,19 +202,6 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>238</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
@ -171,11 +217,24 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QTextEdit" name="textEdit_Pulse"/>
<widget class="QTextEdit" name="textEdit_Pulse">
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="placeholderText">
<string>Whats happening?</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<widget class="QFrame" name="frame_picture">
<property name="minimumSize">
<size>
<width>0</width>
@ -301,6 +360,25 @@
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_picture">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>570</width>
<height>376</height>
<height>377</height>
</rect>
</property>
<property name="windowTitle">
@ -20,6 +20,12 @@
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="Line" name="line">
<property name="minimumSize">
@ -32,7 +38,7 @@
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>5</number>
<number>4</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@ -49,6 +49,9 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QWidget" name="widget_prefix" native="true">
<property name="sizePolicy">
@ -98,6 +101,9 @@
<property name="text">
<string>retweeted</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
@ -158,6 +164,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -209,6 +218,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -260,6 +272,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -311,6 +326,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -429,6 +447,9 @@
<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>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
@ -492,63 +513,61 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Line" name="line_replyLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>1</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Line" name="line_replyLine">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>5</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
@ -572,6 +591,9 @@
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#555753;&quot;&gt;Replying to @sidler&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>

View File

@ -64,6 +64,18 @@
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
@ -130,6 +142,9 @@
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -150,6 +165,9 @@
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -287,11 +305,8 @@
<iconset resource="TheWire_images.qrc">
<normaloff>:/images/external-link.svg</normaloff>:/images/external-link.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
@ -534,6 +549,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -585,6 +603,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -636,6 +657,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -687,6 +711,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>

View File

@ -172,16 +172,26 @@ bool WireGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode
const RsWireGroup &group = *pgroup;
// description = QString::fromUtf8(group.mDescription.c_str());
#if 0
if (group.mThumbnail.mData) {
if (group.mHeadshot.mData) {
QPixmap pixmap;
if (GxsIdDetails::loadPixmapFromData(group.mThumbnail.mData, group.mThumbnail.mSize, pixmap,GxsIdDetails::ORIGINAL)) {
if (GxsIdDetails::loadPixmapFromData(group.mHeadshot.mData, group.mHeadshot.mSize, pixmap,GxsIdDetails::ORIGINAL)) {
setLogo(pixmap);
}
} else {
setLogo(FilesDefs::getPixmapFromQtResourcePath(":/images/album_create_64.png"));
setLogo(FilesDefs::getPixmapFromQtResourcePath(":/images/album_create_64.png"));
}
// from Extra Widget.
mExtra->setTagline(group.mTagline);
mExtra->setLocation(group.mLocation);
if (group.mMasthead.mData){
QPixmap pixmap;
if (GxsIdDetails::loadPixmapFromData(group.mMasthead.mData, group.mMasthead.mSize, pixmap,GxsIdDetails::ORIGINAL))
{
mExtra->setMasthead(pixmap);
}
}
#endif
return true;
}

View File

@ -24,6 +24,7 @@
#include <QBuffer>
#include "WireGroupItem.h"
#include "WireGroupDialog.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/common/FilesDefs.h"
@ -39,6 +40,8 @@ WireGroupItem::WireGroupItem(WireGroupHolder *holder, const RsWireGroup &grp)
setAttribute ( Qt::WA_DeleteOnClose, true );
setup();
// disabled, still not yet functional Edit/Update
editButton->setEnabled(false);
}
RsGxsGroupId &WireGroupItem::groupId()
@ -84,6 +87,7 @@ void WireGroupItem::setup()
connect(toolButton_show, SIGNAL(clicked()), this, SLOT(show()));
connect(toolButton_subscribe, SIGNAL(clicked()), this, SLOT(subscribe()));
connect(editButton, SIGNAL(clicked()), this, SLOT(editGroupDetails()));
setGroupSet();
}
@ -93,16 +97,19 @@ void WireGroupItem::setGroupSet()
toolButton_type->setText("Own");
toolButton_subscribe->setText("N/A");
toolButton_subscribe->setEnabled(false);
editButton->show();
}
else if (mGroup.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
{
toolButton_type->setText("Following");
toolButton_subscribe->setText("Unfollow");
editButton->hide();
}
else
{
toolButton_type->setText("Other");
toolButton_subscribe->setText("Follow");
editButton->hide();
}
}
@ -174,3 +181,16 @@ const QPixmap *WireGroupItem::getPixmap()
return NULL;
}
void WireGroupItem::editGroupDetails()
{
RsGxsGroupId groupId = mGroup.mMeta.mGroupId;
if (groupId.isNull())
{
std::cerr << "WireGroupItem::editGroupDetails() No Group selected";
std::cerr << std::endl;
return;
}
WireGroupDialog wireEdit(GxsGroupDialog::MODE_EDIT, groupId, this);
wireEdit.exec ();
}

View File

@ -55,6 +55,7 @@ public:
private slots:
void show();
void subscribe();
void editGroupDetails();
protected:
void mousePressEvent(QMouseEvent *event);

View File

@ -136,6 +136,20 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editButton">
<property name="toolTip">
<string>Edit Profile</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/mail/compose.png</normaloff>:/icons/mail/compose.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -143,7 +143,7 @@ PulseViewGroup QToolButton#toolButton_follow{
color: white;
background: #0099cc;
border-radius: 4px;
max-height: 27px;
max-height: 20px;
min-width: 4em;
padding: 2px;
padding-left: 6px;
@ -220,7 +220,7 @@ PulseAddDialog QPushButton#pushButton_Post:disabled {
color: white;
background: #d40000;
border-radius: 4px;
max-height: 27px;
max-height: 20px;
min-width: 4em;
padding-left: 6px;
padding-right: 6px;
@ -1110,6 +1110,20 @@ PulseTopLevel QFrame#frame, PulseViewGroup QFrame#frame, PulseReply QFrame#frame
background: white;
}
ChatLobbyWidget QTreeWidget#lobbyTreeWidget{
font-size: 10pt;
PulseAddDialog QTextEdit#textEdit_Pulse {
border: 2px solid #7ecbfb;
border-radius: 6px;
background: white;
}
PulseAddDialog QFrame#frame_input, QFrame#frame_reply {
border: 0px;
}
PulseReply #line_replyLine , PulseMessage #line{
color: #7ecbfb;
}
WireDialog QLabel#label_viewMode {
font-size: 12pt;
}