Merge remote-tracking branch 'remotes/defnax/New-Posted-Card-View'

This commit is contained in:
hunbernd 2020-01-05 19:51:57 +01:00
commit 2e0063da05
7 changed files with 314 additions and 225 deletions

View File

@ -65,14 +65,43 @@ PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *pos
/* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
ui->removeButton->hide();
/* load settings */
processSettings(true);
}
PostedCreatePostDialog::~PostedCreatePostDialog()
{
Settings->saveWidgetInformation(this);
// save settings
processSettings(false);
delete ui;
}
void PostedCreatePostDialog::processSettings(bool load)
{
Settings->beginGroup(QString("PostedCreatePostDialog"));
if (load) {
// load settings
// state of ID Chooser combobox
int index = Settings->value("IDChooser", 0).toInt();
ui->idChooser->setCurrentIndex(index);
} else {
// save settings
// state of ID Chooser combobox
Settings->setValue("IDChooser", ui->idChooser->currentIndex());
}
Settings->endGroup();
}
void PostedCreatePostDialog::createPost()
{
if(ui->titleEdit->text().isEmpty()) {
@ -186,6 +215,8 @@ void PostedCreatePostDialog::addPicture()
files.append(imagefilename);
ui->hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
}
ui->removeButton->show();
}
void PostedCreatePostDialog::on_postButton_clicked()
@ -202,3 +233,12 @@ void PostedCreatePostDialog::on_linkButton_clicked()
{
ui->stackedWidget->setCurrentIndex(2);
}
void PostedCreatePostDialog::on_removeButton_clicked()
{
imagefilename = "";
imagebytes.clear();
QPixmap empty;
ui->imageLabel->setPixmap(empty);
ui->removeButton->hide();
}

View File

@ -55,9 +55,12 @@ private slots:
void on_postButton_clicked();
void on_imageButton_clicked();
void on_linkButton_clicked();
void on_removeButton_clicked();
void fileHashingFinished(QList<HashedFile> hashedFiles);
private:
void processSettings(bool load);
QString mLink;
QString mNotes;
TokenQueue* mTokenQueue;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>575</width>
<height>429</height>
<height>529</height>
</rect>
</property>
<property name="windowTitle">
@ -48,217 +48,7 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<widget class="StyledLabel" name="info_label">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>You are submitting a post. The key to a successful submission is interesting content and a descriptive title.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="buttonHSpacer">
<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>
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QPushButton" name="postButton">
<property name="text">
<string>Post</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/post.png</normaloff>:/images/post.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="imageButton">
<property name="text">
<string>Image</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/photo.png</normaloff>:/images/photo.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="linkButton">
<property name="text">
<string>Link</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/link.png</normaloff>:/images/link.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>298</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="signedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Post as</string>
</property>
</widget>
</item>
<item>
<widget class="GxsIdChooser" name="idChooser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
@ -269,7 +59,7 @@
<number>0</number>
</property>
<property name="topMargin">
<number>6</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
@ -299,7 +89,20 @@
<string>Preview</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="1">
<item row="0" column="0" rowspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QLabel" name="imageLabel">
<property name="minimumSize">
<size>
@ -321,7 +124,7 @@
</property>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="2" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -334,8 +137,8 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<item row="1" column="2">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -347,6 +150,26 @@
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QToolButton" name="removeButton">
<property name="toolTip">
<string>Remove image</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/trashcan.png</normaloff>:/images/trashcan.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -427,7 +250,34 @@
</widget>
</widget>
</item>
<item row="5" column="1">
<item row="5" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="signedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Post as</string>
</property>
</widget>
</item>
<item>
<widget class="GxsIdChooser" name="idChooser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="submitButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -443,22 +293,212 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QLineEdit" name="titleEdit">
<item row="6" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="placeholderText">
<string>Title</string>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QPushButton" name="postButton">
<property name="text">
<string>Post</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/post.png</normaloff>:/images/post.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="imageButton">
<property name="text">
<string>Image</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/photo.png</normaloff>:/images/photo.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="linkButton">
<property name="text">
<string>Link</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/link.png</normaloff>:/images/link.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>298</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" colspan="3">
<widget class="StyledLabel" name="info_label">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>You are submitting a post. The key to a successful submission is interesting content and a descriptive title.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="buttonHSpacer">
<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>
<item row="2" column="0" colspan="3">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>6</number>
</property>
<item>
<widget class="QLineEdit" name="titleEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Title</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@ -21,6 +21,7 @@
#include <QDateTime>
#include <QMenu>
#include <QStyle>
#include <QTextDocument>
#include "rshare.h"
#include "PostedItem.h"
@ -342,7 +343,10 @@ void PostedItem::fill()
// FIX THIS UP LATER.
ui->notes->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
if(ui->notes->text().isEmpty())
QTextDocument doc;
doc.setHtml(ui->notes->text());
if(doc.toPlainText().trimmed().isEmpty())
ui->notesButton->hide();
// differences between Feed or Top of Comment.
if (mFeedHolder)

View File

@ -21,11 +21,13 @@
<file>images/share.png</file>
<file>images/notes.png</file>
<file>images/link.png</file>
<file>images/linkext.png</file>
<file>images/post.png</file>
<file>images/photo.png</file>
<file>images/classic.png</file>
<file>images/card.png</file>
<file>images/down-hover.png</file>
<file>images/up-hover.png</file>
<file>images/trashcan.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB