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 */ /* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId()); ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
ui->removeButton->hide();
/* load settings */
processSettings(true);
} }
PostedCreatePostDialog::~PostedCreatePostDialog() PostedCreatePostDialog::~PostedCreatePostDialog()
{ {
Settings->saveWidgetInformation(this); Settings->saveWidgetInformation(this);
// save settings
processSettings(false);
delete ui; 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() void PostedCreatePostDialog::createPost()
{ {
if(ui->titleEdit->text().isEmpty()) { if(ui->titleEdit->text().isEmpty()) {
@ -186,6 +215,8 @@ void PostedCreatePostDialog::addPicture()
files.append(imagefilename); files.append(imagefilename);
ui->hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING); ui->hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
} }
ui->removeButton->show();
} }
void PostedCreatePostDialog::on_postButton_clicked() void PostedCreatePostDialog::on_postButton_clicked()
@ -202,3 +233,12 @@ void PostedCreatePostDialog::on_linkButton_clicked()
{ {
ui->stackedWidget->setCurrentIndex(2); 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_postButton_clicked();
void on_imageButton_clicked(); void on_imageButton_clicked();
void on_linkButton_clicked(); void on_linkButton_clicked();
void on_removeButton_clicked();
void fileHashingFinished(QList<HashedFile> hashedFiles); void fileHashingFinished(QList<HashedFile> hashedFiles);
private: private:
void processSettings(bool load);
QString mLink; QString mLink;
QString mNotes; QString mNotes;
TokenQueue* mTokenQueue; TokenQueue* mTokenQueue;

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>575</width> <width>575</width>
<height>429</height> <height>529</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -48,217 +48,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <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"> <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"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
@ -269,7 +59,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>6</number> <number>0</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>0</number>
@ -299,7 +89,20 @@
<string>Preview</string> <string>Preview</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4"> <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"> <widget class="QLabel" name="imageLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -321,7 +124,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2" colspan="2">
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -334,8 +137,8 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="0"> <item row="1" column="2">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_5">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -347,6 +150,26 @@
</property> </property>
</spacer> </spacer>
</item> </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> </layout>
</widget> </widget>
</item> </item>
@ -427,7 +250,34 @@
</widget> </widget>
</widget> </widget>
</item> </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"> <widget class="QPushButton" name="submitButton">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -443,22 +293,212 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="3"> <item row="6" column="2">
<widget class="QLineEdit" name="titleEdit"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="alignment"> <property name="orientation">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="placeholderText"> <property name="standardButtons">
<string>Title</string> <set>QDialogButtonBox::Cancel</set>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB