videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h
/**
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: VideoListSelectionDialogTester class
*
*/
#ifndef __VIDEOLISTSELECTIONDIALOGTESTER_H__
#define __VIDEOLISTSELECTIONDIALOGTESTER_H__
#include <qpointer.h>
#include "videolistselectiondialog.h"
class VideoListSelectionDialogTesterHelper : public QObject
{
Q_OBJECT
signals:
void selectionChangedSignal();
void modelReadySignal();
void updateCounterSignal();
void primaryActionTriggeredSignal();
void finishedSignal(HbAction*);
public:
VideoListSelectionDialogTesterHelper(VideoListSelectionDialog *testable = 0)
: mTestable(testable), mSignalsConnected(false) {};
~VideoListSelectionDialogTesterHelper() {};
bool connectSignals()
{
if(!mTestable || mSignalsConnected)
{
return false;
}
mSignalsConnected = true;
if(!connect(this, SIGNAL(selectionChangedSignal()), mTestable, SLOT(selectionChangedSlot())))
{
return false;
}
if(!connect(this, SIGNAL(modelReadySignal()), mTestable, SLOT(modelReadySlot())))
{
return false;
}
if(!connect(this, SIGNAL(primaryActionTriggeredSignal()),
mTestable, SLOT(primaryActionTriggeredSlot())))
{
return false;
}
if(!connect(this, SIGNAL(finishedSignal(HbAction*)), mTestable, SLOT(finishedSlot(HbAction*))))
{
return false;
}
return true;
}
void disconnectSignals()
{
if(mTestable && mSignalsConnected)
{
mSignalsConnected = false;
disconnect(this, SIGNAL(selectionChangedSignal()), mTestable, SLOT(selectionChangedSlot()));
disconnect(this, SIGNAL(modelReadySignal()), mTestable, SLOT(modelReadySlot()));
disconnect(this, SIGNAL(primaryActionTriggeredSignal()),
mTestable, SLOT(primaryActionTriggeredSlot()));
disconnect(this, SIGNAL(finishedSignal(HbAction*)), mTestable, SLOT(finishedSlot(HbAction*)));
}
}
void emitSelectionChangedSlot()
{
emit selectionChangedSignal();
}
void emitModelReadySlot()
{
emit modelReadySignal();
}
void emitPrimaryActionTriggeredSlot()
{
emit primaryActionTriggeredSignal();
}
void emitFinishedSlot(HbAction *action)
{
emit finishedSignal(action);
}
QPointer<VideoListSelectionDialog> mTestable;
/**
* flag indicating if signals are connected.
*/
bool mSignalsConnected;
};
#endif