File indexing completed on 2024-04-28 03:51:15

0001 /*.
0002     SPDX-FileCopyrightText: 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef STEP_INFOBROWSER_H
0008 #define STEP_INFOBROWSER_H
0009 
0010 #include <QDockWidget>
0011 #include <QTextBrowser>
0012 #include <QUrl>
0013 
0014 class WorldModel;
0015 class QModelIndex;
0016 class QShowEvent;
0017 class QAction;
0018 
0019 class KToolBar;
0020 class KHTMLPart;
0021 class KJob;
0022 
0023 class InfoBrowser: public QDockWidget
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit InfoBrowser(WorldModel* worldModel, QWidget* parent = nullptr);
0029 
0030 public slots:
0031     void openUrl(const QUrl& url, bool clearHistory = false, bool fromHistory = false);
0032 
0033 protected slots:
0034     void worldCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
0035     void setHtml(const QString& data, bool fromHistory = false, const QUrl& url = QUrl());
0036 
0037     void back();
0038     void forward();
0039     void openInBrowser();
0040     void syncSelection(bool checked = true);
0041 
0042 protected:
0043     void showEvent(QShowEvent* event) override;
0044     void updateSyncSelection();
0045 
0046     WorldModel* _worldModel;
0047 
0048     KToolBar*   _toolBar;
0049     QTextBrowser* _htmlBrowser;
0050 
0051     QAction*    _followAction;
0052     QAction*    _syncAction;
0053     QAction*    _execAction;
0054     QAction*    _backAction;
0055     QAction*    _forwardAction;
0056     QStringList _backHistory;
0057     QStringList _forwardHistory;
0058 
0059     bool        _selectionChanged;
0060 };
0061 
0062 
0063 #endif