Skip to content

Commit

Permalink
add help menu and dialog
Browse files Browse the repository at this point in the history
git-svn-id: https://dvbcut.svn.sourceforge.net/svnroot/dvbcut/trunk@165 36490176-9c1c-0410-b649-dbf2af5787bf
  • Loading branch information
too-tired committed Jun 27, 2009
1 parent ef83275 commit b6e7d05
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 3 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2009-06-27 Michael Riepe <[email protected]>

* src/dvbcut.cpp:
* src/dvbcut.h:
* src/dvbcutbase.ui:
Add help dialog and about box.
* src/dvbcut_en.html:
Initial (rudimentary) help file.
* DISTFILES:
Add dvbcut_en.html.
* src/Makefile.in:
Install dvbcut_en.html.

2009-06-27 Michael Riepe <[email protected]>

* src/stream.h:
Expand Down
1 change: 1 addition & 0 deletions DISTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ src/differenceimageprovider.cpp
src/differenceimageprovider.h
src/dvbcut.cpp
src/dvbcut.h
src/dvbcut_en.html
src/dvbcutbase.h
src/dvbcutbase.ui
src/eventlistitem.cpp
Expand Down
4 changes: 3 additions & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ bindir = @bindir@
datadir = @datadir@
mandir = @mandir@
man1dir = $(mandir)/man1
helpdir = $(prefix)/share/help

installdirs = $(DESTDIR)$(bindir)
installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(helpdir)

CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ -Wall $(DEFS) $(CPPFLAGS)
Expand Down Expand Up @@ -94,6 +95,7 @@ check:

install: all installdirs
$(INSTALL_PROGRAM) dvbcut$(EXEEXT) $(DESTDIR)$(bindir)
$(INSTALL_DATA) dvbcut_en.html $(DESTDIR)$(helpdir)

installdirs: $(installdirs)

Expand Down
87 changes: 87 additions & 0 deletions src/dvbcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2381,3 +2381,90 @@ void dvbcut::update_quick_picture_lookup_table() {
update_time_display();
}

void dvbcut::helpAboutAction_activated()
{
QMessageBox::about(this, tr("dvbcut"),
tr("<head></head><body><span style=\"font-family: Helvetica,Arial,sans-serif;\">"
"<p>dvbcut Version %1</p>"
"eMail: <a href=\"mailto:[email protected]?subject=Comment%20about%20dvbcut\">"
"[email protected]</a></p>"
"<p>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.</p>"
"<p>You should have received a copy of the GNU General Public License along "
"with this program; if not, see "
"<a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>.</p>"
"</span></body></html>").arg(VERSION_STRING));
}

#include <qhbox.h>
#include <qvbox.h>
#include <qdialog.h>
#include <qtextbrowser.h>
#include <qpushbutton.h>

class helpDialog : public QDialog {
public:
helpDialog(QWidget *parent, const char *name, QString file)
: QDialog(parent, name)
{
vbox = new QVBox(this);
vbox->resize(640, 480);
viewer = new QTextBrowser(vbox);
hbox = new QHBox(vbox);
prev = new QPushButton(tr("Prev"), hbox);
next = new QPushButton(tr("Next"), hbox);
home = new QPushButton(tr("Home"), hbox);
close = new QPushButton(tr("Close"), hbox);
close->setDefault(true);
connect(prev, SIGNAL(clicked()), viewer, SLOT(backward()));
connect(viewer, SIGNAL(backwardAvailable(bool)), prev, SLOT(setEnabled(bool)));
connect(next, SIGNAL(clicked()), viewer, SLOT(forward()));
connect(viewer, SIGNAL(forwardAvailable(bool)), next, SLOT(setEnabled(bool)));
connect(home, SIGNAL(clicked()), viewer, SLOT(home()));
connect(close, SIGNAL(clicked()), this, SLOT(accept()));
viewer->setSource(file);
setCaption(tr("dvbcut help"));
show();
}
virtual ~helpDialog() {
delete prev;
delete next;
delete home;
delete close;
delete hbox;
delete viewer;
delete vbox;
}
private:
QVBox *vbox;
QHBox *hbox;
QTextBrowser *viewer;
QPushButton *prev, *next, *home, *close;
};

void dvbcut::helpContentAction_activated()
{
QFileInfo appDir(qApp->applicationDirPath());
// first search in the directory containing dvbcut
QString helpFile = appDir.absFilePath() + "/dvbcut_en.html";
#ifndef __WIN32__
// Unix/Linux: search in the associated share subdirectory
if (!QFile::exists(helpFile)) {
helpFile = appDir.dirPath(true) + "/share/help/dvbcut_en.html";
}
#endif
if (QFile::exists(helpFile)) {
helpDialog dlg(this, "helpDialog", helpFile);
dlg.exec();
}
else {
QMessageBox::information(this, tr("dvbcut"),
tr("Help file %1 not available").arg(helpFile));
}
}
4 changes: 4 additions & 0 deletions src/dvbcut.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ class dvbcut: public dvbcutbase
void snapshotSave(std::vector<int> piclist, int range=0, int samples=1);
int chooseBestPicture(int startpic, int range, int smaples);

protected slots:
virtual void helpAboutAction_activated();
virtual void helpContentAction_activated();

public:
~dvbcut();
dvbcut(QWidget *parent = 0, const char *name = 0, WFlags fl = WType_TopLevel|WDestructiveClose );
Expand Down
35 changes: 35 additions & 0 deletions src/dvbcut_en.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<h1>Keyboard Shortcuts</h1>
<table>
<tr><td><b><u>Shortcut</u></b></td><td><b><u>Description</u></b></td></tr>
<tr><td>Alt+F</td><td>Open file menu</td></tr>
<tr><td>Alt+E</td><td>Open edit menu</td></tr>
<tr><td>Alt+V</td><td>Open view menu</td></tr>
<tr><td>Alt+H</td><td>Open help menu</td></tr>
<tr><td>O</td><td>Open a new file</td></tr>
<tr><td>S</td><td>Save the current project</td></tr>
<tr><td>G</td><td>Save a snapshot</td></tr>
<tr><td>Ctrl+G</td><td>Save chapter snapshots</td></tr>
<tr><td>E</td><td>Export Video</td></tr>
<tr><td>Ctrl+Q</td><td>Quit the program</td></tr>
<tr><td>A</td><td>Set start marker</td></tr>
<tr><td>N</td><td>Set stop marker</td></tr>
<tr><td>C</td><td>Set chapter marker</td></tr>
<tr><td>B</td><td>Set bookmark</td></tr>
<tr><td>Ctrl+C</td><td>Auto chapters</td></tr>
<tr><td>M</td><td>Suggest bookmarks</td></tr>
<tr><td>I</td><td>Import bookmarks</td></tr>
<tr><td>Ctrl+N</td><td>Normal view</td></tr>
<tr><td>Ctrl+U</td><td>Unscaled view</td></tr>
<tr><td>Ctrl+D</td><td>Show difference to current picture</td></tr>
<tr><td>Ctrl++</td><td>Zoom in</td></tr>
<tr><td>Ctrl+&mdash;</td><td>Zoom out</td></tr>
<tr><td>Ctrl+1</td><td>View full size</td></tr>
<tr><td>Ctrl+2</td><td>View half size</td></tr>
<tr><td>Ctrl+4</td><td>View quarter size</td></tr>
<tr><td>Ctrl+3</td><td>View custom size</td></tr>
<tr><td>P</td><td>Play video</td></tr>
<tr><td>Q</td><td>Stop playing video</td></tr>
<tr><td>Shift+&gt;</td><td>Play last 2 seconds audio</td></tr>
<tr><td>&lt;</td><td>Play next 2 seconds audio</td></tr>
<tr><td>F1</td><td>Show this file</td></tr>
</table>
56 changes: 54 additions & 2 deletions src/dvbcutbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@
<separator/>
<action name="fileCloseAction"/>
</item>
<item text="Edit" name="editMenu">
<item text="&amp;Edit" name="editMenu">
<action name="editStartAction"/>
<action name="editStopAction"/>
<action name="editChapterAction"/>
Expand All @@ -466,7 +466,7 @@
<action name="editSuggestAction"/>
<action name="editImportAction"/>
</item>
<item text="View" name="viewMenu">
<item text="&amp;View" name="viewMenu">
<action name="viewNormalAction"/>
<action name="viewUnscaledAction"/>
<action name="viewDifferenceAction"/>
Expand All @@ -486,6 +486,10 @@
<action name="playAudio1Action"/>
<action name="playAudio2Action"/>
</item>
<item text="&amp;Help" name="Help">
<action name="helpAboutAction"/>
<action name="helpContentAction"/>
</item>
</menubar>
<toolbars>
<toolbar dock="2">
Expand Down Expand Up @@ -966,6 +970,40 @@
<string>Ctrl+G</string>
</property>
</action>
<action>
<property name="name">
<cstring>helpAboutAction</cstring>
</property>
<property name="text">
<string>&amp;About</string>
</property>
<property name="menuText">
<string>&amp;About</string>
</property>
<property name="toolTip">
<string>About </string>
</property>
<property name="statusTip">
<string>About </string>
</property>
</action>
<action>
<property name="name">
<cstring>helpContentAction</cstring>
</property>
<property name="text">
<string>&amp;Contents</string>
</property>
<property name="menuText">
<string>&amp;Contents</string>
</property>
<property name="toolTip">
<string>Contents</string>
</property>
<property name="accel">
<string>F1</string>
</property>
</action>
</actions>
<images>
<image name="image0">
Expand Down Expand Up @@ -1234,6 +1272,18 @@
<receiver>dvbcutbase</receiver>
<slot>chapterSnapshotsSave()</slot>
</connection>
<connection>
<sender>helpAboutAction</sender>
<signal>activated()</signal>
<receiver>dvbcutbase</receiver>
<slot>helpAboutAction_activated()</slot>
</connection>
<connection>
<sender>helpContentAction</sender>
<signal>activated()</signal>
<receiver>dvbcutbase</receiver>
<slot>helpContentAction_activated()</slot>
</connection>
</connections>
<includes>
<include location="local" impldecl="in implementation">gettext.h</include>
Expand Down Expand Up @@ -1281,6 +1331,8 @@
<slot>viewQuarterSize()</slot>
<slot>snapshotSave()</slot>
<slot>chapterSnapshotsSave()</slot>
<slot>helpAboutAction_activated()</slot>
<slot>helpContentAction_activated()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>

0 comments on commit b6e7d05

Please sign in to comment.