From 004b9243248a29eaa73b5fae5a5ef7b5ca914f94 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 25 Jul 2010 13:00:30 +0200 Subject: Fixed StatisticsDialog adapted StatisticsDialog to the new database schema and make it use WebKit and HTML to display the graph bars. This change obsoleted the classes ActorCountModel and GraphBarWidget. --- actorcountmodel.cpp | 76 ----------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 actorcountmodel.cpp (limited to 'actorcountmodel.cpp') diff --git a/actorcountmodel.cpp b/actorcountmodel.cpp deleted file mode 100644 index ac82f97..0000000 --- a/actorcountmodel.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - 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 -#include - -#include "actorcountmodel.h" - -ActorCountModel::ActorCountModel(QObject *parent) : QAbstractItemModel(parent) { - QSqlQuery query("SELECT iactorid, tactorname FROM actor ORDER BY tactorname ASC"); - QSqlQuery countQuery; - countQuery.prepare("SELECT COUNT(*) FROM movieactormap WHERE iactorid = :id"); - while(query.next()){ - QVariant *name = new QVariant(query.value(1)); - countQuery.bindValue(":id", query.value(0)); - countQuery.exec(); - QVariant *count; - while(countQuery.next()){ - count = new QVariant(countQuery.value(0)); - } - QList l; - l << name << count; - mItems.append(l); - } - mHeaderData << tr("Model name") << tr("Movies"); -} - -ActorCountModel::~ActorCountModel() { - foreach(QList l, mItems){ - qDeleteAll(l); - } -} - -QModelIndex ActorCountModel::index(int row, int column, const QModelIndex &parent) const { - if((column > 1) || (row >= mItems.size()) || (row < 0) || (parent != QModelIndex())){ - return QModelIndex(); - } - return createIndex(row, column, 0); -} - -int ActorCountModel::rowCount(const QModelIndex &) const { - return mItems.size(); -} - -int ActorCountModel::columnCount(const QModelIndex &) const { - return 2; -} - -QVariant ActorCountModel::data(const QModelIndex &idx, int role) const { - if(!idx.isValid() || (idx.column() > 1) || (idx.row() > mItems.size())){ - return QVariant(); - } - switch (role) { - case Qt::DisplayRole: - return *(mItems.at(idx.row()).at(idx.column())); - break; - case Qt::DecorationRole: - if(idx.column() == 0){ - return QIcon(":/dildo.png"); - } - break; - } - return QVariant(); -} - -QVariant ActorCountModel::headerData(int section, Qt::Orientation o, int role) const { - if((role != Qt::DisplayRole) || (o != Qt::Horizontal) || (section > 1)){ - return QVariant(); - } - return mHeaderData.at(section); -} - -- cgit v1.2.3-70-g09d2