/*************************************************************************** * Copyright (C) 2004 by Michael Schulze * * mike.s@genion.de * * * * 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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "statisticsutility.h" #include //Added by qt3to4: #include const QString StatisticsUtility::defaultmimetype= QString( "text/html"); const QString StatisticsUtility::name= QString( "Statistics"); StatisticsUtility::StatisticsUtility() : IPodUtility() { } StatisticsUtility::~StatisticsUtility() { } const QString& StatisticsUtility::getName() { return name; } const QString& StatisticsUtility::getDefaultMimeType() { return defaultmimetype; } void StatisticsUtility::handleRequest(IPod& ipod, const KUrl&, QByteArray& response, QString& mimeType) { IPodSysInfo * sysInfo = ipod.getSysInfo(); sysInfo->refreshDiskUsageStats(); QTextOStream stream(&response); QString title= ipod.getName(); long mbTotal = sysInfo->getTotalDiskSpaceKB() >> 10; long mbAvail = sysInfo->getAvailableDiskSpaceKB() >> 10; long percent = (sysInfo->getUsedDiskSpaceKB() >> 10) * 100 / mbTotal; mimeType= "text/html"; stream << "Statistics for " + title + "\n"; stream << "\n"; stream << "

Statistics for " + title + "

\n"; stream << "\n"; stream << "\n"; stream << "\n"; stream << "\n"; stream << "\n"; // usage graphics stream << ""; stream << "
Number of tracks" << QString::number( ipod.getNumTracks()) << "
Number of playlists" << QString::number( ipod.getNumPlaylists()) << "
Total disk space" << mbTotal << " MB
Space available on the device" << mbAvail << " MB
\n"; for (int i = 0; i < 20; ++i) { stream << ""; } stream << "
 
\n"; }