activityfw/testapplications/nftapps/lowmemoryapp/basewidget.h
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #ifndef BASEWIDGET_H_
       
    18 #define BASEWIDGET_H_
       
    19 
       
    20 #include <hbwidget.h>
       
    21 #include <QGraphicsLinearLayout>
       
    22 #include <QGraphicsGridLayout>
       
    23 #include <HbPushButton>
       
    24 #include <hblabel.h>
       
    25 #include <HbComboBox>
       
    26 #include <hbcheckbox.h>
       
    27 #include <hblineedit.h>
       
    28 #include <HbValidator>
       
    29 #include <QPixmap>
       
    30 #include <QByteArray>
       
    31 #include <QTimer>
       
    32 #include <QTextStream>
       
    33 #include <afactivitystorage.h>
       
    34 #include <afstorageglobals.h>
       
    35 
       
    36 class basewidget: public HbWidget
       
    37 {
       
    38     Q_OBJECT
       
    39 public:
       
    40     basewidget(QObject* activityStorage, QObject* activityManager, QTextStream* stream, QGraphicsItem *parent = 0);
       
    41     ~basewidget();
       
    42     
       
    43 
       
    44 protected:
       
    45 
       
    46 
       
    47 protected:
       
    48     
       
    49     QGraphicsGridLayout *mGridLayout;
       
    50     HbPushButton *mSaveButton;
       
    51     HbPushButton *mThumbButton;
       
    52     HbPushButton *mDataButton;
       
    53     HbLabel* mStatusValueLabel;
       
    54     HbLineEdit* mKBytesEdid;
       
    55     HbLabel* mCatchLabel;
       
    56     
       
    57     HbLabel* mBytesEditLabel;
       
    58 
       
    59     
       
    60 
       
    61     QIntValidator* mQKBytesValidator;
       
    62     HbValidator* mKBytesValidator;
       
    63     
       
    64     QObject* mActivityStorage;
       
    65     QObject* mActivityManager;
       
    66     QPixmap* mPixmap;
       
    67     QByteArray* mByteArray;
       
    68     
       
    69 
       
    70     QTextStream* mStream;
       
    71     
       
    72     QVariant* mSaveVariant;
       
    73     QVariantHash* mSaveMetadata;
       
    74     QStringList mActivities;
       
    75     char* mAlloc;
       
    76     QString mAction;   
       
    77     
       
    78     
       
    79 
       
    80 protected slots:
       
    81     void save();
       
    82     void data();
       
    83     void thumb();
       
    84     void thumbnailReady(QPixmap pixmap, void* ptr);
       
    85     
       
    86 public:
       
    87 
       
    88 protected:
       
    89 	int Bytes() const;
       
    90 
       
    91 	int Edit2Int(const HbLineEdit* lineedit) const;
       
    92 	void prepareDataSave();
       
    93 	void prepareThumbSave();
       
    94 	void clearSaveData();
       
    95 	bool saveActivity(int name);
       
    96 	bool removeActivity(const QString& name);
       
    97 	bool privateData(const QString& name);
       
    98 	bool getThumbnail(const QString& name);
       
    99 	bool activities();
       
   100 
       
   101 	int ClientHeapSize();
       
   102 
       
   103 	void logErrorMessage(const QString& mess);
       
   104 
       
   105 	void releaseMem();
       
   106 
       
   107 	void logCatchError(const QString& mess);
       
   108 	void logDataType(const QString& type);
       
   109 	void logPixmapSize(const QPixmap& pix);
       
   110 	void logAction(const QString& mess);
       
   111 	void logSaveResult(bool res);
       
   112 	bool alloc();
       
   113 	void releaseAlloced();
       
   114 	
       
   115 
       
   116     
       
   117 };
       
   118 
       
   119 #endif /* BASEWIDGET_H_*/