Skip to content

Commit

Permalink
GUI: add help menu with links to the documentation
Browse files Browse the repository at this point in the history
Implements #1195.
  • Loading branch information
mbunkus committed May 25, 2015
1 parent b419998 commit 44ae7de
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2015-05-25 Moritz Bunkus <moritz@bunkus.org>

* MKVToolNix GUI: new feature: added a »help« menu with links to
several parts of the MKVToolNix documentation. Implements #1195.

* MKVToolNix GUI: job output tool: added a button for acknowleding
the warnings/errors produced for the job shown. Implements #1210
and is the last part of the implementation of #1196.
Expand Down
31 changes: 31 additions & 0 deletions src/mkvtoolnix-gui/forms/main_window/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,22 @@
<addaction name="separator"/>
<addaction name="actionJobOutputClose"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Hel&amp;p</string>
</property>
<addaction name="actionHelpMkvmergeDocumentation"/>
<addaction name="actionHelpFAQ"/>
<addaction name="actionHelpKnownProblems"/>
<addaction name="separator"/>
<addaction name="actionHelpWebSite"/>
</widget>
<addaction name="menuGUI"/>
<addaction name="menuMerge"/>
<addaction name="menuHeaderEditor"/>
<addaction name="menuChapterEditor"/>
<addaction name="menuJobOutput"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionMergeNew">
Expand Down Expand Up @@ -493,6 +504,26 @@
<string>Ctrl+W</string>
</property>
</action>
<action name="actionHelpWebSite">
<property name="text">
<string>MKVToolNix &amp;web site</string>
</property>
</action>
<action name="actionHelpFAQ">
<property name="text">
<string>&amp;FAQ</string>
</property>
</action>
<action name="actionHelpKnownProblems">
<property name="text">
<string>Known &amp;problems in recent releases</string>
</property>
</action>
<action name="actionHelpMkvmergeDocumentation">
<property name="text">
<string>mkv&amp;merge documentation</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
Expand Down
21 changes: 21 additions & 0 deletions src/mkvtoolnix-gui/main_window/main_window.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "common/common_pch.h"

#include <QCloseEvent>
#include <QDesktopServices>
#include <QIcon>
#include <QLabel>
#include <QSettings>
Expand Down Expand Up @@ -48,6 +49,7 @@ MainWindow::MainWindow(QWidget *parent)

setupMenu();
setupToolSelector();
setupHelpURLs();

// Setup window properties.
setWindowIcon(Util::loadIcon(Q("mkvtoolnix-gui.png"), QList<int>{} << 32 << 48 << 64 << 128 << 256));
Expand Down Expand Up @@ -101,6 +103,11 @@ MainWindow::setupMenu() {
#else
ui->actionGUICheckForUpdates->setVisible(false);
#endif // HAVE_CURL_EASY_H

connect(ui->actionHelpFAQ, &QAction::triggered, this, &MainWindow::visitHelpURL);
connect(ui->actionHelpKnownProblems, &QAction::triggered, this, &MainWindow::visitHelpURL);
connect(ui->actionHelpMkvmergeDocumentation, &QAction::triggered, this, &MainWindow::visitHelpURL);
connect(ui->actionHelpWebSite, &QAction::triggered, this, &MainWindow::visitHelpURL);
}

void
Expand Down Expand Up @@ -149,6 +156,14 @@ MainWindow::setupToolSelector() {
connect(m_toolJobs->model(), &Jobs::Model::numUnacknowledgedWarningsOrErrorsChanged, m_statusBarProgress, &StatusBarProgressWidget::setNumUnacknowledgedWarningsOrErrors);
}

void
MainWindow::setupHelpURLs() {
m_helpURLs[ui->actionHelpFAQ] = "https://github.com/mbunkus/mkvtoolnix/wiki";
m_helpURLs[ui->actionHelpKnownProblems] = "https://github.com/mbunkus/mkvtoolnix/wiki/Troubleshooting";
m_helpURLs[ui->actionHelpMkvmergeDocumentation] = "https://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge.html";
m_helpURLs[ui->actionHelpWebSite] = "https://www.bunkus.org/videotools/mkvtoolnix/";
}

void
MainWindow::showAndEnableMenu(QMenu &menu,
bool show) {
Expand Down Expand Up @@ -366,4 +381,10 @@ MainWindow::resizeEvent(QResizeEvent *event) {
event->accept();
}

void
MainWindow::visitHelpURL() {
if (m_helpURLs.contains(sender()))
QDesktopServices::openUrl(m_helpURLs[sender()]);
}

}}
4 changes: 4 additions & 0 deletions src/mkvtoolnix-gui/main_window/main_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class MainWindow : public QMainWindow {
Util::WindowGeometrySaver m_geometrySaver;
std::unique_ptr<Util::MovingPixmapOverlay> m_movingPixmapOverlay;

QHash<QObject *, QString> m_helpURLs;

protected: // static
static MainWindow *ms_mainWindow;

Expand All @@ -82,6 +84,7 @@ public slots:
virtual void changeToolToSender();
virtual void toolChanged(int index);
virtual void editPreferences();
virtual void visitHelpURL();

#if defined(HAVE_CURL_EASY_H)
virtual void updateCheckFinished(UpdateCheckStatus status, mtx_release_version_t release);
Expand All @@ -105,6 +108,7 @@ public slots:
protected:
virtual void setupMenu();
virtual void setupToolSelector();
virtual void setupHelpURLs();
virtual QWidget *createNotImplementedWidget();

virtual void closeEvent(QCloseEvent *event);
Expand Down

0 comments on commit 44ae7de

Please sign in to comment.