Added help screen.

This commit is contained in:
LoRd_MuldeR 2012-02-01 01:08:54 +01:00
parent 18a3411e6e
commit 405e7d2382
9 changed files with 341 additions and 2 deletions

131
gui/win_help.ui Normal file
View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HelpDialog</class>
<widget class="QDialog" name="HelpDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>784</width>
<height>384</height>
</rect>
</property>
<property name="windowTitle">
<string>Help Screen</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>12</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/images/x264.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="font">
<font>
<family>Lucida Console</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::WidgetWidth</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonClose">
<property name="minimumSize">
<size>
<width>128</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Discard</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../res/resources.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonClose</sender>
<signal>clicked()</signal>
<receiver>HelpDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>645</x>
<y>362</y>
</hint>
<hint type="destinationlabel">
<x>359</x>
<y>191</y>
</hint>
</hints>
</connection>
</connections>
</ui>

BIN
res/images/x264.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -20,5 +20,6 @@
<file>buttons/play.png</file>
<file>buttons/play_big.png</file>
<file>buttons/world_link.png</file>
<file>images/x264.png</file>
</qresource>
</RCC>

View File

@ -23,6 +23,7 @@
#include "global.h"
#include "model_options.h"
#include "win_help.h"
#include <QDate>
#include <QTimer>
@ -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))
{

123
src/win_help.cpp Normal file
View File

@ -0,0 +1,123 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2012 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
// 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 <QProcess>
#include <QScrollBar>
#include <QTimer>
///////////////////////////////////////////////////////////////////////////////
// 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);
}
}

50
src/win_help.h Normal file
View File

@ -0,0 +1,50 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2012 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
// 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);
};

View File

@ -263,7 +263,7 @@ void MainWindow::showAbout(void)
text += QString().sprintf("Note that this program is distributed with ABSOLUTELY NO WARRANTY.<br><br>");
text += QString().sprintf("Please check the web-site at <a href=\"%s\">%s</a> for updates !!!<br></tt></nobr>", home_url, home_url);
QMessageBox::information(this, tr("About..."), text.replace("-", "&minus;"));
QMessageBox::information(this, tr("About..."), text.replace("-", "&minus;"), tr("Close"));
}
void MainWindow::showWebLink(void)

View File

@ -134,6 +134,15 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="gui\win_help.ui">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
<None Include="ReadMe.txt" />
<CustomBuild Include="res\resources.qrc">
<FileType>Document</FileType>
@ -148,6 +157,14 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<None Include="res\icons\movie.ico" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="src\win_help.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="src\win_addJob.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
@ -202,11 +219,13 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<ClCompile Include="src\global.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\win_addJob.cpp" />
<ClCompile Include="src\win_help.cpp" />
<ClCompile Include="src\win_main.cpp" />
<ClCompile Include="tmp\moc\moc_model_jobList.cpp" />
<ClCompile Include="tmp\moc\moc_model_logFile.cpp" />
<ClCompile Include="tmp\moc\moc_thread_encode.cpp" />
<ClCompile Include="tmp\moc\moc_win_addJob.cpp" />
<ClCompile Include="tmp\moc\moc_win_help.cpp" />
<ClCompile Include="tmp\moc\moc_win_main.cpp" />
<ClCompile Include="tmp\qrc\qrc_resources.cpp" />
</ItemGroup>

View File

@ -86,6 +86,12 @@
<ClCompile Include="src\model_options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\win_help.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tmp\moc\moc_win_help.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="gui\win_main.ui">
@ -112,6 +118,12 @@
<CustomBuild Include="src\win_addJob.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="gui\win_help.ui">
<Filter>Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="src\win_help.h">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="x264_launcher.rc">