mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed font handling in PeersDialog.
Fixed Qt bug in PeersDialog and PopupChatDialog with a workaround. - QTextEdit::clear() does not reset the CharFormat if document contains hyperlinks that have been accessed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3652 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f430fee12d
commit
0e063f9a1b
@ -174,14 +174,11 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
|
||||
ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
||||
|
||||
_currentColor = Qt::black;
|
||||
|
||||
QPixmap pxm(16,16);
|
||||
pxm.fill(_currentColor);
|
||||
ui.colorChatButton->setIcon(pxm);
|
||||
|
||||
mCurrentColor = Qt::black;
|
||||
mCurrentFont.fromString(Settings->getChatScreenFont());
|
||||
ui.lineEdit->setFont(mCurrentFont);
|
||||
|
||||
colorChanged(mCurrentColor);
|
||||
fontChanged(mCurrentFont);
|
||||
|
||||
style.setStyleFromSettings(ChatStyle::TYPE_PUBLIC);
|
||||
|
||||
@ -203,8 +200,6 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
grpchatmenu->addAction(ui.actionMessageHistory);
|
||||
ui.menuButton->setMenu(grpchatmenu);
|
||||
|
||||
_underline = false;
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
menu->addAction(ui.actionAdd_Friend);
|
||||
menu->addAction(ui.actionAdd_Group);
|
||||
@ -1499,6 +1494,10 @@ void PeersDialog::sendMsg()
|
||||
|
||||
rsMsgs->sendPublicChat(message);
|
||||
ui.lineEdit->clear();
|
||||
// workaround for Qt bug - http://bugreports.qt.nokia.com/browse/QTBUG-2533
|
||||
// QTextEdit::clear() does not reset the CharFormat if document contains hyperlinks that have been accessed.
|
||||
ui.lineEdit->setCurrentCharFormat(QTextCharFormat ());
|
||||
|
||||
setFont();
|
||||
|
||||
/* redraw send list */
|
||||
@ -1598,22 +1597,39 @@ void PeersDialog::insertSendList()
|
||||
|
||||
void PeersDialog::setColor()
|
||||
{
|
||||
|
||||
bool ok;
|
||||
QRgb color = QColorDialog::getRgba(ui.lineEdit->textColor().rgba(), &ok, this);
|
||||
if (ok) {
|
||||
_currentColor = QColor(color);
|
||||
QPixmap pxm(16,16);
|
||||
pxm.fill(_currentColor);
|
||||
ui.colorChatButton->setIcon(pxm);
|
||||
mCurrentColor = QColor(color);
|
||||
colorChanged(mCurrentColor);
|
||||
}
|
||||
setFont();
|
||||
}
|
||||
|
||||
void PeersDialog::colorChanged(const QColor &c)
|
||||
{
|
||||
QPixmap pxm(16,16);
|
||||
pxm.fill(mCurrentColor);
|
||||
ui.colorChatButton->setIcon(pxm);
|
||||
}
|
||||
|
||||
void PeersDialog::getFont()
|
||||
{
|
||||
bool ok;
|
||||
mCurrentFont = QFontDialog::getFont(&ok, mCurrentFont, this);
|
||||
if (ok) {
|
||||
fontChanged(mCurrentFont);
|
||||
}
|
||||
}
|
||||
|
||||
void PeersDialog::fontChanged(const QFont &font)
|
||||
{
|
||||
mCurrentFont = font;
|
||||
|
||||
ui.textboldChatButton->setChecked(mCurrentFont.bold());
|
||||
ui.textunderlineChatButton->setChecked(mCurrentFont.underline());
|
||||
ui.textitalicChatButton->setChecked(mCurrentFont.italic());
|
||||
|
||||
setFont();
|
||||
}
|
||||
|
||||
@ -1623,20 +1639,12 @@ void PeersDialog::setFont()
|
||||
mCurrentFont.setUnderline(ui.textunderlineChatButton->isChecked());
|
||||
mCurrentFont.setItalic(ui.textitalicChatButton->isChecked());
|
||||
ui.lineEdit->setFont(mCurrentFont);
|
||||
ui.lineEdit->setTextColor(_currentColor);
|
||||
ui.lineEdit->setTextColor(mCurrentColor);
|
||||
Settings->setChatScreenFont(mCurrentFont.toString());
|
||||
|
||||
ui.lineEdit->setFocus();
|
||||
|
||||
}
|
||||
|
||||
void PeersDialog::underline()
|
||||
{
|
||||
_underline = !_underline;
|
||||
ui.lineEdit->setFontUnderline(_underline);
|
||||
}
|
||||
|
||||
|
||||
// Update Chat Info information
|
||||
void PeersDialog::setChatInfo(QString info, QColor color)
|
||||
{
|
||||
|
@ -144,7 +144,6 @@ private slots:
|
||||
|
||||
void setFont();
|
||||
void getFont();
|
||||
void underline();
|
||||
|
||||
void changeAvatarClicked();
|
||||
void getAvatar();
|
||||
@ -175,6 +174,9 @@ private:
|
||||
void processSettings(bool bLoad);
|
||||
void addChatMsg(bool incoming, bool history, QString &name, QDateTime &recvTime, QString &message);
|
||||
|
||||
void colorChanged(const QColor &c);
|
||||
void fontChanged(const QFont &font);
|
||||
|
||||
class QLabel *iconLabel, *textLabel;
|
||||
class QWidget *widget;
|
||||
class QWidgetAction *widgetAction;
|
||||
@ -201,8 +203,7 @@ private:
|
||||
IMHistoryKeeper historyKeeper;
|
||||
ChatStyle style;
|
||||
|
||||
QColor _currentColor;
|
||||
bool _underline;
|
||||
QColor mCurrentColor;
|
||||
time_t last_status_send_time ;
|
||||
|
||||
QFont mCurrentFont; /* how the text will come out */
|
||||
|
@ -761,6 +761,10 @@ void PopupChatDialog::sendChat()
|
||||
}
|
||||
|
||||
chatWidget->clear();
|
||||
// workaround for Qt bug - http://bugreports.qt.nokia.com/browse/QTBUG-2533
|
||||
// QTextEdit::clear() does not reset the CharFormat if document contains hyperlinks that have been accessed.
|
||||
chatWidget->setCurrentCharFormat(QTextCharFormat ());
|
||||
|
||||
setFont();
|
||||
|
||||
/* redraw send list */
|
||||
|
Loading…
Reference in New Issue
Block a user