mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
fixed textcolor
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@449 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5e41b21cef
commit
29a74b9898
@ -44,6 +44,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QHeaderView>
|
||||
#include <QtGui/QKeyEvent>
|
||||
|
||||
/** Constructor */
|
||||
ChatDialog::ChatDialog(QWidget *parent)
|
||||
@ -52,7 +53,6 @@ ChatDialog::ChatDialog(QWidget *parent)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
setupsendActions();
|
||||
|
||||
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||
|
||||
@ -69,14 +69,15 @@ ChatDialog::ChatDialog(QWidget *parent)
|
||||
connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
||||
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||
#endif
|
||||
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||
|
||||
connect(ui.actionSend, SIGNAL(triggered()), this, SLOT(returnPressed()));
|
||||
|
||||
ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
||||
|
||||
// connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
|
||||
// this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) ));
|
||||
|
||||
//loadInitMsg();
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.msgSendList -> setRootIsDecorated( false );
|
||||
@ -114,25 +115,6 @@ void ChatDialog::msgSendListCostumPopupMenu( QPoint point )
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
/*int ChatDialog::loadInitMsg()
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
//out << std::endl;
|
||||
//out << std::endl;
|
||||
//out << std::endl;
|
||||
//out << " Welcome to:";
|
||||
//out << "<br>" << std::endl;
|
||||
//out << " Retroshare's group chat. <br>";
|
||||
|
||||
QString txt = QString::fromStdString(out.str());
|
||||
ui.msgText->setHtml(txt);
|
||||
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
void ChatDialog::insertChat()
|
||||
{
|
||||
std::list<ChatInfo> newchat;
|
||||
@ -326,11 +308,18 @@ void ChatDialog::clearOldChats()
|
||||
|
||||
void ChatDialog::setColor()
|
||||
{
|
||||
textColor = QColorDialog::getColor(Qt::black, this);
|
||||
|
||||
bool ok;
|
||||
QRgb color = QColorDialog::getRgba(ui.lineEdit->textColor().rgba(), &ok, this);
|
||||
if (ok) {
|
||||
_currentColor = QColor(color);
|
||||
ui.lineEdit->setTextColor(_currentColor);
|
||||
QPixmap pxm(24,24);
|
||||
pxm.fill(textColor);
|
||||
pxm.fill(_currentColor);
|
||||
ui.colorChatButton->setIcon(pxm);
|
||||
ui.lineEdit->setTextColor(textColor);
|
||||
}
|
||||
ui.lineEdit->setFocus();
|
||||
|
||||
}
|
||||
|
||||
void ChatDialog::getFont()
|
||||
@ -354,13 +343,10 @@ void ChatDialog::setFont()
|
||||
|
||||
}
|
||||
|
||||
void ChatDialog::setupsendActions()
|
||||
void ChatDialog::returnPressed()
|
||||
{
|
||||
QAction *a;
|
||||
|
||||
a = new QAction(this);
|
||||
a->setShortcut(Qt::CTRL + Qt::Key_S);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(sendMsg()));
|
||||
this->sendMsg();
|
||||
|
||||
}
|
||||
|
||||
@ -388,4 +374,14 @@ void ChatDialog::displayInfoChatMenu(const QPoint& pos) {
|
||||
myChatMenu.exec(mapToGlobal(pos)+QPoint(0,80));
|
||||
}
|
||||
|
||||
bool ChatDialog::keyPressed(QEvent * event)
|
||||
{
|
||||
QKeyEvent * e = static_cast<QKeyEvent *>(event);
|
||||
if ((e->key() == Qt::Key_Enter) || (e->key() == Qt::Key_Return)) {
|
||||
event->accept();
|
||||
sendMsg();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ void insertChat();
|
||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, bool show);
|
||||
void clearOldChats();
|
||||
|
||||
//int loadInitMsg();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -66,11 +65,14 @@ void toggleSendItem( QTreeWidgetItem *item, int col );
|
||||
void setFont();
|
||||
void getFont();
|
||||
|
||||
void setupsendActions();
|
||||
|
||||
void on_actionClearChat_triggered();
|
||||
void displayInfoChatMenu(const QPoint& pos);
|
||||
|
||||
void returnPressed();
|
||||
bool keyPressed(QEvent * event);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -86,6 +88,7 @@ private:
|
||||
QTreeView *msgSendList;
|
||||
|
||||
QColor textColor;
|
||||
QColor _currentColor;
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user