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,15 +44,15 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <QtGui/QKeyEvent>
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
ChatDialog::ChatDialog(QWidget *parent)
|
ChatDialog::ChatDialog(QWidget *parent)
|
||||||
: MainPage(parent)
|
: MainPage (parent)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
setupsendActions();
|
|
||||||
|
|
||||||
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||||
|
|
||||||
@ -69,14 +69,15 @@ ChatDialog::ChatDialog(QWidget *parent)
|
|||||||
connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
||||||
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||||
#endif
|
#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")));
|
ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
||||||
|
|
||||||
// connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
|
// connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
|
||||||
// this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) ));
|
// this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) ));
|
||||||
|
|
||||||
//loadInitMsg();
|
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.msgSendList -> setRootIsDecorated( false );
|
ui.msgSendList -> setRootIsDecorated( false );
|
||||||
@ -114,25 +115,6 @@ void ChatDialog::msgSendListCostumPopupMenu( QPoint point )
|
|||||||
contextMnu.exec( mevent->globalPos() );
|
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()
|
void ChatDialog::insertChat()
|
||||||
{
|
{
|
||||||
std::list<ChatInfo> newchat;
|
std::list<ChatInfo> newchat;
|
||||||
@ -326,11 +308,18 @@ void ChatDialog::clearOldChats()
|
|||||||
|
|
||||||
void ChatDialog::setColor()
|
void ChatDialog::setColor()
|
||||||
{
|
{
|
||||||
textColor = QColorDialog::getColor(Qt::black, this);
|
|
||||||
QPixmap pxm(24,24);
|
bool ok;
|
||||||
pxm.fill(textColor);
|
QRgb color = QColorDialog::getRgba(ui.lineEdit->textColor().rgba(), &ok, this);
|
||||||
ui.colorChatButton->setIcon(pxm);
|
if (ok) {
|
||||||
ui.lineEdit->setTextColor(textColor);
|
_currentColor = QColor(color);
|
||||||
|
ui.lineEdit->setTextColor(_currentColor);
|
||||||
|
QPixmap pxm(24,24);
|
||||||
|
pxm.fill(_currentColor);
|
||||||
|
ui.colorChatButton->setIcon(pxm);
|
||||||
|
}
|
||||||
|
ui.lineEdit->setFocus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatDialog::getFont()
|
void ChatDialog::getFont()
|
||||||
@ -354,15 +343,12 @@ void ChatDialog::setFont()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatDialog::setupsendActions()
|
void ChatDialog::returnPressed()
|
||||||
{
|
{
|
||||||
QAction *a;
|
|
||||||
|
|
||||||
a = new QAction(this);
|
this->sendMsg();
|
||||||
a->setShortcut(Qt::CTRL + Qt::Key_S);
|
|
||||||
connect(a, SIGNAL(triggered()), this, SLOT(sendMsg()));
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update Chat Info information
|
// Update Chat Info information
|
||||||
void ChatDialog::setChatInfo(QString info, QColor color) {
|
void ChatDialog::setChatInfo(QString info, QColor color) {
|
||||||
@ -388,4 +374,14 @@ void ChatDialog::displayInfoChatMenu(const QPoint& pos) {
|
|||||||
myChatMenu.exec(mapToGlobal(pos)+QPoint(0,80));
|
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;
|
||||||
|
}
|
||||||
|
@ -43,8 +43,7 @@ public:
|
|||||||
void insertChat();
|
void insertChat();
|
||||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, bool show);
|
PopupChatDialog *getPrivateChat(std::string id, std::string name, bool show);
|
||||||
void clearOldChats();
|
void clearOldChats();
|
||||||
|
|
||||||
//int loadInitMsg();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@ -66,11 +65,14 @@ void toggleSendItem( QTreeWidgetItem *item, int col );
|
|||||||
void setFont();
|
void setFont();
|
||||||
void getFont();
|
void getFont();
|
||||||
|
|
||||||
void setupsendActions();
|
|
||||||
|
|
||||||
void on_actionClearChat_triggered();
|
void on_actionClearChat_triggered();
|
||||||
void displayInfoChatMenu(const QPoint& pos);
|
void displayInfoChatMenu(const QPoint& pos);
|
||||||
|
|
||||||
|
void returnPressed();
|
||||||
|
bool keyPressed(QEvent * event);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -85,7 +87,8 @@ private:
|
|||||||
|
|
||||||
QTreeView *msgSendList;
|
QTreeView *msgSendList;
|
||||||
|
|
||||||
QColor textColor;
|
QColor textColor;
|
||||||
|
QColor _currentColor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user