mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 23:25:32 -04:00
The standard font is now used for new chat lobbies.
Added a new menu item to set the font of a private chat and chat lobby to the default font. Fixed german language. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4926 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f441f4a407
commit
d828d23ca7
9 changed files with 215 additions and 186 deletions
|
@ -71,13 +71,14 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
connect(ui->textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(ui->textitalicButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(ui->attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture()));
|
||||
connect(ui->fontButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
||||
connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||
connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(chooseColor()));
|
||||
connect(ui->emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget()));
|
||||
connect(ui->actionSaveChatHistory, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
|
||||
connect(ui->actionClearChatHistory, SIGNAL(triggered()), this, SLOT(clearChatHistory()));
|
||||
connect(ui->actionDeleteChatHistory, SIGNAL(triggered()), this, SLOT(deleteChatHistory()));
|
||||
connect(ui->actionMessageHistory, SIGNAL(triggered()), this, SLOT(messageHistory()));
|
||||
connect(ui->actionChooseFont, SIGNAL(triggered()), this, SLOT(chooseFont()));
|
||||
connect(ui->actionResetFont, SIGNAL(triggered()), this, SLOT(resetFont()));
|
||||
|
||||
connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
||||
|
||||
|
@ -89,27 +90,22 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
ui->infoframe->setVisible(false);
|
||||
ui->statusmessagelabel->hide();
|
||||
|
||||
ui->textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png")));
|
||||
ui->textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png")));
|
||||
ui->textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png")));
|
||||
ui->fontButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
||||
ui->emoteiconButton->setIcon(QIcon(QString(":/images/emoticons/kopete/kopete020.png")));
|
||||
|
||||
ui->textboldButton->setCheckable(true);
|
||||
ui->textunderlineButton->setCheckable(true);
|
||||
ui->textitalicButton->setCheckable(true);
|
||||
|
||||
setAcceptDrops(true);
|
||||
ui->chattextEdit->setAcceptDrops(false);
|
||||
ui->hashBox->setDropWidget(this);
|
||||
ui->hashBox->setAutoHide(true);
|
||||
|
||||
QMenu *toolmenu = new QMenu();
|
||||
toolmenu->addAction(ui->actionClearChatHistory);
|
||||
toolmenu->addAction(ui->actionDeleteChatHistory);
|
||||
toolmenu->addAction(ui->actionSaveChatHistory);
|
||||
toolmenu->addAction(ui->actionMessageHistory);
|
||||
ui->pushtoolsButton->setMenu(toolmenu);
|
||||
QMenu *menu = new QMenu();
|
||||
menu->addAction(ui->actionChooseFont);
|
||||
menu->addAction(ui->actionResetFont);
|
||||
ui->fontButton->setMenu(menu);
|
||||
|
||||
menu = new QMenu();
|
||||
menu->addAction(ui->actionClearChatHistory);
|
||||
menu->addAction(ui->actionDeleteChatHistory);
|
||||
menu->addAction(ui->actionSaveChatHistory);
|
||||
menu->addAction(ui->actionMessageHistory);
|
||||
ui->pushtoolsButton->setMenu(menu);
|
||||
|
||||
ui->chattextEdit->installEventFilter(this);
|
||||
|
||||
|
@ -148,8 +144,9 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
|||
currentColor.setNamedColor(PeerSettings->getPrivateChatColor(peerId));
|
||||
currentFont.fromString(PeerSettings->getPrivateChatFont(peerId));
|
||||
|
||||
colorChanged(currentColor);
|
||||
fontChanged(currentFont);
|
||||
colorChanged();
|
||||
fontChanged();
|
||||
setColorAndFont();
|
||||
|
||||
// load style
|
||||
PeerSettings->getStyle(peerId, "ChatWidget", style);
|
||||
|
@ -407,7 +404,7 @@ void ChatWidget::sendChat()
|
|||
// QTextEdit::clear() does not reset the CharFormat if document contains hyperlinks that have been accessed.
|
||||
chatWidget->setCurrentCharFormat(QTextCharFormat ());
|
||||
|
||||
setFont();
|
||||
setColorAndFont();
|
||||
}
|
||||
|
||||
void ChatWidget::on_closeInfoFrameButton_clicked()
|
||||
|
@ -415,46 +412,51 @@ void ChatWidget::on_closeInfoFrameButton_clicked()
|
|||
ui->infoframe->setVisible(false);
|
||||
}
|
||||
|
||||
void ChatWidget::setColor()
|
||||
void ChatWidget::chooseColor()
|
||||
{
|
||||
bool ok;
|
||||
QRgb color = QColorDialog::getRgba(ui->chattextEdit->textColor().rgba(), &ok, window());
|
||||
if (ok) {
|
||||
currentColor = QColor(color);
|
||||
PeerSettings->setPrivateChatColor(peerId, currentColor.name());
|
||||
colorChanged(currentColor);
|
||||
colorChanged();
|
||||
setColorAndFont();
|
||||
}
|
||||
setFont();
|
||||
}
|
||||
|
||||
void ChatWidget::colorChanged(const QColor &c)
|
||||
void ChatWidget::colorChanged()
|
||||
{
|
||||
QPixmap pix(16, 16);
|
||||
pix.fill(c);
|
||||
pix.fill(currentColor);
|
||||
ui->colorButton->setIcon(pix);
|
||||
}
|
||||
|
||||
void ChatWidget::getFont()
|
||||
void ChatWidget::chooseFont()
|
||||
{
|
||||
bool ok;
|
||||
QFont font = QFontDialog::getFont(&ok, currentFont, this);
|
||||
if (ok) {
|
||||
fontChanged(font);
|
||||
currentFont = font;
|
||||
fontChanged();
|
||||
setFont();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatWidget::fontChanged(const QFont &font)
|
||||
void ChatWidget::resetFont()
|
||||
{
|
||||
currentFont = font;
|
||||
|
||||
ui->textboldButton->setChecked(currentFont.bold());
|
||||
ui->textunderlineButton->setChecked(currentFont.underline());
|
||||
ui->textitalicButton->setChecked(currentFont.italic());
|
||||
|
||||
currentFont.fromString(Settings->getChatScreenFont());
|
||||
fontChanged();
|
||||
setFont();
|
||||
}
|
||||
|
||||
void ChatWidget::setFont()
|
||||
void ChatWidget::fontChanged()
|
||||
{
|
||||
ui->textboldButton->setChecked(currentFont.bold());
|
||||
ui->textunderlineButton->setChecked(currentFont.underline());
|
||||
ui->textitalicButton->setChecked(currentFont.italic());
|
||||
}
|
||||
|
||||
void ChatWidget::setColorAndFont()
|
||||
{
|
||||
currentFont.setBold(ui->textboldButton->isChecked());
|
||||
currentFont.setUnderline(ui->textunderlineButton->isChecked());
|
||||
|
@ -464,7 +466,11 @@ void ChatWidget::setFont()
|
|||
ui->chattextEdit->setTextColor(currentColor);
|
||||
|
||||
ui->chattextEdit->setFocus();
|
||||
}
|
||||
|
||||
void ChatWidget::setFont()
|
||||
{
|
||||
setColorAndFont();
|
||||
PeerSettings->setPrivateChatFont(peerId, currentFont.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -101,8 +101,9 @@ private slots:
|
|||
void addExtraPicture();
|
||||
void on_closeInfoFrameButton_clicked();
|
||||
|
||||
void setColor();
|
||||
void getFont();
|
||||
void chooseColor();
|
||||
void chooseFont();
|
||||
void resetFont();
|
||||
void setFont();
|
||||
|
||||
void sendChat();
|
||||
|
@ -117,8 +118,9 @@ private:
|
|||
void updateStatusTyping();
|
||||
void setCurrentFileName(const QString &fileName);
|
||||
|
||||
void colorChanged(const QColor &c);
|
||||
void fontChanged(const QFont &font);
|
||||
void colorChanged();
|
||||
void fontChanged();
|
||||
void setColorAndFont();
|
||||
void processSettings(bool load);
|
||||
|
||||
std::string peerId;
|
||||
|
|
|
@ -288,6 +288,10 @@ background: white;}</string>
|
|||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
|
@ -319,8 +323,12 @@ background: white;}</string>
|
|||
<property name="toolTip">
|
||||
<string>Bold</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit-bold.png</normaloff>:/images/edit-bold.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
|
@ -347,8 +355,12 @@ background: white;}</string>
|
|||
<property name="toolTip">
|
||||
<string>Underline</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit-underline.png</normaloff>:/images/edit-underline.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
|
@ -375,8 +387,12 @@ background: white;}</string>
|
|||
<property name="toolTip">
|
||||
<string>Italic</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit-italic.png</normaloff>:/images/edit-italic.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
|
@ -387,13 +403,13 @@ background: white;}</string>
|
|||
<widget class="QToolButton" name="fontButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<width>32</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<width>32</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -403,8 +419,12 @@ background: white;}</string>
|
|||
<property name="toolTip">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/fonts.png</normaloff>:/images/fonts.png</iconset>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
|
@ -456,9 +476,6 @@ background: white;}</string>
|
|||
<property name="toolTip">
|
||||
<string>Attach a Picture</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
||||
|
@ -488,9 +505,6 @@ background: white;}</string>
|
|||
<property name="toolTip">
|
||||
<string>Add a File for your Friend</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
|
@ -507,7 +521,7 @@ background: white;}</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushtoolsButton">
|
||||
<widget class="QToolButton" name="pushtoolsButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
|
@ -523,24 +537,6 @@ background: white;}</string>
|
|||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton::menu-indicator {
|
||||
subcontrol-origin: padding;
|
||||
subcontrol-position: bottom right;
|
||||
}
|
||||
|
||||
QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open {
|
||||
position: relative;
|
||||
top: 1px; left: 1px; /* shift the arrow by 2 px */
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
border: 1px solid #CCCCCC;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/configure.png</normaloff>:/images/configure.png</iconset>
|
||||
|
@ -551,7 +547,10 @@ border: 1px solid #CCCCCC;
|
|||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -651,6 +650,16 @@ border: 1px solid #CCCCCC;
|
|||
<string>Deletes all stored and displayed chat history</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionChooseFont">
|
||||
<property name="text">
|
||||
<string>Choose font</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionResetFont">
|
||||
<property name="text">
|
||||
<string>Reset font to default</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue