Changed window CreateForumMsg from QMainWindow to QDialog.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5659 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-10-10 13:36:54 +00:00
parent b67f9f88fe
commit 091cab4d10
4 changed files with 108 additions and 153 deletions

View File

@ -1474,7 +1474,6 @@ void ForumsDialog::createthread()
} }
CreateForumMsg *cfm = new CreateForumMsg(mCurrForumId, ""); CreateForumMsg *cfm = new CreateForumMsg(mCurrForumId, "");
cfm->setWindowTitle(tr("Start New Thread"));
cfm->show(); cfm->show();
/* window will destroy itself! */ /* window will destroy itself! */

View File

@ -41,13 +41,19 @@
/** Constructor */ /** Constructor */
CreateForumMsg::CreateForumMsg(std::string fId, std::string pId) CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId)
: QMainWindow(NULL), mForumId(fId), mParentId(pId) : QDialog(NULL), mForumId(fId), mParentId(pId)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
setWindowTitle(text);
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
ui.headerFrame->setHeaderText(text);
Settings->loadWidgetInformation(this); Settings->loadWidgetInformation(this);
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) ); connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
@ -55,8 +61,8 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// connect up the buttons. // connect up the buttons.
connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) ); connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg()));
connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) ); connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile())); connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile()));
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink())); connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
@ -189,11 +195,6 @@ void CreateForumMsg::closeEvent (QCloseEvent * /*event*/)
Settings->saveWidgetInformation(this); Settings->saveWidgetInformation(this);
} }
void CreateForumMsg::cancelMsg()
{
close();
}
void CreateForumMsg::smileyWidgetForums() void CreateForumMsg::smileyWidgetForums()
{ {
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false); Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);

View File

@ -25,12 +25,12 @@
#include "ui_CreateForumMsg.h" #include "ui_CreateForumMsg.h"
class CreateForumMsg : public QMainWindow class CreateForumMsg : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
CreateForumMsg(std::string fId, std::string pId); CreateForumMsg(const std::string &fId, const std::string &pId);
void newMsg(); /* cleanup */ void newMsg(); /* cleanup */
@ -41,7 +41,6 @@ private slots:
void fileHashingFinished(QList<HashedFile> hashedFiles); void fileHashingFinished(QList<HashedFile> hashedFiles);
/* actions to take.... */ /* actions to take.... */
void createMsg(); void createMsg();
void cancelMsg();
void pasteLink(); void pasteLink();
void pasteLinkFull(); void pasteLinkFull();
void pasteOwnCertificateLink(); void pasteOwnCertificateLink();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>CreateForumMsg</class> <class>CreateForumMsg</class>
<widget class="QMainWindow" name="CreateForumMsg"> <widget class="QDialog" name="CreateForumMsg">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -17,21 +17,27 @@
<iconset resource="../images.qrc"> <iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset> <normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <layout class="QVBoxLayout" name="verticalLayout">
<enum>Qt::ToolButtonTextUnderIcon</enum> <property name="spacing">
</property> <number>0</number>
<widget class="QWidget" name="centralwidget"> </property>
<layout class="QGridLayout" name="gridLayout_5"> <property name="margin">
<property name="margin"> <number>0</number>
<number>0</number> </property>
</property> <item>
<property name="spacing"> <widget class="HeaderFrame" name="headerFrame"/>
<number>0</number> </item>
</property> <item>
<item row="0" column="0"> <widget class="QFrame" name="frame">
<layout class="QGridLayout" name="gridLayout_4"> <property name="frameShape">
<item row="0" column="0"> <enum>QFrame::StyledPanel</enum>
<widget class="QFrame" name="frame_4"> </property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="subjectFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
@ -39,48 +45,37 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<property name="topMargin"> <property name="margin">
<number>6</number> <number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout"> <widget class="QLabel" name="forumLabel">
<item> <property name="text">
<widget class="QLabel" name="label_2"> <string>Forum</string>
<property name="text"> </property>
<string>Forum</string> </widget>
</property> </item>
</widget> <item row="0" column="1">
</item> <widget class="QLineEdit" name="forumName">
<item> <property name="enabled">
<widget class="QLineEdit" name="forumName"> <bool>false</bool>
<property name="enabled"> </property>
<bool>false</bool> </widget>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QHBoxLayout"> <widget class="QLabel" name="subjectLabel">
<item> <property name="text">
<widget class="QLabel" name="label"> <string>Subject</string>
<property name="text"> </property>
<string>Subject</string> </widget>
</property> </item>
</widget> <item row="1" column="1">
</item> <widget class="QLineEdit" name="forumSubject"/>
<item>
<widget class="QLineEdit" name="forumSubject"/>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QFrame" name="toolBarFrame"> <widget class="QFrame" name="toolBarFrame">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -206,112 +201,73 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item>
<widget class="QFrame" name="frame_3"> <widget class="QGroupBox" name="messageGroupBox">
<property name="frameShape"> <property name="title">
<enum>QFrame::NoFrame</enum> <string>Forum Post</string>
</property> </property>
<property name="frameShadow"> <layout class="QGridLayout" name="gridLayout">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="topMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox"> <widget class="QTextEdit" name="forumMessage">
<property name="title"> <property name="contextMenuPolicy">
<string>Forum Post</string> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <property name="html">
<item row="0" column="0"> <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
<widget class="QTextEdit" name="forumMessage">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="html">
<string notr="true">&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; &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; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Attach files via drag and drop</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="HashBox" name="hashBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>You can attach files via drag and drop here in this window</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="hashGroupBox">
<property name="title">
<string>Attach files via drag and drop</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="HashBox" name="hashBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>You can attach files via drag and drop here in this window</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout> </layout>
</item> </widget>
</layout> </item>
</widget> </layout>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string notr="true">toolBar</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="postmessage_action"/>
<addaction name="close_action"/>
</widget>
<action name="postmessage_action">
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail_send24.png</normaloff>:/images/mail_send24.png</iconset>
</property>
<property name="text">
<string>Post Forum Msg</string>
</property>
</action>
<action name="close_action">
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/button_cancel.png</normaloff>:/images/button_cancel.png</iconset>
</property>
<property name="text">
<string>Close</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>HashBox</class> <class>HashBox</class>
<extends>QScrollArea</extends> <extends>QScrollArea</extends>