OSDN Git Service

Bump program version + updated changelog.
[x264-launcher/x264-launcher.git] / src / win_help.cpp
index a6c20d1..64bc9b3 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Simple x264 Launcher
-// Copyright (C) 2004-2014 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"
+#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_sysinfo(sysinfo),
+       m_preferences(preferences),
+       m_options(options),
        m_process(new QProcess()),
        ui(new Ui::HelpDialog())
 {
@@ -82,11 +89,11 @@ void HelpDialog::showEvent(QShowEvent *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())
@@ -100,7 +107,7 @@ void HelpDialog::closeEvent(QCloseEvent *e)
        if(m_process->state() != QProcess::NotRunning)
        {
                e->ignore();
-               x264_beep(x264_beep_warning);
+               MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
                return;
        }
 
@@ -131,7 +138,8 @@ void HelpDialog::finished(void)
                m_startAgain = false;
                if(!m_avs2yuv)
                {
-                       m_process->start(X264_BINARY(m_appDir, m_use10BitEncoding, m_x64supported), QStringList() << "--fullhelp");
+                       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())