diff options
author | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-09-05 18:04:34 +0000 |
---|---|---|
committer | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-09-05 18:04:34 +0000 |
commit | 7c2a67b93e0e2b80bb89985c92a5aafc6b2b3d65 (patch) | |
tree | 60f59ae8df7a8f6b895f226c8445a9b144826497 | |
parent | b83db5872cc3ac45795fad67ad2b50d8f9994c96 (diff) | |
download | SheMov-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
-rw-r--r-- | shemov.cpp | 35 | ||||
-rw-r--r-- | shemov.h | 5 | ||||
-rw-r--r-- | shemov.pro | 6 | ||||
-rw-r--r-- | statisticsdialog.cpp | 50 | ||||
-rw-r--r-- | statisticsdialog.h | 45 |
5 files changed, 139 insertions, 2 deletions
@@ -195,6 +195,25 @@ void SheMov::setFsFree(){ mFsFree->setPixmap(QPixmap::fromImage(img)); } +void SheMov::aboutShemov(){ + QString aboutLabel = QString(tr("About %1")).arg(qApp->applicationName()); + QString aboutText = QString(tr("<p>%1 is a little application to keep track of your pr0n movie collection, though it isn't limited to pr0n movies.</p>")).arg(qApp->applicationName()); + aboutText.append("<table>"); + aboutText.append(tr("<tr><td>Author<td></td>Sissy herself</td></tr>")); + aboutText.append(QString(tr("<tr><td>Organization</td><td>%1</td></tr>")).arg(qApp->organizationName())); + aboutText.append(QString(tr("<tr><td>Version</td><td>%1</td></tr>")).arg(qApp->applicationVersion())); + aboutText.append(tr("<tr><td>Dependencies</td><td><ul>")); + aboutText.append(tr("<li>Qt (thanks to Nokia for this great library)</li>")); + aboutText.append(tr("<li>cryptopp for hashing the movies (thanks)</li>")); + aboutText.append(tr("<li>libmagic for figuring out the file type</li>")); + aboutText.append("</ul></tr></table>"); + QMessageBox::about(this, aboutLabel, aboutText); +} + +void SheMov::showStatistics(){ + +} + void SheMov::createStatusbar(){ QLabel *selSizeL = new QLabel(tr("Sel. Size")); mSelectedSize = new QLabel(tr("nothing selected yet")); @@ -326,6 +345,15 @@ void SheMov::createActions(){ mDeleteFromArchiveA = new QAction(tr("Delete from archive..."), this); mAVWidget->fileView()->addAction(mDeleteFromArchiveA); connect(mDeleteFromArchiveA, SIGNAL(triggered()), mAVWidget, SLOT(deleteFromArchive())); + + //Help menu + QString aboutLabel = QString(tr("About %1...")).arg(qApp->applicationName()); + mAboutShemovA = new QAction(aboutLabel, this); + connect(mAboutShemovA, SIGNAL(triggered()), this, SLOT(aboutShemov())); + mAboutQtA = new QAction(tr("About Qt..."), this); + connect(mAboutQtA, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + mStatisticsA = new QAction(tr("Some statistics..."), this); + connect(mStatisticsA, SIGNAL(triggered()), this, SLOT(showStatistics())); } void SheMov::createMenus(){ @@ -372,6 +400,13 @@ void SheMov::createMenus(){ mEditFSMenuA = menuBar()->addMenu(mEditFSMenu); mEditArchiveMenuA = menuBar()->addMenu(mEditArchiveMenu); mEditArchiveMenuA->setVisible(false); + + QMenu *helpMenu = new QMenu(tr("&Help"), this); + helpMenu->addAction(mAboutShemovA); + helpMenu->addAction(mAboutQtA); + helpMenu->addSeparator(); + helpMenu->addAction(mStatisticsA); + menuBar()->addMenu(helpMenu); } void SheMov::createExtractMenu(){ @@ -40,6 +40,8 @@ class SheMov : public QMainWindow { void configure(); void tabChanged(int newTab); void setFsFree(); + void aboutShemov(); + void showStatistics(); private: void createStatusbar(); @@ -77,6 +79,9 @@ class SheMov : public QMainWindow { QAction *mMoveBurnA; QAction *mSetDvdA; QAction *mDeleteFromArchiveA; + QAction *mAboutShemovA; + QAction *mAboutQtA; + QAction *mStatisticsA; QList<QAction*> mExtractToA; //EndActions @@ -29,7 +29,8 @@ sizedelegate.cpp \ archiveddelegate.cpp \ coverarchiveeditor.cpp \ textenterdialog.cpp \ -moviepropertiesdialog.cpp +moviepropertiesdialog.cpp \ +statisticsdialog.cpp HEADERS = listitem.h \ listmodel.h \ movieitem.h \ @@ -57,7 +58,8 @@ sizedelegate.h \ archiveddelegate.h \ coverarchiveeditor.h \ textenterdialog.h \ -moviepropertiesdialog.h +moviepropertiesdialog.h \ +statisticsdialog.h LIBS += -lmagic LIBS += -lcryptopp INCLUDEPATH += /usr/include/cryptopp 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); +} + diff --git a/statisticsdialog.h b/statisticsdialog.h new file mode 100644 index 0000000..7dd78c2 --- /dev/null +++ b/statisticsdialog.h @@ -0,0 +1,45 @@ +/* + 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 STATISTICSDIALOG_H +#define STATISTICSDIALOG_H + +#include <QDialog> +#include <QMap> + +class QTabWidget; +class QPaintEvent; +class QSize; + +class StatisticsDialog : public QDialog { + Q_OBJECT + public: + StatisticsDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); + ~StatisticsDialog() {}; + + private: + QTabWidget *mTab; +}; + +class QualityStats : public QWidget { + Q_OBJECT + public: + QualityStats(QWidget *parent = 0); + ~QualityStats() {}; + virtual QSize sizeHint() const; + + protected: + void paintEvent(QPaintEvent *); + + private: + int mBarHeight; + const int mMargin; + QMap<int, int> mQualityDistrib; +}; + +#endif + |