Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / plugins / statistics / statisticsdialog.h
bloba27b2dfef4afc9e9ce1d94a55d88e6841b7d5e38
1 /*
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 *************************************************************************
9 * *
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. *
14 * *
15 *************************************************************************
18 #ifndef _STATISTICSDIALOG_H
19 #define _STATISTICSDIALOG_H
21 #include <qwidget.h>
22 #include <kdialog.h>
23 #include <kurl.h>
24 #include "kopetemetacontact.h"
26 class QStringList;
28 namespace Ui { class StatisticsWidgetUI; }
29 class StatisticsDB;
30 class StatisticsContact;
32 class KHTMLPart;
34 namespace KParts
36 struct BrowserArguments;
37 class OpenUrlArguments;
40 class StatisticsDialog : public KDialog
42 Q_OBJECT
43 public:
44 typedef QPair<QDate, QString> StatusPair;
46 StatisticsDialog(StatisticsContact *contact, StatisticsDB* db, QWidget* parent=0);
47 ~StatisticsDialog();
49 QSize sizeHint () const { return QSize ( 800, 600 ); }
51 private:
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
61 StatisticsDB *m_db;
62 /// Metacontact for which we get the statistics from m_db
63 StatisticsContact *m_contact;
65 /// colors for graphs and calendar
66 QColor m_onlineColor;
67 QColor m_awayColor;
68 QColor m_offlineColor;
69 QColor m_backgroundColor;
70 QColor m_textColor;
72 void generatePageFromQStringList(QStringList values, const QString & subTitle);
74 /// Generates the main page
75 void generatePageGeneral();
76 /**
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);
83 private slots:
84 /**
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 &);
90 /**
91 * Color the calendar cells to show statuses across entire months
93 void fillCalendarCells ();
95 /**
96 * Display details of one day of contact's activity
98 void generateOneDayStats ();
103 #endif // _STATISTICSDIALOG_H