chat-blinking if invisible and message received
This commit is contained in:
@@ -26,7 +26,6 @@ using namespace std;
|
||||
|
||||
Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
|
||||
{
|
||||
|
||||
myW->setChat(this);
|
||||
|
||||
}
|
||||
@@ -43,4 +42,18 @@ void Chat::sendMessage() {
|
||||
myW->lineEdit_ChatInput->setText("");
|
||||
}
|
||||
|
||||
void Chat::receiveMessage(std::string message) { myW->textBrowser_Chat->append(QString::fromUtf8(message.c_str())); }
|
||||
void Chat::receiveMessage(std::string message) {
|
||||
|
||||
myW->textBrowser_Chat->append(QString::fromUtf8(message.c_str()));
|
||||
checkInvisible();
|
||||
}
|
||||
|
||||
void Chat::checkInvisible() {
|
||||
|
||||
switch (myW->tabWidget->currentIndex()) {
|
||||
|
||||
case 1: { myW->tabWidget->stopBlinkChatTab(); }
|
||||
break;
|
||||
default: { myW->tabWidget->startBlinkChatTab(); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
|
||||
class mainWindowImpl;
|
||||
|
||||
class Chat : public QObject
|
||||
@@ -42,12 +43,15 @@ public slots:
|
||||
|
||||
void sendMessage();
|
||||
void receiveMessage(std::string);
|
||||
|
||||
void checkInvisible();
|
||||
|
||||
private:
|
||||
|
||||
mainWindowImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
|
||||
|
||||
friend class GuiWrapper;
|
||||
};
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect ( horizontalSlider_speed, SIGNAL( valueChanged(int)), this, SLOT ( setGameSpeed(int) ) );
|
||||
connect ( pushButton_break, SIGNAL( clicked()), this, SLOT ( breakButtonClicked() ) ); // auch wieder starten!!!!
|
||||
|
||||
connect( tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( setChatFocus() ) );
|
||||
connect( tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( tabSwitchAction() ) );
|
||||
connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) );
|
||||
|
||||
//Nachrichten Thread-Save
|
||||
@@ -2457,7 +2457,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||
if (event->key() == Qt::Key_F10) { switchLeftToolBox(); }
|
||||
if (event->key() == Qt::Key_F11) { switchRightToolBox(); }
|
||||
// if (event->key() == Qt::Key_F) { switchFullscreen(); } //f
|
||||
// if (event->key() == Qt::Key_S) { showMyCards(); } //f
|
||||
// if (event->key() == Qt::Key_S) { myChat->checkInvisible(); } //f
|
||||
if (event->key() == 16777249) {
|
||||
pushButton_break->click();
|
||||
ctrlPressed = TRUE;
|
||||
@@ -2511,11 +2511,17 @@ void mainWindowImpl::blinkingStartButtonAnimationAction() {
|
||||
|
||||
void mainWindowImpl::sendChatMessage() { myChat->sendMessage(); }
|
||||
|
||||
void mainWindowImpl::setChatFocus() {
|
||||
void mainWindowImpl::tabSwitchAction() {
|
||||
|
||||
if(tabWidget->currentIndex() == 1) lineEdit_ChatInput->setFocus();
|
||||
else lineEdit_ChatInput->clearFocus();
|
||||
switch(tabWidget->currentIndex()) {
|
||||
|
||||
case 1: { lineEdit_ChatInput->setFocus();
|
||||
myChat->checkInvisible();
|
||||
}
|
||||
break;
|
||||
default: { lineEdit_ChatInput->clearFocus(); }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void mainWindowImpl::closeEvent(QCloseEvent *event) {
|
||||
|
||||
@@ -237,7 +237,7 @@ public slots:
|
||||
void paintStartSplash();
|
||||
|
||||
void sendChatMessage();
|
||||
void setChatFocus();
|
||||
void tabSwitchAction();
|
||||
|
||||
void networkError(int, int);
|
||||
void networkStart(boost::shared_ptr<Game> game);
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// C++ Implementation: MyRightTabWidget
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "myrighttabwidget.h"
|
||||
|
||||
// using namespace std;
|
||||
|
||||
MyRightTabWidget::MyRightTabWidget(QGroupBox *parent)
|
||||
: QTabWidget(parent), chatBlinkTimer(0), myTabBar(0)
|
||||
{
|
||||
// fadeOutTimer = new QTimer;
|
||||
// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame()));
|
||||
myTabBar = this->tabBar();
|
||||
|
||||
chatBlinkTimer = new QTimer;
|
||||
connect(chatBlinkTimer, SIGNAL(timeout()), this, SLOT( blinkChatTab() ));
|
||||
}
|
||||
|
||||
|
||||
MyRightTabWidget::~MyRightTabWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void MyRightTabWidget::startBlinkChatTab() { chatBlinkTimer->start(500); }
|
||||
void MyRightTabWidget::stopBlinkChatTab() { chatBlinkTimer->stop(); }
|
||||
|
||||
void MyRightTabWidget::blinkChatTab() {
|
||||
|
||||
if(myTabBar->tabTextColor(1).red() == 240) myTabBar->setTabTextColor(1, QColor(113,162,0));
|
||||
else myTabBar->setTabTextColor(1, QColor(240,240,240));
|
||||
}
|
||||
|
||||
void MyRightTabWidget::paintEvent(QPaintEvent * event) {
|
||||
|
||||
QTabWidget::paintEvent(event);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// C++ Interface: MyRightTabWidget
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef MYRIGHTTABWIDGET_H
|
||||
#define MYRIGHTTABWIDGET_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtCore>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class MyRightTabWidget : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MyRightTabWidget(QGroupBox*);
|
||||
|
||||
~MyRightTabWidget();
|
||||
|
||||
|
||||
void paintEvent(QPaintEvent * event);
|
||||
void startBlinkChatTab();
|
||||
void stopBlinkChatTab();
|
||||
|
||||
public slots:
|
||||
|
||||
void blinkChatTab();
|
||||
|
||||
private:
|
||||
|
||||
QTimer *chatBlinkTimer;
|
||||
QTabBar *myTabBar;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user