2017-09-22 10:08:02 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class lcRenderDialog;
|
|
|
|
}
|
|
|
|
|
2023-06-18 19:06:44 -07:00
|
|
|
class lcRenderProcess : public QProcess
|
2023-06-02 00:02:53 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-06-18 19:06:44 -07:00
|
|
|
explicit lcRenderProcess(QObject* parent = nullptr)
|
2023-06-02 00:02:53 +02:00
|
|
|
: QProcess(parent)
|
|
|
|
{
|
|
|
|
}
|
2023-06-18 19:06:44 -07:00
|
|
|
~lcRenderProcess();
|
2023-06-02 00:02:53 +02:00
|
|
|
};
|
|
|
|
|
2019-09-14 12:05:30 -07:00
|
|
|
class lcRenderPreviewWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
lcRenderPreviewWidget(QWidget* Parent)
|
|
|
|
: QWidget(Parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetImage(QImage Image)
|
|
|
|
{
|
|
|
|
mImage = Image;
|
|
|
|
mScaledImage = QImage();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2020-03-22 15:44:41 -07:00
|
|
|
void resizeEvent(QResizeEvent* Event) override;
|
|
|
|
void paintEvent(QPaintEvent* PaintEvent) override;
|
2019-09-14 12:05:30 -07:00
|
|
|
|
|
|
|
QImage mImage;
|
|
|
|
QImage mScaledImage;
|
|
|
|
};
|
|
|
|
|
2017-09-22 10:08:02 -07:00
|
|
|
class lcRenderDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-06-02 00:02:53 +02:00
|
|
|
explicit lcRenderDialog(QWidget* Parent, int Command);
|
2017-09-22 10:08:02 -07:00
|
|
|
~lcRenderDialog();
|
|
|
|
|
|
|
|
public slots:
|
2020-03-22 15:44:41 -07:00
|
|
|
void reject() override;
|
2017-09-22 10:08:02 -07:00
|
|
|
void on_RenderButton_clicked();
|
2017-12-27 13:55:37 -08:00
|
|
|
void on_OutputBrowseButton_clicked();
|
2023-06-02 00:02:53 +02:00
|
|
|
void on_RenderSettingsButton_clicked();
|
|
|
|
void on_RenderOutputButton_clicked();
|
2017-09-22 10:08:02 -07:00
|
|
|
void Update();
|
|
|
|
|
2019-03-08 12:42:36 +01:00
|
|
|
protected slots:
|
2023-06-02 00:02:53 +02:00
|
|
|
void ReadStdOut();
|
|
|
|
void WriteStdOut();
|
|
|
|
void UpdateElapsedTime() const;
|
2019-03-08 12:42:36 +01:00
|
|
|
|
2017-09-22 10:08:02 -07:00
|
|
|
protected:
|
2023-06-18 19:06:44 -07:00
|
|
|
QString GetStdOutFileName() const;
|
|
|
|
QString GetStdErrFileName() const;
|
2017-11-04 18:54:12 -07:00
|
|
|
QString GetPOVFileName() const;
|
2023-06-02 00:02:53 +02:00
|
|
|
QString ReadStdErr(bool& Error) const;
|
2017-11-04 18:54:12 -07:00
|
|
|
void CloseProcess();
|
|
|
|
bool PromptCancel();
|
2019-03-08 12:42:36 +01:00
|
|
|
void ShowResult();
|
2023-06-02 00:02:53 +02:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
int TerminateChildProcess(const qint64 Pid, const qint64 Ppid);
|
|
|
|
#endif
|
2017-12-06 22:08:56 -08:00
|
|
|
#ifndef QT_NO_PROCESS
|
2023-06-18 19:06:44 -07:00
|
|
|
lcRenderProcess* mProcess;
|
2017-12-06 22:08:56 -08:00
|
|
|
#endif
|
2023-06-02 00:02:53 +02:00
|
|
|
enum CommandType
|
|
|
|
{
|
|
|
|
POVRAY_RENDER,
|
|
|
|
BLENDER_RENDER,
|
|
|
|
OPEN_IN_BLENDER
|
|
|
|
};
|
|
|
|
|
2017-11-04 18:54:12 -07:00
|
|
|
QTimer mUpdateTimer;
|
2023-06-02 00:02:53 +02:00
|
|
|
QElapsedTimer mRenderTime;
|
2018-01-14 21:45:50 -08:00
|
|
|
QFile mOutputFile;
|
|
|
|
void* mOutputBuffer;
|
2017-12-09 16:27:56 -08:00
|
|
|
QImage mImage;
|
2019-03-09 16:38:54 -08:00
|
|
|
QStringList mStdErrList;
|
2023-06-02 00:02:53 +02:00
|
|
|
QStringList mStdOutList;
|
|
|
|
|
|
|
|
int mWidth;
|
|
|
|
int mHeight;
|
|
|
|
int mPreviewWidth;
|
|
|
|
int mPreviewHeight;
|
|
|
|
int mCommand;
|
|
|
|
int mBlendProgValue;
|
|
|
|
int mBlendProgMax;
|
|
|
|
double mScale;
|
|
|
|
QString mImportModule;
|
2023-07-06 02:02:58 +02:00
|
|
|
QString mLabelMessage;
|
2023-06-02 00:02:53 +02:00
|
|
|
QString mDataPath;
|
2017-09-22 10:08:02 -07:00
|
|
|
|
2017-11-04 18:54:12 -07:00
|
|
|
Ui::lcRenderDialog* ui;
|
2017-09-22 10:08:02 -07:00
|
|
|
};
|