chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | #ifndef SKINSPECTORWIDGET_H_ |
| 11 | #define SKINSPECTORWIDGET_H_ |
| 12 | |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 13 | #include "SkMatrix.h" |
| 14 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 15 | #include <QWidget> |
| 16 | #include <QTabWidget> |
| 17 | #include <QTextEdit> |
| 18 | #include <QHBoxLayout> |
| 19 | #include <QLabel> |
| 20 | #include <QLineEdit> |
kkinnunen | 7c339ae | 2015-01-02 06:35:43 -0800 | [diff] [blame] | 21 | #include <QGroupBox> |
| 22 | #include <QGridLayout> |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 23 | |
| 24 | /** \class SkInspectorWidget |
| 25 | |
| 26 | The InspectorWidget contains the overview and details tab. These contain |
| 27 | information about the whole picture and details about each draw command. |
| 28 | */ |
| 29 | class SkInspectorWidget : public QWidget { |
| 30 | Q_OBJECT |
| 31 | |
| 32 | public: |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 33 | enum TabType { |
| 34 | kOverview_TabType, |
| 35 | kDetail_TabType, |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 36 | kClipStack_TabType, |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 37 | kTotalTabCount, |
| 38 | }; |
| 39 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 40 | /** |
| 41 | Constructs a widget with the specified parent for layout purposes. |
| 42 | @param parent The parent container of this widget |
| 43 | */ |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 44 | SkInspectorWidget(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 45 | |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 46 | void setDisabled(bool isDisabled) { |
| 47 | fMatrixAndClipWidget.setDisabled(isDisabled); |
| 48 | } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 49 | |
| 50 | /** |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 51 | Sets the text in tab at the specified index. |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 52 | @param text |
| 53 | */ |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 54 | void setText(QString text, TabType type); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 55 | |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 56 | /** |
| 57 | Sets the text in the current matrix. |
| 58 | @param matrixValues |
| 59 | */ |
| 60 | void setMatrix(const SkMatrix& matrix); |
| 61 | |
| 62 | /** |
| 63 | Sets the text in the current clip. |
| 64 | @param clipValues |
| 65 | */ |
| 66 | void setClip(const SkIRect& clip); |
| 67 | |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 68 | class Tab : public QWidget { |
| 69 | QWidget fTab; |
| 70 | QHBoxLayout fTabLayout; |
| 71 | QTextEdit fTabText; |
| 72 | QString fName; |
| 73 | |
| 74 | Tab(const char* name) { |
| 75 | fTabText.setReadOnly(true); |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 76 | fTabLayout.addWidget(&fTabText); |
| 77 | fTab.setLayout(&fTabLayout); |
| 78 | fName = QString(name); |
| 79 | } |
| 80 | }; |
| 81 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 82 | private: |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 83 | QHBoxLayout fHorizontalLayout; |
| 84 | QTabWidget fTabWidget; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 85 | |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 86 | QWidget fTabs[kTotalTabCount]; |
| 87 | QHBoxLayout fTabLayouts[kTotalTabCount]; |
| 88 | QTextEdit fTabTexts[kTotalTabCount]; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 89 | |
kkinnunen | 7c339ae | 2015-01-02 06:35:43 -0800 | [diff] [blame] | 90 | QFrame fMatrixAndClipWidget; |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 91 | QVBoxLayout fVerticalLayout; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 92 | |
kkinnunen | 7c339ae | 2015-01-02 06:35:43 -0800 | [diff] [blame] | 93 | QGroupBox fMatrixGroup; |
| 94 | QGridLayout fMatrixLayout; |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 95 | QLineEdit fMatrixEntry[9]; |
| 96 | |
kkinnunen | 7c339ae | 2015-01-02 06:35:43 -0800 | [diff] [blame] | 97 | QGroupBox fClipGroup; |
| 98 | QGridLayout fClipLayout; |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 99 | QLineEdit fClipEntry[4]; |
| 100 | |
kkinnunen | 7c339ae | 2015-01-02 06:35:43 -0800 | [diff] [blame] | 101 | void setupMatrix(); |
| 102 | void setupClip(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | #endif |