Files
ORC-Gallery-Linux/src/updatedatabasedialog.h
T
2026-06-19 16:45:22 -04:00

58 lines
1.5 KiB
C++

#ifndef UPDATEDATABASEDIALOG_H
#define UPDATEDATABASEDIALOG_H
#include <QDialog>
#include <QTextEdit>
#include <QProgressBar>
#include <QLabel>
#include <QPushButton>
#include <QProcess>
#include <QString>
/**
* @brief Non-modal dialog that runs the OCR update script and streams its output.
*
* The dialog stays open after the process finishes so the user can read the log.
* It emits updateFinished() when the script exits successfully so the caller can
* reload the gallery.
*/
class UpdateDatabaseDialog : public QDialog
{
Q_OBJECT
public:
explicit UpdateDatabaseDialog(const QString &scriptPath,
const QString &dbPath,
const QString &screenshotsDir,
QWidget *parent = nullptr);
~UpdateDatabaseDialog();
signals:
/** Emitted when the OCR script exits with code 0. */
void updateFinished();
private slots:
void onReadyReadStdOut();
void onReadyReadStdErr();
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void onCancelClicked();
private:
void startProcess();
void appendLog(const QString &text, bool isError = false);
QString m_scriptPath;
QString m_dbPath;
QString m_screenshotsDir;
QLabel *m_statusLabel;
QTextEdit *m_logView;
QProgressBar*m_progressBar;
QPushButton *m_cancelButton;
QPushButton *m_closeButton;
QProcess *m_process;
};
#endif // UPDATEDATABASEDIALOG_H