diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
index 6bcf7a83f..af0ca5edf 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
@@ -34,6 +34,7 @@
#include "util/qtthreadsutils.h"
#include "util/HandleRichText.h"
#include "gui/Identity/IdDialog.h"
+#include "gui/settings/rsharesettings.h"
#include "gui/MainWindow.h"
#include "util/DateTime.h"
@@ -234,8 +235,10 @@ void BoardPostDisplayWidgetBase::baseSetup()
if (urlOkay)
{
QString siteurl = url.toEncoded();
+ linkColor = Settings->getLinkColor();
- label->setStyleSheet("text-decoration: underline; color:#2255AA;");
+ QString colorstring = QString("%1;").arg(linkColor.name());
+ label->setStyleSheet("text-decoration: underline; color:" + colorstring );
label->setCursor(QCursor(Qt::PointingHandCursor));
label->setToolTip(siteurl);
diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h
index 731ddc9da..ff17df272 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h
@@ -107,6 +107,8 @@ signals:
protected:
RsPostedPost mPost;
uint8_t mDisplayFlags;
+private:
+ QColor linkColor;
};
class BoardPostDisplayWidget_compact : public BoardPostDisplayWidgetBase
@@ -146,6 +148,8 @@ protected:
void setup() override; // to be overloaded by the different views
private:
+ QColor linkColor;
+
/** Qt Designer generated object */
Ui::BoardPostDisplayWidget_compact *ui;
};
diff --git a/retroshare-gui/src/gui/Posted/PostedCardView.cpp b/retroshare-gui/src/gui/Posted/PostedCardView.cpp
index c63996b3a..3d7fc2e43 100644
--- a/retroshare-gui/src/gui/Posted/PostedCardView.cpp
+++ b/retroshare-gui/src/gui/Posted/PostedCardView.cpp
@@ -228,9 +228,14 @@ void PostedCardView::fill()
if (urlOkay)
{
+ linkColor = Settings->getLinkColor();
+ QString colorstring = QString("%1;").arg(linkColor.name());
+
QString urlstr = QString(" ");
+ urlstr += QString("\" > ");
urlstr += messageName();
urlstr += QString(" ");
diff --git a/retroshare-gui/src/gui/Posted/PostedCardView.h b/retroshare-gui/src/gui/Posted/PostedCardView.h
index 0f4f5f2ab..aeb0f19b6 100644
--- a/retroshare-gui/src/gui/Posted/PostedCardView.h
+++ b/retroshare-gui/src/gui/Posted/PostedCardView.h
@@ -57,6 +57,8 @@ protected:
void toggleNotes() override;
private:
+ QColor linkColor;
+
/** Qt Designer generated object */
Ui::PostedCardView *ui;
};
diff --git a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
index c50c168b7..0680ab725 100644
--- a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
+++ b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
@@ -911,7 +911,7 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
ui->infoAdministrator->setId(group.mMeta.mAuthorId) ;
link = RetroShareLink::createMessage(group.mMeta.mAuthorId, "");
- ui->infoAdministrator->setText(link.toHtml());
+ ui->infoAdministrator->setText(link.toHtmlColored());
ui->createdinfolabel->setText(DateTime::formatLongDateTime(group.mMeta.mPublishTs));
diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp
index a22f9ced8..95c9ddf2b 100644
--- a/retroshare-gui/src/gui/RetroShareLink.cpp
+++ b/retroshare-gui/src/gui/RetroShareLink.cpp
@@ -36,6 +36,7 @@
#include "msgs/MessageComposer.h"
#include "Posted/PostedDialog.h"
#include "util/misc.h"
+#include "gui/settings/rsharesettings.h"
#include
#include
@@ -430,6 +431,7 @@ void RetroShareLink::fromUrl(const QUrl& url)
RetroShareLink::RetroShareLink()
{
clear();
+ linkColor = Settings->getLinkColor();
}
RetroShareLink RetroShareLink::createFile(const QString& name, uint64_t size, const QString& hash)
@@ -1131,6 +1133,22 @@ QString RetroShareLink::toHtml() const
return html;
}
+QString RetroShareLink::toHtmlColored() const
+{
+ //linkColor = Settings->getLinkColor();
+ QString colorstring = QString("%1;").arg(linkColor.name());
+
+ QString html = " " + niceName() + "" ;
+
+ return html;
+}
+
QString RetroShareLink::toHtmlFull() const
{
return QString("" + toString() + "" ;
diff --git a/retroshare-gui/src/gui/RetroShareLink.h b/retroshare-gui/src/gui/RetroShareLink.h
index 61c794b11..c32551c6f 100644
--- a/retroshare-gui/src/gui/RetroShareLink.h
+++ b/retroshare-gui/src/gui/RetroShareLink.h
@@ -41,6 +41,7 @@
#include
#include
#include
+#include
#include
@@ -138,6 +139,8 @@ class RetroShareLink
QString toHtmlSize() const ;
+ QString toHtmlColored() const;
+
QUrl toUrl() const ;
bool operator==(const RetroShareLink& l) const { return _type == l._type && _hash == l._hash ; }
@@ -176,6 +179,7 @@ class RetroShareLink
time_t _time_stamp ; // time stamp at which the link will expire.
QString _radix_group_data;
uint32_t _count ;
+ QColor linkColor;
unsigned int _subType; // for general use as sub type for _type (RSLINK_SUBTYPE_...)
};
diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.cpp b/retroshare-gui/src/gui/common/MimeTextEdit.cpp
index 3d3398b0c..6d51bafc2 100644
--- a/retroshare-gui/src/gui/common/MimeTextEdit.cpp
+++ b/retroshare-gui/src/gui/common/MimeTextEdit.cpp
@@ -33,6 +33,7 @@
#include "util/HandleRichText.h"
#include "gui/RetroShareLink.h"
#include "util/imageutil.h"
+#include "gui/settings/rsharesettings.h"
#include
@@ -44,6 +45,10 @@ MimeTextEdit::MimeTextEdit(QWidget *parent)
mForceCompleterShowNextKeyEvent = false;
highliter = new RsSyntaxHighlighter(this);
mOnlyPlainText = false;
+
+ linkColor = Settings->getLinkColor();
+ QString sheet = QString::fromLatin1("a { text-decoration: underline; color: %1 }").arg(linkColor.name());
+ document()->setDefaultStyleSheet(sheet);
}
bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.h b/retroshare-gui/src/gui/common/MimeTextEdit.h
index b575c1ac9..0270e0f66 100644
--- a/retroshare-gui/src/gui/common/MimeTextEdit.h
+++ b/retroshare-gui/src/gui/common/MimeTextEdit.h
@@ -91,6 +91,7 @@ private:
RsSyntaxHighlighter *highliter;
bool mOnlyPlainText;
int mMaxBytes = -1; //limit content size, for pasting images
+ QColor linkColor;
};
#endif // MIMETEXTEDIT_H
diff --git a/retroshare-gui/src/gui/common/RSTextBrowser.cpp b/retroshare-gui/src/gui/common/RSTextBrowser.cpp
index 4a203ea1b..4432d681c 100644
--- a/retroshare-gui/src/gui/common/RSTextBrowser.cpp
+++ b/retroshare-gui/src/gui/common/RSTextBrowser.cpp
@@ -23,6 +23,7 @@
#include "RSImageBlockWidget.h"
#include "gui/common/FilesDefs.h"
#include "util/imageutil.h"
+#include "gui/settings/rsharesettings.h"
#include //To get RsAccounts
@@ -51,6 +52,8 @@ RSTextBrowser::RSTextBrowser(QWidget *parent) :
highlighter = new RsSyntaxHighlighter(this);
+ updateLinkColor();
+
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
}
@@ -360,3 +363,18 @@ void RSTextBrowser::copyImage()
QTextCursor cursor = cursorForPosition(point);
ImageUtil::copyImage(window(), cursor);
}
+
+void RSTextBrowser::showEvent(QShowEvent *event)
+{
+ if (!event->spontaneous()) {
+ updateLinkColor();
+ }
+}
+
+void RSTextBrowser::updateLinkColor()
+{
+ linkColor = Settings->getLinkColor();
+ QString sheet = QString::fromLatin1("a { text-decoration: underline; color: %1 }").arg(linkColor.name());
+ document()->setDefaultStyleSheet(sheet);
+
+}
diff --git a/retroshare-gui/src/gui/common/RSTextBrowser.h b/retroshare-gui/src/gui/common/RSTextBrowser.h
index a10a2b30a..f1de40323 100644
--- a/retroshare-gui/src/gui/common/RSTextBrowser.h
+++ b/retroshare-gui/src/gui/common/RSTextBrowser.h
@@ -60,6 +60,8 @@ public:
QMenu *createStandardContextMenuFromPoint(const QPoint &widgetPos);
+ virtual void showEvent(QShowEvent *) ;
+
Q_SIGNALS:
void calculateContextMenuActions();
@@ -74,6 +76,7 @@ private slots:
void viewSource();
void saveImage();
void copyImage();
+ void updateLinkColor();
protected:
void paintEvent(QPaintEvent *event);
@@ -89,6 +92,8 @@ private:
RSImageBlockWidget *mImageBlockWidget;
bool mLinkClickActive;
RsSyntaxHighlighter *highlighter;
+ QColor linkColor;
+
QList mContextMenuActions;
#ifdef RSTEXTBROWSER_CHECKIMAGE_DEBUG
QRect mCursorRectStart;
diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp
index c44713d5e..bbe0bcf72 100644
--- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp
+++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp
@@ -1330,7 +1330,7 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
if(!group.mMeta.mAuthorId.isNull())
{
RetroShareLink link = RetroShareLink::createMessage(group.mMeta.mAuthorId, "");
- ui->infoAdministrator->setText(link.toHtml());
+ ui->infoAdministrator->setText(link.toHtmlColored());
}
else
ui->infoAdministrator->setText("[No contact author]");
diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.cpp b/retroshare-gui/src/gui/msgs/MessageWidget.cpp
index 2f81b749d..195a2d27d 100644
--- a/retroshare-gui/src/gui/msgs/MessageWidget.cpp
+++ b/retroshare-gui/src/gui/msgs/MessageWidget.cpp
@@ -705,7 +705,7 @@ void MessageWidget::fill(const std::string &msgId)
}
else
{
- ui.fromText->setText(link.toHtml());
+ ui.fromText->setText(link.toHtmlColored());
ui.fromText->setToolTip(tooltip_string) ;
if (toolButtonReply) toolButtonReply->setEnabled(true);
}
diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp
index 0a767a20f..969f0dadb 100755
--- a/retroshare-gui/src/gui/settings/AppearancePage.cpp
+++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp
@@ -39,6 +39,7 @@
#include "util/misc.h"
#include
+#include
#include
#include
#include
@@ -363,6 +364,11 @@ void AppearancePage::load()
whileBlocking(ui.checkBoxShowSystrayOnStatus)->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool());
whileBlocking(ui.minimumFontSize_SB)->setValue(Settings->getFontSize());
+
+ rgbLinkColor=Settings->getLinkColor();
+ QPixmap colorpix(24, 24);
+ colorpix.fill(rgbLinkColor);
+ ui.linkColorButton->setIcon(colorpix);
}
void AppearancePage::updateFontSize()
@@ -371,3 +377,25 @@ void AppearancePage::updateFontSize()
RsGUIEventManager::getInstance()->notifySettingsChanged();
}
+
+void AppearancePage::on_linkColorButton_clicked()
+{
+ QColor color = QColorDialog::getColor(QColor::fromRgba(rgbLinkColor), window(), "", QColorDialog::ShowAlphaChannel);
+ if (color.isValid()) {
+ rgbLinkColor = color.rgba();
+ QPixmap pix(24, 24);
+ pix.fill(color);
+ ui.linkColorButton->setIcon(pix);
+ Settings->setLinkColor(rgbLinkColor);
+ }
+}
+
+void AppearancePage::on_resetButton_clicked()
+{
+ QRgb color = QString::number(QColor(3, 155, 198).rgba()).toUInt();
+ defaultColor = color;
+ QPixmap pix(24, 24);
+ pix.fill(color);
+ ui.linkColorButton->setIcon(pix);
+ Settings->setLinkColor(defaultColor);
+}
diff --git a/retroshare-gui/src/gui/settings/AppearancePage.h b/retroshare-gui/src/gui/settings/AppearancePage.h
index 7a458139d..5774a48e3 100755
--- a/retroshare-gui/src/gui/settings/AppearancePage.h
+++ b/retroshare-gui/src/gui/settings/AppearancePage.h
@@ -73,9 +73,15 @@ private slots:
void updateStyle() ;
void updateFontSize();
+ void on_linkColorButton_clicked();
+ void on_resetButton_clicked();
+
private:
void switch_status(MainWindow::StatusElement s,const QString& key,bool b);
+ QRgb rgbLinkColor;
+ QRgb defaultColor;
+
/** Qt Designer generated object */
Ui::AppearancePage ui;
};
diff --git a/retroshare-gui/src/gui/settings/AppearancePage.ui b/retroshare-gui/src/gui/settings/AppearancePage.ui
index 13dc7a48e..902329637 100755
--- a/retroshare-gui/src/gui/settings/AppearancePage.ui
+++ b/retroshare-gui/src/gui/settings/AppearancePage.ui
@@ -71,7 +71,92 @@
- -
+
-
+
+
+
+ 0
+ 64
+
+
+
+ Qt::NoContextMenu
+
+
+
+
+
+ Style
+
+
+
-
+
+
+
+ 150
+ 0
+
+
+
+ Choose RetroShare's interface style
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 215
+ 20
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 64
+
+
+
+ Style Sheet
+
+
+
-
+
+
+
+ 150
+ 0
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 215
+ 20
+
+
+
+
+
+
+
+ -
@@ -289,8 +374,8 @@
- 188
- 96
+ 20
+ 40
@@ -298,7 +383,62 @@
- -
+
-
+
+
+ Link Color
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Color of the links
+
+
+
+ -
+
+
+
+ 24
+ 24
+
+
+
+
+ 24
+ 24
+
+
+
+ Set link color
+
+
+
+
+
+
+ -
+
+
+ Reset to default color
+
+
+
+ :/icons/textedit/undo.png:/icons/textedit/undo.png
+
+
+
+
+
+
+ -
Status Bar
@@ -407,7 +547,7 @@
- -
+
-
Qt::Vertical
@@ -420,91 +560,6 @@
- -
-
-
-
- 0
- 64
-
-
-
- Qt::NoContextMenu
-
-
-
-
-
- Style
-
-
-
-
-
-
-
- 150
- 0
-
-
-
- Choose RetroShare's interface style
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 215
- 20
-
-
-
-
-
-
-
- -
-
-
-
- 0
- 64
-
-
-
- Style Sheet
-
-
-
-
-
-
-
- 150
- 0
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 215
- 20
-
-
-
-
-
-
-
@@ -514,6 +569,8 @@
-
+
+
+
diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp
index 887d4276f..53716b174 100644
--- a/retroshare-gui/src/gui/settings/rsharesettings.cpp
+++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp
@@ -1225,6 +1225,15 @@ void RshareSettings::setMessageFontSize(int value)
setValueToGroup("Message", "FontSize", value);
}
+void RshareSettings::setLinkColor(QRgb rgbValue)
+{
+ setValueToGroup("Chat", "LinkColor", QString::number(rgbValue));
+}
+QRgb RshareSettings::getLinkColor()
+{
+ return valueFromGroup("Chat", "LinkColor", QString::number(QColor(3, 155, 198).rgba())).toUInt();
+}
+
#ifdef RS_JSONAPI
bool RshareSettings::getJsonApiEnabled()
{
diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h
index d4b39be9a..ac000185f 100644
--- a/retroshare-gui/src/gui/settings/rsharesettings.h
+++ b/retroshare-gui/src/gui/settings/rsharesettings.h
@@ -381,6 +381,9 @@ public:
int getMessageFontSize();
void setMessageFontSize(int value);
+ void setLinkColor(QRgb rgbValue);
+ QRgb getLinkColor();
+
#ifdef RS_JSONAPI
bool getJsonApiEnabled();
void setJsonApiEnabled(bool enabled);