| 1 |
/* dvbcut |
| 2 |
Copyright (c) 2005 Sven Over <[email protected]> |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or modify |
| 5 |
it under the terms of the GNU General Public License as published by |
| 6 |
the Free Software Foundation; either version 2 of the License, or |
| 7 |
(at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License |
| 15 |
along with this program; if not, write to the Free Software |
| 16 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 |
*/ |
| 18 |
|
| 19 |
/* $Id$ */ |
| 20 |
|
| 21 |
#ifndef _GNU_SOURCE |
| 22 |
#define _GNU_SOURCE |
| 23 |
#endif |
| 24 |
|
| 25 |
#include <cstdio> |
| 26 |
#include <cstdarg> |
| 27 |
#include <cstdlib> |
| 28 |
#include <QString> |
| 29 |
#include "logoutput.h" |
| 30 |
|
| 31 |
void |
| 32 |
logoutput::setprogress(int permille) { |
| 33 |
if (currentprogress==permille) |
| 34 |
return; |
| 35 |
currentprogress=permille; |
| 36 |
fprintf(stderr,"[%3d.%d]\r",currentprogress/10,currentprogress%10); |
| 37 |
} |
| 38 |
|
| 39 |
void logoutput::printmsg(const QString &str, const QString head, const QString tail) |
| 40 |
{ |
| 41 |
if (!head.isEmpty()) |
| 42 |
fprintf(stderr, "%s", head.toLatin1().data()); |
| 43 |
fprintf(stderr, "%s", str.toLatin1().data()); |
| 44 |
if (!tail.isEmpty()) |
| 45 |
fprintf(stderr, "%s", tail.toLatin1().data()); |
| 46 |
fprintf(stderr, "\n"); |
| 47 |
} |
| 48 |
|
| 49 |
/*virtual*/ |
| 50 |
void logoutput::print(const QString &str) |
| 51 |
{ |
| 52 |
printmsg(str, "", ""); |
| 53 |
} |
| 54 |
|
| 55 |
/*virtual*/ |
| 56 |
void logoutput::printheading(const QString &str) |
| 57 |
{ |
| 58 |
printmsg(str, "=== ", " ==="); |
| 59 |
} |
| 60 |
|
| 61 |
/*virtual*/ |
| 62 |
void logoutput::printinfo(const QString &str) |
| 63 |
{ |
| 64 |
printmsg(str, "INFO: ", 0); |
| 65 |
} |
| 66 |
|
| 67 |
/*virtual*/ |
| 68 |
void logoutput::printerror(const QString &str) |
| 69 |
{ |
| 70 |
printmsg(str, "ERROR: ", 0); |
| 71 |
} |
| 72 |
|
| 73 |
/*virtual*/ |
| 74 |
void logoutput::printwarning(const QString &str) |
| 75 |
{ |
| 76 |
printmsg(str, "WARNING: ", 0); |
| 77 |
} |