From 405e7d238240845ec07a9ef7186bdd16f7526e22 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Wed, 1 Feb 2012 01:08:54 +0100 Subject: [PATCH] Added help screen. --- gui/win_help.ui | 131 ++++++++++++++++++++++++++++++++++++++++++ res/images/x264.png | Bin 0 -> 2778 bytes res/resources.qrc | 1 + src/win_addJob.cpp | 5 +- src/win_help.cpp | 123 +++++++++++++++++++++++++++++++++++++++ src/win_help.h | 50 ++++++++++++++++ src/win_main.cpp | 2 +- x264_launcher.vcxproj | 19 ++++++ x264_launcher.vcxproj.filters | 12 ++++ 9 files changed, 341 insertions(+), 2 deletions(-) create mode 100644 gui/win_help.ui create mode 100644 res/images/x264.png create mode 100644 src/win_help.cpp create mode 100644 src/win_help.h 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 0000000000000000000000000000000000000000..9b755e5998d4917c15c08f3c0b3b2bababc2ca83 GIT binary patch literal 2778 zcmV<03MKW4P)HFjryWZeDnICrs<0T zty-JZ0JZ8>P)rmB>T?S@UJ>Z}!>i zch*|pxA)ncBng$`Q4_)Guv-4x<~saKCPk70M`^xtoCt^Bj|E~59Kpa^ANorNq-q+V zNb=H);D9uc)pFj0!@`&yjHny~C3l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zn86td6~}7Hk|p@?n7srE1Htg{@TN_hFo|Zu-q_#YkJ=$^$R8#jc;JDXZ@wAM$jHd^ z&p*Ft(V{!=yc0l}36$YJBPb_GcrVy0WQ9obfcjLh53bLZZF z@4YcJxC(p_JonslM~)m>wQ3dk5EYX^?Ca}WxpF1QHf-2%^ytxcyZzEjFCq55_ug9+ zMWC^jFexC;IP|o1UU{pni-%0I)uzq7%jOM}b=j=TWDQqDHap+{uVY^x{^+BR#_W6O z(5Iey3h~yhTeo7x3UHi1e?CAX@NKu8GE@nV7ux+G~-juppROQReG?QJ<#9 zd$KXeY3`zo8|`AraIvnbb1i=@N7^j4kU6&pjvqhPXzba&d&$zJxC)m2g*Pt*m^Et_ z`sv+w-#vc(I3^!^>@nPfkjFH}S#7ww_r$M>Y^jF~eLJpwhLdZZiZ{9p$p(qn4PQ<+5cFaF zV+3EwV(`zLIWssosN@!@h9o<}z~~u9)Wp4um(xXIWjQ9P=FtZPdBA;MYI_ z-BeP(O|A?^#&K>uTds^?A0wDx zV7f#vtPCR6v!yQ_TZ~NXedmQkY!}Fon+_T{{Jnv~$Vrm?|Ga}OOV$|-as&mepy1R| g14?i%y^x{*083nLF0N(_{Qv*}07*qoM6N<$g1iY|v;Y7A literal 0 HcmV?d00001 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 + -- 2.11.0