defuze.me
Client
|
00001 /************************************************************************** 00002 ** defuze.me Epitech Innovative Project 00003 ** 00004 ** Copyright 2010-2011 00005 ** Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard 00006 ** Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier 00007 ** 00008 ** All rights reserved. 00009 **************************************************************************/ 00010 00011 #include "cornerwidget.hpp" 00012 #include "guicore.hpp" 00013 #include "qtwin.h" 00014 00015 using namespace Gui; 00016 00017 CornerWidget::CornerWidget(GuiCore *guiCore, QWidget *parent) : 00018 QWidget(parent), guiCore(guiCore) 00019 { 00020 setupUi(this); 00021 if (guiCore->getPublicParameter("aero", QVariant(true)).toBool()) 00022 if (QtWin::isCompositionEnabled()) 00023 setTextShadowEffects(); 00024 } 00025 00026 void CornerWidget::setTextShadowEffects() 00027 { 00028 setTextShadow(fullscreenButtonEffect, fullscreenButton); 00029 setTextShadow(helpButtonEffect, helpButton); 00030 setTextShadow(aboutButtonEffect, aboutButton); 00031 setTextShadow(parametersButtonEffect, parametersButton); 00032 setTextShadow(quitButtonEffect, quitButton); 00033 } 00034 00035 void CornerWidget::setTextShadow(QGraphicsDropShadowEffect *effect, QWidget *button) 00036 { 00037 effect = new QGraphicsDropShadowEffect; 00038 effect->setBlurRadius(8); 00039 effect->setOffset(0, 0); 00040 effect->setColor(QColor("#FFFFFF")); 00041 button->setGraphicsEffect(effect); 00042 } 00043 00044 void CornerWidget::changeEvent(QEvent *e) 00045 { 00046 QWidget::changeEvent(e); 00047 switch (e->type()) { 00048 case QEvent::LanguageChange: 00049 retranslateUi(this); 00050 break; 00051 default: 00052 break; 00053 } 00054 } 00055 00056 void CornerWidget::on_fullscreenButton_clicked() 00057 { 00058 if (guiCore->getMainWindow()->windowState() != Qt::WindowFullScreen) 00059 { 00060 guiCore->getMainWindow()->getTabWidget()->setAutoFillBackground(true); 00061 guiCore->getMainWindow()->setWindowState(Qt::WindowFullScreen); 00062 fullscreenButton->setText(tr("Windowed")); 00063 } 00064 else 00065 { 00066 guiCore->getMainWindow()->getTabWidget()->setAutoFillBackground(false); 00067 guiCore->getMainWindow()->setWindowState(Qt::WindowMaximized); 00068 fullscreenButton->setText(tr("Fullscreen")); 00069 } 00070 } 00071 00072 void Gui::CornerWidget::on_quitButton_clicked() 00073 { 00074 guiCore->getMainWindow()->close(); 00075 } 00076 00077 00078 void Gui::CornerWidget::on_parametersButton_clicked() 00079 { 00080 guiCore->toogleParametersModule(); 00081 } 00082 00083 void Gui::CornerWidget::on_aboutButton_clicked() 00084 { 00085 guiCore->getAboutDialog()->show(); 00086 }