diff --git a/gui/win_help.ui b/gui/win_help.ui new file mode 100644 index 0000000..5de3565 --- /dev/null +++ b/gui/win_help.ui @@ -0,0 +1,131 @@ + + + HelpDialog + + + + 0 + 0 + 784 + 384 + + + + Help Screen + + + true + + + true + + + + + + 12 + + + + + + + + :/images/x264.png + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + Lucida Console + 9 + + + + Qt::ScrollBarAlwaysOff + + + QPlainTextEdit::WidgetWidth + + + true + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 128 + 0 + + + + Discard + + + false + + + + + + + + + + + + + buttonClose + clicked() + HelpDialog + close() + + + 645 + 362 + + + 359 + 191 + + + + + diff --git a/res/images/x264.png b/res/images/x264.png new file mode 100644 index 0000000..9b755e5 Binary files /dev/null and b/res/images/x264.png differ diff --git a/res/resources.qrc b/res/resources.qrc index 25eea1f..732b009 100644 --- a/res/resources.qrc +++ b/res/resources.qrc @@ -20,5 +20,6 @@ buttons/play.png buttons/play_big.png buttons/world_link.png + images/x264.png diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp index f89d2e9..6b53fb0 100644 --- a/src/win_addJob.cpp +++ b/src/win_addJob.cpp @@ -23,6 +23,7 @@ #include "global.h" #include "model_options.h" +#include "win_help.h" #include #include @@ -185,7 +186,9 @@ bool AddJobDialog::eventFilter(QObject *o, QEvent *e) { if((o == labelHelpScreen) && (e->type() == QEvent::MouseButtonPress)) { - QMessageBox::information(this, tr("Not yet"), tr("Not implemented yet. Please use the '?' menu for now!")); + HelpDialog *helpScreen = new HelpDialog(this); + helpScreen->exec(); + X264_DELETE(helpScreen); } else if((o == editCustomParams) && (e->type() == QEvent::FocusOut)) { diff --git a/src/win_help.cpp b/src/win_help.cpp new file mode 100644 index 0000000..5f61651 --- /dev/null +++ b/src/win_help.cpp @@ -0,0 +1,123 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2012 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "win_help.h" +#include "global.h" + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// Constructor & Destructor +/////////////////////////////////////////////////////////////////////////////// + +HelpDialog::HelpDialog(QWidget *parent) +: + QDialog(parent), + m_appDir(QApplication::applicationDirPath()), + m_process(new QProcess()) +{ + //Init the dialog, from the .ui file + setupUi(this); + setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); + + //Fix size + setMinimumSize(size()); + + //Prepare process + m_process->setReadChannelMode(QProcess::MergedChannels); + m_process->setReadChannel(QProcess::StandardOutput); + connect(m_process, SIGNAL(readyRead()), this, SLOT(readyRead())); + connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finished())); + + m_startAgain = true; +} + +HelpDialog::~HelpDialog(void) +{ + delete m_process; +} + +/////////////////////////////////////////////////////////////////////////////// +// Events +/////////////////////////////////////////////////////////////////////////////// + +void HelpDialog::showEvent(QShowEvent *event) +{ + QDialog::showEvent(event); + + m_startAgain = true; + m_process->start(QString("%1/toolset/x264.exe").arg(m_appDir), QStringList() << "--version"); + + if(!m_process->waitForStarted()) + { + plainTextEdit->appendPlainText(tr("Failed to create x264 process :-(")); + } +} + +void HelpDialog::closeEvent(QCloseEvent *e) +{ + if(m_process->state() != QProcess::NotRunning) + { + e->ignore(); + MessageBeep(MB_ICONWARNING); + return; + } + + QDialog::closeEvent(e); +} + +/////////////////////////////////////////////////////////////////////////////// +// Slots +/////////////////////////////////////////////////////////////////////////////// + +void HelpDialog::readyRead(void) +{ + while(m_process->canReadLine()) + { + QString line = QString::fromLatin1(m_process->readLine()); + while(line.endsWith('\r') || line.endsWith('\n')) + { + line = line.left(line.length() - 1); + } + plainTextEdit->appendPlainText(line); + } +} + +void HelpDialog::finished(void) +{ + if(m_startAgain) + { + m_startAgain = false; + m_process->start(QString("%1/toolset/x264.exe").arg(m_appDir), QStringList() << "--fullhelp"); + plainTextEdit->appendPlainText("\n--------\n"); + + if(!m_process->waitForStarted()) + { + plainTextEdit->appendPlainText(tr("Failed to create x264 process :-(")); + } + } + else + { + plainTextEdit->verticalScrollBar()->setSliderPosition(0); + } +} diff --git a/src/win_help.h b/src/win_help.h new file mode 100644 index 0000000..4b173ea --- /dev/null +++ b/src/win_help.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2012 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "uic_win_help.h" + +class QProcess; + +class HelpDialog : public QDialog, private Ui::HelpDialog +{ + Q_OBJECT + +public: + HelpDialog(QWidget *parent); + ~HelpDialog(void); + +private slots: + void readyRead(void); + void finished(void); + +private: + const QString m_appDir; + QProcess *const m_process; + + bool m_startAgain; + +protected: + virtual void showEvent(QShowEvent *event); + virtual void closeEvent(QCloseEvent *e); +}; + diff --git a/src/win_main.cpp b/src/win_main.cpp index 2e9f45d..dcb2af4 100644 --- a/src/win_main.cpp +++ b/src/win_main.cpp @@ -263,7 +263,7 @@ void MainWindow::showAbout(void) text += QString().sprintf("Note that this program is distributed with ABSOLUTELY NO WARRANTY.

"); text += QString().sprintf("Please check the web-site at %s for updates !!!
", home_url, home_url); - QMessageBox::information(this, tr("About..."), text.replace("-", "−")); + QMessageBox::information(this, tr("About..."), text.replace("-", "−"), tr("Close")); } void MainWindow::showWebLink(void) diff --git a/x264_launcher.vcxproj b/x264_launcher.vcxproj index 22d4a7a..c0fe8d7 100644 --- a/x264_launcher.vcxproj +++ b/x264_launcher.vcxproj @@ -134,6 +134,15 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) + + Document + "$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)" + "$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)" + UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h" + UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h" + $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) + $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) + Document @@ -148,6 +157,14 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools + + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" + MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" + MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" + $(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" @@ -202,11 +219,13 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools + + diff --git a/x264_launcher.vcxproj.filters b/x264_launcher.vcxproj.filters index 93bac79..3dfed5a 100644 --- a/x264_launcher.vcxproj.filters +++ b/x264_launcher.vcxproj.filters @@ -86,6 +86,12 @@ Source Files + + Source Files + + + Generated Files + @@ -112,6 +118,12 @@ Header Files + + Dialogs + + + Header Files +