activityfw/testapplications/nftapps/lptapp/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 *mStartTestButton;
       
    51     HbPushButton *mChangeTestButton;
       
    52     HbPushButton *mBreakButton;
       
    53     HbCheckBox* mTestCheckBox;
       
    54     HbLineEdit* mItemsEdid;
       
    55     HbLineEdit* mTimesEdid;
       
    56     HbLineEdit* mKBytesEdid;
       
    57     HbLabel* mClientMemBeforeLabel;
       
    58     HbLabel* mClientMemAfterLabel;
       
    59     HbLabel* mClientMemDiffLabel;
       
    60     HbLabel* mDbMemBeforeLabel;
       
    61     HbLabel* mDbMemAfterLabel;
       
    62     HbLabel* mDbMemDiffLabel;
       
    63     HbLabel* mActionLabel;
       
    64     HbLabel* mIterLabel;
       
    65     HbLabel* mTimesLabel;
       
    66     HbLabel* mStatusLabel;
       
    67     HbLabel* mStatusValueLabel;
       
    68     HbLabel* mTimesEditLabel;
       
    69     HbLabel* mBytesEditLabel;
       
    70     HbLabel* mItemsEditLabel;
       
    71     
       
    72     QIntValidator* mQItemsValidator;
       
    73     HbValidator* mItemsValidator;
       
    74     QIntValidator* mQTimesValidator;
       
    75     HbValidator* mTimesValidator;
       
    76     QIntValidator* mQKBytesValidator;
       
    77     HbValidator* mKBytesValidator;
       
    78     
       
    79     QObject* mActivityStorage;
       
    80     QObject* mActivityManager;
       
    81     QPixmap* mPixmap;
       
    82     QByteArray* mByteArray;
       
    83     
       
    84     int mItemsCounter;
       
    85     int mTimesCounter;
       
    86     int mItems;
       
    87     int mTimes;
       
    88     int mClientMemBefore;
       
    89     int mDbMemBefore;
       
    90     
       
    91     QTimer* mTimer;
       
    92     QTextStream* mStream;
       
    93     
       
    94     QVariant* mSaveVariant;
       
    95     QVariantHash* mSaveMetadata;
       
    96     QStringList mActivities; 
       
    97     QString mAction;   
       
    98     
       
    99     
       
   100 signals:
       
   101     void viewChangedRequest();
       
   102     void testEnded(int reason);
       
   103 
       
   104 protected slots:
       
   105     virtual void timeout();
       
   106     virtual void test();
       
   107     void breakTest();
       
   108     
       
   109 public:
       
   110 
       
   111 protected:
       
   112 	bool TestCheckBoxChecked() const;
       
   113 	int Bytes() const;
       
   114 	int Times() const;
       
   115 	int Items() const;
       
   116 	int Edit2Int(const HbLineEdit* lineedit) const;
       
   117 	void prepareSave();
       
   118 	void clearSaveData();
       
   119 	bool saveActivity(int name);
       
   120 	bool removeActivity(const QString& name);
       
   121 	bool privateData(const QString& name);
       
   122 	bool getThumbnail(const QString& name);
       
   123 	bool activities();
       
   124 	int dbSize();
       
   125 	int ClientHeapSize();
       
   126 	void enableControls(bool enable);
       
   127 	void logFirst();
       
   128 	void logLast();
       
   129 	void logBaseMessage();
       
   130 	void logErrorMessage(const QString& mess);
       
   131 	void updateItemLabel(int item);
       
   132 	void updateTimeLabel(int time);
       
   133 	void updateActionLabel();
       
   134 	bool checkActNum();
       
   135 	void releaseMem();
       
   136 	virtual void endTest(int reason);
       
   137 	void setError(const QString& mess);
       
   138 	void endNormally();
       
   139 	void logSettings();
       
   140 	void clearLabels();
       
   141 	
       
   142 
       
   143     
       
   144 };
       
   145 
       
   146 #endif /* BASEWIDGET_H_*/