From b6e7d05cd0a7b43307c6b2e17ba0dae01569b52f Mon Sep 17 00:00:00 2001 From: too-tired Date: Sat, 27 Jun 2009 17:08:09 +0000 Subject: [PATCH] add help menu and dialog git-svn-id: https://dvbcut.svn.sourceforge.net/svnroot/dvbcut/trunk@165 36490176-9c1c-0410-b649-dbf2af5787bf --- ChangeLog | 13 +++++++ DISTFILES | 1 + src/Makefile.in | 4 ++- src/dvbcut.cpp | 87 ++++++++++++++++++++++++++++++++++++++++++++++ src/dvbcut.h | 4 +++ src/dvbcut_en.html | 35 +++++++++++++++++++ src/dvbcutbase.ui | 56 +++++++++++++++++++++++++++-- 7 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 src/dvbcut_en.html diff --git a/ChangeLog b/ChangeLog index e3e5690..6f5e417 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-06-27 Michael Riepe + + * 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 * src/stream.h: diff --git a/DISTFILES b/DISTFILES index 059201e..efb5f68 100644 --- a/DISTFILES +++ b/DISTFILES @@ -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 diff --git a/src/Makefile.in b/src/Makefile.in index 57def24..8f88942 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -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) @@ -94,6 +95,7 @@ check: install: all installdirs $(INSTALL_PROGRAM) dvbcut$(EXEEXT) $(DESTDIR)$(bindir) + $(INSTALL_DATA) dvbcut_en.html $(DESTDIR)$(helpdir) installdirs: $(installdirs) diff --git a/src/dvbcut.cpp b/src/dvbcut.cpp index a0ba9b3..aac620d 100644 --- a/src/dvbcut.cpp +++ b/src/dvbcut.cpp @@ -2381,3 +2381,90 @@ void dvbcut::update_quick_picture_lookup_table() { update_time_display(); } +void dvbcut::helpAboutAction_activated() +{ + QMessageBox::about(this, tr("dvbcut"), + tr("" + "

dvbcut Version %1

" + "eMail: " + "dvbcut-user@lists.sourceforge.net

" + "

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, see " + "http://www.gnu.org/licenses/.

" + "
").arg(VERSION_STRING)); +} + +#include +#include +#include +#include +#include + +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)); + } +} diff --git a/src/dvbcut.h b/src/dvbcut.h index df041df..68a44d5 100644 --- a/src/dvbcut.h +++ b/src/dvbcut.h @@ -130,6 +130,10 @@ class dvbcut: public dvbcutbase void snapshotSave(std::vector 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 ); diff --git a/src/dvbcut_en.html b/src/dvbcut_en.html new file mode 100644 index 0000000..1b637f1 --- /dev/null +++ b/src/dvbcut_en.html @@ -0,0 +1,35 @@ +

Keyboard Shortcuts

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ShortcutDescription
Alt+FOpen file menu
Alt+EOpen edit menu
Alt+VOpen view menu
Alt+HOpen help menu
OOpen a new file
SSave the current project
GSave a snapshot
Ctrl+GSave chapter snapshots
EExport Video
Ctrl+QQuit the program
ASet start marker
NSet stop marker
CSet chapter marker
BSet bookmark
Ctrl+CAuto chapters
MSuggest bookmarks
IImport bookmarks
Ctrl+NNormal view
Ctrl+UUnscaled view
Ctrl+DShow difference to current picture
Ctrl++Zoom in
Ctrl+—Zoom out
Ctrl+1View full size
Ctrl+2View half size
Ctrl+4View quarter size
Ctrl+3View custom size
PPlay video
QStop playing video
Shift+>Play last 2 seconds audio
<Play next 2 seconds audio
F1Show this file
diff --git a/src/dvbcutbase.ui b/src/dvbcutbase.ui index 78ff388..2148f44 100644 --- a/src/dvbcutbase.ui +++ b/src/dvbcutbase.ui @@ -456,7 +456,7 @@ - + @@ -466,7 +466,7 @@ - + @@ -486,6 +486,10 @@ + + + + @@ -966,6 +970,40 @@ Ctrl+G + + + helpAboutAction + + + &About + + + &About + + + About + + + About + + + + + helpContentAction + + + &Contents + + + &Contents + + + Contents + + + F1 + + @@ -1234,6 +1272,18 @@ dvbcutbase chapterSnapshotsSave() + + helpAboutAction + activated() + dvbcutbase + helpAboutAction_activated() + + + helpContentAction + activated() + dvbcutbase + helpContentAction_activated() + gettext.h @@ -1281,6 +1331,8 @@ viewQuarterSize() snapshotSave() chapterSnapshotsSave() + helpAboutAction_activated() + helpContentAction_activated()