2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-02-02 14:25:22 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-02-02 14:25:22 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-02-02 14:25:22 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-02-02 14:25:22 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-03-29 13:53:25 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-02-02 14:25:22 +01:00
|
|
|
|
2015-04-02 16:49:04 +02:00
|
|
|
#include <coreplugin/helpmanager.h>
|
|
|
|
|
|
2014-09-25 16:29:56 +02:00
|
|
|
#include <QMetaType>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMutex>
|
|
|
|
|
#include <QObject>
|
2014-06-17 15:37:40 +02:00
|
|
|
#include <QUrl>
|
2014-09-25 16:29:56 +02:00
|
|
|
#include <QStandardItemModel>
|
2010-02-02 14:25:22 +01:00
|
|
|
|
2010-03-23 17:21:48 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QHelpEngine)
|
2010-02-02 14:25:22 +01:00
|
|
|
|
2010-03-23 17:21:48 +01:00
|
|
|
class BookmarkManager;
|
|
|
|
|
|
2010-02-02 14:25:22 +01:00
|
|
|
namespace Help {
|
2014-06-17 15:37:40 +02:00
|
|
|
namespace Internal {
|
2010-02-02 14:25:22 +01:00
|
|
|
|
2010-06-11 13:11:37 +02:00
|
|
|
class LocalHelpManager : public QObject
|
2010-02-02 14:25:22 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2010-06-11 13:11:37 +02:00
|
|
|
public:
|
2014-06-17 15:37:40 +02:00
|
|
|
struct HelpData {
|
|
|
|
|
QUrl resolvedUrl;
|
|
|
|
|
QByteArray data;
|
|
|
|
|
QString mimeType;
|
|
|
|
|
};
|
|
|
|
|
|
2015-04-02 16:49:04 +02:00
|
|
|
enum StartOption {
|
|
|
|
|
ShowHomePage = 0,
|
|
|
|
|
ShowBlankPage = 1,
|
|
|
|
|
ShowLastPages = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-19 10:47:13 +02:00
|
|
|
LocalHelpManager(QObject *parent = nullptr);
|
2018-05-07 15:08:20 +02:00
|
|
|
~LocalHelpManager() override;
|
2010-03-23 17:21:48 +01:00
|
|
|
|
2014-05-14 13:15:01 +02:00
|
|
|
static LocalHelpManager *instance();
|
|
|
|
|
|
2014-10-22 14:47:04 +02:00
|
|
|
static QString defaultHomePage();
|
|
|
|
|
static QString homePage();
|
|
|
|
|
static void setHomePage(const QString &page);
|
|
|
|
|
|
2015-04-02 16:49:04 +02:00
|
|
|
static QFont fallbackFont();
|
|
|
|
|
static void setFallbackFont(const QFont &font);
|
|
|
|
|
|
|
|
|
|
static StartOption startOption();
|
|
|
|
|
static void setStartOption(StartOption option);
|
|
|
|
|
|
|
|
|
|
static Core::HelpManager::HelpViewerLocation contextHelpOption();
|
|
|
|
|
static void setContextHelpOption(Core::HelpManager::HelpViewerLocation location);
|
|
|
|
|
|
|
|
|
|
static bool returnOnClose();
|
|
|
|
|
static void setReturnOnClose(bool returnOnClose);
|
|
|
|
|
|
|
|
|
|
static QStringList lastShownPages();
|
|
|
|
|
static void setLastShownPages(const QStringList &pages);
|
|
|
|
|
|
|
|
|
|
static QList<float> lastShownPagesZoom();
|
2016-09-21 16:08:35 +02:00
|
|
|
static void setLastShownPagesZoom(const QList<qreal> &zoom);
|
2015-04-02 16:49:04 +02:00
|
|
|
|
|
|
|
|
static int lastSelectedTab();
|
|
|
|
|
static void setLastSelectedTab(int index);
|
|
|
|
|
|
2014-12-12 11:21:14 +01:00
|
|
|
static void setupGuiHelpEngine();
|
|
|
|
|
static void setEngineNeedsUpdate();
|
2010-02-02 14:25:22 +01:00
|
|
|
|
2010-03-23 17:21:48 +01:00
|
|
|
static QHelpEngine& helpEngine();
|
|
|
|
|
static BookmarkManager& bookmarkManager();
|
|
|
|
|
|
2014-06-03 17:17:08 +02:00
|
|
|
static bool isValidUrl(const QString &link);
|
2014-05-14 13:15:01 +02:00
|
|
|
|
2014-06-17 15:37:40 +02:00
|
|
|
static QByteArray loadErrorMessage(const QUrl &url, const QString &errorString);
|
|
|
|
|
Q_INVOKABLE static Help::Internal::LocalHelpManager::HelpData helpData(const QUrl &url);
|
2014-05-14 13:15:01 +02:00
|
|
|
|
2014-09-25 16:29:56 +02:00
|
|
|
static QAbstractItemModel *filterModel();
|
|
|
|
|
static void setFilterIndex(int index);
|
2014-10-01 17:52:57 +02:00
|
|
|
static int filterIndex();
|
2014-09-25 16:29:56 +02:00
|
|
|
|
|
|
|
|
static void updateFilterModel();
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void filterIndexChanged(int index);
|
2015-04-02 16:49:04 +02:00
|
|
|
void fallbackFontChanged(const QFont &font);
|
|
|
|
|
void returnOnCloseChanged();
|
2014-09-25 16:29:56 +02:00
|
|
|
|
2010-02-02 14:25:22 +01:00
|
|
|
private:
|
2014-12-12 11:21:14 +01:00
|
|
|
static bool m_guiNeedsSetup;
|
|
|
|
|
static bool m_needsCollectionFile;
|
2010-03-23 17:21:48 +01:00
|
|
|
|
2014-09-25 16:29:56 +02:00
|
|
|
static QStandardItemModel *m_filterModel;
|
|
|
|
|
static QString m_currentFilter;
|
|
|
|
|
static int m_currentFilterIndex;
|
|
|
|
|
|
2010-03-23 17:21:48 +01:00
|
|
|
static QMutex m_guiMutex;
|
|
|
|
|
static QHelpEngine *m_guiEngine;
|
|
|
|
|
|
2010-06-11 13:11:37 +02:00
|
|
|
static QMutex m_bkmarkMutex;
|
2010-03-23 17:21:48 +01:00
|
|
|
static BookmarkManager *m_bookmarkManager;
|
2010-02-02 14:25:22 +01:00
|
|
|
};
|
2014-06-17 15:37:40 +02:00
|
|
|
|
|
|
|
|
} // Internal
|
2010-02-02 14:25:22 +01:00
|
|
|
} // Help
|
|
|
|
|
|
2014-06-17 15:37:40 +02:00
|
|
|
Q_DECLARE_METATYPE(Help::Internal::LocalHelpManager::HelpData)
|