itom  4.1.0
checkerBookmarkPanel.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 
22  Further hints:
23  ------------------------
24 
25  This file belongs to the code editor of itom. The code editor is
26  in major parts a fork / rewritten version of the python-based source
27  code editor PyQode from Colin Duquesnoy and others
28  (see https://github.com/pyQode). PyQode itself is licensed under
29  the MIT License (MIT).
30 
31  Some parts of the code editor of itom are also inspired by the
32  source code editor of the Spyder IDE (https://github.com/spyder-ide),
33  also licensed under the MIT License and developed by the Spyder Project
34  Contributors.
35 
36 *********************************************************************** */
37 
38 #ifndef CHECKERBOOKMARKPANEL_H
39 #define CHECKERBOOKMARKPANEL_H
40 
41 /*
42 Checker panels:
43 
44 - CheckerPanel: draw checker messages in front of each line
45 - GlobalCheckerPanel: draw all checker markers as colored rectangle to
46  offer a global view of all errors
47 */
48 
49 #include "../panel.h"
50 #include "../utils/utils.h"
51 #include "../textBlockUserData.h"
52 #include "../../models/bookmarkModel.h"
53 
54 #include <qevent.h>
55 #include <qsize.h>
56 #include <qcolor.h>
57 #include <qicon.h>
58 #include <qmap.h>
59 
60 class QMenu;
61 class QAction;
62 
63 namespace ito {
64 
65 class DelayJobRunnerBase;
66 /*
67 Shows messages collected by one or more checker modes
68 */
70 {
71  Q_OBJECT
72 public:
73  CheckerBookmarkPanel(BookmarkModel *bookmarkModel, const QString &description = "", QWidget *parent = NULL);
74  virtual ~CheckerBookmarkPanel();
75 
76  virtual QSize sizeHint() const;
77 
78  virtual void onUninstall();
79 
80  QList<CodeCheckerItem> markersForLine(int line) const;
81 
82  static QIcon iconFromMessages(bool hasCheckerMessages, bool hasBookmark, CodeCheckerItem::CheckerType checkerStatus);
83 
84 protected:
85  virtual void paintEvent(QPaintEvent *e);
86  virtual void mouseReleaseEvent(QMouseEvent *e);
87  virtual void mouseMoveEvent(QMouseEvent *e);
88  virtual void leaveEvent(QEvent *e);
89  virtual void contextMenuEvent (QContextMenuEvent *e);
90 
91 protected:
92  void displayTooltip(QList<QVariant> args);
93 
94 private:
95  int m_previousLine;
96  DelayJobRunnerBase *m_pJobRunner;
97  QMenu *m_pContextMenu;
98  QMap<QString, QAction*> m_contextMenuActions;
99  int m_contextMenuLine;
100  BookmarkModel* m_pBookmarkModel;
101 
102 signals:
103  void toggleBookmarkRequested(int line);
104  void gotoBookmarkRequested(bool next);
105  void clearAllBookmarksRequested();
106 
107 private slots:
108  void menuToggleBookmark();
109 };
110 
111 } //end namespace ito
112 
113 #endif
114 
115 
model for management of all bookmarks. This model will be displayed by a viewer-widget in the main wi...
void toggleBookmarkRequested(int line)
borrowed reference to the bookmark model. This model is owned by the script editor organizer...
Definition: checkerBookmarkPanel.h:69
Definition: apiFunctionsGraph.cpp:39
Definition: delayJobRunner.h:54
Definition: panel.h:66