update the licence & added the changes for Channel message composer

This commit is contained in:
defnax 2019-12-23 21:26:54 +01:00
parent 096de94b00
commit 824fc5049b
14 changed files with 349 additions and 296 deletions

View File

@ -25,7 +25,7 @@
#include "util/misc.h" #include "util/misc.h"
#include "util/TokenQueue.h" #include "util/TokenQueue.h"
#include "util/MRichTextEdit.h" #include "util/RichTextEdit.h"
#include "gui/feeds/SubFileItem.h" #include "gui/feeds/SubFileItem.h"
#include "util/rsdir.h" #include "util/rsdir.h"
@ -51,7 +51,7 @@ PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *pos
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute ( Qt::WA_DeleteOnClose, true );
ui->MRichTextEditWidget->setPlaceHolderTextPosted(); ui->RichTextEditWidget->setPlaceHolderTextPosted();
/* 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());
@ -86,7 +86,7 @@ void PostedCreatePostDialog::createPost()
post.mLink = std::string(ui->linkEdit->text().toUtf8()); post.mLink = std::string(ui->linkEdit->text().toUtf8());
QString text; QString text;
text = ui->MRichTextEditWidget->toHtml(); text = ui->RichTextEditWidget->toHtml();
post.mNotes = std::string(text.toUtf8()); post.mNotes = std::string(text.toUtf8());
post.mMeta.mAuthorId = authorId; post.mMeta.mAuthorId = authorId;

View File

@ -23,7 +23,7 @@
#include <QDialog> #include <QDialog>
#include "retroshare/rsposted.h" #include "retroshare/rsposted.h"
#include "util/MRichTextEdit.h" #include "util/RichTextEdit.h"
class TokenQueue; class TokenQueue;

View File

@ -278,7 +278,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item row="1" column="0"> <item row="1" column="0">
<widget class="MRichTextEdit" name="MRichTextEditWidget" native="true"/> <widget class="RichTextEdit" name="RichTextEditWidget" native="true"/>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLineEdit" name="titleEdit"> <widget class="QLineEdit" name="titleEdit">
@ -467,9 +467,9 @@
<header>gui/gxs/GxsIdChooser.h</header> <header>gui/gxs/GxsIdChooser.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>MRichTextEdit</class> <class>RichTextEdit</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>util/MRichTextEdit.h</header> <header>util/RichTextEdit.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>

View File

@ -33,6 +33,7 @@
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/rsdir.h" #include "util/rsdir.h"
#include "util/RichTextEdit.h"
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
@ -55,7 +56,7 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
Settings->loadWidgetInformation(this); Settings->loadWidgetInformation(this);
mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this); mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this);
headerFrame->setHeaderImage(QPixmap(":/images/channels.png")); headerFrame->setHeaderImage(QPixmap(":/icons/png/channel.png"));
if(!existing_post.isNull()) if(!existing_post.isNull())
headerFrame->setHeaderText(tr("Edit Channel Post")); headerFrame->setHeaderText(tr("Edit Channel Post"));
@ -64,17 +65,19 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute ( Qt::WA_DeleteOnClose, true );
buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Post"));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg()));
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(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(tabWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool))); connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool)));
connect(addPictureButton, SIGNAL(clicked()), this, SLOT(addPicture()));
connect(msgEdit, SIGNAL(textChanged()), this, SLOT(checkLength()));
generateSpinBox->setEnabled(false); generateSpinBox->setEnabled(false);
thumbNailCb->setVisible(false); thumbNailCb->setVisible(false);
@ -84,7 +87,6 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
thumbNailCb->setVisible(true); thumbNailCb->setVisible(true);
thumbNailCb->setEnabled(true); thumbNailCb->setEnabled(true);
#endif #endif
//buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
setAcceptDrops(true); setAcceptDrops(true);
@ -96,26 +98,6 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
#endif #endif
} }
static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000;
void CreateGxsChannelMsg::checkLength()
{
QString text;
RsHtml::optimizeHtml(msgEdit, text);
std::wstring msg = text.toStdWString();
int charRemains = MAX_ALLOWED_GXS_MESSAGE_SIZE - msg.length();
if(charRemains >= 0) {
text = tr("It remains %1 characters after HTML conversion.").arg(charRemains);
infoLabel->setStyleSheet("QLabel#infoLabel { }");
}else{
text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains));
infoLabel->setStyleSheet("QLabel#infoLabel {color: red; font: bold; }");
}
buttonBox->button(QDialogButtonBox::Ok)->setToolTip(text);
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(charRemains>=0);
infoLabel->setText(text);
}
CreateGxsChannelMsg::~CreateGxsChannelMsg() CreateGxsChannelMsg::~CreateGxsChannelMsg()
{ {
Settings->saveWidgetInformation(this); Settings->saveWidgetInformation(this);
@ -442,7 +424,7 @@ void CreateGxsChannelMsg::addSubject(const QString& text)
void CreateGxsChannelMsg::addHtmlText(const QString& text) void CreateGxsChannelMsg::addHtmlText(const QString& text)
{ {
msgEdit->setHtml(text) ; RichTextEditWidget->setText(text) ;
} }
void CreateGxsChannelMsg::addAttachment(const std::string &path) void CreateGxsChannelMsg::addAttachment(const std::string &path)
@ -650,8 +632,9 @@ void CreateGxsChannelMsg::sendMsg()
/* construct message bits */ /* construct message bits */
std::string subject = std::string(misc::removeNewLine(subjectEdit->text()).toUtf8()); std::string subject = std::string(misc::removeNewLine(subjectEdit->text()).toUtf8());
QString text; QString text;
RsHtml::optimizeHtml(msgEdit, text); text = RichTextEditWidget->toHtml();
std::string msg = std::string(text.toUtf8()); std::string msg = std::string(text.toUtf8());
std::list<RsGxsFile> files; std::list<RsGxsFile> files;
@ -763,18 +746,6 @@ void CreateGxsChannelMsg::addThumbnail()
thumbnail_label->setPixmap(picture); thumbnail_label->setPixmap(picture);
} }
void CreateGxsChannelMsg::addPicture()
{
QString file;
if (misc::getOpenFileName(window(), RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg *.jpeg)", file)) {
QString encodedImage;
if (RsHtml::makeEmbeddedImage(file, encodedImage, 640*480, MAX_ALLOWED_GXS_MESSAGE_SIZE - 200)) {
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
msgEdit->textCursor().insertFragment(fragment);
}
}
}
void CreateGxsChannelMsg::loadChannelPostInfo(const uint32_t &token) void CreateGxsChannelMsg::loadChannelPostInfo(const uint32_t &token)
{ {
#ifdef DEBUG_CREATE_GXS_MSG #ifdef DEBUG_CREATE_GXS_MSG
@ -801,13 +772,16 @@ void CreateGxsChannelMsg::loadChannelPostInfo(const uint32_t &token)
} }
subjectEdit->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str())) ; subjectEdit->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str())) ;
msgEdit->setText(QString::fromUtf8(post.mMsg.c_str())) ; RichTextEditWidget->setText(QString::fromUtf8(post.mMsg.c_str()));
for(std::list<RsGxsFile>::const_iterator it(post.mFiles.begin());it!=post.mFiles.end();++it) for(std::list<RsGxsFile>::const_iterator it(post.mFiles.begin());it!=post.mFiles.end();++it)
addAttachment(it->mHash,it->mName,it->mSize,true,RsPeerId(),true); addAttachment(it->mHash,it->mName,it->mSize,true,RsPeerId(),true);
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); thumbnail_label->setPixmap(picture);
}
} }
void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token) void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token)
@ -856,3 +830,13 @@ void CreateGxsChannelMsg::loadRequest(const TokenQueue *queue, const TokenReques
} }
} }
} }
void CreateGxsChannelMsg::on_channelpostButton_clicked()
{
stackedWidget->setCurrentIndex(0);
}
void CreateGxsChannelMsg::on_attachmentsButton_clicked()
{
stackedWidget->setCurrentIndex(1);
}

View File

@ -69,10 +69,10 @@ private slots:
void contextMenu(QPoint) ; void contextMenu(QPoint) ;
void addThumbnail(); void addThumbnail();
void addPicture();
void checkLength();
void allowAutoMediaThumbNail(bool); void allowAutoMediaThumbNail(bool);
void on_channelpostButton_clicked();
void on_attachmentsButton_clicked();
private: private:
void loadChannelInfo(const uint32_t &token); void loadChannelInfo(const uint32_t &token);
void loadChannelPostInfo(const uint32_t &token); void loadChannelPostInfo(const uint32_t &token);

View File

@ -37,7 +37,11 @@
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"/> <widget class="HeaderFrame" name="headerFrame">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QFrame" name="mainFrame"> <widget class="QFrame" name="mainFrame">
@ -47,9 +51,56 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="mainFrameGLayout"> <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QPushButton" name="channelpostButton">
<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="0" column="1">
<widget class="QPushButton" name="attachmentsButton">
<property name="text">
<string>Attachments</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/attachements.png</normaloff>:/icons/png/attachements.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</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 row="1" column="0" colspan="3">
<widget class="QStackedWidget" name="stackedWidget">
<property name="mouseTracking"> <property name="mouseTracking">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -62,15 +113,138 @@
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="channelPostTab"> <widget class="QWidget" name="stackedWidgetPage1">
<attribute name="title"> <layout class="QGridLayout" name="gridLayout_3">
<string>Channel Post</string> <property name="leftMargin">
</attribute> <number>0</number>
<layout class="QGridLayout" name="channelPostTabGLayout"> </property>
<item row="0" column="0" colspan="3"> <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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;&quot;&gt;Attachments:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Use Drag and Drop / Add Files button, to Hash new files.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Copy/Paste RetroShare links from your shares&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -94,138 +268,22 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<layout class="QGridLayout" name="channelAttachGLayout">
<item row="1" column="0">
<widget class="QPushButton" name="addfilepushButton">
<property name="text">
<string>Add File to Attach</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
</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="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="addPictureButton">
<property name="text">
<string>Add Picture</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="channelAttachLabel">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;&quot;&gt;Attachments:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Use Drag and Drop / Add Files button, to Hash new files.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Copy/Paste RetroShare links from your shares&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<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="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>98</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="messageGBox">
<property name="title">
<string>Message</string>
</property>
<layout class="QVBoxLayout" name="messageGBoxVLayout">
<item>
<layout class="QHBoxLayout" name="subjectHLayout">
<item>
<widget class="QLabel" name="subjectLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="subjectEdit"/>
</item>
</layout>
</item>
<item>
<widget class="MimeTextEdit" name="msgEdit"/>
</item>
<item>
<widget class="QLabel" name="infoLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> <widget class="QWidget" name="stackedWidgetPage2">
</layout>
</widget>
<widget class="QWidget" name="attachmentsTab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/attachment.png</normaloff>:/images/attachment.png</iconset>
</attribute>
<attribute name="title">
<string>Attachments</string>
</attribute>
<layout class="QGridLayout" name="attachmentsTabGLayout"> <layout class="QGridLayout" name="attachmentsTabGLayout">
<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 row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="attachmentsPixLabel"> <widget class="QLabel" name="attachmentsPixLabel">
<property name="text"> <property name="text">
@ -286,8 +344,8 @@ p, li { white-space: pre-wrap; }
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset> <normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -320,7 +378,7 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>812</width> <width>81</width>
<height>24</height> <height>24</height>
</rect> </rect>
</property> </property>
@ -371,7 +429,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="buttonHLayout"> <layout class="QHBoxLayout" name="buttonHLayout">
<item> <item>
<widget class="QCheckBox" name="generateCheckBox"> <widget class="QCheckBox" name="generateCheckBox">
@ -392,6 +450,9 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -408,19 +469,21 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget> <customwidget>
<class>HeaderFrame</class> <class>HeaderFrame</class>
<extends>QFrame</extends> <extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header> <header>gui/common/HeaderFrame.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>RichTextEdit</class>
<extends>QWidget</extends>
<header>util/RichTextEdit.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/> <include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>

View File

@ -306,5 +306,8 @@
<file>icons/textedit/redo.png</file> <file>icons/textedit/redo.png</file>
<file>icons/textedit/undo.png</file> <file>icons/textedit/undo.png</file>
<file>icons/textedit/settings.png</file> <file>icons/textedit/settings.png</file>
<file>icons/png/add-file.png</file>
<file>icons/png/add-image.png</file>
<file>icons/png/attachements.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -626,7 +626,7 @@ HEADERS += rshare.h \
gui/statistics/BWGraph.h \ gui/statistics/BWGraph.h \
util/RsSyntaxHighlighter.h \ util/RsSyntaxHighlighter.h \
util/imageutil.h \ util/imageutil.h \
util/MRichTextEdit.h \ util/RichTextEdit.h \
gui/NetworkDialog/pgpid_item_model.h \ gui/NetworkDialog/pgpid_item_model.h \
gui/NetworkDialog/pgpid_item_proxy.h \ gui/NetworkDialog/pgpid_item_proxy.h \
gui/common/RsCollection.h \ gui/common/RsCollection.h \
@ -749,7 +749,7 @@ FORMS += gui/StartDialog.ui \
gui/statistics/BwCtrlWindow.ui \ gui/statistics/BwCtrlWindow.ui \
gui/statistics/RttStatistics.ui \ gui/statistics/RttStatistics.ui \
gui/GetStartedDialog.ui \ gui/GetStartedDialog.ui \
util/MRichTextEdit.ui util/RichTextEdit.ui
# gui/ForumsDialog.ui \ # gui/ForumsDialog.ui \
@ -827,7 +827,7 @@ SOURCES += main.cpp \
util/HandleRichText.cpp \ util/HandleRichText.cpp \
util/ObjectPainter.cpp \ util/ObjectPainter.cpp \
util/RsFile.cpp \ util/RsFile.cpp \
util/MRichTextEdit.cpp \ util/RichTextEdit.cpp \
gui/profile/ProfileWidget.cpp \ gui/profile/ProfileWidget.cpp \
gui/profile/StatusMessage.cpp \ gui/profile/StatusMessage.cpp \
gui/profile/ProfileManager.cpp \ gui/profile/ProfileManager.cpp \

View File

@ -1,29 +1,24 @@
/* /*******************************************************************************
** Copyright (C) 2019 by defnax <retroshare.project@gmail.com> * util/RichTextEdit.cpp *
** * *
** Copyright (C) 2013 Jiří Procházka (Hobrasoft) * Copyright (c) 2019 Retroshare Team <retroshare.project@gmail.com> *
** Contact: http://www.hobrasoft.cz/ * *
** * This program is free software: you can redistribute it and/or modify *
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). * it under the terms of the GNU Affero General Public License as *
** Contact: http://www.qt-project.org/legal * published by the Free Software Foundation, either version 3 of the *
** * License, or (at your option) any later version. *
** $QT_BEGIN_LICENSE:LGPL$ * *
** GNU Lesser General Public License Usage * This program is distributed in the hope that it will be useful, *
** This file is under the terms of the GNU Lesser General Public License * but WITHOUT ANY WARRANTY; without even the implied warranty of *
** version 2.1 as published by the Free Software Foundation and appearing * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
** in the file LICENSE.LGPL included in the packaging of this file. * GNU Affero General Public License for more details. *
** Please review the following information to ensure the * *
** GNU Lesser General Public License version 2.1 requirements * You should have received a copy of the GNU Affero General Public License *
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. * along with this program. If not, see <https://www.gnu.org/licenses/>. *
** * *
** In addition, as a special exception, Digia gives you certain additional *******************************************************************************/
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
*/
#include "MRichTextEdit.h" #include "RichTextEdit.h"
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QMimeData> #include <QMimeData>
@ -47,7 +42,7 @@
static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000; static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000;
MRichTextEdit::MRichTextEdit(QWidget *parent) : QWidget(parent) { RichTextEdit::RichTextEdit(QWidget *parent) : QWidget(parent) {
setupUi(this); setupUi(this);
m_lastBlockList = 0; m_lastBlockList = 0;
f_textedit->setTabStopWidth(40); f_textedit->setTabStopWidth(40);
@ -203,7 +198,7 @@ MRichTextEdit::MRichTextEdit(QWidget *parent) : QWidget(parent) {
} }
void MRichTextEdit::textSource() { void RichTextEdit::textSource() {
QDialog *dialog = new QDialog(this); QDialog *dialog = new QDialog(this);
QPlainTextEdit *pte = new QPlainTextEdit(dialog); QPlainTextEdit *pte = new QPlainTextEdit(dialog);
pte->setPlainText( f_textedit->toHtml() ); pte->setPlainText( f_textedit->toHtml() );
@ -220,7 +215,7 @@ void MRichTextEdit::textSource() {
} }
void MRichTextEdit::textRemoveFormat() { void RichTextEdit::textRemoveFormat() {
QTextCharFormat fmt; QTextCharFormat fmt;
fmt.setFontWeight(QFont::Normal); fmt.setFontWeight(QFont::Normal);
fmt.setFontUnderline (false); fmt.setFontUnderline (false);
@ -246,7 +241,7 @@ void MRichTextEdit::textRemoveFormat() {
} }
void MRichTextEdit::textRemoveAllFormat() { void RichTextEdit::textRemoveAllFormat() {
f_bold ->setChecked(false); f_bold ->setChecked(false);
f_underline ->setChecked(false); f_underline ->setChecked(false);
f_italic ->setChecked(false); f_italic ->setChecked(false);
@ -257,37 +252,37 @@ void MRichTextEdit::textRemoveAllFormat() {
} }
void MRichTextEdit::textBold() { void RichTextEdit::textBold() {
QTextCharFormat fmt; QTextCharFormat fmt;
fmt.setFontWeight(f_bold->isChecked() ? QFont::Bold : QFont::Normal); fmt.setFontWeight(f_bold->isChecked() ? QFont::Bold : QFont::Normal);
mergeFormatOnWordOrSelection(fmt); mergeFormatOnWordOrSelection(fmt);
} }
void MRichTextEdit::focusInEvent(QFocusEvent *) { void RichTextEdit::focusInEvent(QFocusEvent *) {
f_textedit->setFocus(Qt::TabFocusReason); f_textedit->setFocus(Qt::TabFocusReason);
} }
void MRichTextEdit::textUnderline() { void RichTextEdit::textUnderline() {
QTextCharFormat fmt; QTextCharFormat fmt;
fmt.setFontUnderline(f_underline->isChecked()); fmt.setFontUnderline(f_underline->isChecked());
mergeFormatOnWordOrSelection(fmt); mergeFormatOnWordOrSelection(fmt);
} }
void MRichTextEdit::textItalic() { void RichTextEdit::textItalic() {
QTextCharFormat fmt; QTextCharFormat fmt;
fmt.setFontItalic(f_italic->isChecked()); fmt.setFontItalic(f_italic->isChecked());
mergeFormatOnWordOrSelection(fmt); mergeFormatOnWordOrSelection(fmt);
} }
void MRichTextEdit::textStrikeout() { void RichTextEdit::textStrikeout() {
QTextCharFormat fmt; QTextCharFormat fmt;
fmt.setFontStrikeOut(f_strikeout->isChecked()); fmt.setFontStrikeOut(f_strikeout->isChecked());
mergeFormatOnWordOrSelection(fmt); mergeFormatOnWordOrSelection(fmt);
} }
void MRichTextEdit::textSize(const QString &p) { void RichTextEdit::textSize(const QString &p) {
qreal pointSize = p.toFloat(); qreal pointSize = p.toFloat();
if (p.toFloat() > 0) { if (p.toFloat() > 0) {
QTextCharFormat fmt; QTextCharFormat fmt;
@ -296,7 +291,7 @@ void MRichTextEdit::textSize(const QString &p) {
} }
} }
void MRichTextEdit::textLink(bool checked) { void RichTextEdit::textLink(bool checked) {
bool unlink = false; bool unlink = false;
QTextCharFormat fmt; QTextCharFormat fmt;
if (checked) { if (checked) {
@ -325,7 +320,7 @@ void MRichTextEdit::textLink(bool checked) {
mergeFormatOnWordOrSelection(fmt); mergeFormatOnWordOrSelection(fmt);
} }
void MRichTextEdit::textStyle(int index) { void RichTextEdit::textStyle(int index) {
QTextCursor cursor = f_textedit->textCursor(); QTextCursor cursor = f_textedit->textCursor();
cursor.beginEditBlock(); cursor.beginEditBlock();
@ -371,7 +366,7 @@ void MRichTextEdit::textStyle(int index) {
cursor.endEditBlock(); cursor.endEditBlock();
} }
void MRichTextEdit::textFgColor() { void RichTextEdit::textFgColor() {
QColor col = QColorDialog::getColor(f_textedit->textColor(), this); QColor col = QColorDialog::getColor(f_textedit->textColor(), this);
QTextCursor cursor = f_textedit->textCursor(); QTextCursor cursor = f_textedit->textCursor();
if (!cursor.hasSelection()) { if (!cursor.hasSelection()) {
@ -388,7 +383,7 @@ void MRichTextEdit::textFgColor() {
fgColorChanged(col); fgColorChanged(col);
} }
void MRichTextEdit::textBgColor() { void RichTextEdit::textBgColor() {
QColor col = QColorDialog::getColor(f_textedit->textBackgroundColor(), this); QColor col = QColorDialog::getColor(f_textedit->textBackgroundColor(), this);
QTextCursor cursor = f_textedit->textCursor(); QTextCursor cursor = f_textedit->textCursor();
if (!cursor.hasSelection()) { if (!cursor.hasSelection()) {
@ -405,21 +400,21 @@ void MRichTextEdit::textBgColor() {
bgColorChanged(col); bgColorChanged(col);
} }
void MRichTextEdit::listBullet(bool checked) { void RichTextEdit::listBullet(bool checked) {
if (checked) { if (checked) {
f_list_ordered->setChecked(false); f_list_ordered->setChecked(false);
} }
list(checked, QTextListFormat::ListDisc); list(checked, QTextListFormat::ListDisc);
} }
void MRichTextEdit::listOrdered(bool checked) { void RichTextEdit::listOrdered(bool checked) {
if (checked) { if (checked) {
f_list_bullet->setChecked(false); f_list_bullet->setChecked(false);
} }
list(checked, QTextListFormat::ListDecimal); list(checked, QTextListFormat::ListDecimal);
} }
void MRichTextEdit::list(bool checked, QTextListFormat::Style style) { void RichTextEdit::list(bool checked, QTextListFormat::Style style) {
QTextCursor cursor = f_textedit->textCursor(); QTextCursor cursor = f_textedit->textCursor();
cursor.beginEditBlock(); cursor.beginEditBlock();
if (!checked) { if (!checked) {
@ -438,7 +433,7 @@ void MRichTextEdit::list(bool checked, QTextListFormat::Style style) {
cursor.endEditBlock(); cursor.endEditBlock();
} }
void MRichTextEdit::mergeFormatOnWordOrSelection(const QTextCharFormat &format) { void RichTextEdit::mergeFormatOnWordOrSelection(const QTextCharFormat &format) {
QTextCursor cursor = f_textedit->textCursor(); QTextCursor cursor = f_textedit->textCursor();
if (!cursor.hasSelection()) { if (!cursor.hasSelection()) {
cursor.select(QTextCursor::WordUnderCursor); cursor.select(QTextCursor::WordUnderCursor);
@ -448,7 +443,7 @@ void MRichTextEdit::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
f_textedit->setFocus(Qt::TabFocusReason); f_textedit->setFocus(Qt::TabFocusReason);
} }
void MRichTextEdit::slotCursorPositionChanged() { void RichTextEdit::slotCursorPositionChanged() {
QTextList *l = f_textedit->textCursor().currentList(); QTextList *l = f_textedit->textCursor().currentList();
if (m_lastBlockList && (l == m_lastBlockList || (l != 0 && m_lastBlockList != 0 if (m_lastBlockList && (l == m_lastBlockList || (l != 0 && m_lastBlockList != 0
&& l->format().style() == m_lastBlockList->format().style()))) { && l->format().style() == m_lastBlockList->format().style()))) {
@ -473,7 +468,7 @@ void MRichTextEdit::slotCursorPositionChanged() {
} }
} }
void MRichTextEdit::fontChanged(const QFont &f) { void RichTextEdit::fontChanged(const QFont &f) {
f_fontsize->setCurrentIndex(f_fontsize->findText(QString::number(f.pointSize()))); f_fontsize->setCurrentIndex(f_fontsize->findText(QString::number(f.pointSize())));
f_bold->setChecked(f.bold()); f_bold->setChecked(f.bold());
f_italic->setChecked(f.italic()); f_italic->setChecked(f.italic());
@ -512,7 +507,7 @@ void MRichTextEdit::fontChanged(const QFont &f) {
} }
} }
void MRichTextEdit::fgColorChanged(const QColor &c) { void RichTextEdit::fgColorChanged(const QColor &c) {
QPixmap pix(16, 16); QPixmap pix(16, 16);
if (c.isValid()) { if (c.isValid()) {
pix.fill(c); pix.fill(c);
@ -522,7 +517,7 @@ void MRichTextEdit::fgColorChanged(const QColor &c) {
f_fgcolor->setIcon(pix); f_fgcolor->setIcon(pix);
} }
void MRichTextEdit::bgColorChanged(const QColor &c) { void RichTextEdit::bgColorChanged(const QColor &c) {
QPixmap pix(16, 16); QPixmap pix(16, 16);
if (c.isValid()) { if (c.isValid()) {
pix.fill(c); pix.fill(c);
@ -532,21 +527,21 @@ void MRichTextEdit::bgColorChanged(const QColor &c) {
f_bgcolor->setIcon(pix); f_bgcolor->setIcon(pix);
} }
void MRichTextEdit::slotCurrentCharFormatChanged(const QTextCharFormat &format) { void RichTextEdit::slotCurrentCharFormatChanged(const QTextCharFormat &format) {
fontChanged(format.font()); fontChanged(format.font());
bgColorChanged((format.background().isOpaque()) ? format.background().color() : QColor()); bgColorChanged((format.background().isOpaque()) ? format.background().color() : QColor());
fgColorChanged((format.foreground().isOpaque()) ? format.foreground().color() : QColor()); fgColorChanged((format.foreground().isOpaque()) ? format.foreground().color() : QColor());
f_link->setChecked(format.isAnchor()); f_link->setChecked(format.isAnchor());
} }
void MRichTextEdit::slotClipboardDataChanged() { void RichTextEdit::slotClipboardDataChanged() {
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
if (const QMimeData *md = QApplication::clipboard()->mimeData()) if (const QMimeData *md = QApplication::clipboard()->mimeData())
f_paste->setEnabled(md->hasText()); f_paste->setEnabled(md->hasText());
#endif #endif
} }
QString MRichTextEdit::toHtml() const { QString RichTextEdit::toHtml() const {
QString s = f_textedit->toHtml(); QString s = f_textedit->toHtml();
// convert emails to links // convert emails to links
s = s.replace(QRegExp("(<[^a][^>]+>(?:<span[^>]+>)?|\\s)([a-zA-Z\\d]+@[a-zA-Z\\d]+\\.[a-zA-Z]+)"), "\\1<a href=\"mailto:\\2\">\\2</a>"); s = s.replace(QRegExp("(<[^a][^>]+>(?:<span[^>]+>)?|\\s)([a-zA-Z\\d]+@[a-zA-Z\\d]+\\.[a-zA-Z]+)"), "\\1<a href=\"mailto:\\2\">\\2</a>");
@ -556,15 +551,15 @@ QString MRichTextEdit::toHtml() const {
return s; return s;
} }
void MRichTextEdit::increaseIndentation() { void RichTextEdit::increaseIndentation() {
indent(+1); indent(+1);
} }
void MRichTextEdit::decreaseIndentation() { void RichTextEdit::decreaseIndentation() {
indent(-1); indent(-1);
} }
void MRichTextEdit::indent(int delta) { void RichTextEdit::indent(int delta) {
QTextCursor cursor = f_textedit->textCursor(); QTextCursor cursor = f_textedit->textCursor();
cursor.beginEditBlock(); cursor.beginEditBlock();
QTextBlockFormat bfmt = cursor.blockFormat(); QTextBlockFormat bfmt = cursor.blockFormat();
@ -576,7 +571,7 @@ void MRichTextEdit::indent(int delta) {
cursor.endEditBlock(); cursor.endEditBlock();
} }
void MRichTextEdit::setText(const QString& text) { void RichTextEdit::setText(const QString& text) {
if (text.isEmpty()) { if (text.isEmpty()) {
setPlainText(text); setPlainText(text);
return; return;
@ -588,7 +583,7 @@ void MRichTextEdit::setText(const QString& text) {
} }
} }
void MRichTextEdit::insertImage() { void RichTextEdit::insertImage() {
QString file; QString file;
if (misc::getOpenFileName(window(), RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg *.jpeg)", file)) { if (misc::getOpenFileName(window(), RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg *.jpeg)", file)) {
QString encodedImage; QString encodedImage;
@ -599,7 +594,7 @@ void MRichTextEdit::insertImage() {
} }
} }
void MRichTextEdit::checkLength(){ void RichTextEdit::checkLength(){
QString text; QString text;
RsHtml::optimizeHtml(f_textedit, text); RsHtml::optimizeHtml(f_textedit, text);
std::wstring msg = text.toStdWString(); std::wstring msg = text.toStdWString();
@ -615,6 +610,7 @@ void MRichTextEdit::checkLength(){
f_info->setText(text); f_info->setText(text);
} }
void MRichTextEdit::setPlaceHolderTextPosted() {
void RichTextEdit::setPlaceHolderTextPosted() {
f_textedit->setPlaceholderText(tr("Text (optional)")); f_textedit->setPlaceholderText(tr("Text (optional)"));
} }

View File

@ -1,41 +1,36 @@
/* /*******************************************************************************
** Copyright (C) 2019 by defnax <retroshare.project@gmail.com> * util/RichTextEdit.h *
** * *
** Copyright (C) 2013 Jiří Procházka (Hobrasoft) * Copyright (c) 2019 Retroshare Team <retroshare.project@gmail.com> *
** Contact: http://www.hobrasoft.cz/ * *
** * This program is free software: you can redistribute it and/or modify *
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). * it under the terms of the GNU Affero General Public License as *
** Contact: http://www.qt-project.org/legal * published by the Free Software Foundation, either version 3 of the *
** * License, or (at your option) any later version. *
** $QT_BEGIN_LICENSE:LGPL$ * *
** GNU Lesser General Public License Usage * This program is distributed in the hope that it will be useful, *
** This file is under the terms of the GNU Lesser General Public License * but WITHOUT ANY WARRANTY; without even the implied warranty of *
** version 2.1 as published by the Free Software Foundation and appearing * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
** in the file LICENSE.LGPL included in the packaging of this file. * GNU Affero General Public License for more details. *
** Please review the following information to ensure the * *
** GNU Lesser General Public License version 2.1 requirements * You should have received a copy of the GNU Affero General Public License *
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. * along with this program. If not, see <https://www.gnu.org/licenses/>. *
** * *
** In addition, as a special exception, Digia gives you certain additional *******************************************************************************/
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
*/
#ifndef _MRICHTEXTEDIT_H_ #ifndef _RICHTEXTEDIT_H_
#define _MRICHTEXTEDIT_H_ #define _RICHTEXTEDIT_H_
#include <QPointer> #include <QPointer>
#include "ui_MRichTextEdit.h" #include "ui_RichTextEdit.h"
/** /**
* @Brief A simple rich-text editor * @Brief A simple rich-text editor
*/ */
class MRichTextEdit : public QWidget, protected Ui::MRichTextEdit { class RichTextEdit : public QWidget, protected Ui::RichTextEdit {
Q_OBJECT Q_OBJECT
public: public:
MRichTextEdit(QWidget *parent = 0); RichTextEdit(QWidget *parent = 0);
QString toPlainText() const { return f_textedit->toPlainText(); } QString toPlainText() const { return f_textedit->toPlainText(); }
QString toHtml() const; QString toHtml() const;

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MRichTextEdit</class> <class>RichTextEdit</class>
<widget class="QWidget" name="MRichTextEdit"> <widget class="QWidget" name="RichTextEdit">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>699</width> <width>703</width>
<height>312</height> <height>312</height>
</rect> </rect>
</property> </property>
@ -62,6 +62,12 @@
</item> </item>
<item> <item>
<widget class="QComboBox" name="f_fontsize"> <widget class="QComboBox" name="f_fontsize">
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::ClickFocus</enum> <enum>Qt::ClickFocus</enum>
</property> </property>
@ -557,6 +563,12 @@
</item> </item>
<item> <item>
<widget class="MimeTextEdit" name="f_textedit"> <widget class="MimeTextEdit" name="f_textedit">
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="autoFormatting"> <property name="autoFormatting">
<set>QTextEdit::AutoNone</set> <set>QTextEdit::AutoNone</set>
</property> </property>