File indexing completed on 2024-05-19 05:42:26
0001 // ct_lvtqtw_graphtabelement.h -*-C++-*- 0002 0003 /* 0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk> 0005 // SPDX-License-Identifier: Apache-2.0 0006 // 0007 // Licensed under the Apache License, Version 2.0 (the "License"); 0008 // you may not use this file except in compliance with the License. 0009 // You may obtain a copy of the License at 0010 // 0011 // http://www.apache.org/licenses/LICENSE-2.0 0012 // 0013 // Unless required by applicable law or agreed to in writing, software 0014 // distributed under the License is distributed on an "AS IS" BASIS, 0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0016 // See the License for the specific language governing permissions and 0017 // limitations under the License. 0018 */ 0019 0020 #ifndef DEFINED_CT_LVTQTW_GRAPHTABELEMENT_H 0021 #define DEFINED_CT_LVTQTW_GRAPHTABELEMENT_H 0022 0023 #include <lvtqtw_export.h> 0024 0025 #include <ct_lvtldr_lakosiannode.h> 0026 #include <ct_lvtplg_pluginmanager.h> 0027 #include <ct_lvtprj_projectfile.h> 0028 0029 #include <ct_lvtshr_graphenums.h> 0030 0031 #include <kmessagewidget.h> 0032 0033 #include <QWidget> 0034 #include <memory> 0035 0036 class QString; 0037 class QJsonDocument; 0038 class CodeVisApplicationTestFixture; 0039 0040 namespace Ui { 0041 class GraphTabElement; 0042 } 0043 namespace Codethink::lvtqtc { 0044 class GraphicsView; 0045 class ITool; 0046 } // namespace Codethink::lvtqtc 0047 namespace Codethink::lvtldr { 0048 class NodeStorage; 0049 } 0050 namespace Codethink::lvtprj { 0051 class ProjectFile; 0052 } 0053 0054 namespace Codethink::lvtqtw { 0055 0056 class LVTQTW_EXPORT GraphTabElement : public QWidget { 0057 Q_OBJECT 0058 public: 0059 friend class ::CodeVisApplicationTestFixture; 0060 0061 GraphTabElement(Codethink::lvtldr::NodeStorage& nodeStorage, lvtprj::ProjectFile& projectFile, QWidget *parent); 0062 ~GraphTabElement() override; 0063 0064 void setCurrentDiagramFromHistory(int idx); 0065 // connected with the currentIndexChanged from the History Model. 0066 0067 [[nodiscard]] lvtqtc::GraphicsView *graphicsView() const; 0068 0069 Q_SIGNAL void historyUpdate(const QString& bookmarkName); 0070 // triggered when we change the displayed graph due to one of the history 0071 // buttons 0072 0073 Q_SIGNAL void sendMessage(const QString& message, KMessageWidget::MessageType type); 0074 0075 void toggleFilterVisibility(); 0076 0077 void setPluginManager(Codethink::lvtplg::PluginManager& pm); 0078 0079 void saveBookmark(const QString& title, lvtprj::ProjectFile::BookmarkType type); 0080 void loadBookmark(const QJsonDocument& doc, lvtshr::HistoryType historyType); 0081 0082 protected: 0083 void resizeEvent(QResizeEvent *ev) override; 0084 0085 private: 0086 void setupToolBar(Codethink::lvtldr::NodeStorage& nodeStorage); 0087 std::vector<lvtqtc::ITool *> tools() const; 0088 0089 std::unique_ptr<Ui::GraphTabElement> ui; 0090 struct Private; 0091 std::unique_ptr<Private> d; 0092 }; 0093 0094 } // namespace Codethink::lvtqtw 0095 #endif