From 02583ad23279569087c7fc2b6e09d919287e5d72 Mon Sep 17 00:00:00 2001 From: drbob <retroshare.project@gmail.com> Date: Sat, 29 Nov 2008 12:12:30 +0000 Subject: [PATCH] Reverted to Forum Msgs back to before formatting. Made self appear in center of NetworkView git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@850 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/elastic/node.cpp | 19 +- .../src/gui/forums/CreateForumMsg.cpp | 534 +----------------- .../src/gui/forums/CreateForumMsg.h | 78 +-- .../src/gui/forums/CreateForumMsg.ui | 303 +++------- 4 files changed, 91 insertions(+), 843 deletions(-) diff --git a/retroshare-gui/src/gui/elastic/node.cpp b/retroshare-gui/src/gui/elastic/node.cpp index 8adda1a51..fd2947a93 100644 --- a/retroshare-gui/src/gui/elastic/node.cpp +++ b/retroshare-gui/src/gui/elastic/node.cpp @@ -42,6 +42,7 @@ #include "edge.h" #include "node.h" #include "graphwidget.h" +#include <math.h> Node::Node(GraphWidget *graphWidget, uint32_t t, std::string id_in, std::string n) : graph(graphWidget), ntype(t), id(id_in), name(n), @@ -87,8 +88,9 @@ void Node::calculateForces() } } + // Now subtract all forces pulling items together - double weight = (edgeList.size() + 1) * 10; + double weight = sqrt(edgeList.size() + 1) * 10; foreach (Edge *edge, edgeList) { QPointF pos; if (edge->sourceNode() == this) @@ -98,14 +100,25 @@ void Node::calculateForces() xvel += pos.x() / weight; yvel += pos.y() / weight; } - + + // push away from edges too. + QRectF sceneRect = scene()->sceneRect(); + int mid_x = (sceneRect.left() + sceneRect.right()) / 2; + int mid_y = (sceneRect.top() + sceneRect.bottom()) / 2; + if (qAbs(xvel) < 0.1 && qAbs(yvel) < 0.1) xvel = yvel = 0; - QRectF sceneRect = scene()->sceneRect(); newPos = pos() + QPointF(xvel, yvel); newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10)); newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10)); + + if (ntype == ELASTIC_NODE_TYPE_OWN) + { + /* own one always goes in the middle */ + newPos.setX(mid_x); + newPos.setY(mid_y); + } } bool Node::advance() diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp index 8933e6eff..acfef6004 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp @@ -26,144 +26,20 @@ #include "rsiface/rsforums.h" -#include <QContextMenuEvent> -#include <QCloseEvent> -#include <QColorDialog> -#include <QClipboard> -#include <QFile> -#include <QFileDialog> -#include <QFileInfo> -#include <QMenu> -#include <QCursor> -#include <QPoint> -#include <QMouseEvent> -#include <QMessageBox> -#include <QPixmap> -#include <QPrintDialog> -#include <QPrinter> -#include <QHeaderView> -#include <QTextCodec> -#include <QTextEdit> -#include <QTextCursor> -#include <QTextList> -#include <QTextStream> -#include <QTextDocumentFragment> - /** Constructor */ -CreateForumMsg::CreateForumMsg(std::string fId, std::string pId, QWidget *parent, Qt::WFlags flags) -: QMainWindow(parent, flags), mForumId(fId), mParentId(pId) +CreateForumMsg::CreateForumMsg(std::string fId, std::string pId) +: QMainWindow(NULL), mForumId(fId), mParentId(pId) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); - - setupFileActions(); - setupEditActions(); - setupViewActions(); - setupInsertActions(); - RshareSettings config; + RshareSettings config; config.loadWidgetInformation(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - // connect up the buttons. connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) ); connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) ); - connect(ui.boldbtn, SIGNAL(clicked()), this, SLOT(textBold())); - connect(ui.underlinebtn, SIGNAL(clicked()), this, SLOT(textUnderline())); - connect(ui.italicbtn, SIGNAL(clicked()), this, SLOT(textItalic())); - connect(ui.colorbtn, SIGNAL(clicked()), this, SLOT(textColor())); - - connect(ui.forumMessage, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)), - this, SLOT(currentCharFormatChanged(const QTextCharFormat &))); - connect(ui.forumMessage, SIGNAL(cursorPositionChanged()), - this, SLOT(cursorPositionChanged())); - - connect(ui.forumMessage->document(), SIGNAL(modificationChanged(bool)), - actionSave, SLOT(setEnabled(bool))); - connect(ui.forumMessage->document(), SIGNAL(modificationChanged(bool)), - this, SLOT(setWindowModified(bool))); - connect(ui.forumMessage->document(), SIGNAL(undoAvailable(bool)), - actionUndo, SLOT(setEnabled(bool))); - connect(ui.forumMessage->document(), SIGNAL(redoAvailable(bool)), - actionRedo, SLOT(setEnabled(bool))); - - setWindowModified(ui.forumMessage->document()->isModified()); - actionSave->setEnabled(ui.forumMessage->document()->isModified()); - actionUndo->setEnabled(ui.forumMessage->document()->isUndoAvailable()); - actionRedo->setEnabled(ui.forumMessage->document()->isRedoAvailable()); - - connect(actionUndo, SIGNAL(triggered()), ui.forumMessage, SLOT(undo())); - connect(actionRedo, SIGNAL(triggered()), ui.forumMessage, SLOT(redo())); - - actionCut->setEnabled(false); - actionCopy->setEnabled(false); - - connect(actionCut, SIGNAL(triggered()), ui.forumMessage, SLOT(cut())); - connect(actionCopy, SIGNAL(triggered()), ui.forumMessage, SLOT(copy())); - connect(actionPaste, SIGNAL(triggered()), ui.forumMessage, SLOT(paste())); - - connect(ui.forumMessage, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); - connect(ui.forumMessage, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); - - connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); - - QActionGroup *grp = new QActionGroup(this); - connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *))); - - actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"), tr("&Left"), grp); - actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); - actionAlignLeft->setCheckable(true); - actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp); - actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); - actionAlignCenter->setCheckable(true); - actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp); - actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); - actionAlignRight->setCheckable(true); - actionAlignJustify = new QAction(QIcon(":/images/textedit/textjustify.png"), tr("&Justify"), grp); - actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); - actionAlignJustify->setCheckable(true); - - ui.comboStyle->addItem("Standard"); - ui.comboStyle->addItem("Bullet List (Disc)"); - ui.comboStyle->addItem("Bullet List (Circle)"); - ui.comboStyle->addItem("Bullet List (Square)"); - ui.comboStyle->addItem("Ordered List (Decimal)"); - ui.comboStyle->addItem("Ordered List (Alpha lower)"); - ui.comboStyle->addItem("Ordered List (Alpha upper)"); - connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(textStyle(int))); - - connect(ui.comboFont, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &))); - - ui.comboSize->setEditable(true); - - QFontDatabase db; - foreach(int size, db.standardSizes()) - ui.comboSize->addItem(QString::number(size)); - - connect(ui.comboSize, SIGNAL(activated(const QString &)),this, SLOT(textSize(const QString &))); - ui.comboSize->setCurrentIndex(ui.comboSize->findText(QString::number(QApplication::font().pointSize()))); - - ui.boldbtn->setIcon(QIcon(QString(":/images/textedit/textbold.png"))); - ui.underlinebtn->setIcon(QIcon(QString(":/images/textedit/textunder.png"))); - ui.italicbtn->setIcon(QIcon(QString(":/images/textedit/textitalic.png"))); - ui.textalignmentbtn->setIcon(QIcon(QString(":/images/textedit/textcenter.png"))); - //ui.actionContactsView->setIcon(QIcon(":/images/contacts24.png")); - //ui.actionSaveas->setIcon(QIcon(":/images/save24.png")); - - QMenu * alignmentmenu = new QMenu(); - alignmentmenu->addAction(actionAlignLeft); - alignmentmenu->addAction(actionAlignCenter); - alignmentmenu->addAction(actionAlignRight); - alignmentmenu->addAction(actionAlignJustify); - ui.textalignmentbtn->setMenu(alignmentmenu); - - QPixmap pxm(24,24); - pxm.fill(Qt::black); - ui.colorbtn->setIcon(pxm); - newMsg(); } @@ -225,409 +101,7 @@ void CreateForumMsg::cancelMsg() close(); return; - RshareSettings config; + RshareSettings config; config.saveWidgetInformation(this); } -void CreateForumMsg::textBold() -{ - QTextCharFormat fmt; - fmt.setFontWeight(ui.boldbtn->isChecked() ? QFont::Bold : QFont::Normal); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateForumMsg::textUnderline() -{ - QTextCharFormat fmt; - fmt.setFontUnderline(ui.underlinebtn->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateForumMsg::textItalic() -{ - QTextCharFormat fmt; - fmt.setFontItalic(ui.italicbtn->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateForumMsg::textFamily(const QString &f) -{ - QTextCharFormat fmt; - fmt.setFontFamily(f); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateForumMsg::textSize(const QString &p) -{ - QTextCharFormat fmt; - fmt.setFontPointSize(p.toFloat()); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateForumMsg::textStyle(int styleIndex) -{ - QTextCursor cursor = ui.forumMessage->textCursor(); - - if (styleIndex != 0) { - QTextListFormat::Style style = QTextListFormat::ListDisc; - - switch (styleIndex) { - default: - case 1: - style = QTextListFormat::ListDisc; - break; - case 2: - style = QTextListFormat::ListCircle; - break; - case 3: - style = QTextListFormat::ListSquare; - break; - case 4: - style = QTextListFormat::ListDecimal; - break; - case 5: - style = QTextListFormat::ListLowerAlpha; - break; - case 6: - style = QTextListFormat::ListUpperAlpha; - break; - } - - cursor.beginEditBlock(); - - QTextBlockFormat blockFmt = cursor.blockFormat(); - - QTextListFormat listFmt; - - if (cursor.currentList()) { - listFmt = cursor.currentList()->format(); - } else { - listFmt.setIndent(blockFmt.indent() + 1); - blockFmt.setIndent(0); - cursor.setBlockFormat(blockFmt); - } - - listFmt.setStyle(style); - - cursor.createList(listFmt); - - cursor.endEditBlock(); - } else { - // #### - QTextBlockFormat bfmt; - bfmt.setObjectIndex(-1); - cursor.mergeBlockFormat(bfmt); - } -} - -void CreateForumMsg::textColor() -{ - QColor col = QColorDialog::getColor(ui.forumMessage->textColor(), this); - if (!col.isValid()) - return; - QTextCharFormat fmt; - fmt.setForeground(col); - mergeFormatOnWordOrSelection(fmt); - colorChanged(col); -} - -void CreateForumMsg::textAlign(QAction *a) -{ - if (a == actionAlignLeft) - ui.forumMessage->setAlignment(Qt::AlignLeft); - else if (a == actionAlignCenter) - ui.forumMessage->setAlignment(Qt::AlignHCenter); - else if (a == actionAlignRight) - ui.forumMessage->setAlignment(Qt::AlignRight); - else if (a == actionAlignJustify) - ui.forumMessage->setAlignment(Qt::AlignJustify); -} - -void CreateForumMsg::currentCharFormatChanged(const QTextCharFormat &format) -{ - fontChanged(format.font()); - colorChanged(format.foreground().color()); -} - -void CreateForumMsg::cursorPositionChanged() -{ - alignmentChanged(ui.forumMessage->alignment()); -} - -void CreateForumMsg::mergeFormatOnWordOrSelection(const QTextCharFormat &format) -{ - QTextCursor cursor = ui.forumMessage->textCursor(); - if (!cursor.hasSelection()) - cursor.select(QTextCursor::WordUnderCursor); - cursor.mergeCharFormat(format); - ui.forumMessage->mergeCurrentCharFormat(format); -} - -void CreateForumMsg::fontChanged(const QFont &f) -{ - ui.comboFont->setCurrentIndex(ui.comboFont->findText(QFontInfo(f).family())); - ui.comboSize->setCurrentIndex(ui.comboSize->findText(QString::number(f.pointSize()))); - ui.boldbtn->setChecked(f.bold()); - ui.italicbtn->setChecked(f.italic()); - ui.underlinebtn->setChecked(f.underline()); -} - -void CreateForumMsg::colorChanged(const QColor &c) -{ - QPixmap pix(16, 16); - pix.fill(c); - ui.colorbtn->setIcon(pix); -} - -void CreateForumMsg::alignmentChanged(Qt::Alignment a) -{ - if (a & Qt::AlignLeft) { - actionAlignLeft->setChecked(true); - } else if (a & Qt::AlignHCenter) { - actionAlignCenter->setChecked(true); - } else if (a & Qt::AlignRight) { - actionAlignRight->setChecked(true); - } else if (a & Qt::AlignJustify) { - actionAlignJustify->setChecked(true); - } -} - -void CreateForumMsg::clipboardDataChanged() -{ - actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); -} - -void CreateForumMsg::fileNew() -{ - if (maybeSave()) { - ui.forumMessage->clear(); - //setCurrentFileName(QString()); - } -} - -void CreateForumMsg::fileOpen() -{ - QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."), - QString(), tr("HTML-Files (*.htm *.html);;All Files (*)")); - if (!fn.isEmpty()) - load(fn); -} - -bool CreateForumMsg::fileSave() -{ - if (fileName.isEmpty()) - return fileSaveAs(); - - QFile file(fileName); - if (!file.open(QFile::WriteOnly)) - return false; - QTextStream ts(&file); - ts.setCodec(QTextCodec::codecForName("UTF-8")); - ts << ui.forumMessage->document()->toHtml("UTF-8"); - ui.forumMessage->document()->setModified(false); - return true; -} - -bool CreateForumMsg::fileSaveAs() -{ - QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."), - QString(), tr("HTML-Files (*.htm *.html);;All Files (*)")); - if (fn.isEmpty()) - return false; - setCurrentFileName(fn); - return fileSave(); -} - -void CreateForumMsg::filePrint() -{ -#ifndef QT_NO_PRINTER - QPrinter printer(QPrinter::HighResolution); - printer.setFullPage(true); - QPrintDialog *dlg = new QPrintDialog(&printer, this); - if (ui.forumMessage->textCursor().hasSelection()) - dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection); - dlg->setWindowTitle(tr("Print Document")); - if (dlg->exec() == QDialog::Accepted) { - ui.forumMessage->print(&printer); - } - delete dlg; -#endif -} - -/*void TextEdit::filePrintPreview() -{ - PrintPreview *preview = new PrintPreview(textEdit->document(), this); - preview->setWindowModality(Qt::WindowModal); - preview->setAttribute(Qt::WA_DeleteOnClose); - preview->show(); -}*/ - -void CreateForumMsg::filePrintPdf() -{ -#ifndef QT_NO_PRINTER - QString fileName = QFileDialog::getSaveFileName(this, "Export PDF", - QString(), "*.pdf"); - if (!fileName.isEmpty()) { - if (QFileInfo(fileName).suffix().isEmpty()) - fileName.append(".pdf"); - QPrinter printer(QPrinter::HighResolution); - printer.setOutputFormat(QPrinter::PdfFormat); - printer.setOutputFileName(fileName); - ui.forumMessage->document()->print(&printer); - } -#endif -} - -void CreateForumMsg::setCurrentFileName(const QString &fileName) -{ - this->fileName = fileName; - ui.forumMessage->document()->setModified(false); - - setWindowModified(false); -} - -bool CreateForumMsg::load(const QString &f) -{ - if (!QFile::exists(f)) - return false; - QFile file(f); - if (!file.open(QFile::ReadOnly)) - return false; - - QByteArray data = file.readAll(); - QTextCodec *codec = Qt::codecForHtml(data); - QString str = codec->toUnicode(data); - if (Qt::mightBeRichText(str)) { - ui.forumMessage->setHtml(str); - } else { - str = QString::fromLocal8Bit(data); - ui.forumMessage->setPlainText(str); - } - - setCurrentFileName(f); - return true; -} - - -bool CreateForumMsg::maybeSave() -{ - if (!ui.forumMessage->document()->isModified()) - return true; - if (fileName.startsWith(QLatin1String(":/"))) - return true; - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("Save Message"), - tr("Forum Message has not been Sent.\n" - "Do you want to save forum message ?"), - QMessageBox::Save | QMessageBox::Discard - | QMessageBox::Cancel); - if (ret == QMessageBox::Save) - return fileSave(); - else if (ret == QMessageBox::Cancel) - return false; - return true; -} - -void CreateForumMsg::setupFileActions() -{ - QMenu *menu = new QMenu(tr("&File"), this); - menuBar()->addMenu(menu); - - QAction *a; - - a = new QAction(QIcon(":/images/textedit/filenew.png"), tr("&New"), this); - a->setShortcut(QKeySequence::New); - connect(a, SIGNAL(triggered()), this, SLOT(fileNew())); - menu->addAction(a); - - a = new QAction(QIcon(":/images/textedit/fileopen.png"), tr("&Open..."), this); - a->setShortcut(QKeySequence::Open); - connect(a, SIGNAL(triggered()), this, SLOT(fileOpen())); - menu->addAction(a); - - menu->addSeparator(); - - actionSave = a = new QAction(QIcon(":/images/textedit/filesave.png"), tr("&Save"), this); - a->setShortcut(QKeySequence::Save); - connect(a, SIGNAL(triggered()), this, SLOT(fileSave())); - a->setEnabled(false); - menu->addAction(a); - - a = new QAction(tr("Save &As..."), this); - connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs())); - menu->addAction(a); - menu->addSeparator(); - - a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("&Print..."), this); - a->setShortcut(QKeySequence::Print); - connect(a, SIGNAL(triggered()), this, SLOT(filePrint())); - menu->addAction(a); - - /*a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("Print Preview..."), this); - connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview())); - menu->addAction(a);*/ - - a = new QAction(QIcon(":/images/textedit/exportpdf.png"), tr("&Export PDF..."), this); - a->setShortcut(Qt::CTRL + Qt::Key_D); - connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf())); - menu->addAction(a); - - menu->addSeparator(); - - a = new QAction(tr("&Quit"), this); - a->setShortcut(Qt::CTRL + Qt::Key_Q); - connect(a, SIGNAL(triggered()), this, SLOT(close())); - menu->addAction(a); -} - -void CreateForumMsg::setupEditActions() -{ - QMenu *menu = new QMenu(tr("&Edit"), this); - menuBar()->addMenu(menu); - - QAction *a; - a = actionUndo = new QAction(QIcon(":/images/textedit/editundo.png"), tr("&Undo"), this); - a->setShortcut(QKeySequence::Undo); - menu->addAction(a); - a = actionRedo = new QAction(QIcon(":/images/textedit/editredo.png"), tr("&Redo"), this); - a->setShortcut(QKeySequence::Redo); - menu->addAction(a); - menu->addSeparator(); - a = actionCut = new QAction(QIcon(":/images/textedit/editcut.png"), tr("Cu&t"), this); - a->setShortcut(QKeySequence::Cut); - menu->addAction(a); - a = actionCopy = new QAction(QIcon(":/images/textedit/editcopy.png"), tr("&Copy"), this); - a->setShortcut(QKeySequence::Copy); - menu->addAction(a); - a = actionPaste = new QAction(QIcon(":/images/textedit/editpaste.png"), tr("&Paste"), this); - a->setShortcut(QKeySequence::Paste); - menu->addAction(a); - actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); -} - -void CreateForumMsg::setupViewActions() -{ - QMenu *menu = new QMenu(tr("&View"), this); - menuBar()->addMenu(menu); - - //QAction *a; - - /*a = new QAction(QIcon(""), tr("&Contacts Sidebar"), this); - connect(a, SIGNAL(triggered()), this, SLOT(toggleContacts())); - menu->addAction(a);*/ - -} - -void CreateForumMsg::setupInsertActions() -{ - QMenu *menu = new QMenu(tr("&Insert"), this); - menuBar()->addMenu(menu); - - //QAction *a; - - /*a = new QAction(QIcon(""), tr("&Image"), this); - connect(a, SIGNAL(triggered()), this, SLOT(addImage())); - menu->addAction(a);*/ - -} - diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.h b/retroshare-gui/src/gui/forums/CreateForumMsg.h index a14ff8724..9cf377725 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.h +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.h @@ -24,95 +24,29 @@ #define _CREATE_FORUM_MSG_DIALOG_H #include <QWidget> -#include <QMainWindow> #include <string> #include "ui_CreateForumMsg.h" -class QAction; -class QComboBox; -class QFontComboBox; -class QTextEdit; -class QTextCharFormat; - class CreateForumMsg : public QMainWindow { Q_OBJECT public: - CreateForumMsg(std::string fId, std::string pId, QWidget *parent = 0, Qt::WFlags flags = 0); + CreateForumMsg(std::string fId, std::string pId); - void newMsg(); /* cleanup */ - -public slots: - - void createMsg(); - void cancelMsg(); +void newMsg(); /* cleanup */ private slots: /* actions to take.... */ - - - void fileNew(); - void fileOpen(); - bool fileSave(); - bool fileSaveAs(); - void filePrint(); - - //void filePrintPreview(); - void filePrintPdf(); - - void textBold(); - void textUnderline(); - void textItalic(); - void textFamily(const QString &f); - void textSize(const QString &p); - void textStyle(int styleIndex); - void textColor(); - void textAlign(QAction *a); - - void currentCharFormatChanged(const QTextCharFormat &format); - void cursorPositionChanged(); - - void clipboardDataChanged(); +void createMsg(); +void cancelMsg(); private: - std::string mForumId; - std::string mParentId; - - void setTextColor(const QColor& col) ; - void setupFileActions(); - void setupEditActions(); - void setupViewActions(); - void setupInsertActions(); - - void mergeFormatOnWordOrSelection(const QTextCharFormat &format); - void fontChanged(const QFont &f); - void colorChanged(const QColor &c); - void alignmentChanged(Qt::Alignment a); - - bool load(const QString &f); - bool maybeSave(); - - void setCurrentFileName(const QString &fileName); - - - QAction *actionSave, - *actionAlignLeft, - *actionAlignCenter, - *actionAlignRight, - *actionAlignJustify, - *actionUndo, - *actionRedo, - *actionCut, - *actionCopy, - *actionPaste; - - QString fileName; - - + std::string mForumId; + std::string mParentId; /** Qt Designer generated object */ Ui::CreateForumMsg ui; diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.ui b/retroshare-gui/src/gui/forums/CreateForumMsg.ui index fc5b58262..b2f301ee0 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.ui +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.ui @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>527</width> - <height>410</height> + <width>441</width> + <height>353</height> </rect> </property> <property name="windowTitle" > @@ -20,239 +20,76 @@ </property> <widget class="QWidget" name="centralwidget" > <layout class="QGridLayout" > - <property name="horizontalSpacing" > - <number>2</number> - </property> - <property name="verticalSpacing" > - <number>1</number> - </property> <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="spacing" > - <number>6</number> - </property> + <layout class="QVBoxLayout" > <item> - <widget class="QLabel" name="label_2" > - <property name="text" > - <string>Forum</string> - </property> - </widget> + <layout class="QHBoxLayout" > + <item> + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Forum</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="forumName" > + <property name="enabled" > + <bool>false</bool> + </property> + </widget> + </item> + </layout> </item> <item> - <widget class="QLineEdit" name="forumName" > - <property name="enabled" > - <bool>false</bool> - </property> - </widget> + <layout class="QHBoxLayout" > + <item> + <widget class="QLabel" name="label" > + <property name="text" > + <string>Forum Post Subject</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="forumSubject" /> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" > + <item> + <widget class="QLabel" name="label_5" > + <property name="text" > + <string>Forum Post</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="signBox" > + <property name="text" > + <string>Sign Message</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QTextEdit" name="forumMessage" /> </item> </layout> </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label" > - <property name="text" > - <string>Forum Post Subject</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="forumSubject" /> - </item> - </layout> - </item> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <item> - <widget class="QLabel" name="label_5" > - <property name="text" > - <string>Forum Post</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="signBox" > - <property name="text" > - <string>Sign Message</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="3" column="0" > - <layout class="QGridLayout" > - <property name="horizontalSpacing" > - <number>6</number> - </property> - <property name="verticalSpacing" > - <number>0</number> - </property> - <item row="0" column="0" > - <widget class="QComboBox" name="comboStyle" /> - </item> - <item row="0" column="1" > - <widget class="QFontComboBox" name="comboFont" /> - </item> - <item row="0" column="2" > - <widget class="QComboBox" name="comboSize" > - <property name="toolTip" > - <string>Font size</string> - </property> - </widget> - </item> - <item row="0" column="3" > - <widget class="QPushButton" name="boldbtn" > - <property name="minimumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="toolTip" > - <string>Bold</string> - </property> - <property name="text" > - <string/> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="4" > - <widget class="QPushButton" name="underlinebtn" > - <property name="minimumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="toolTip" > - <string>Underline</string> - </property> - <property name="text" > - <string/> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="5" > - <widget class="QPushButton" name="italicbtn" > - <property name="minimumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="toolTip" > - <string>Italic</string> - </property> - <property name="text" > - <string/> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="6" > - <widget class="QPushButton" name="colorbtn" > - <property name="minimumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="toolTip" > - <string>Color</string> - </property> - <property name="text" > - <string/> - </property> - </widget> - </item> - <item row="0" column="7" > - <widget class="QPushButton" name="textalignmentbtn" > - <property name="minimumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>28</width> - <height>28</height> - </size> - </property> - <property name="toolTip" > - <string>Alignment</string> - </property> - <property name="text" > - <string/> - </property> - </widget> - </item> - <item row="0" column="8" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>51</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="4" column="0" > - <widget class="QTextEdit" name="forumMessage" /> - </item> </layout> </widget> <widget class="QToolBar" name="toolBar" > @@ -268,16 +105,6 @@ <addaction name="postmessage_action" /> <addaction name="close_action" /> </widget> - <widget class="QMenuBar" name="menuBar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>527</width> - <height>30</height> - </rect> - </property> - </widget> <action name="postmessage_action" > <property name="icon" > <iconset resource="../images.qrc" >:/images/mail_send24.png</iconset>