add timeoutanimation for network player actions

This commit is contained in:
doitux
2007-05-29 21:31:30 +00:00
parent ccb339be04
commit ba82acbd06
6 changed files with 565 additions and 428 deletions
+2
View File
@@ -113,6 +113,7 @@ HEADERS += src/game.h \
src/engine/network_engine/clientturn.h \
src/gui/qt/mainwindow/mainwindowimpl.h \
src/gui/qt/mainwindow/mycardspixmaplabel.h \
src/gui/qt/mainwindow/mysetlabel.h \
src/gui/qt/mainwindow/myrighttabwidget.h \
src/gui/qt/mainwindow/mylefttabwidget.h \
src/gui/qt/mainwindow/startsplash/startsplash.h \
@@ -205,6 +206,7 @@ SOURCES += src/game.cpp \
src/gui/qt/guiwrapper.cpp \
src/gui/qt/mainwindow/mainwindowimpl.cpp \
src/gui/qt/mainwindow/mycardspixmaplabel.cpp \
src/gui/qt/mainwindow/mysetlabel.cpp \
src/gui/qt/mainwindow/myrighttabwidget.cpp \
src/gui/qt/mainwindow/mylefttabwidget.cpp \
src/gui/qt/mainwindow/startsplash/startsplash.cpp \
+431 -426
View File
@@ -1610,118 +1610,6 @@
<bool>true</bool>
</property>
</widget>
<widget class="QFrame" name="frame_Cards0" >
<property name="geometry" >
<rect>
<x>95</x>
<y>40</y>
<width>118</width>
<height>111</height>
</rect>
</property>
<widget class="QLabel" name="textLabel_Status0" >
<property name="geometry" >
<rect>
<x>9</x>
<y>35</y>
<width>100</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags" >
<enum>Qt::NoTextInteraction</enum>
</property>
</widget>
</widget>
<widget class="QLabel" name="textLabel_Set0" >
<property name="geometry" >
<rect>
<x>95</x>
<y>20</y>
<width>118</width>
<height>16</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName0" >
<property name="geometry" >
<rect>
@@ -1799,6 +1687,118 @@
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
<widget class="QFrame" name="frame_Cards0" >
<property name="geometry" >
<rect>
<x>95</x>
<y>40</y>
<width>118</width>
<height>111</height>
</rect>
</property>
<widget class="QLabel" name="textLabel_Status0" >
<property name="geometry" >
<rect>
<x>9</x>
<y>35</y>
<width>100</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags" >
<enum>Qt::NoTextInteraction</enum>
</property>
</widget>
</widget>
<widget class="MySetLabel" name="textLabel_Set0" >
<property name="geometry" >
<rect>
<x>95</x>
<y>20</y>
<width>118</width>
<height>16</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
</widget>
</item>
<item>
@@ -3052,7 +3052,84 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="textLabel_Set1" >
<widget class="QLabel" name="label_PlayerName1" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="MySetLabel" name="textLabel_Set1" >
<property name="geometry" >
<rect>
<x>85</x>
@@ -3132,83 +3209,6 @@
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName1" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</widget>
</item>
</layout>
@@ -4283,7 +4283,84 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="textLabel_Set6" >
<widget class="QLabel" name="label_PlayerName6" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="MySetLabel" name="textLabel_Set6" >
<property name="geometry" >
<rect>
<x>85</x>
@@ -4363,83 +4440,6 @@
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName6" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</widget>
</item>
</layout>
@@ -4776,7 +4776,7 @@
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Set2" >
<widget class="MySetLabel" name="textLabel_Set2" >
<property name="geometry" >
<rect>
<x>85</x>
@@ -5106,7 +5106,84 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="textLabel_Set3" >
<widget class="QLabel" name="label_PlayerName3" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="MySetLabel" name="textLabel_Set3" >
<property name="geometry" >
<rect>
<x>85</x>
@@ -5186,83 +5263,6 @@
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName3" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</widget>
</item>
<item>
@@ -5590,7 +5590,7 @@
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Set4" >
<widget class="MySetLabel" name="textLabel_Set4" >
<property name="geometry" >
<rect>
<x>85</x>
@@ -5920,7 +5920,84 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="textLabel_Set5" >
<widget class="QLabel" name="label_PlayerName5" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="MySetLabel" name="textLabel_Set5" >
<property name="geometry" >
<rect>
<x>85</x>
@@ -6000,83 +6077,6 @@
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName5" >
<property name="geometry" >
<rect>
<x>85</x>
<y>17</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>199</red>
<green>199</green>
<blue>199</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</widget>
</item>
<item>
@@ -6174,6 +6174,11 @@
<extends>QTabWidget</extends>
<header>mylefttabwidget.h</header>
</customwidget>
<customwidget>
<class>MySetLabel</class>
<extends>QLabel</extends>
<header>mysetlabel.h</header>
</customwidget>
<customwidget>
<class>MyRightTabWidget</class>
<extends>QTabWidget</extends>
+3 -1
View File
@@ -32,6 +32,7 @@
#include "startsplash.h"
#include "mycardspixmaplabel.h"
#include "mysetlabel.h"
#include "playerinterface.h"
#include "boardinterface.h"
@@ -2502,7 +2503,8 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); }
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_D) { setLabelArray[0]->startTimeOutAnimation(10); } //f
if (event->key() == Qt::Key_E) { setLabelArray[0]->stopTimeOutAnimation(); } //f
if (event->key() == Qt::Key_S) { playSound(); } //s
if (event->key() == 16777249) {
pushButton_break->click();
+1 -1
View File
@@ -329,7 +329,7 @@ private:
QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
+81
View File
@@ -0,0 +1,81 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "mysetlabel.h"
// using namespace std;
MySetLabel::MySetLabel(QGroupBox* parent)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0)
{
timeOutAnimationTimer = new QTimer;
connect(timeOutAnimationTimer, SIGNAL(timeout()), this, SLOT(nextTimeOutAnimationFrame()));
// flipCardsTimer = new QTimer;
// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame()));
}
MySetLabel::~MySetLabel()
{
}
void MySetLabel::startTimeOutAnimation(int secs) {
timeOutValue = secs;
timeOutFrame = 1;
timeOutAnimationWidth = 118;
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(40);
}
void MySetLabel::stopTimeOutAnimation() {
timeOutAnimationTimer->stop();
timeOutAnimation = FALSE;
update();
}
void MySetLabel::nextTimeOutAnimationFrame() {
if(timeOutAnimationWidth >=0) {
if(timeOutFrame%(timeOutValue*25/118) == 0)
timeOutAnimationWidth--;
timeOutFrame++;
update();
}
else stopTimeOutAnimation();
}
void MySetLabel::paintEvent(QPaintEvent * event) {
if(!timeOutAnimation) {
QLabel::paintEvent(event);
}
if(timeOutAnimation) {
QPainter painter(this);
QLinearGradient linearGrad(QPointF(0, 10), QPointF(113, 10));
linearGrad.setColorAt(0, Qt::red);
linearGrad.setColorAt(0.5, Qt::yellow);
linearGrad.setColorAt(1, Qt::green);
painter.setBrush(linearGrad);
painter.setPen(QColor(0,0,0));
painter.drawRect(0,6,timeOutAnimationWidth,8);
}
}
+47
View File
@@ -0,0 +1,47 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYSETLABEL_H
#define MYSETLABEL_H
#include <QtGui>
#include <QtCore>
#include <iostream>
class MySetLabel : public QLabel
{
Q_OBJECT
public:
MySetLabel(QGroupBox*);
~MySetLabel();
void startTimeOutAnimation(int secs);
void stopTimeOutAnimation();
void paintEvent(QPaintEvent * event);
public slots:
void nextTimeOutAnimationFrame();
private:
QTimer *timeOutAnimationTimer;
bool timeOutAnimation;
int timeOutAnimationWidth;
int timeOutValue;
int timeOutFrame;
};
#endif