///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
-// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2017 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
///////////////////////////////////////////////////////////////////////////////
#include "win_help.h"
+#include "UIC_win_help.h"
+
+//Internal
#include "global.h"
+#include "model_options.h"
+#include "model_sysinfo.h"
+#include "model_preferences.h"
+#include "encoder_factory.h"
+#include "source_factory.h"
+
+//MUtils
+#include <MUtils/Sound.h>
+//Qt
#include <QProcess>
#include <QScrollBar>
#include <QTimer>
-#define AVS2_BINARY(BIN_DIR, IS_X64) QString("%1/%2/avs2yuv_%2.exe").arg((BIN_DIR), ((IS_X64) ? "x64" : "x86"))
-#define X264_BINARY(BIN_DIR, IS_10BIT, IS_X64) QString("%1/%2/x264_%3_%2.exe").arg((BIN_DIR), ((IS_X64) ? "x64" : "x86"), ((IS_10BIT) ? "10bit" : "8bit"))
-
///////////////////////////////////////////////////////////////////////////////
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
-HelpDialog::HelpDialog(QWidget *parent, bool avs2yuv, bool x64supported, bool use10BitEncoding)
+HelpDialog::HelpDialog(QWidget *parent, bool avs2yuv, const SysinfoModel *const sysinfo, const OptionsModel *const options, const PreferencesModel *const preferences)
:
QDialog(parent),
- m_appDir(QApplication::applicationDirPath() + "/toolset"),
m_avs2yuv(avs2yuv),
- m_x64supported(x64supported),
- m_use10BitEncoding(use10BitEncoding),
- m_process(new QProcess())
+ m_sysinfo(sysinfo),
+ m_preferences(preferences),
+ m_options(options),
+ m_process(new QProcess()),
+ ui(new Ui::HelpDialog())
{
//Init the dialog, from the .ui file
- setupUi(this);
+ ui->setupUi(this);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
//Fix size
HelpDialog::~HelpDialog(void)
{
delete m_process;
+ delete ui;
}
///////////////////////////////////////////////////////////////////////////////
void HelpDialog::showEvent(QShowEvent *event)
{
- logo_x264->setHidden(m_avs2yuv);
- logo_avisynth->setVisible(m_avs2yuv);
+ ui->logo_x264->setHidden(m_avs2yuv);
+ ui->logo_avisynth->setVisible(m_avs2yuv);
QDialog::showEvent(event);
if(!m_avs2yuv)
{
- m_process->start(X264_BINARY(m_appDir, m_use10BitEncoding, m_x64supported), QStringList() << "--version");
+ m_process->start(EncoderFactory::getEncoderInfo(m_options->encType()).getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()), QStringList() << "--version");
}
else
{
- m_process->start(AVS2_BINARY(m_appDir, m_x64supported), QStringList());
+ m_process->start(SourceFactory::getSourceInfo(SourceFactory::SourceType_AVS).getBinaryPath(m_sysinfo, m_preferences->getPrefer64BitSource() && m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64)), QStringList());
}
if(!m_process->waitForStarted())
{
- plainTextEdit->appendPlainText(tr("Failed to create x264 process :-("));
+ ui->plainTextEdit->appendPlainText(tr("Failed to create x264 process :-("));
}
}
if(m_process->state() != QProcess::NotRunning)
{
e->ignore();
- x264_beep(x264_beep_warning);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
return;
}
{
line = line.left(line.length() - 1);
}
- plainTextEdit->appendPlainText(line);
+ ui->plainTextEdit->appendPlainText(line);
}
}
m_startAgain = false;
if(!m_avs2yuv)
{
- m_process->start(X264_BINARY(m_appDir, m_use10BitEncoding, m_x64supported), QStringList() << "--fullhelp");
- plainTextEdit->appendPlainText("\n--------\n");
+ const AbstractEncoderInfo &encInfo = EncoderFactory::getEncoderInfo(m_options->encType());
+ m_process->start(encInfo.getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()), QStringList() << encInfo.getHelpCommand());
+ ui->plainTextEdit->appendPlainText("\n--------\n");
if(!m_process->waitForStarted())
{
- plainTextEdit->appendPlainText(tr("Failed to create x264 process :-("));
+ ui->plainTextEdit->appendPlainText(tr("Failed to create x264 process :-("));
}
}
}
else
{
- plainTextEdit->verticalScrollBar()->setSliderPosition(0);
+ ui->plainTextEdit->verticalScrollBar()->setSliderPosition(0);
}
}