chat-blinking if invisible and message received
This commit is contained in:
@@ -111,6 +111,7 @@ HEADERS += src/game.h \
|
|||||||
src/engine/network_engine/clientturn.h \
|
src/engine/network_engine/clientturn.h \
|
||||||
src/gui/qt/mainwindow/mainwindowimpl.h \
|
src/gui/qt/mainwindow/mainwindowimpl.h \
|
||||||
src/gui/qt/mainwindow/mycardspixmaplabel.h \
|
src/gui/qt/mainwindow/mycardspixmaplabel.h \
|
||||||
|
src/gui/qt/mainwindow/myrighttabwidget.h \
|
||||||
src/gui/qt/mainwindow/startsplash/startsplash.h \
|
src/gui/qt/mainwindow/startsplash/startsplash.h \
|
||||||
src/gui/qt/mainwindow/log/log.h \
|
src/gui/qt/mainwindow/log/log.h \
|
||||||
src/gui/qt/mainwindow/chat/chat.h \
|
src/gui/qt/mainwindow/chat/chat.h \
|
||||||
@@ -199,6 +200,7 @@ SOURCES += src/game.cpp \
|
|||||||
src/gui/qt/guiwrapper.cpp \
|
src/gui/qt/guiwrapper.cpp \
|
||||||
src/gui/qt/mainwindow/mainwindowimpl.cpp \
|
src/gui/qt/mainwindow/mainwindowimpl.cpp \
|
||||||
src/gui/qt/mainwindow/mycardspixmaplabel.cpp \
|
src/gui/qt/mainwindow/mycardspixmaplabel.cpp \
|
||||||
|
src/gui/qt/mainwindow/myrighttabwidget.cpp \
|
||||||
src/gui/qt/mainwindow/startsplash/startsplash.cpp \
|
src/gui/qt/mainwindow/startsplash/startsplash.cpp \
|
||||||
src/gui/qt/mainwindow/log/log.cpp \
|
src/gui/qt/mainwindow/log/log.cpp \
|
||||||
src/gui/qt/mainwindow/chat/chat.cpp \
|
src/gui/qt/mainwindow/chat/chat.cpp \
|
||||||
|
|||||||
@@ -1800,10 +1800,19 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QTabWidget" name="tabWidget" >
|
<widget class="MyRightTabWidget" name="tabWidget" >
|
||||||
<property name="palette" >
|
<property name="palette" >
|
||||||
<palette>
|
<palette>
|
||||||
<active>
|
<active>
|
||||||
|
<colorrole role="WindowText" >
|
||||||
|
<brush brushstyle="SolidPattern" >
|
||||||
|
<color alpha="255" >
|
||||||
|
<red>240</red>
|
||||||
|
<green>240</green>
|
||||||
|
<blue>240</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
<colorrole role="Button" >
|
<colorrole role="Button" >
|
||||||
<brush brushstyle="SolidPattern" >
|
<brush brushstyle="SolidPattern" >
|
||||||
<color alpha="255" >
|
<color alpha="255" >
|
||||||
@@ -1815,6 +1824,15 @@
|
|||||||
</colorrole>
|
</colorrole>
|
||||||
</active>
|
</active>
|
||||||
<inactive>
|
<inactive>
|
||||||
|
<colorrole role="WindowText" >
|
||||||
|
<brush brushstyle="SolidPattern" >
|
||||||
|
<color alpha="255" >
|
||||||
|
<red>240</red>
|
||||||
|
<green>240</green>
|
||||||
|
<blue>240</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
<colorrole role="Button" >
|
<colorrole role="Button" >
|
||||||
<brush brushstyle="SolidPattern" >
|
<brush brushstyle="SolidPattern" >
|
||||||
<color alpha="255" >
|
<color alpha="255" >
|
||||||
@@ -1826,6 +1844,15 @@
|
|||||||
</colorrole>
|
</colorrole>
|
||||||
</inactive>
|
</inactive>
|
||||||
<disabled>
|
<disabled>
|
||||||
|
<colorrole role="WindowText" >
|
||||||
|
<brush brushstyle="SolidPattern" >
|
||||||
|
<color alpha="255" >
|
||||||
|
<red>128</red>
|
||||||
|
<green>128</green>
|
||||||
|
<blue>128</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
<colorrole role="Button" >
|
<colorrole role="Button" >
|
||||||
<brush brushstyle="SolidPattern" >
|
<brush brushstyle="SolidPattern" >
|
||||||
<color alpha="255" >
|
<color alpha="255" >
|
||||||
@@ -5831,6 +5858,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>MyRightTabWidget</class>
|
||||||
|
<extends>QTabWidget</extends>
|
||||||
|
<header>myrighttabwidget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>spinBox_set</tabstop>
|
<tabstop>spinBox_set</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ using namespace std;
|
|||||||
|
|
||||||
Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
|
Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
|
||||||
{
|
{
|
||||||
|
|
||||||
myW->setChat(this);
|
myW->setChat(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,4 +42,18 @@ void Chat::sendMessage() {
|
|||||||
myW->lineEdit_ChatInput->setText("");
|
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>
|
#include <QtCore>
|
||||||
|
|
||||||
|
|
||||||
class mainWindowImpl;
|
class mainWindowImpl;
|
||||||
|
|
||||||
class Chat : public QObject
|
class Chat : public QObject
|
||||||
@@ -42,12 +43,15 @@ public slots:
|
|||||||
|
|
||||||
void sendMessage();
|
void sendMessage();
|
||||||
void receiveMessage(std::string);
|
void receiveMessage(std::string);
|
||||||
|
void checkInvisible();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
mainWindowImpl *myW;
|
mainWindowImpl *myW;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
friend class GuiWrapper;
|
friend class GuiWrapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
connect ( horizontalSlider_speed, SIGNAL( valueChanged(int)), this, SLOT ( setGameSpeed(int) ) );
|
connect ( horizontalSlider_speed, SIGNAL( valueChanged(int)), this, SLOT ( setGameSpeed(int) ) );
|
||||||
connect ( pushButton_break, SIGNAL( clicked()), this, SLOT ( breakButtonClicked() ) ); // auch wieder starten!!!!
|
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() ) );
|
connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) );
|
||||||
|
|
||||||
//Nachrichten Thread-Save
|
//Nachrichten Thread-Save
|
||||||
@@ -2457,7 +2457,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
|
|||||||
if (event->key() == Qt::Key_F10) { switchLeftToolBox(); }
|
if (event->key() == Qt::Key_F10) { switchLeftToolBox(); }
|
||||||
if (event->key() == Qt::Key_F11) { switchRightToolBox(); }
|
if (event->key() == Qt::Key_F11) { switchRightToolBox(); }
|
||||||
// if (event->key() == Qt::Key_F) { switchFullscreen(); } //f
|
// 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) {
|
if (event->key() == 16777249) {
|
||||||
pushButton_break->click();
|
pushButton_break->click();
|
||||||
ctrlPressed = TRUE;
|
ctrlPressed = TRUE;
|
||||||
@@ -2511,11 +2511,17 @@ void mainWindowImpl::blinkingStartButtonAnimationAction() {
|
|||||||
|
|
||||||
void mainWindowImpl::sendChatMessage() { myChat->sendMessage(); }
|
void mainWindowImpl::sendChatMessage() { myChat->sendMessage(); }
|
||||||
|
|
||||||
void mainWindowImpl::setChatFocus() {
|
void mainWindowImpl::tabSwitchAction() {
|
||||||
|
|
||||||
if(tabWidget->currentIndex() == 1) lineEdit_ChatInput->setFocus();
|
switch(tabWidget->currentIndex()) {
|
||||||
else lineEdit_ChatInput->clearFocus();
|
|
||||||
|
|
||||||
|
case 1: { lineEdit_ChatInput->setFocus();
|
||||||
|
myChat->checkInvisible();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: { lineEdit_ChatInput->clearFocus(); }
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::closeEvent(QCloseEvent *event) {
|
void mainWindowImpl::closeEvent(QCloseEvent *event) {
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ public slots:
|
|||||||
void paintStartSplash();
|
void paintStartSplash();
|
||||||
|
|
||||||
void sendChatMessage();
|
void sendChatMessage();
|
||||||
void setChatFocus();
|
void tabSwitchAction();
|
||||||
|
|
||||||
void networkError(int, int);
|
void networkError(int, int);
|
||||||
void networkStart(boost::shared_ptr<Game> game);
|
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
|
||||||
@@ -12,61 +12,32 @@
|
|||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string>Please select an avatar</string>
|
<string>Please select an avatar</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<widget class="QListWidget" name="listWidget" >
|
||||||
<property name="margin" >
|
<property name="geometry" >
|
||||||
<number>9</number>
|
<rect>
|
||||||
|
<x>9</x>
|
||||||
|
<y>9</y>
|
||||||
|
<width>460</width>
|
||||||
|
<height>220</height>
|
||||||
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
</widget>
|
||||||
<number>6</number>
|
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>9</x>
|
||||||
|
<y>235</y>
|
||||||
|
<width>460</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" >
|
<property name="orientation" >
|
||||||
<widget class="QListWidget" name="listWidget" >
|
<enum>Qt::Horizontal</enum>
|
||||||
<property name="horizontalScrollBarPolicy" >
|
</property>
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
<property name="standardButtons" >
|
||||||
</property>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||||
<property name="iconSize" >
|
</property>
|
||||||
<size>
|
</widget>
|
||||||
<width>50</width>
|
|
||||||
<height>50</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="flow" >
|
|
||||||
<enum>QListView::TopToBottom</enum>
|
|
||||||
</property>
|
|
||||||
<property name="isWrapping" stdset="0" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="resizeMode" >
|
|
||||||
<enum>QListView::Adjust</enum>
|
|
||||||
</property>
|
|
||||||
<property name="layoutMode" >
|
|
||||||
<enum>QListView::Batched</enum>
|
|
||||||
</property>
|
|
||||||
<property name="gridSize" >
|
|
||||||
<size>
|
|
||||||
<width>70</width>
|
|
||||||
<height>70</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="viewMode" >
|
|
||||||
<enum>QListView::IconMode</enum>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" >
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons" >
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|||||||
@@ -31,10 +31,14 @@ selectAvatarDialogImpl::selectAvatarDialogImpl(QWidget *parent, ConfigFile *c)
|
|||||||
|
|
||||||
// listWidget->setViewMode(QListView::IconMode);
|
// listWidget->setViewMode(QListView::IconMode);
|
||||||
// listWidget->setIconSize(QSize(50,50));
|
// listWidget->setIconSize(QSize(50,50));
|
||||||
// listWidget->setSpacing(20);
|
|
||||||
// listWidget->setDragEnabled(FALSE);
|
|
||||||
// listWidget->setResizeMode(QListView::Adjust);
|
|
||||||
// listWidget->setLayoutDirection(Qt::LeftToRight);
|
// listWidget->setLayoutDirection(Qt::LeftToRight);
|
||||||
|
listWidget->setViewMode(QListView::IconMode);
|
||||||
|
listWidget->setIconSize(QSize(50, 50));
|
||||||
|
// listWidget->setFlow(QListView::TopToBottom);
|
||||||
|
// listWidget->setWrapping(true);
|
||||||
|
listWidget->setSpacing(20);
|
||||||
|
listWidget->setDragEnabled(FALSE);
|
||||||
|
listWidget->setResizeMode(QListView::Adjust);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<30; i++) {
|
for (i=0; i<30; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user