mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-05 13:19:32 -04:00
Fixed choose of the font in PopupChatDialog with the font dialog.
New class RsharePeerSettings and a global variable PeerSettings for read and write settings of a peer (gpg id). Save font and color in PopupChatDialog. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3464 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7c126f24ba
commit
cbdb717e51
12 changed files with 279 additions and 35 deletions
|
@ -64,7 +64,7 @@ void ChatStyle::styleChanged(int styleType)
|
|||
}
|
||||
}
|
||||
|
||||
bool ChatStyle::setStylePath(QString stylePath, QString styleVariant)
|
||||
bool ChatStyle::setStylePath(const QString &stylePath, const QString &styleVariant)
|
||||
{
|
||||
m_styleType = TYPE_UNKNOWN;
|
||||
|
||||
|
@ -572,7 +572,7 @@ static QString getBaseDir()
|
|||
return true;
|
||||
}
|
||||
|
||||
/*static*/ bool ChatStyle::getAvailableVariants(QString stylePath, QStringList &variants)
|
||||
/*static*/ bool ChatStyle::getAvailableVariants(const QString &stylePath, QStringList &variants)
|
||||
{
|
||||
variants.clear();
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
/* Default destructor */
|
||||
~ChatStyle();
|
||||
|
||||
bool setStylePath(QString stylePath, QString styleVariant);
|
||||
bool setStylePath(const QString &stylePath, const QString &styleVariant);
|
||||
bool setStyleFromSettings(enumStyleType styleType);
|
||||
void loadEmoticons();
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
void showSmileyWidget(QWidget *parent, QWidget *button, const char *slotAddMethod);
|
||||
static bool getAvailableStyles(enumStyleType styleType, QList<ChatStyleInfo> &styles);
|
||||
static bool getAvailableVariants(QString stylePath, QStringList &variants);
|
||||
static bool getAvailableVariants(const QString &stylePath, QStringList &variants);
|
||||
|
||||
private slots:
|
||||
void styleChanged(int styleType);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <retroshare/rsstatus.h>
|
||||
#include <retroshare/rsiface.h>
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/settings/RsharePeerSettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "../RsAutoUpdatePage.h"
|
||||
|
||||
|
@ -145,7 +146,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
|||
//ui.textBrowser->setOpenExternalLinks ( false );
|
||||
//ui.textBrowser->setOpenLinks ( false );
|
||||
|
||||
QString title = tr("RetroShare - ") + QString::fromStdString(name) ;
|
||||
QString title = tr("RetroShare - ") + QString::fromStdString(name);
|
||||
setWindowTitle(title);
|
||||
|
||||
setWindowIcon(QIcon(IMAGE_WINDOW));
|
||||
|
@ -173,11 +174,11 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
|||
//toolmenu->addAction(ui.action_Disable_Emoticons);
|
||||
ui.pushtoolsButton->setMenu(toolmenu);
|
||||
|
||||
mCurrentColor = Qt::black;
|
||||
mCurrentFont = QFont("Comic Sans MS", 10);
|
||||
mCurrentColor.setNamedColor(PeerSettings->getPrivateChatColor(dialogId));
|
||||
mCurrentFont.fromString(PeerSettings->getPrivateChatFont(dialogId));
|
||||
|
||||
colorChanged(mCurrentColor);
|
||||
setFont();
|
||||
fontChanged(mCurrentFont);
|
||||
|
||||
pasteLinkAct = new QAction(QIcon(":/images/pasterslink.png"), tr( "Paste retroshare Link" ), this );
|
||||
connect( pasteLinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) );
|
||||
|
@ -667,10 +668,11 @@ void PopupChatDialog::on_closeInfoFrameButton_clicked()
|
|||
|
||||
void PopupChatDialog::setColor()
|
||||
{
|
||||
bool ok;
|
||||
bool ok;
|
||||
QRgb color = QColorDialog::getRgba(ui.chattextEdit->textColor().rgba(), &ok, this);
|
||||
if (ok) {
|
||||
mCurrentColor = QColor(color);
|
||||
PeerSettings->setPrivateChatColor(dialogId, mCurrentColor.name());
|
||||
colorChanged(mCurrentColor);
|
||||
}
|
||||
setFont();
|
||||
|
@ -686,25 +688,35 @@ void PopupChatDialog::colorChanged(const QColor &c)
|
|||
void PopupChatDialog::getFont()
|
||||
{
|
||||
bool ok;
|
||||
mCurrentFont = QFontDialog::getFont(&ok, mCurrentFont, this);
|
||||
QFont font = QFontDialog::getFont(&ok, mCurrentFont, this);
|
||||
if (ok) {
|
||||
fontChanged(font);
|
||||
}
|
||||
}
|
||||
|
||||
void PopupChatDialog::fontChanged(const QFont &font)
|
||||
{
|
||||
mCurrentFont = font;
|
||||
|
||||
ui.textboldButton->setChecked(mCurrentFont.bold());
|
||||
ui.textunderlineButton->setChecked(mCurrentFont.underline());
|
||||
ui.textitalicButton->setChecked(mCurrentFont.italic());
|
||||
|
||||
setFont();
|
||||
}
|
||||
|
||||
void PopupChatDialog::setFont()
|
||||
{
|
||||
mCurrentFont.setBold(ui.textboldButton->isChecked());
|
||||
mCurrentFont.setUnderline(ui.textunderlineButton->isChecked());
|
||||
mCurrentFont.setItalic(ui.textitalicButton->isChecked());
|
||||
|
||||
// mCurrentFont.setBold(ui.textboldButton->isChecked());
|
||||
bool flag;
|
||||
flag=ui.textboldButton->isChecked();
|
||||
mCurrentFont.setBold(flag);
|
||||
mCurrentFont.setUnderline(ui.textunderlineButton->isChecked());
|
||||
mCurrentFont.setItalic(ui.textitalicButton->isChecked());
|
||||
ui.chattextEdit->setFont(mCurrentFont);
|
||||
ui.chattextEdit->setTextColor(mCurrentColor);
|
||||
|
||||
ui.chattextEdit->setFont(mCurrentFont);
|
||||
ui.chattextEdit->setTextColor(mCurrentColor);
|
||||
|
||||
ui.chattextEdit->setFocus();
|
||||
ui.chattextEdit->setFocus();
|
||||
|
||||
PeerSettings->setPrivateChatFont(dialogId, mCurrentFont.toString());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -115,6 +115,7 @@ private slots:
|
|||
private:
|
||||
|
||||
void colorChanged(const QColor &c);
|
||||
void fontChanged(const QFont &font);
|
||||
void addAttachment(std::string,int flag);
|
||||
void processSettings(bool bLoad);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue