Commit 8eed806d authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Move context help from Kid3MainWindow to ContextHelp.

parent 549b9189
......@@ -25,7 +25,7 @@ set(kid3_SRCS filelist.cpp fileproxymodel.cpp frame.cpp framelist.cpp
editframefieldsdialog.cpp playlistdialog.cpp playlistconfig.cpp
playlistcreator.cpp amazonimporter.cpp amazonconfig.cpp
recentfilesmenu.cpp playtoolbar.cpp textimporter.cpp textimportdialog.cpp
trackdatamatcher.cpp tagimportdialog.cpp configstore.cpp)
trackdatamatcher.cpp tagimportdialog.cpp configstore.cpp contexthelp.cpp)
if (HAVE_QTDBUS)
set(kid3_SRCS ${kid3_SRCS} scriptinterface.cpp)
......
......@@ -39,7 +39,7 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "externalprocess.h"
#include "configtable.h"
#include "configtablemodel.h"
......@@ -287,7 +287,7 @@ void BrowseCoverArtDialog::saveConfig()
*/
void BrowseCoverArtDialog::showHelp()
{
Kid3MainWindow::displayHelp("browse_pictures");
ContextHelp::displayHelp("browse_pictures");
}
/**
......
......@@ -57,7 +57,7 @@
#include "stringlistedit.h"
#include "configtable.h"
#include "commandstablemodel.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
enum { TextEncodingV1Latin1Index = 13 };
......@@ -631,7 +631,7 @@ void ConfigDialog::getConfig(FormatConfig* fnCfg,
*/
void ConfigDialog::slotHelp()
{
Kid3MainWindow::displayHelp("configure-kid3");
ContextHelp::displayHelp("configure-kid3");
}
#ifndef CONFIG_USE_KDE
......
/**
* \file contexthelp.cpp
* Context sensitive help.
*
* \b Project: Kid3
* \author Urs Fleisch
* \date 09 Jul 2011
*
* Copyright (C) 2011 Urs Fleisch
*
* This file is part of Kid3.
*
* Kid3 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.
*
* Kid3 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/>.
*/
#include "contexthelp.h"
#ifdef CONFIG_USE_KDE
#include <ktoolinvocation.h>
#else
#include "browserdialog.h"
#include "qtcompatmac.h"
BrowserDialog* ContextHelp::s_helpBrowser = 0;
#endif
#ifdef CONFIG_USE_KDE
/**
* Display help for a topic.
*
* @param anchor anchor in help document
*/
void ContextHelp::displayHelp(const QString& anchor)
{
KToolInvocation::invokeHelp(anchor);
}
#else
/**
* Display help for a topic.
*
* @param anchor anchor in help document
*/
void ContextHelp::displayHelp(const QString& anchor)
{
if (!s_helpBrowser) {
QString caption(QCM_translate(I18N_NOOP("Kid3 Handbook")));
s_helpBrowser =
new BrowserDialog(0, caption);
}
if (s_helpBrowser) {
s_helpBrowser->goToAnchor(anchor);
s_helpBrowser->setModal(!anchor.isEmpty());
if (s_helpBrowser->isHidden()) {
s_helpBrowser->show();
}
}
}
#endif
/**
* Free static resources.
*/
void ContextHelp::staticCleanup()
{
#ifndef CONFIG_USE_KDE
delete s_helpBrowser;
s_helpBrowser = 0;
#endif
}
/**
* \file contexthelp.h
* Context sensitive help.
*
* \b Project: Kid3
* \author Urs Fleisch
* \date 09 Jul 2011
*
* Copyright (C) 2011 Urs Fleisch
*
* This file is part of Kid3.
*
* Kid3 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.
*
* Kid3 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/>.
*/
#ifndef CONTEXTHELP_H
#define CONTEXTHELP_H
#include <QString>
#include "config.h"
class BrowserDialog;
/**
* Context sensitive help.
*/
class ContextHelp {
public:
/**
* Display help for a topic.
*
* @param anchor anchor in help document
*/
static void displayHelp(const QString& anchor = QString());
/**
* Free static resources.
*/
static void staticCleanup();
private:
#ifndef CONFIG_USE_KDE
static BrowserDialog* s_helpBrowser;
#endif
};
#endif // CONTEXTHELP_H
......@@ -33,10 +33,6 @@
#include <QFileDialog>
#endif
#include "taggedfile.h"
#include "genres.h"
#include "configstore.h"
#include "kid3mainwindow.h"
#include <QLayout>
#include <QPushButton>
#include <QLabel>
......@@ -52,11 +48,15 @@
#include <QUrl>
#include <QToolTip>
#include <QMessageBox>
#include "qtcompatmac.h"
#include <QGroupBox>
#include <QTextStream>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "taggedfile.h"
#include "genres.h"
#include "configstore.h"
#include "contexthelp.h"
#include "qtcompatmac.h"
/**
* Constructor.
......@@ -352,5 +352,5 @@ void ExportDialog::saveConfig()
*/
void ExportDialog::showHelp()
{
Kid3MainWindow::displayHelp("export");
ContextHelp::displayHelp("export");
}
......@@ -38,12 +38,12 @@
#include <QLineEdit>
#include <QComboBox>
#include <QToolTip>
#include "qtcompatmac.h"
#include <QGroupBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "qtcompatmac.h"
/**
* Constructor.
......@@ -212,7 +212,7 @@ void FilterDialog::saveConfig()
*/
void FilterDialog::showHelp()
{
Kid3MainWindow::displayHelp("filter");
ContextHelp::displayHelp("filter");
}
/**
......
......@@ -33,7 +33,6 @@
#include "frametablemodel.h"
#include "editframedialog.h"
#include "editframefieldsdialog.h"
#include "kid3mainwindow.h"
#include "qtcompatmac.h"
#ifdef CONFIG_USE_KDE
#include <kfiledialog.h>
......
......@@ -30,7 +30,6 @@
#include <QUrl>
#include "serverimporterconfig.h"
#include "kid3mainwindow.h"
/**
* Constructor.
......
......@@ -61,7 +61,7 @@
#include "textimportdialog.h"
#include "tagimportdialog.h"
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "taggedfile.h"
#include "trackdata.h"
#include "trackdatamodel.h"
......@@ -586,7 +586,7 @@ void ImportDialog::setDestination(ImportConfig::ImportDestination dest)
*/
void ImportDialog::showHelp()
{
Kid3MainWindow::displayHelp("import");
ContextHelp::displayHelp("import");
}
/**
......
......@@ -64,7 +64,6 @@
#include <kstandardaction.h>
#include <kshortcutsdialog.h>
#include <krecentfilesaction.h>
#include <ktoolinvocation.h>
#include <kactioncollection.h>
#include <kedittoolbar.h>
#include <kconfigskeleton.h>
......@@ -75,6 +74,7 @@
#include <QStatusBar>
#include <QMessageBox>
#include <QFileDialog>
#include "recentfilesmenu.h"
#endif
#include "kid3form.h"
......@@ -100,6 +100,7 @@
#include "pictureframe.h"
#include "textimporter.h"
#include "configstore.h"
#include "contexthelp.h"
#ifdef HAVE_ID3LIB
#include "mp3file.h"
#endif
......@@ -119,13 +120,6 @@
#include "playtoolbar.h"
#endif
#ifndef CONFIG_USE_KDE
#include "recentfilesmenu.h"
#include "browserdialog.h"
BrowserDialog* Kid3MainWindow::s_helpBrowser = 0;
#endif
/** Current directory */
QString Kid3MainWindow::s_dirName;
......@@ -207,10 +201,6 @@ Kid3MainWindow::~Kid3MainWindow()
delete m_downloadDialog;
delete m_browseCoverArtDialog;
delete m_playlistDialog;
#ifndef CONFIG_USE_KDE
delete s_helpBrowser;
s_helpBrowser = 0;
#endif
#ifdef HAVE_PHONON
delete m_playToolBar;
#endif
......@@ -1150,6 +1140,7 @@ void Kid3MainWindow::cleanup()
{
m_configStore->sync();
TaggedFile::staticCleanup();
ContextHelp::staticCleanup();
}
/**
......@@ -1440,16 +1431,6 @@ void Kid3MainWindow::slotSettingsToolbars()
}
}
/**
* Display help for a topic.
*
* @param anchor anchor in help document
*/
void Kid3MainWindow::displayHelp(const QString& anchor)
{
KToolInvocation::invokeHelp(anchor);
}
void Kid3MainWindow::slotHelpHandbook() {}
void Kid3MainWindow::slotHelpAbout() {}
void Kid3MainWindow::slotHelpAboutQt() {}
......@@ -1475,33 +1456,12 @@ void Kid3MainWindow::slotViewStatusBar()
slotStatusMsg(i18n("Ready."));
}
/**
* Display help for a topic.
*
* @param anchor anchor in help document
*/
void Kid3MainWindow::displayHelp(const QString& anchor)
{
if (!s_helpBrowser) {
QString caption(i18n("Kid3 Handbook"));
s_helpBrowser =
new BrowserDialog(NULL, caption);
}
if (s_helpBrowser) {
s_helpBrowser->goToAnchor(anchor);
s_helpBrowser->setModal(!anchor.isEmpty());
if (s_helpBrowser->isHidden()) {
s_helpBrowser->show();
}
}
}
/**
* Display handbook.
*/
void Kid3MainWindow::slotHelpHandbook()
{
displayHelp();
ContextHelp::displayHelp();
}
/**
......
......@@ -40,7 +40,6 @@ typedef KXmlGuiWindow Kid3MainWindowBaseClass;
#include "qtcompatmac.h"
#include <QMainWindow>
class QAction;
class BrowserDialog;
class RecentFilesMenu;
/** Base class for main window. */
typedef QMainWindow Kid3MainWindowBaseClass;
......@@ -294,13 +293,6 @@ public:
*/
DirProxyModel* getDirProxyModel() { return m_dirProxyModel; }
/**
* Display help for a topic.
*
* @param anchor anchor in help document
*/
static void displayHelp(const QString& anchor = QString::null);
/**
* Get directory name.
* @return directory.
......@@ -844,8 +836,6 @@ private:
QAction* m_viewStatusBar;
QAction* m_settingsAutoHideTags;
QAction* m_settingsShowHidePicture;
static BrowserDialog* s_helpBrowser;
#endif
/** Current directory */
......
......@@ -41,7 +41,7 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "musicbrainzclient.h"
#include "comboboxdelegate.h"
#include "trackdatamodel.h"
......@@ -462,7 +462,7 @@ void MusicBrainzDialog::saveConfig()
*/
void MusicBrainzDialog::showHelp()
{
Kid3MainWindow::displayHelp("import-musicbrainz");
ContextHelp::displayHelp("import-musicbrainz");
}
/**
......
......@@ -40,7 +40,7 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "qtcompatmac.h"
/**
......@@ -177,7 +177,7 @@ void NumberTracksDialog::saveConfig()
*/
void NumberTracksDialog::showHelp()
{
Kid3MainWindow::displayHelp("number-tracks");
ContextHelp::displayHelp("number-tracks");
}
/**
......
......@@ -41,7 +41,7 @@
#include <QGroupBox>
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "trackdata.h"
#include "qtcompatmac.h"
......@@ -282,5 +282,5 @@ void PlaylistDialog::saveConfig() const
*/
void PlaylistDialog::showHelp()
{
Kid3MainWindow::displayHelp("create-playlist");
ContextHelp::displayHelp("create-playlist");
}
......@@ -41,7 +41,7 @@
#include "frame.h"
#include "trackdata.h"
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "miscconfig.h"
#include "qtcompatmac.h"
......@@ -607,7 +607,7 @@ void RenDirDialog::saveConfig()
*/
void RenDirDialog::showHelp()
{
Kid3MainWindow::displayHelp("rename-directory");
ContextHelp::displayHelp("rename-directory");
}
/**
......
......@@ -38,7 +38,7 @@
#include <QListView>
#include "serverimporter.h"
#include "serverimporterconfig.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "trackdata.h"
#include "qtcompatmac.h"
......@@ -467,6 +467,6 @@ void ServerImportDialog::requestTrackList(const QModelIndex& index)
void ServerImportDialog::showHelp()
{
if (m_source && m_source->helpAnchor()) {
Kid3MainWindow::displayHelp(m_source->helpAnchor());
ContextHelp::displayHelp(m_source->helpAnchor());
}
}
......@@ -28,7 +28,6 @@
#include <QStandardItemModel>
#include "serverimporterconfig.h"
#include "importclient.h"
#include "kid3mainwindow.h"
#include "trackdata.h"
#include "qtcompatmac.h"
......
......@@ -34,7 +34,7 @@
#include "importparser.h"
#include "trackdatamodel.h"
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "qtcompatmac.h"
/**
......@@ -172,5 +172,5 @@ void TagImportDialog::saveConfig()
*/
void TagImportDialog::showHelp()
{
Kid3MainWindow::displayHelp("import-tags");
ContextHelp::displayHelp("import-tags");
}
......@@ -43,7 +43,7 @@
#include "textimporter.h"
#include "importparser.h"
#include "configstore.h"
#include "kid3mainwindow.h"
#include "contexthelp.h"
#include "qtcompatmac.h"
/**
......@@ -233,5 +233,5 @@ void TextImportDialog::saveConfig()
*/
void TextImportDialog::showHelp()
{
Kid3MainWindow::displayHelp("import-text");
ContextHelp::displayHelp("import-text");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment