summaryrefslogtreecommitdiffstats
path: root/statisticsdialog.cpp
diff options
context:
space:
mode:
authoram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-09-05 18:04:34 +0000
committeram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-09-05 18:04:34 +0000
commit7c2a67b93e0e2b80bb89985c92a5aafc6b2b3d65 (patch)
tree60f59ae8df7a8f6b895f226c8445a9b144826497 /statisticsdialog.cpp
parentb83db5872cc3ac45795fad67ad2b50d8f9994c96 (diff)
downloadSheMov-7c2a67b93e0e2b80bb89985c92a5aafc6b2b3d65.tar.gz
SheMov-7c2a67b93e0e2b80bb89985c92a5aafc6b2b3d65.tar.bz2
SheMov-7c2a67b93e0e2b80bb89985c92a5aafc6b2b3d65.zip
-started statistics. It compiles, but does nothing at all yet
-implemented aboutShemov and aboutQt git-svn-id: file:///var/svn/repos2/shemov/trunk@405 f440f766-f032-0410-8965-dc7d17de2ca0
Diffstat (limited to 'statisticsdialog.cpp')
-rw-r--r--statisticsdialog.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/statisticsdialog.cpp b/statisticsdialog.cpp
new file mode 100644
index 0000000..09b9d15
--- /dev/null
+++ b/statisticsdialog.cpp
@@ -0,0 +1,50 @@
+/*
+ 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 <QTabWidget>
+#include <QPainter>
+#include <QHBoxLayout>
+#include <QSqlQuery>
+#include <QVariant>
+#include <QFontMetrics>
+#include <QApplication>
+#include <QPainter>
+#include <QPen>
+#include <QBrush>
+#include <QGradient>
+
+#include "statisticsdialog.h"
+
+StatisticsDialog::StatisticsDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){
+ QHBoxLayout *mainLayout = new QHBoxLayout;
+ mTab = new QTabWidget;
+}
+
+QualityStats::QualityStats(QWidget *parent) : QWidget(parent), mMargin(10) {
+ QSqlQuery q("SELECT DISTINCT(iquality), COUNT(iquality) FROM movies GROUP BY iquality");
+ q.exec();
+ while(q.next()){
+ mQualityDistrib[q.value(0).toInt()] = q.value(1).toInt();
+ }
+ QFontMetrics fm(qApp->font());
+ mBarHeight = fm.height();
+}
+
+void QualityStats::paintEvent(QPaintEvent *){
+ QPainter p(this);
+ int width = size().width();
+ QPen pen(Qt::red);
+ p.setPen(pen);
+}
+
+QSize QualityStats::sizeHint() const {
+ int height = mQualityDistrib.count() * mBarHeight;
+ height += mQualityDistrib.count() * mMargin;
+ height += mBarHeight + mMargin;
+ return QSize(400, height);
+}
+