File indexing completed on 2024-05-19 05:05:34

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2022 Thomas Fischer <fischer@unix-ag.uni-kl.de>
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  *   This program is distributed in the hope that it will be useful,       *
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0014  *   GNU General Public License for more details.                          *
0015  *                                                                         *
0016  *   You should have received a copy of the GNU General Public License     *
0017  *   along with this program; if not, see <https://www.gnu.org/licenses/>. *
0018  ***************************************************************************/
0019 
0020 #ifndef KBIBTEX_IO_FILEEXPORTERTOOLCHAIN_H
0021 #define KBIBTEX_IO_FILEEXPORTERTOOLCHAIN_H
0022 
0023 #include <QTemporaryDir>
0024 
0025 #include <FileExporter>
0026 #include <Preferences>
0027 
0028 #ifdef HAVE_KF
0029 #include "kbibtexio_export.h"
0030 #endif // HAVE_KF
0031 
0032 class QString;
0033 
0034 /**
0035 @author Thomas Fischer
0036  */
0037 class KBIBTEXIO_EXPORT FileExporterToolchain : public FileExporter
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     explicit FileExporterToolchain(QObject *parent);
0043 
0044     static bool kpsewhich(const QString &filename);
0045 
0046 Q_SIGNALS:
0047     void processStandardOut(const QString);
0048     void processStandardError(const QString);
0049 
0050 protected:
0051     QTemporaryDir tempDir;
0052 
0053     bool runProcesses(const QStringList &progs, bool doEmitProcessOutput = false);
0054     bool runProcess(const QString &cmd, const QStringList &args, bool doEmitProcessOutput = false);
0055     bool writeFileToIODevice(const QString &filename, QIODevice *device);
0056 
0057     QString pageSizeToLaTeXName(const Preferences::PageSize pageSize) const;
0058 };
0059 
0060 #endif // KBIBTEX_IO_FILEEXPORTERTOOLCHAIN_H