When loading a comicbook, try to get just the size of the various images without...
[kdegraphics.git] / okular / generators / comicbook / unrar.h
blobd0fca3ca0a7ed1e42373d6fc8a0ee09600504256
1 /***************************************************************************
2 * Copyright (C) 2007 by Tobias Koenig <tokoe@kde.org> *
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 ***************************************************************************/
10 #ifndef UNRAR_H
11 #define UNRAR_H
13 #include <QtCore/QObject>
14 #include <QtCore/QProcess>
15 #include <QtCore/QStringList>
17 class QEventLoop;
18 class KTempDir;
19 class KPtyProcess;
21 class Unrar : public QObject
23 Q_OBJECT
25 public:
26 /**
27 * Creates a new unrar object.
29 Unrar();
31 /**
32 * Destroys the unrar object.
34 ~Unrar();
36 /**
37 * Opens given rar archive.
39 bool open( const QString &fileName );
41 /**
42 * Returns the list of files from the archive.
44 QStringList list();
46 /**
47 * Returns the content of the file with the given name.
49 QByteArray contentOf( const QString &fileName ) const;
51 /**
52 * Returns a new device for reading the file with the given name.
54 QIODevice* createDevice( const QString &fileName ) const;
56 static bool isAvailable();
57 static bool isSuitableVersionAvailable();
59 private Q_SLOTS:
60 void readFromStdout();
61 void readFromStderr();
62 void finished( int exitCode, QProcess::ExitStatus exitStatus );
64 private:
65 int startSyncProcess( const QStringList &args );
66 void writeToProcess( const QByteArray &data );
68 #if defined(Q_OS_WIN)
69 QProcess *mProcess;
70 #else
71 KPtyProcess *mProcess;
72 #endif
73 QEventLoop *mLoop;
74 QString mFileName;
75 QByteArray mStdOutData;
76 QByteArray mStdErrData;
77 KTempDir *mTempDir;
80 #endif