/*
 * gdisplay.h
 *
 * Declaration of class to display a graph in CPhone
 *
 * CPhone is a cross platform voip gui.
 *
 * Copyright (c) Indranet Technologies Ltd.
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Anna, and then copied to CPhone
 *
 * The Initial Developer of the Original Code is Indranet Technologies Ltd.
 *
 * The Initial Author of the Original Code is Derek J Smithies.  (derek@indranet.co.nz)
 *
 *
 * Contributor(s): ______________________________________.
 *
 *
 *  $Log: gdisplay.h,v $
 *  Revision 1.2  2003/08/26 04:48:02  dereksmithies
 *  Fixes to get statistics working right, add icons, add ok,cancel,apply buttons
 *
 *  Revision 1.1  2003/08/26 03:36:14  dereksmithies
 *  Initial release of statistics display
 *
 *
 *
 *
 *
 */

#ifndef GDISPLAY_H
#define GDISPLAY_H

#ifndef QT_H
#include "qwidget.h"
#endif
#include <qframe.h>
#include <qimage.h>
#include <qthread.h>
#include <qlabel.h>
#include <qstring.h>


class MainInterface;

#include "statisticsSub.h"

class GraphDisplay : public QFrame  
{
 public:
  GraphDisplay( QWidget *parent=0, const char *name=0, WFlags f=0);
  ~GraphDisplay();

  void drawContents(QPainter *p);

  void RemoveGraph();

  void InitiateRepaint(bool doErase = FALSE);

  void SetDisplayData(StatisticsPacketList *data);
  
  double GetCurrentMax();

  QString GetRateString();
  QString GetRateString(bool isSend);
  QString GetDualRateString();

 protected:
  void PurgeOldData();

  QMutex accessMutex;
  QMutex refreshMutex;
  int    refreshCount;

  double currentMax;
  double currentSentMax;
  double currentRcvdMax;

  double rate_rcvd[DATA_ELEMS];
  double rate_sent[DATA_ELEMS];

  int writeIndex;
};



#endif // GDISPLAY_H


syntax highlighted by Code2HTML, v. 0.9.1