1 /***************************************************************************
2  *   copyright       : (C) 2003-2007 by Pascal Brachet                     *
3  *   addons by Frederic Devernay <frederic.devernay@m4x.org>               *
4  *   http://www.xm1math.net/texmaker/                                      *
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
10  *                                                                         *
11  ***************************************************************************/
12 
13 #ifndef Header_WebPublish_Dialog
14 #define Header_WebPublish_Dialog
15 
16 #include "mostQtHeaders.h"
17 
18 #include "buildmanager.h"
19 
20 #include "ui_webpublishdialog.h"
21 
22 
23 typedef  QMap<QString, QString> LinkMap;
24 
25 class WebPublishDialogConfig;
26 
27 class WebPublishDialog : public QDialog
28 {
29 	Q_OBJECT
30 
31 public:
32 	WebPublishDialog(QWidget *parent = 0, WebPublishDialogConfig *aConfig = 0, BuildManager *aBuildManager = 0, QTextCodec *input_codec = 0);
33 	~WebPublishDialog();
34 	Ui::WebPublishDialog ui;
35 
36 protected:
37 	void closeEvent(QCloseEvent *);
38 
39 private slots:
40 	void accept();
41 	void init();
42 	void convert(const QString &fileName);
43 	void RunCommand(const QString &cmd, const QString &file, const bool waitendprocess, const char *stdErrSlot = 0);
44 	void SlotEndProcess(int err);
45 	void copyDataFile(QString fileNameWithoutDir, QString to_file);
46 	void removeFile(QString file);
47 	void ps2gif(QString input, QString output, int id_page, int w, int h, int maxw);
48 	void writepages(QString mode);
49 	void fatalerror(QString msg);
50 	void latexerror(QString logfile);
51 	void clean();
52 	void proceedSlot();
53 	void browseSlot();
54 	void applyusersettings();
55 	void extractpage(QString psfile, int page);
56 	void bboxProcess();
57 	void readBboxOutput();
58 	void imgProcess(const QString &params, const QString &psFile);
59 	void readImgOutput();
60 	void readOutputForLog();
61 
62 private:
63 	WebPublishDialogConfig *const config;
64 	BuildManager *const buildManager;
65 
66 	QTextCodec *codec;
67 	QString programdir, colorlink, depth, base,  workdir, htmldir, browser;
68 	QString filename;
69 	QString curLog;
70 
71 	int maxwidth, nb_pages, nb_content_pages, id_page, x1, y1, x2, y2;
72 	bool procfinished, ttwperr, errprocess;
73 	QPointer<QProcess> proc;
74 	int nbpagesps(QString psfile);
75 	QString header();
76 	QString footer();
77 	QString content_navigation(int page, int numpages, QString up_page);
78 	QString codepic(QString pic_name, QString map_name);
79 	LinkMap loc;
80 	QVector<int> x1box, y1box, x2box, y2box;
81 };
82 
83 
84 #endif
85 
86