/***************************************************************************
 *   Copyright (C) 2004 by Marco Kraus                                     *
 *   marco@linuxstuff.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.             *
 ***************************************************************************/

#ifndef PDFKREATOR_H
#define PDFKREATOR_H

#define BUFFERSIZE 1024

#include "PDFKreatorDialog.h"

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>

#include <qlineedit.h>
#include <qcombobox.h>
#include <qfiledialog.h>
#include <qprocess.h>
#include <qtextbrowser.h>
#include <qtabwidget.h>
#include <qprogressbar.h>
#include <qpushbutton.h>
#include <qtimer.h>
#include <qfile.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qlistbox.h>
#include <qtoolbox.h>
#include <qstringlist.h> 
#include <qlistbox.h> 

#include <klocale.h>

class pdfkreator : public PDFKreatorDialog
{
  Q_OBJECT

public:
  pdfkreator(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
  ~pdfkreator();

private:
   bool running;  
   bool concatStart;
      
   QProcess* tifgen;   
   QProcess* psgen;
   QProcess* pdfgen;   
   QProcess* rotate;
   QProcess* preview;
   
   int ProcessCounter;
   
   void Convert();  
   void ConCat();
   void TransPDF();
   void CleanUp();

   QString pdfname;
   
   QString oname; // postscript helpers
   QString iname; 
   QString buffer;
   FILE* fout;
   FILE* fin;
      
public slots:

protected:

protected slots:
   virtual void quitPDFKreator();
   virtual void Create();   
   virtual void SelectJoinFiles();
   virtual void RemoveJoinFile();
   virtual void SelectOutputDir();
   
   virtual void MoveUp();
   virtual void MoveDown();   
   virtual void RotateRight();
   virtual void RotateLeft();   
   
   virtual void previewFile();   
   
   virtual void readFromPSStdout();
   virtual void readFromPSStderr();
   
   virtual void readFromPDFStdout();
   virtual void readFromPDFStderr();   

   virtual void readFromTIFStdout();
   virtual void readFromTIFStderr();   

   virtual void readFromRotateStdout();
   virtual void readFromRotateStderr();   
         
   virtual void psgenExiting();
   virtual void pdfgenExiting();   
   virtual void tifgenExiting();   
   virtual void rotateExiting();
};

#endif

