2 statisticsdialog.h - Kopete Statistics Dialog
4 Copyright (c) 2003-2004 by Marc Cramdal <marc.cramdal@gmail.com>
6 Copyright (c) 2007 by the Kopete Developers <kopete-devel@kde.org>
8 *************************************************************************
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 *************************************************************************
18 #ifndef _STATISTICSDIALOG_H
19 #define _STATISTICSDIALOG_H
24 #include "kopetemetacontact.h"
28 namespace Ui
{ class StatisticsWidgetUI
; }
30 class StatisticsContact
;
36 struct BrowserArguments
;
37 class OpenUrlArguments
;
40 class StatisticsDialog
: public KDialog
44 typedef QPair
<QDate
, QString
> StatusPair
;
46 StatisticsDialog(StatisticsContact
*contact
, StatisticsDB
* db
, QWidget
* parent
=0);
49 QSize
sizeHint () const { return QSize ( 800, 600 ); }
52 QString
generateHTMLChart(const int *hours
, const int *hours2
, const int *hours3
, const QString
& caption
, const QColor
& color
);
53 QString
generateHTMLChartBar(int height
, const QString
& color
, const QString
& caption
);
54 QString
stringFromSeconds(const int seconds
);
56 Ui::StatisticsWidgetUI
*dialogUi
;
57 KHTMLPart
*generalHTMLPart
;
58 KHTMLPart
*calendarHTMLPart
;
60 /// Database from which we get the statistics
62 /// Metacontact for which we get the statistics from m_db
63 StatisticsContact
*m_contact
;
65 /// colors for graphs and calendar
68 QColor m_offlineColor
;
69 QColor m_backgroundColor
;
72 void generatePageFromQStringList(QStringList values
, const QString
& subTitle
);
74 /// Generates the main page
75 void generatePageGeneral();
77 * @brief Generates the page for a given day of the week.
78 * \param dayOfWeek Monday..Sunday, 0..7
80 void generatePageForDay(const int dayOfWeek
);
81 void generatePageForMonth(const int monthOfYear
);
85 * We manage the openUrlRequestDelayed signal from the generalHTMLPart->browserExtension() in order to
86 * generate requested pages on the fly.
88 void slotOpenURLRequest(const KUrl
& url
, const KParts::OpenUrlArguments
&, const KParts::BrowserArguments
&);
91 * Color the calendar cells to show statuses across entire months
93 void fillCalendarCells ();
96 * Display details of one day of contact's activity
98 void generateOneDayStats ();
103 #endif // _STATISTICSDIALOG_H