Add Rhubarb timeout Preference

This commit is contained in:
manongjohn 2021-03-14 18:18:58 -04:00 committed by manongjohn
parent ea81bcd94a
commit b66677a309
5 changed files with 12 additions and 2 deletions

View file

@ -283,6 +283,7 @@ public:
int getFfmpegTimeout() { return getIntValue(ffmpegTimeout); } int getFfmpegTimeout() { return getIntValue(ffmpegTimeout); }
QString getFastRenderPath() const { return getStringValue(fastRenderPath); } QString getFastRenderPath() const { return getStringValue(fastRenderPath); }
QString getRhubarbPath() const { return getStringValue(rhubarbPath); } QString getRhubarbPath() const { return getStringValue(rhubarbPath); }
int getRhubarbTimeout() { return getIntValue(rhubarbTimeout); }
// Drawing tab // Drawing tab
QString getScanLevelType() const { return getStringValue(scanLevelType); } QString getScanLevelType() const { return getStringValue(scanLevelType); }

View file

@ -75,6 +75,7 @@ enum PreferencesItemId {
ffmpegTimeout, ffmpegTimeout,
fastRenderPath, fastRenderPath,
rhubarbPath, rhubarbPath,
rhubarbTimeout,
//---------- //----------
// Drawing // Drawing

View file

@ -834,7 +834,9 @@ void LipSyncPopup::onApplyButton() {
return; return;
} }
runRhubarb(); runRhubarb();
m_rhubarb->waitForFinished(); int rhubarbTimeout = Preferences::instance()->getRhubarbTimeout();
if (rhubarbTimeout > 0) rhubarbTimeout * 1000;
m_rhubarb->waitForFinished(rhubarbTimeout);
m_progressDialog->hide(); m_progressDialog->hide();
QString results = m_rhubarb->readAllStandardError(); QString results = m_rhubarb->readAllStandardError();
results += m_rhubarb->readAllStandardOutput(); results += m_rhubarb->readAllStandardOutput();

View file

@ -1046,6 +1046,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
{ffmpegTimeout, tr("Process Timeout:")}, {ffmpegTimeout, tr("Process Timeout:")},
{fastRenderPath, tr("Fast Render Output Directory:")}, {fastRenderPath, tr("Fast Render Output Directory:")},
{rhubarbPath, tr("Executable Directory:")}, {rhubarbPath, tr("Executable Directory:")},
{rhubarbTimeout, tr("Analyze Audio Timeout (sec; -1 = no timeout):") },
// Drawing // Drawing
{scanLevelType, tr("Scan File Format:")}, {scanLevelType, tr("Scan File Format:")},
@ -1641,7 +1642,10 @@ QWidget* PreferencesPopup::createImportExportPage() {
} }
QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb Lip Sync"), lay); QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb Lip Sync"), lay);
{ insertUI(rhubarbPath, rhubarbOptionsLay); } {
insertUI(rhubarbPath, rhubarbOptionsLay);
insertUI(rhubarbTimeout, rhubarbOptionsLay);
}
lay->setRowStretch(lay->rowCount(), 1); lay->setRowStretch(lay->rowCount(), 1);
insertFootNote(lay); insertFootNote(lay);

View file

@ -450,6 +450,8 @@ void Preferences::definePreferenceItems() {
std::numeric_limits<int>::max()); std::numeric_limits<int>::max());
define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop"); define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop");
define(rhubarbPath, "rhubarbPath", QMetaType::QString, ""); define(rhubarbPath, "rhubarbPath", QMetaType::QString, "");
define(rhubarbTimeout, "rhubarbTimeout", QMetaType::Int, -1, -1,
std::numeric_limits<int>::max());
// Drawing // Drawing
define(scanLevelType, "scanLevelType", QMetaType::QString, "tif"); define(scanLevelType, "scanLevelType", QMetaType::QString, "tif");