main/glxaiwservicehandler.h
author William Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:33:32 +0100
branchGCC_SURGE
changeset 51 525c140ec8db
parent 48 d0b4e67b3a60
child 54 0f0f3f26f787
permissions -rw-r--r--
Catchup to latest Symbian^4

/*
* 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:   ?Description
*
*/

#ifndef GLXFETCHER_H
#define GLXFETCHER_H

#include <hbmainwindow.h>
#include <xqserviceprovider.h>
#include <QStringList>
#include <xqsharablefile.h>

//FORWARD CLASS DECLARATION
class GlxView;
class HbPushButton;
class HbMenu;
class QGraphicsGridLayout; 
class GlxGetImageService;
class GlxMediaModel;
class QModelIndex;
class GlxImageViewerService;
class GlxStateManager;
class CGlxImageViewerManager;
class GlxGetImageServiceNSDI;
class GlxGetImageServiceDSDI;

/**
 *  GlxAiwServiceHandler
 * 
 */
class GlxAiwServiceHandler: public HbMainWindow
    {
    Q_OBJECT
public:
    /**
     * Constructor
     */
    GlxAiwServiceHandler();

    /**
     * Destructor.
     */
    ~GlxAiwServiceHandler();
	void launchFetcher(QString viewTitle);
	void launchImageViewer();
public slots:  
    void itemSelected(const QModelIndex &  index);    
    void handleClientDisconnect();
	void itemSpecificMenuTriggered(qint32,QPointF );
    void openFSView();
	void handleFSSelect();
    void closeContextMenu();
    
private:
    GlxMediaModel *mModel;
    GlxView* mView;
	GlxStateManager *mStateMgr;
	GlxView* mFSView;
    HbMenu *mFetcherContextMenu;

    GlxGetImageService* mFetcherService;
    GlxGetImageServiceNSDI* mNSDIService;
    GlxGetImageServiceDSDI* mDSDIService;
    GlxImageViewerService* mImageViewerService;
    };

/**
 *  GlxGetImageService
 * 
 */	
class GlxGetImageService : public XQServiceProvider
{
    Q_OBJECT
public:
    GlxGetImageService( GlxAiwServiceHandler *parent = 0 );
    ~GlxGetImageService();
    bool isActive();
    void complete( QStringList filesList);
    
public slots://for QTHighway to notify provider about request
    void fetch();
    
public slots://for provider to notify client
    void fetchFailed( int errorCode );
    
private:
    void doComplete( QStringList filesList);
    
private:
    int mImageRequestIndex;
    GlxAiwServiceHandler* mServiceApp;
};

/**
 *  GlxGetImageServiceDSDI
 *  Service provide for new service and depricated interface
 */ 
class GlxGetImageServiceNSDI : public XQServiceProvider
{
    Q_OBJECT
public:
    GlxGetImageServiceNSDI( GlxAiwServiceHandler *parent = 0 );
    ~GlxGetImageServiceNSDI();
    bool isActive();
    void complete( QStringList filesList);
    
public slots://for QTHighway to notify provider about request
    void fetch( QVariantMap filter , QVariant flag );
    void fetch();
    
public slots://for provider to notify client
    void fetchFailed( int errorCode );
    
private:
    void doComplete( QStringList filesList);
    
private:
    int mImageRequestIndex;
    GlxAiwServiceHandler* mServiceApp;
};

/**
 *  GlxGetImageServiceDSDI
 *  Service provide for depricated service and depricated interface
 */ 
class GlxGetImageServiceDSDI : public XQServiceProvider
{
    Q_OBJECT
public:
    GlxGetImageServiceDSDI( GlxAiwServiceHandler *parent = 0 );
    ~GlxGetImageServiceDSDI();
    bool isActive();
    void complete( QStringList filesList);
    
public slots://for QTHighway to notify provider about request
    void fetch( QVariantMap filter, QVariant flag);
    
public slots://for provider to notify client
    void fetchFailed( int errorCode );
    
private:
    void doComplete( QStringList filesList);
    
private:
    int mImageRequestIndex;
    GlxAiwServiceHandler* mServiceApp;
};


class GlxImageViewerService : public XQServiceProvider
{
    Q_OBJECT
    public:
        GlxImageViewerService( GlxAiwServiceHandler *parent = 0 );
        ~GlxImageViewerService();
        void complete(bool ok);

    public slots:
        bool view(QString file);
        bool view(XQSharableFile file);
        bool asyncRequest() {return mAsyncRequest;}

    private:
        GlxAiwServiceHandler* mServiceApp;
        int mAsyncReqId;
        bool mRetValue;
		bool mAsyncRequest;
		CGlxImageViewerManager* mImageViewerInstance;
};

    
#endif //GLXFETCHER_H