diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index fc07d6fd3..5689a8ecf 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -151,6 +151,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags) 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.color2btn, SIGNAL(clicked()), this, SLOT(textbackgroundColor())); + connect(ui.imagebtn, SIGNAL(clicked()), this, SLOT(addImage())); connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); //connect(ui.linkbtn, SIGNAL(clicked()), this, SLOT(insertLink())); @@ -281,6 +283,10 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags) QPixmap pxm(24,24); pxm.fill(Qt::black); ui.colorbtn->setIcon(pxm); + + QPixmap pxm2(24,24); + pxm2.fill(Qt::white); + ui.color2btn->setIcon(pxm2); /* Set header resize modes and initial section sizes */ QHeaderView * _smheader = ui.msgFileList->header () ; @@ -2142,6 +2148,17 @@ void MessageComposer::textColor() colorChanged(col); } +void MessageComposer::textbackgroundColor() +{ + QColor col2 = QColorDialog::getColor(ui.msgText->textBackgroundColor(), this); + if (!col2.isValid()) + return; + QTextCharFormat fmt; + fmt.setBackground(col2); + mergeFormatOnWordOrSelection(fmt); + colorChanged2(col2); +} + void MessageComposer::textAlign(QAction *a) { if (a == actionAlignLeft) @@ -2168,6 +2185,7 @@ void MessageComposer::currentCharFormatChanged(const QTextCharFormat &format) { fontChanged(format.font()); colorChanged(format.foreground().color()); + colorChanged2(format.background().color()); } void MessageComposer::cursorPositionChanged() @@ -2200,6 +2218,13 @@ void MessageComposer::colorChanged(const QColor &c) ui.colorbtn->setIcon(pix); } +void MessageComposer::colorChanged2(const QColor &c) +{ + QPixmap pix(16, 16); + pix.fill(c); + ui.color2btn->setIcon(pix); +} + void MessageComposer::alignmentChanged(Qt::Alignment a) { if (a & Qt::AlignLeft) { diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index 34e41657f..e4dbcbb30 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -124,6 +124,7 @@ private slots: void textSize(const QString &p); void textStyle(int styleIndex); void textColor(); + void textbackgroundColor(); void textAlign(QAction *a); void smileyWidget(); void addSmileys(); @@ -187,6 +188,7 @@ private: void mergeFormatOnWordOrSelection(const QTextCharFormat &format); void fontChanged(const QFont &f); void colorChanged(const QColor &c); + void colorChanged2(const QColor &c); void alignmentChanged(Qt::Alignment a); bool sendMessage_internal(bool bDraftbox); diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.ui b/retroshare-gui/src/gui/msgs/MessageComposer.ui index 9e89c3501..3e0368704 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.ui +++ b/retroshare-gui/src/gui/msgs/MessageComposer.ui @@ -60,16 +60,7 @@ - - 1 - - - 1 - - - 1 - - + 1 @@ -221,16 +212,7 @@ QFrame::Sunken - - 6 - - - 6 - - - 6 - - + 6 @@ -238,7 +220,128 @@ 1 - + + + + + 45 + 16777215 + + + + Qt::ClickFocus + + + Font size + + + + + + + + 1677 + 1677 + + + + Qt::NoFocus + + + Increase font size + + + + + + + :/images/textedit/format_font_size_more.png:/images/textedit/format_font_size_more.png + + + + 24 + 24 + + + + true + + + + + + + + 167 + 167 + + + + Qt::NoFocus + + + Decrease font size + + + + + + + :/images/textedit/format_font_size_less.png:/images/textedit/format_font_size_less.png + + + + 24 + 24 + + + + true + + + + + + + + 0 + 0 + + + + + 1677 + 1677 + + + + Qt::NoFocus + + + Bold + + + + + + + :/images/textedit/textbold.png:/images/textedit/textbold.png + + + + 24 + 24 + + + + true + + + true + + + + @@ -279,7 +382,7 @@ - + @@ -383,156 +486,7 @@ - - - - - 45 - 16777215 - - - - Qt::ClickFocus - - - Font size - - - - - - - - 1677 - 1677 - - - - Qt::NoFocus - - - Increase font size - - - - - - - :/images/textedit/format_font_size_more.png:/images/textedit/format_font_size_more.png - - - - 24 - 24 - - - - true - - - - - - - - 167 - 167 - - - - Qt::NoFocus - - - Decrease font size - - - - - - - :/images/textedit/format_font_size_less.png:/images/textedit/format_font_size_less.png - - - - 24 - 24 - - - - true - - - - - - - - 0 - 0 - - - - - 1677 - 1677 - - - - Qt::NoFocus - - - Bold - - - - - - - :/images/textedit/textbold.png:/images/textedit/textbold.png - - - - 24 - 24 - - - - true - - - true - - - - - - - - 0 - 0 - - - - - 167 - 167 - - - - Qt::NoFocus - - - Select Color - - - - - - true - - - - + @@ -569,7 +523,7 @@ - + Qt::NoFocus @@ -595,7 +549,7 @@ - + Qt::Horizontal @@ -608,7 +562,7 @@ - + @@ -649,7 +603,7 @@ - + Qt::NoFocus @@ -669,6 +623,50 @@ + + + + + 0 + 0 + + + + + 167 + 167 + + + + Qt::NoFocus + + + Set Text color + + + + + + true + + + + + + + Set Text background color + + + + + + false + + + true + + + @@ -763,16 +761,7 @@ QFrame::Box - - 6 - - - 6 - - - 6 - - + 6 @@ -1009,16 +998,7 @@ border-image: url(:/images/closepressed.png) - - 0 - - - 0 - - - 0 - - + 0