summaryrefslogtreecommitdiffstats
path: root/kvoctrain/kvoctrain/statistik-dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'kvoctrain/kvoctrain/statistik-dialogs')
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.cpp46
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.h43
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/GenStatPageForm.ui218
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/Makefile.am11
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.cpp64
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.h48
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.cpp289
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.h74
-rw-r--r--kvoctrain/kvoctrain/statistik-dialogs/StatistikPageForm.ui86
9 files changed, 879 insertions, 0 deletions
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.cpp b/kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.cpp
new file mode 100644
index 00000000..d9fdea3f
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.cpp
@@ -0,0 +1,46 @@
+/***************************************************************************
+
+ general statistics dialog page
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Sep 21 20:50:53 MET 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
+ (C) 2001 The KDE-EDU team
+ (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "GenStatPage.h"
+
+#include <kvoctraindoc.h>
+
+#include <qlabel.h>
+#include <qvaluevector.h>
+
+GenStatPage::GenStatPage(kvoctrainDoc *doc, QWidget* parent, const char* name): GenStatPageForm( parent, name )
+{
+ l_filename->setText(doc->URL().path());
+ l_title->setText(doc->getTitle());
+ l_author->setText(doc->getAuthor());
+ QString s;
+ s.setNum(doc->numEntries());
+ kcfg_entriesPerLesson->setText(s);
+ vector<QString> lesson = doc->getLessonDescr();
+ s.setNum(lesson.size());
+ l_lessons->setText(s);
+}
+
+#include "GenStatPage.moc"
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.h b/kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.h
new file mode 100644
index 00000000..b868741f
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/GenStatPage.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+
+ general statistics dialog page
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Sep 21 20:50:53 MET 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
+ (C) 2001 The KDE-EDU team
+ (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef GenStatPage_included
+#define GenStatPage_included
+
+#include "GenStatPageForm.h"
+
+class kvoctrainDoc;
+
+class GenStatPage : public GenStatPageForm
+{
+ Q_OBJECT
+
+public:
+
+ GenStatPage(kvoctrainDoc *doc, QWidget* parent = NULL, const char* name = NULL);
+
+};
+#endif // GenStatPage_included
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/GenStatPageForm.ui b/kvoctrain/kvoctrain/statistik-dialogs/GenStatPageForm.ui
new file mode 100644
index 00000000..669ec746
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/GenStatPageForm.ui
@@ -0,0 +1,218 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>GenStatPageForm</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>423</width>
+ <height>190</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>-</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Filename:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Title:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2_2_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Entries:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Author:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2_2_2_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Lessons:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>l_lessons</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>kcfg_entriesPerLesson</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>l_author</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>l_title</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>l_filename</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <spacer row="5" column="0">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/Makefile.am b/kvoctrain/kvoctrain/statistik-dialogs/Makefile.am
new file mode 100644
index 00000000..50fbb358
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/Makefile.am
@@ -0,0 +1,11 @@
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../kvt-core -I$(top_builddir)/kvoctrain/kvoctrain/common-dialogs $(all_includes)
+
+noinst_LTLIBRARIES = libstatdlg.la
+
+libstatdlg_la_SOURCES = \
+ StatistikPage.cpp GenStatPage.cpp \
+ StatistikPageForm.ui GenStatPageForm.ui \
+ StatistikDlg.cpp
+
+METASOURCES = AUTO
+
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.cpp b/kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.cpp
new file mode 100644
index 00000000..79bdcb99
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.cpp
@@ -0,0 +1,64 @@
+/***************************************************************************
+
+ statistics dialog class
+
+ -----------------------------------------------------------------------
+
+ begin : Sun Sep 19 20:50:53 MET 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
+ (C) 2001 The KDE-EDU team
+ (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+
+#include "StatistikDlg.h"
+#include "StatistikPage.h"
+#include "GenStatPage.h"
+
+#include <klocale.h>
+
+#include <langset.h>
+#include <kvoctraindoc.h>
+
+StatistikDlg::StatistikDlg(LangSet &langset, kvoctrainDoc *doc, QWidget *parent, const char *name, bool modal)
+ : KDialogBase(Tabbed, i18n("Document Statistics"), Close, Close, parent, name, modal)
+{
+ QFrame * page;
+ QVBoxLayout * topLayout;
+ StatistikPage *spage;
+
+ page = addPage(i18n("General"));
+ topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() );
+ GenStatPage *gspage = new GenStatPage (doc, page, name);
+ topLayout->addWidget(gspage);
+
+ for (int i = 1; i < (int) doc->numLangs(); i++)
+ {
+ QString s = langset.findLongId(doc->getIdent(i));
+ if (s.isEmpty() )
+ s = doc->getIdent(i);
+ else
+ s = i18n(s.local8Bit());
+
+ page = addPage(s);
+ topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() );
+ spage = new StatistikPage (i, doc, page, name);
+ topLayout->addWidget(spage);
+ }
+}
+
+#include "StatistikDlg.moc"
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.h b/kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.h
new file mode 100644
index 00000000..4f519550
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/StatistikDlg.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+
+ show document statistics
+
+ -----------------------------------------------------------------------
+
+ begin : Sun Sep 19 20:50:53 MET 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
+ (C) 2001 The KDE-EDU team
+ (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef StatistikDlg_included
+#define StatistikDlg_included
+
+#include <kdialogbase.h>
+
+#include <vector>
+using namespace std;
+
+class kvoctrainDoc;
+class LangSet;
+class GradeCols;
+
+class StatistikDlg : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ StatistikDlg(LangSet &langset, kvoctrainDoc *doc, QWidget *parent = NULL, const char *name = NULL, bool modal = true);
+
+};
+
+#endif // StatistikDlg_included
+
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.cpp b/kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.cpp
new file mode 100644
index 00000000..6541d085
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.cpp
@@ -0,0 +1,289 @@
+/***************************************************************************
+
+ statistics dialog page
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Sep 21 20:50:53 MET 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
+ (C) 2001 The KDE-EDU team
+ (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "StatistikPage.h"
+
+#include <kpopupmenu.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#include <kvoctraindoc.h>
+#include <prefs.h>
+
+#include <qcursor.h>
+#include <qpainter.h>
+
+#define MIN_COL_WIDTH 2
+#define PIX_SHIFT 2
+#define SIZE_GRADE 100+PIX_SHIFT
+#define SIZE_COUNT 70
+#define SIZE_LESSON 300
+
+#define TB_FGRADE 0
+#define TB_TGRADE 1
+#define TB_COUNT 2
+#define TB_LESSON 3
+
+
+class GradeListItem : public QListViewItem
+{
+public:
+ inline GradeListItem (QListView* parent, int _lesson): QListViewItem(parent), lesson(_lesson) {}
+ inline int getLesson() const { return lesson; }
+
+private:
+ int lesson;
+};
+
+
+StatistikPage::StatistikPage(int col, kvoctrainDoc *_doc, QWidget *parent, const char *name)
+ : StatistikPageForm( parent, name ), doc(_doc)
+{
+ StatListView->setColumnWidth(0, SIZE_GRADE + 10);
+ StatListView->setColumnWidth(1, SIZE_GRADE + 10);
+ StatListView->setColumnWidth(2, SIZE_COUNT);
+ StatListView->setColumnWidth(3, SIZE_LESSON);
+
+ vector<QString> lesson = doc->getLessonDescr();
+
+ fsc.resize(lesson.size()+1);
+ tsc.resize(lesson.size()+1);
+
+ // accumulate numbers of grades per lesson
+ for (int i = 0; i < (int) doc->numEntries(); i++) {
+ kvoctrainExpr *expr = doc->getEntry(i);
+ int fg = QMIN(KV_MAX_GRADE, expr->getGrade(col, false));
+ int tg = QMIN(KV_MAX_GRADE, expr->getGrade(col, true));
+ int l = expr->getLesson();
+ if (l >= 0 && l <= (int) lesson.size() ) {
+ fsc[l].grade[fg]++;
+ fsc[l].num++;
+ tsc[l].grade[tg]++;
+ tsc[l].num++;
+ }
+ }
+ setupPixmaps();
+ connect(StatListView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint& , int ) ),
+ this, SLOT( slotRMB( QListViewItem *, const QPoint &, int ) ) );
+}
+
+
+void StatistikPage::setupPixmaps()
+{
+ // create pixmaps with bar charts of numbers of grades
+ int height;
+ GradeListItem lvi (StatListView, 0);
+ height = lvi.height();
+ for (int entry = 0; entry < (int) fsc.size(); entry++) {
+ QPainter p;
+ QColor color;
+ QPixmap fpix (SIZE_GRADE, height);
+ p.begin( &fpix);
+ p.eraseRect (0, 0, fpix.width(), fpix.height());
+ p.setPen( black );
+ if (fsc[entry].num != 0) {
+
+ int num = 0;
+ for (int j = KV_NORM_GRADE; j <= KV_MAX_GRADE; j++)
+ if (fsc[entry].grade[j] != 0)
+ num++;
+
+ int maxw = fpix.width() -PIX_SHIFT -PIX_SHIFT -1;
+ int w = maxw;
+ int widths [KV_MAX_GRADE+1];
+ for (int j = KV_NORM_GRADE; j <= KV_MAX_GRADE; j++) {
+ if (fsc[entry].grade[j] == 0)
+ widths[j] = 0;
+ else {
+ if (num <= 1) {
+ widths[j] = w;
+ w = 0;
+ }
+ else {
+ --num;
+ widths[j] = QMAX(MIN_COL_WIDTH, fsc[entry].grade[j] * maxw / fsc[entry].num);
+ w -= widths[j];
+ }
+ }
+ }
+
+ int x = 0;
+ int x2 = 1+PIX_SHIFT;
+ for (int j = KV_MIN_GRADE; j <= KV_MAX_GRADE; j++) {
+ switch (j) {
+ case KV_NORM_GRADE: color = Prefs::gradeCol(0); break;
+ case KV_LEV1_GRADE: color = Prefs::gradeCol(1); break;
+ case KV_LEV2_GRADE: color = Prefs::gradeCol(2); break;
+ case KV_LEV3_GRADE: color = Prefs::gradeCol(3); break;
+ case KV_LEV4_GRADE: color = Prefs::gradeCol(4); break;
+ case KV_LEV5_GRADE: color = Prefs::gradeCol(5); break;
+ case KV_LEV6_GRADE: color = Prefs::gradeCol(6); break;
+ case KV_LEV7_GRADE: color = Prefs::gradeCol(7); break;
+ default : color = Prefs::gradeCol(1);
+ }
+ if (widths[j] != 0) {
+ x2 += widths[j];
+ p.fillRect(x+PIX_SHIFT, 1, x2-x, height-1, color);
+ p.drawRect(x+PIX_SHIFT, 1, x2-x, height-1);
+ x = x2-1;
+ }
+ }
+ }
+ else {
+ p.fillRect(PIX_SHIFT, 1, fpix.width()-PIX_SHIFT, height-1, Prefs::gradeCol(0));
+ p.drawRect(PIX_SHIFT, 1, fpix.width()-PIX_SHIFT, height-1);
+ }
+ p.end();
+ from_pix.push_back(fpix);
+
+ QPixmap tpix (SIZE_GRADE, height);
+ p.begin( &tpix );
+ p.eraseRect (0, 0, tpix.width(), tpix.height());
+ p.setPen( black );
+ if (tsc[entry].num != 0) {
+ int num = 0;
+ for (int j = KV_NORM_GRADE; j <= KV_MAX_GRADE; j++)
+ if (tsc[entry].grade[j] != 0)
+ num++;
+
+ int maxw = tpix.width() -PIX_SHIFT -PIX_SHIFT -1;
+ int w = maxw;
+ int widths [KV_MAX_GRADE+1];
+ for (int j = KV_NORM_GRADE; j <= KV_MAX_GRADE; j++) {
+ if (tsc[entry].grade[j] == 0)
+ widths[j] = 0;
+ else {
+ if (num <= 1) {
+ widths[j] = w;
+ w = 0;
+ }
+ else {
+ --num;
+ widths[j] = QMAX(MIN_COL_WIDTH, tsc[entry].grade[j] * maxw / tsc[entry].num);
+ w -= widths[j];
+ }
+ }
+ }
+
+ int x = 0;
+ int x2 = 1+PIX_SHIFT;
+ for (int j = KV_MIN_GRADE; j <= KV_MAX_GRADE; j++) {
+ switch (j) {
+ case KV_NORM_GRADE: color = Prefs::gradeCol(0); break;
+ case KV_LEV1_GRADE: color = Prefs::gradeCol(1); break;
+ case KV_LEV2_GRADE: color = Prefs::gradeCol(2); break;
+ case KV_LEV3_GRADE: color = Prefs::gradeCol(3); break;
+ case KV_LEV4_GRADE: color = Prefs::gradeCol(4); break;
+ case KV_LEV5_GRADE: color = Prefs::gradeCol(5); break;
+ case KV_LEV6_GRADE: color = Prefs::gradeCol(6); break;
+ case KV_LEV7_GRADE: color = Prefs::gradeCol(7); break;
+ default : color = Prefs::gradeCol(1);
+ }
+ if (widths[j] != 0) {
+ x2 += widths[j];
+ p.fillRect(x+PIX_SHIFT, 1, x2-x, height-1, color);
+ p.drawRect(x+PIX_SHIFT, 1, x2-x, height-1);
+ x = x2-1;
+ }
+ }
+ }
+ else {
+ p.fillRect(PIX_SHIFT, 1, tpix.width()-PIX_SHIFT, height-1, Prefs::gradeCol(0));
+ p.drawRect(PIX_SHIFT, 1, tpix.width()-PIX_SHIFT, height-1);
+ }
+ p.end();
+ to_pix.push_back(tpix);
+ }
+
+ // setup rows with pixmaps and strings
+ vector<QString> lesson = doc->getLessonDescr();
+
+ QString s;
+
+ GradeListItem *plvi = new GradeListItem(StatListView, 0);
+ plvi->setPixmap (TB_FGRADE, from_pix[0]);
+ plvi->setPixmap (TB_TGRADE, to_pix[0]);
+ s.setNum (tsc[0].num);
+ plvi->setText (TB_COUNT, s);
+ plvi->setText (TB_LESSON, i18n("<no lesson>"));
+ StatListView->insertItem (plvi);
+
+ for (int i = 0; i < (int) lesson.size(); i++) {
+ plvi = new GradeListItem(StatListView, i+1);
+ plvi->setPixmap (TB_FGRADE, from_pix[i+1]);
+ plvi->setPixmap (TB_TGRADE, to_pix[i+1]);
+ s.setNum (tsc[i+1].num);
+ plvi->setText (TB_COUNT, s);
+ plvi->setText (TB_LESSON, lesson[i]);
+ StatListView->insertItem (plvi);
+ }
+}
+
+
+void StatistikPage::slotRMB( QListViewItem* Item, const QPoint & /*point*/, int col)
+{
+ if( Item != 0)
+ slotPopupMenu(((GradeListItem*)Item)->getLesson(), col);
+}
+
+
+void StatistikPage::slotPopupMenu(int row, int col)
+{
+ struct stat_counter *sc;
+
+ if (col == TB_FGRADE) {
+ if (row >= (int) fsc.size() ) {
+ kdError() << "row >= fsc.size()" << endl;
+ return;
+ }
+ else
+ sc = &fsc[row];
+ }
+ else if (col == TB_TGRADE) {
+ if (row >= (int) tsc.size() ) {
+ kdError() << "row >= tsc.size()" << endl;
+ return;
+ }
+ else
+ sc = &tsc[row];
+ }
+ else
+ return;
+
+ KPopupMenu *header_m = new KPopupMenu(i18n("Number of Entries per Grade"));
+
+ header_m->insertItem (i18n(KV_NORM_TEXT) + "\t" + QString::number(sc->grade[KV_NORM_GRADE]) );
+ header_m->insertItem (i18n(KV_LEV1_TEXT) + "\t" + QString::number(sc->grade[KV_LEV1_GRADE]) );
+ header_m->insertItem (i18n(KV_LEV2_TEXT) + "\t" + QString::number(sc->grade[KV_LEV2_GRADE]) );
+ header_m->insertItem (i18n(KV_LEV3_TEXT) + "\t" + QString::number(sc->grade[KV_LEV3_GRADE]) );
+ header_m->insertItem (i18n(KV_LEV4_TEXT) + "\t" + QString::number(sc->grade[KV_LEV4_GRADE]) );
+ header_m->insertItem (i18n(KV_LEV5_TEXT) + "\t" + QString::number(sc->grade[KV_LEV5_GRADE]) );
+ header_m->insertItem (i18n(KV_LEV6_TEXT) + "\t" + QString::number(sc->grade[KV_LEV6_GRADE]) );
+ header_m->insertItem (i18n(KV_LEV7_TEXT) + "\t" + QString::number(sc->grade[KV_LEV7_GRADE]) );
+
+ header_m->exec(QCursor::pos()+QPoint(10, 0));
+}
+
+#include "StatistikPage.moc"
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.h b/kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.h
new file mode 100644
index 00000000..a5a7d166
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/StatistikPage.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+
+ statistics dialog page
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Sep 21 20:50:53 MET 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
+ (C) 2001 The KDE-EDU team
+ (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef StatistikPage_included
+#define StatistikPage_included
+
+#include "StatistikPageForm.h"
+
+#include <kvoctrainexpr.h>
+
+#include <qlistview.h>
+
+class kvoctrainDoc;
+class GradeCols;
+
+class StatistikPage : public StatistikPageForm
+{
+ Q_OBJECT
+
+public:
+ StatistikPage(int col, kvoctrainDoc *doc, QWidget *parent = NULL, const char *name = NULL);
+
+public slots:
+ void slotPopupMenu(int row, int col);
+ void slotRMB( QListViewItem* Item, const QPoint & point, int );
+
+protected:
+ void setupPixmaps();
+
+ struct stat_counter
+ {
+ stat_counter() {
+ for (int i = 0; i <= KV_MAX_GRADE; i++)
+ grade[i] = 0;
+ num = 0;
+ }
+
+ int grade [KV_MAX_GRADE+1];
+ int num;
+ };
+
+ int calc_width (struct StatistikPage::stat_counter *gc, int grade, int max_width);
+
+ vector<QPixmap> from_pix, to_pix;
+ kvoctrainDoc *doc;
+
+ vector<stat_counter> fsc;
+ vector<stat_counter> tsc;
+ //GradeCols *gcol;
+};
+
+#endif // StatistikPage_included
diff --git a/kvoctrain/kvoctrain/statistik-dialogs/StatistikPageForm.ui b/kvoctrain/kvoctrain/statistik-dialogs/StatistikPageForm.ui
new file mode 100644
index 00000000..7964f7e0
--- /dev/null
+++ b/kvoctrain/kvoctrain/statistik-dialogs/StatistikPageForm.ui
@@ -0,0 +1,86 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>StatistikPageForm</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>502</width>
+ <height>203</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>-</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Grade FROM</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Grade TO</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Entries</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Lesson</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>StatListView</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>500</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="selectionMode">
+ <enum>NoSelection</enum>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>