mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
added preview widget when creating pochannel posts
This commit is contained in:
parent
f1092b4a29
commit
fd85965e7d
@ -72,7 +72,8 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
|
|||||||
|
|
||||||
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
||||||
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
||||||
|
connect(subjectEdit,SIGNAL(textChanged(const QString&)),this,SLOT(updatePreviewText(const QString&)));
|
||||||
|
|
||||||
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
|
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
|
||||||
connect(thumbNailCb, SIGNAL(toggled(bool)), this, SLOT(allowAutoMediaThumbNail(bool)));
|
connect(thumbNailCb, SIGNAL(toggled(bool)), this, SLOT(allowAutoMediaThumbNail(bool)));
|
||||||
connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
|
connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
|
||||||
@ -605,6 +606,11 @@ void CreateGxsChannelMsg::saveChannelInfo(const RsGroupMetaData &meta)
|
|||||||
subjectEdit->setFocus();
|
subjectEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateGxsChannelMsg::updatePreviewText(const QString& s)
|
||||||
|
{
|
||||||
|
preview_W->setText(s);
|
||||||
|
}
|
||||||
|
|
||||||
void CreateGxsChannelMsg::sendMsg()
|
void CreateGxsChannelMsg::sendMsg()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CREATE_GXS_MSG
|
#ifdef DEBUG_CREATE_GXS_MSG
|
||||||
@ -717,7 +723,7 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str
|
|||||||
|
|
||||||
void CreateGxsChannelMsg::addThumbnail()
|
void CreateGxsChannelMsg::addThumbnail()
|
||||||
{
|
{
|
||||||
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load thumbnail picture"), 156, 107);
|
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load thumbnail picture"), 107,156); // these absolute sizes are terrible
|
||||||
|
|
||||||
if (img.isNull())
|
if (img.isNull())
|
||||||
return;
|
return;
|
||||||
@ -725,7 +731,7 @@ void CreateGxsChannelMsg::addThumbnail()
|
|||||||
picture = img;
|
picture = img;
|
||||||
|
|
||||||
// to show the selected
|
// to show the selected
|
||||||
thumbnail_label->setPixmap(picture);
|
preview_W->setPixmap(picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGxsChannelMsg::loadOriginalChannelPostInfo()
|
void CreateGxsChannelMsg::loadOriginalChannelPostInfo()
|
||||||
@ -769,7 +775,7 @@ void CreateGxsChannelMsg::loadOriginalChannelPostInfo()
|
|||||||
if(post.mThumbnail.mData != NULL)
|
if(post.mThumbnail.mData != NULL)
|
||||||
{
|
{
|
||||||
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData,post.mThumbnail.mSize,picture,GxsIdDetails::ORIGINAL);
|
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData,post.mThumbnail.mSize,picture,GxsIdDetails::ORIGINAL);
|
||||||
thumbnail_label->setPixmap(picture);
|
preview_W->setPixmap(picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ private slots:
|
|||||||
void addExtraFile();
|
void addExtraFile();
|
||||||
void checkAttachmentReady();
|
void checkAttachmentReady();
|
||||||
void deleteAttachment();
|
void deleteAttachment();
|
||||||
|
void updatePreviewText(const QString &);
|
||||||
|
|
||||||
void cancelMsg();
|
void cancelMsg();
|
||||||
void sendMsg();
|
void sendMsg();
|
||||||
|
@ -52,52 +52,39 @@
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="0" column="0">
|
<item row="2" column="0" colspan="3">
|
||||||
<widget class="QPushButton" name="channelpostButton">
|
<layout class="QHBoxLayout" name="buttonHLayout">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Channel Post</string>
|
<widget class="QCheckBox" name="generateCheckBox">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="icon">
|
<string>Generate mass data</string>
|
||||||
<iconset resource="../icons.qrc">
|
</property>
|
||||||
<normaloff>:/icons/png/comment.png</normaloff>:/icons/png/comment.png</iconset>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="iconSize">
|
<item>
|
||||||
<size>
|
<widget class="QSpinBox" name="generateSpinBox">
|
||||||
<width>24</width>
|
<property name="minimum">
|
||||||
<height>24</height>
|
<number>1</number>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
<property name="maximum">
|
||||||
</widget>
|
<number>999</number>
|
||||||
</item>
|
</property>
|
||||||
<item row="0" column="1">
|
</widget>
|
||||||
<widget class="QPushButton" name="attachmentsButton">
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Attachments</string>
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
</property>
|
<property name="styleSheet">
|
||||||
<property name="icon">
|
<string notr="true"/>
|
||||||
<iconset resource="../icons.qrc">
|
</property>
|
||||||
<normaloff>:/icons/png/attachements.png</normaloff>:/icons/png/attachements.png</iconset>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Horizontal</enum>
|
||||||
<property name="iconSize">
|
</property>
|
||||||
<size>
|
<property name="standardButtons">
|
||||||
<width>24</width>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
<height>24</height>
|
</property>
|
||||||
</size>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
</layout>
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>486</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="0" colspan="3">
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
@ -114,128 +101,8 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="stackedWidgetPage1">
|
<widget class="QWidget" name="stackedWidgetPage1">
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="leftMargin">
|
<item>
|
||||||
<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 row="1" column="0">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0" rowspan="2">
|
|
||||||
<widget class="QLabel" name="thumbnail_label">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>156</width>
|
|
||||||
<height>107</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" colspan="4">
|
|
||||||
<widget class="QLabel" name="channelAttachLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;">Attachments:</span></p>
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/images/feedback_arrow.png" /><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"> Use Drag and Drop / Add Files button, to Hash new files.</span></p>
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/images/feedback_arrow.png" /><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"> Copy/Paste RetroShare links from your shares</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QPushButton" name="addThumbnailButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add Channel Thumbnail</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons.qrc">
|
|
||||||
<normaloff>:/icons/png/add-image.png</normaloff>:/icons/png/add-image.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QPushButton" name="addfilepushButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add File to Attach</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons.qrc">
|
|
||||||
<normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3" colspan="2">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QGroupBox" name="messageGBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Message</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLineEdit" name="subjectEdit">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Title</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="RichTextEdit" name="RichTextEditWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="channelNameHLayout">
|
<layout class="QHBoxLayout" name="channelNameHLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="channelNameLabel">
|
<widget class="QLabel" name="channelNameLabel">
|
||||||
@ -268,6 +135,119 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="ChannelPostThumbnailView" name="preview_W" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="channelAttachLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;">Attachments:</span></p>
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/images/feedback_arrow.png" /><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"> Use Drag and Drop / Add Files button, to Hash new files.</span></p>
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/images/feedback_arrow.png" /><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"> Copy/Paste RetroShare links from your shares</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addThumbnailButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add Channel Thumbnail</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/png/add-image.png</normaloff>:/icons/png/add-image.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addfilepushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add File to Attach</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="messageGBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Message</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLineEdit" name="subjectEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Title</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="RichTextEdit" name="RichTextEditWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="stackedWidgetPage2">
|
<widget class="QWidget" name="stackedWidgetPage2">
|
||||||
@ -329,7 +309,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>632</width>
|
<width>635</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -403,39 +383,65 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="0" column="2">
|
||||||
<layout class="QHBoxLayout" name="buttonHLayout">
|
<spacer name="horizontalSpacer">
|
||||||
<item>
|
<property name="orientation">
|
||||||
<widget class="QCheckBox" name="generateCheckBox">
|
<enum>Qt::Horizontal</enum>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Generate mass data</string>
|
<property name="sizeHint" stdset="0">
|
||||||
</property>
|
<size>
|
||||||
</widget>
|
<width>486</width>
|
||||||
</item>
|
<height>20</height>
|
||||||
<item>
|
</size>
|
||||||
<widget class="QSpinBox" name="generateSpinBox">
|
</property>
|
||||||
<property name="minimum">
|
</spacer>
|
||||||
<number>1</number>
|
</item>
|
||||||
</property>
|
<item row="0" column="1">
|
||||||
<property name="maximum">
|
<widget class="QPushButton" name="attachmentsButton">
|
||||||
<number>999</number>
|
<property name="text">
|
||||||
</property>
|
<string>Attachments</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="icon">
|
||||||
<item>
|
<iconset resource="../icons.qrc">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<normaloff>:/icons/png/attachements.png</normaloff>:/icons/png/attachements.png</iconset>
|
||||||
<property name="styleSheet">
|
</property>
|
||||||
<string notr="true"/>
|
<property name="iconSize">
|
||||||
</property>
|
<size>
|
||||||
<property name="orientation">
|
<width>24</width>
|
||||||
<enum>Qt::Horizontal</enum>
|
<height>24</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="standardButtons">
|
</property>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="0" column="0">
|
||||||
</item>
|
<widget class="QPushButton" name="channelpostButton">
|
||||||
</layout>
|
<property name="text">
|
||||||
|
<string>Channel Post</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/png/comment.png</normaloff>:/icons/png/comment.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<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>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -455,10 +461,16 @@ p, li { white-space: pre-wrap; }
|
|||||||
<header>util/RichTextEdit.h</header>
|
<header>util/RichTextEdit.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ChannelPostThumbnailView</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
123
retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h
Normal file
123
retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h *
|
||||||
|
* *
|
||||||
|
* Copyright 2020 by Retroshare Team <retroshare.project@gmail.com> *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU Affero General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLayout>
|
||||||
|
|
||||||
|
#include "retroshare/rsgxschannels.h"
|
||||||
|
#include "retroshare/rsidentity.h"
|
||||||
|
|
||||||
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
|
#include "gui/common/FilesDefs.h"
|
||||||
|
|
||||||
|
// Class to paint the thumbnails with title
|
||||||
|
|
||||||
|
class ChannelPostThumbnailView: public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// This variable determines the zoom factor on the text below thumbnails. 2.0 is mostly correct for all screen.
|
||||||
|
static constexpr float THUMBNAIL_OVERSAMPLE_FACTOR = 2.0;
|
||||||
|
|
||||||
|
// Size of thumbnails as a function of the height of the font. An aspect ratio of 3/4 is good.
|
||||||
|
|
||||||
|
static const int THUMBNAIL_W = 4;
|
||||||
|
static const int THUMBNAIL_H = 6;
|
||||||
|
|
||||||
|
static constexpr char *CHAN_DEFAULT_IMAGE = ":images/thumb-default-video.png";
|
||||||
|
|
||||||
|
virtual ~ChannelPostThumbnailView()
|
||||||
|
{
|
||||||
|
delete lb;
|
||||||
|
delete lt;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChannelPostThumbnailView(QWidget *parent=NULL): QWidget(parent)
|
||||||
|
{
|
||||||
|
init(FilesDefs::getPixmapFromQtResourcePath(CHAN_DEFAULT_IMAGE), QString("New post"),false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChannelPostThumbnailView(const RsGxsChannelPost& post,QWidget *parent=NULL)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
// now fill the data
|
||||||
|
|
||||||
|
QPixmap thumbnail;
|
||||||
|
|
||||||
|
if(post.mThumbnail.mSize > 0)
|
||||||
|
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData, post.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL);
|
||||||
|
else if(post.mMeta.mPublishTs > 0) // this is for testing that the post is not an empty post (happens at the end of the last row)
|
||||||
|
thumbnail = FilesDefs::getPixmapFromQtResourcePath(CHAN_DEFAULT_IMAGE);
|
||||||
|
|
||||||
|
init(thumbnail, QString::fromUtf8(post.mMeta.mMsgName.c_str()), IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(const QPixmap& thumbnail,const QString& msg,bool is_msg_new)
|
||||||
|
{
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
|
lb = new QLabel(this);
|
||||||
|
lb->setScaledContents(true);
|
||||||
|
layout->addWidget(lb);
|
||||||
|
|
||||||
|
lt = new QLabel(this);
|
||||||
|
layout->addWidget(lt);
|
||||||
|
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
|
||||||
|
|
||||||
|
QFontMetricsF fm(font());
|
||||||
|
int W = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_W * fm.height() ;
|
||||||
|
int H = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_H * fm.height() ;
|
||||||
|
|
||||||
|
lb->setFixedSize(W,H);
|
||||||
|
lb->setPixmap(thumbnail);
|
||||||
|
|
||||||
|
lt->setText(msg);
|
||||||
|
|
||||||
|
QFont font = lt->font();
|
||||||
|
|
||||||
|
if(is_msg_new)
|
||||||
|
{
|
||||||
|
font.setBold(true);
|
||||||
|
lt->setFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
lt->setMaximumWidth(W);
|
||||||
|
lt->setWordWrap(true);
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPixmap(const QPixmap& p) { lb->setPixmap(p); }
|
||||||
|
void setText(const QString& s) { lt->setText(s); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLabel *lb;
|
||||||
|
QLabel *lt;
|
||||||
|
};
|
||||||
|
|
@ -44,11 +44,10 @@
|
|||||||
#include "GxsChannelPostsModel.h"
|
#include "GxsChannelPostsModel.h"
|
||||||
#include "GxsChannelPostFilesModel.h"
|
#include "GxsChannelPostFilesModel.h"
|
||||||
#include "GxsChannelFilesStatusWidget.h"
|
#include "GxsChannelFilesStatusWidget.h"
|
||||||
|
#include "GxsChannelPostThumbnail.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define CHAN_DEFAULT_IMAGE ":images/thumb-default-video.png"
|
|
||||||
|
|
||||||
#define ROLE_PUBLISH FEED_TREEWIDGET_SORTROLE
|
#define ROLE_PUBLISH FEED_TREEWIDGET_SORTROLE
|
||||||
|
|
||||||
/****
|
/****
|
||||||
@ -64,11 +63,6 @@ static const int CHANNEL_TABS_POSTS = 1;
|
|||||||
#define VIEW_MODE_FEEDS 1
|
#define VIEW_MODE_FEEDS 1
|
||||||
#define VIEW_MODE_FILES 2
|
#define VIEW_MODE_FILES 2
|
||||||
|
|
||||||
// Size of thumbnails as a function of the height of the font. An aspect ratio of 3/4 is good.
|
|
||||||
|
|
||||||
#define THUMBNAIL_W 4
|
|
||||||
#define THUMBNAIL_H 6
|
|
||||||
|
|
||||||
// Determine the Shape and size of cells as a factor of the font height. An aspect ratio of 3/4 is what's needed
|
// Determine the Shape and size of cells as a factor of the font height. An aspect ratio of 3/4 is what's needed
|
||||||
// for the image, so it's important that the height is a bit larger so as to leave some room for the text.
|
// for the image, so it's important that the height is a bit larger so as to leave some room for the text.
|
||||||
//
|
//
|
||||||
@ -76,67 +70,10 @@ static const int CHANNEL_TABS_POSTS = 1;
|
|||||||
#define COLUMN_SIZE_FONT_FACTOR_W 6
|
#define COLUMN_SIZE_FONT_FACTOR_W 6
|
||||||
#define COLUMN_SIZE_FONT_FACTOR_H 10
|
#define COLUMN_SIZE_FONT_FACTOR_H 10
|
||||||
|
|
||||||
// This variable determines the zoom factor on the text below thumbnails. 2.0 is mostly correct for all screen.
|
|
||||||
#define THUMBNAIL_OVERSAMPLE_FACTOR 2.0
|
|
||||||
#define STAR_OVERLAY_IMAGE ":icons/star_overlay_128.png"
|
#define STAR_OVERLAY_IMAGE ":icons/star_overlay_128.png"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(RsGxsFile)
|
Q_DECLARE_METATYPE(RsGxsFile)
|
||||||
|
|
||||||
// Class to paint the thumbnails with title
|
|
||||||
|
|
||||||
class ThumbnailView: public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ThumbnailView(const RsGxsChannelPost& post,QWidget *parent=NULL)
|
|
||||||
: QWidget(parent)
|
|
||||||
{
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
||||||
|
|
||||||
QLabel *lb = new QLabel(this);
|
|
||||||
lb->setScaledContents(true);
|
|
||||||
layout->addWidget(lb);
|
|
||||||
|
|
||||||
QLabel *lt = new QLabel(this);
|
|
||||||
layout->addWidget(lt);
|
|
||||||
|
|
||||||
setLayout(layout);
|
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding);
|
|
||||||
|
|
||||||
// now fill the data
|
|
||||||
|
|
||||||
QPixmap thumbnail;
|
|
||||||
|
|
||||||
if(post.mThumbnail.mSize > 0)
|
|
||||||
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData, post.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL);
|
|
||||||
else if(post.mMeta.mPublishTs > 0) // this is for testing that the post is not an empty post (happens at the end of the last row)
|
|
||||||
thumbnail = FilesDefs::getPixmapFromQtResourcePath(CHAN_DEFAULT_IMAGE);
|
|
||||||
|
|
||||||
QFontMetricsF fm(font());
|
|
||||||
int W = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_W * fm.height() ;
|
|
||||||
int H = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_H * fm.height() ;
|
|
||||||
|
|
||||||
lb->setFixedSize(W,H);
|
|
||||||
lb->setPixmap(thumbnail);
|
|
||||||
|
|
||||||
lt->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
|
|
||||||
|
|
||||||
QFont font = lt->font();
|
|
||||||
|
|
||||||
if(IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))
|
|
||||||
{
|
|
||||||
font.setBold(true);
|
|
||||||
lt->setFont(font);
|
|
||||||
}
|
|
||||||
|
|
||||||
lt->setMaximumWidth(W);
|
|
||||||
lt->setWordWrap(true);
|
|
||||||
|
|
||||||
adjustSize();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Delegate used to paint into the table of thumbnails
|
// Delegate used to paint into the table of thumbnails
|
||||||
|
|
||||||
void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
|
void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||||
@ -151,7 +88,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
|||||||
painter->fillRect( option.rect, option.backgroundBrush);
|
painter->fillRect( option.rect, option.backgroundBrush);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
ThumbnailView w(post);
|
ChannelPostThumbnailView w(post);
|
||||||
|
|
||||||
QPixmap pixmap(w.size());
|
QPixmap pixmap(w.size());
|
||||||
|
|
||||||
@ -463,7 +400,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
|
|||||||
if (post.mThumbnail.mData != NULL)
|
if (post.mThumbnail.mData != NULL)
|
||||||
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData, post.mThumbnail.mSize, postImage,GxsIdDetails::ORIGINAL);
|
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData, post.mThumbnail.mSize, postImage,GxsIdDetails::ORIGINAL);
|
||||||
else
|
else
|
||||||
postImage = FilesDefs::getPixmapFromQtResourcePath(CHAN_DEFAULT_IMAGE);
|
postImage = FilesDefs::getPixmapFromQtResourcePath(ChannelPostThumbnailView::CHAN_DEFAULT_IMAGE);
|
||||||
|
|
||||||
int W = QFontMetricsF(font()).height() * 8;
|
int W = QFontMetricsF(font()).height() * 8;
|
||||||
|
|
||||||
@ -689,7 +626,7 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
|||||||
if (group.mImage.mData != NULL) {
|
if (group.mImage.mData != NULL) {
|
||||||
GxsIdDetails::loadPixmapFromData(group.mImage.mData, group.mImage.mSize, chanImage,GxsIdDetails::ORIGINAL);
|
GxsIdDetails::loadPixmapFromData(group.mImage.mData, group.mImage.mSize, chanImage,GxsIdDetails::ORIGINAL);
|
||||||
} else {
|
} else {
|
||||||
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
|
chanImage = QPixmap(ChannelPostThumbnailView::CHAN_DEFAULT_IMAGE);
|
||||||
}
|
}
|
||||||
if(group.mMeta.mGroupName.empty())
|
if(group.mMeta.mGroupName.empty())
|
||||||
ui->channelName_LB->setText(tr("[No name]"));
|
ui->channelName_LB->setText(tr("[No name]"));
|
||||||
|
@ -1337,6 +1337,7 @@ gxschannels {
|
|||||||
gui/gxschannels/GxsChannelPostsModel.h \
|
gui/gxschannels/GxsChannelPostsModel.h \
|
||||||
gui/gxschannels/GxsChannelPostFilesModel.h \
|
gui/gxschannels/GxsChannelPostFilesModel.h \
|
||||||
gui/gxschannels/GxsChannelFilesWidget.h \
|
gui/gxschannels/GxsChannelFilesWidget.h \
|
||||||
|
gui/gxschannels/GxsChannelPostThumbnail.h \
|
||||||
gui/gxschannels/GxsChannelFilesStatusWidget.h \
|
gui/gxschannels/GxsChannelFilesStatusWidget.h \
|
||||||
gui/feeds/GxsChannelGroupItem.h \
|
gui/feeds/GxsChannelGroupItem.h \
|
||||||
gui/feeds/GxsChannelPostItem.h \
|
gui/feeds/GxsChannelPostItem.h \
|
||||||
|
Loading…
Reference in New Issue
Block a user