--- a/QTfrontend/hwform.cpp Sun Jan 15 23:14:10 2012 +0100
+++ b/QTfrontend/hwform.cpp Sun Jan 15 23:35:02 2012 +0100
@@ -220,6 +220,7 @@
connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
+ connect(ui.pageOptions->CBFrontendEffects, SIGNAL(toggled(bool)), this, SLOT(onFrontendEffects(bool)) );
connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
@@ -283,14 +284,12 @@
ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
ui.pageOptions->SchemesName->setModel(ammoSchemeModel);
- wBackground = NULL;
- if (config->isFrontendEffects()) {
- wBackground = new BGWidget(this);
- wBackground->setFixedSize(this->width(), this->height());
- wBackground->lower();
- wBackground->init();
- wBackground->startAnimation();
- }
+ wBackground = new BGWidget(this);
+ wBackground->setFixedSize(this->width(), this->height());
+ wBackground->lower();
+ wBackground->init();
+ wBackground->enabled = config->isFrontendEffects();
+ wBackground->startAnimation();
//Install all eventFilters :
@@ -365,6 +364,15 @@
}
}
+void HWForm::onFrontendEffects(bool value)
+{
+ wBackground->enabled = value;
+ if (value)
+ wBackground->startAnimation();
+ else
+ wBackground->stopAnimation();
+}
+
/*
void HWForm::keyReleaseEvent(QKeyEvent *event)
{
@@ -585,7 +593,7 @@
if (id == ID_PAGE_DRAWMAP)
stopAnim = true;
- if (frontendEffects && !stopAnim)
+ if (!stopAnim)
{
/**Start animation :**/
int coeff = 1;
@@ -597,17 +605,19 @@
QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(lastid));
ui.Pages->widget(lastid)->setGraphicsEffect(effectLast);
#endif
+ // no effects, means 0 effect duration :D
+ int duration = config->isFrontendEffects() ? 500 : 0;
//New page animation
animationNewSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
- animationNewSlide->setDuration(500);
+ animationNewSlide->setDuration(duration);
animationNewSlide->setStartValue(QPoint(width()/coeff, 0));
animationNewSlide->setEndValue(QPoint(0, 0));
animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
#ifndef Q_OS_MAC
animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
- animationNewOpacity->setDuration(500);
+ animationNewOpacity->setDuration(duration);
animationNewOpacity->setStartValue(0.01);
animationNewOpacity->setEndValue(1);
animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -617,14 +627,14 @@
ui.Pages->widget(lastid)->setHidden(false);
animationOldSlide = new QPropertyAnimation(ui.Pages->widget(lastid), "pos");
- animationOldSlide->setDuration(500);
+ animationOldSlide->setDuration(duration);
animationOldSlide->setStartValue(QPoint(0, 0));
animationOldSlide->setEndValue(QPoint(-width()/coeff, 0));
animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
#ifndef Q_OS_MAC
animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
- animationOldOpacity->setDuration(500);
+ animationOldOpacity->setDuration(duration);
animationOldOpacity->setStartValue(1);
animationOldOpacity->setEndValue(0.01);
animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -692,7 +702,7 @@
/**Start animation :**/
- if (curid != 0 && frontendEffects && !stopAnim)
+ if (curid != 0 && !stopAnim)
{
int coeff = 1;
#ifndef Q_OS_MAC
@@ -704,17 +714,19 @@
QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(curid));
ui.Pages->widget(curid)->setGraphicsEffect(effectLast);
#endif
+ // no effects, means 0 effect duration :D
+ int duration = config->isFrontendEffects() ? 500 : 0;
//Last page animation
animationOldSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
- animationOldSlide->setDuration(500);
+ animationOldSlide->setDuration(duration);
animationOldSlide->setStartValue(QPoint(-width()/coeff, 0));
animationOldSlide->setEndValue(QPoint(0, 0));
animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
#ifndef Q_OS_MAC
animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
- animationOldOpacity->setDuration(500);
+ animationOldOpacity->setDuration(duration);
animationOldOpacity->setStartValue(1);
animationOldOpacity->setEndValue(0.01);
animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -723,14 +735,14 @@
ui.Pages->widget(curid)->setHidden(false);
animationNewSlide = new QPropertyAnimation(ui.Pages->widget(curid), "pos");
- animationNewSlide->setDuration(500);
+ animationNewSlide->setDuration(duration);
animationNewSlide->setStartValue(QPoint(0, 0));
animationNewSlide->setEndValue(QPoint(width()/coeff, 0));
animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
#ifndef Q_OS_MAC
animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
- animationNewOpacity->setDuration(500);
+ animationNewOpacity->setDuration(duration);
animationNewOpacity->setStartValue(0.01);
animationNewOpacity->setEndValue(1);
animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -747,8 +759,6 @@
connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
}
-
-
}
void HWForm::OpenSnapshotFolder()
--- a/QTfrontend/hwform.h Sun Jan 15 23:14:10 2012 +0100
+++ b/QTfrontend/hwform.h Sun Jan 15 23:35:02 2012 +0100
@@ -118,6 +118,7 @@
void CreateNetGame();
void UpdateWeapons();
void onFrontendFullscreen(bool value);
+ void onFrontendEffects(bool value);
void Music(bool checked);
void UpdateCampaignPage(int index);
//Starts the transmission process for the feedback
--- a/QTfrontend/ui/page/pageoptions.cpp Sun Jan 15 23:14:10 2012 +0100
+++ b/QTfrontend/ui/page/pageoptions.cpp Sun Jan 15 23:35:02 2012 +0100
@@ -275,7 +275,7 @@
GBAlayout->addWidget(CBFrontendFullscreen);
CBFrontendEffects = new QCheckBox(AGGroupBox);
- CBFrontendEffects->setText(QCheckBox::tr("Frontend effects") + " *");
+ CBFrontendEffects->setText(QCheckBox::tr("Frontend effects"));
GBAlayout->addWidget(CBFrontendEffects);
CBEnableFrontendSound = new QCheckBox(AGGroupBox);
@@ -391,11 +391,6 @@
hr->setFixedHeight(10);
GBAlayout->addWidget(hr);
- QLabel *restartNote = new QLabel(this);
- restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply"));
- restartNote->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
- GBAlayout->addWidget(restartNote);
-
gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1);
}
--- a/QTfrontend/ui/widget/bgwidget.cpp Sun Jan 15 23:14:10 2012 +0100
+++ b/QTfrontend/ui/widget/bgwidget.cpp Sun Jan 15 23:35:02 2012 +0100
@@ -82,7 +82,7 @@
fX = qrand() % (wParent->width() + 1);
}
-BGWidget::BGWidget(QWidget * parent) : QWidget(parent)
+BGWidget::BGWidget(QWidget * parent) : QWidget(parent), enabled(false)
{
setAttribute(Qt::WA_NoSystemBackground, true);
sprite.load(":/res/Star.png");
@@ -123,6 +123,8 @@
void BGWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
+ if (!enabled)
+ return;
QPainter p;
@@ -139,6 +141,9 @@
void BGWidget::animate()
{
+ if (!enabled)
+ return;
+
for (int i = 0; i < SPRITE_MAX; i++)
{
QPoint oldPos = spritePositions[i]->pos();
@@ -159,6 +164,7 @@
void BGWidget::stopAnimation()
{
timerAnimation->stop();
+ repaint();
}
void BGWidget::init()
--- a/QTfrontend/ui/widget/bgwidget.h Sun Jan 15 23:14:10 2012 +0100
+++ b/QTfrontend/ui/widget/bgwidget.h Sun Jan 15 23:35:02 2012 +0100
@@ -63,6 +63,8 @@
void startAnimation();
void stopAnimation();
void init();
+ bool enabled;
+
private:
QImage sprite;
QTimer * timerAnimation;
--- a/project_files/hedgewars.pro Sun Jan 15 23:14:10 2012 +0100
+++ b/project_files/hedgewars.pro Sun Jan 15 23:35:02 2012 +0100
@@ -16,7 +16,7 @@
DESTDIR = .
win32 {
- RC_FILE = ../QTfrontend/res/hedgewars.rc
+ RC_FILE = ../QTfrontend/hedgewars.rc
}
QT += network
@@ -98,7 +98,8 @@
../QTfrontend/sdlkeys.h \
../QTfrontend/ui/mouseoverfilter.h \
../QTfrontend/ui/qpushbuttonwithsound.h \
- ../QTfrontend/ui/widget/qpushbuttonwithsound.h
+ ../QTfrontend/ui/widget/qpushbuttonwithsound.h \
+ ../QTfrontend/ui/page/pagefeedback.h
SOURCES += ../QTfrontend/model/ammoSchemeModel.cpp \
../QTfrontend/model/themesmodel.cpp \
@@ -174,7 +175,9 @@
../QTfrontend/ui_hwform.cpp \
../QTfrontend/hwconsts.cpp \
../QTfrontend/ui/mouseoverfilter.cpp \
- ../QTfrontend/ui/widget/qpushbuttonwithsound.cpp
+ ../QTfrontend/ui/mouseoverfilter.cpp \
+ ../QTfrontend/ui/widget/qpushbuttonwithsound.cpp \
+ ../QTfrontend/ui/page/pagefeedback.cpp
win32 {
SOURCES += ../QTfrontend/xfire.cpp