/*******************************************************************************
*                                                                              *
* Société de Transports de Montréal.                                    	   *
* 2012                                                                         *
*                                                                              *
* Projet Zones Tests                                                           *
*                                                                              *
*                                                                              *
*                                                                              *
*******************************************************************************/
/*
    Description:
	Page de sélection des options (sélection des fonctions de détection, ingénierie,
	mode entretien, etc.).

*/

/* ************************************************************************** */
/* Revision:
### 20131021 JFM
    Verision d'origine.

### YYYMMDD Description du besoin ou du bug
    Description du changement.
 */

/* ************************************************************************** */



#include "ProgressBarPage.h"
#include <QGraphicsProxyWidget>


CProgressBarPage::~CProgressBarPage()
{
}

CProgressBarPage::CProgressBarPage(QGraphicsWidget *Parent)
{
	Q_UNUSED(Parent)
    resize(400,100);

	mBackgroundRect = new QGraphicsRectItem(boundingRect(), this);
	QBrush BackgroundBrush(QColor(245, 245, 255));
	mBackgroundRect->setBrush(BackgroundBrush);

    mTitle = new QGraphicsTextItem("Title",this);
	QFont font;
    font.setPointSize(15);
    mTitle->setFont(font);
    mTitle->setPos(10,2);

    font.setPointSize(10);
    mMiscLabel = new QGraphicsTextItem(this);
    mMiscLabel->setPlainText("MiscLabel");
    mMiscLabel->setFont(font);
    mMiscLabel->setPos(10,50);

    mProgressBar = new QProgressBar();
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
    proxy->setWidget(mProgressBar);
    proxy->setPos(10,30);
    mProgressBar->resize(390,20);

    SetProgressBarRange(100);
    mProgressBar->setValue(0);
}

void CProgressBarPage::resizeEvent(QGraphicsSceneResizeEvent *event)
{
	Q_UNUSED(event)
//	mBackgroundRect->setRect(boundingRect());
}

void CProgressBarPage::SetProgressBarRange(int range)
{
    mProgressBar->setRange(0,range);
    Reset();
}

void CProgressBarPage::Tick()
{
    mCurValue++;
    mProgressBar->setValue(mCurValue);
    mProgressBar->update();
}

void CProgressBarPage::Reset()
{
    mCurValue = 0;
}

void CProgressBarPage::SetMiscLabel(QString Label)
{
    mMiscLabel->setPlainText(Label);
}

void CProgressBarPage::ClearMiscLabel()
{
    mMiscLabel->setPlainText("");
}

void CProgressBarPage::SetTitle(QString Title)
{
    mTitle->setPlainText(Title);
}


//Grab the mouse if the user clicks outside buttons
void CProgressBarPage::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
	Q_UNUSED(event)
}
void CProgressBarPage::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
	Q_UNUSED(event)
}
