Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: debugger/QT/SkInspectorWidget.cpp

Issue 830743002: debugger: Make inspector widget smaller (Closed) Base URL: https://skia.googlesource.com/skia.git@debugger-resize-02-drawop-view-resize
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « debugger/QT/SkInspectorWidget.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkInspectorWidget.h" 10 #include "SkInspectorWidget.h"
11 #include <iostream> 11 #include <iostream>
12 12
robertphillips 2014/12/31 21:06:52 static const int ?
Kimmo Kinnunen 2015/01/02 07:17:54 Done.
13 enum {
14 kSignificantNumbersInFields = 5
15 };
16
13 SkInspectorWidget::SkInspectorWidget() : QWidget() 17 SkInspectorWidget::SkInspectorWidget() : QWidget()
14 , fHorizontalLayout(this) 18 , fHorizontalLayout(this)
15 , fMatrixAndClipWidget(this) 19 , fMatrixAndClipWidget(this)
16 , fVerticalLayout(&fMatrixAndClipWidget) 20 , fVerticalLayout(&fMatrixAndClipWidget) {
17 , fMatrixLabel(this)
18 , fClipLabel(this) {
19
20 fHorizontalLayout.setSpacing(6);
21 fHorizontalLayout.setContentsMargins(11, 11, 11, 11);
22
23 QString tabNames[kTotalTabCount]; 21 QString tabNames[kTotalTabCount];
24 tabNames[kOverview_TabType] = "Overview"; 22 tabNames[kOverview_TabType] = "Overview";
25 tabNames[kDetail_TabType] = "Details"; 23 tabNames[kDetail_TabType] = "Details";
26 tabNames[kClipStack_TabType] = "Clip Stack"; 24 tabNames[kClipStack_TabType] = "Clip Stack";
27 25
28 for (int i = 0; i < kTotalTabCount; i++) { 26 for (int i = 0; i < kTotalTabCount; i++) {
29 fTabTexts[i].setReadOnly(true); 27 fTabTexts[i].setReadOnly(true);
30 fTabLayouts[i].setSpacing(6);
31 fTabLayouts[i].setContentsMargins(11, 11, 11, 11);
32 fTabLayouts[i].addWidget(&fTabTexts[i]); 28 fTabLayouts[i].addWidget(&fTabTexts[i]);
33 fTabs[i].setLayout(&fTabLayouts[i]); 29 fTabs[i].setLayout(&fTabLayouts[i]);
34 fTabWidget.addTab(&fTabs[i], tabNames[i]); 30 fTabWidget.addTab(&fTabs[i], tabNames[i]);
35 } 31 }
36 32
37 fHorizontalLayout.setAlignment(Qt::AlignTop); 33 fHorizontalLayout.setAlignment(Qt::AlignTop);
38 fHorizontalLayout.addWidget(&fTabWidget); 34 fHorizontalLayout.addWidget(&fTabWidget);
39 35
40 /* NOTE(chudy): We add all the line edits to (this). Then we lay them out 36 fMatrixAndClipWidget.setFrameStyle(QFrame::Panel);
41 * by adding them to horizontal layouts.
42 *
43 * We will have 1 big vertical layout, 3 horizontal layouts and then 3
44 * line edits in each horizontal layout. */
45 fMatrixAndClipWidget.setFixedSize(260,300);
46 fMatrixAndClipWidget.setDisabled(true); 37 fMatrixAndClipWidget.setDisabled(true);
47
48 fVerticalLayout.setAlignment(Qt::AlignVCenter); 38 fVerticalLayout.setAlignment(Qt::AlignVCenter);
robertphillips 2014/12/31 21:06:53 this-> on these two ?
Kimmo Kinnunen 2015/01/02 07:17:54 Done.
49 fVerticalLayout.addLayout(setupMatrix()); 39 setupMatrix();
50 fVerticalLayout.addLayout(setupClip()); 40 setupClip();
41 fVerticalLayout.addWidget(&fMatrixGroup);
42 fVerticalLayout.addWidget(&fClipGroup);
51 fHorizontalLayout.addWidget(&fMatrixAndClipWidget); 43 fHorizontalLayout.addWidget(&fMatrixAndClipWidget);
52 } 44 }
53 45
54 void SkInspectorWidget::setText(QString text, TabType type) { 46 void SkInspectorWidget::setText(QString text, TabType type) {
55 fTabTexts[type].setHtml(text); 47 fTabTexts[type].setHtml(text);
56 } 48 }
57 49
58 void SkInspectorWidget::setMatrix(const SkMatrix& matrix) { 50 void SkInspectorWidget::setMatrix(const SkMatrix& matrix) {
59 for(int i=0; i<9; i++) { 51 for(int i=0; i<9; i++) {
60 fMatrixEntry[i].setText(QString::number(matrix.get(i))); 52 fMatrixEntry[i].setText(QString::number(matrix.get(i), 'g', kSignificant NumbersInFields));
61 } 53 }
62 } 54 }
63 55
64 void SkInspectorWidget::setClip(const SkIRect& clip) { 56 void SkInspectorWidget::setClip(const SkIRect& clip) {
65 fClipEntry[0].setText(QString::number(clip.left())); 57 fClipEntry[0].setText(QString::number(clip.left(), 'g', kSignificantNumbersI nFields));
66 fClipEntry[1].setText(QString::number(clip.top())); 58 fClipEntry[1].setText(QString::number(clip.top(), 'g', kSignificantNumbersIn Fields));
67 fClipEntry[2].setText(QString::number(clip.right())); 59 fClipEntry[2].setText(QString::number(clip.right(), 'g', kSignificantNumbers InFields));
68 fClipEntry[3].setText(QString::number(clip.bottom())); 60 fClipEntry[3].setText(QString::number(clip.bottom(), 'g', kSignificantNumber sInFields));
69 } 61 }
70 62
71 QVBoxLayout* SkInspectorWidget::setupMatrix() { 63 void SkInspectorWidget::setupMatrix() {
72 fMatrixLabel.setText("Current Matrix"); 64 fMatrixGroup.setTitle("Current Matrix");
73 fMatrixLabel.setAlignment(Qt::AlignHCenter); 65 fMatrixGroup.setLayout(&fMatrixLayout);
74 66 for (int r = 0; r < 3; ++r) {
75 fMatrixLayout.setSpacing(6); 67 for(int c = 0; c < 3; c++) {
76 fMatrixLayout.setContentsMargins(11,11,11,0); 68 QLineEdit* entry = &fMatrixEntry[r * 3 + c];
77 fMatrixLayout.setAlignment(Qt::AlignTop | Qt::AlignHCenter); 69 fMatrixLayout.addWidget(entry, r, c, Qt::AlignTop | Qt::AlignHCenter );
78 fMatrixLayout.addWidget(&fMatrixLabel); 70 entry->setReadOnly(true);
79 71 entry->setFixedWidth(70);
80 for(int i =0; i<9; i++) {
81 fMatrixEntry[i].setMinimumSize(QSize(70,25));
82 fMatrixEntry[i].setMaximumSize(QSize(70,16777215));
83 fMatrixEntry[i].setReadOnly(true);
84
85 fMatrixRow[i/3].addWidget(&fMatrixEntry[i]);
86 if(i%3 == 2) {
87 fMatrixLayout.addLayout(&fMatrixRow[i/3]);
88 } 72 }
89 } 73 }
90
91 return &fMatrixLayout;
92 } 74 }
93 75
94 QVBoxLayout* SkInspectorWidget::setupClip() { 76 void SkInspectorWidget::setupClip() {
95 fClipLabel.setText("Current Clip"); 77 fClipGroup.setTitle("Current Clip");
96 fClipLabel.setAlignment(Qt::AlignHCenter); 78 fClipGroup.setLayout(&fClipLayout);
97 79 for(int r = 0; r < 2; r++) {
98 fClipLayout.setSpacing(6); 80 for(int c = 0; c < 2; c++) {
99 fClipLayout.setContentsMargins(11,11,11,0); 81 QLineEdit* entry = &fClipEntry[r * 2 + c];
100 fClipLayout.setAlignment(Qt::AlignTop | Qt::AlignHCenter); 82 fClipLayout.addWidget(entry, r, c, Qt::AlignTop | Qt::AlignHCenter);
101 fClipLayout.addWidget(&fClipLabel); 83 entry->setReadOnly(true);
102 84 entry->setFixedWidth(70);
103 for(int i =0; i<4; i++) {
104 fClipEntry[i].setMinimumSize(QSize(70,25));
105 fClipEntry[i].setMaximumSize(QSize(70,16777215));
106 fClipEntry[i].setReadOnly(true);
107
108 fClipRow[i/2].addWidget(&fClipEntry[i]);
109 if(i%2 == 1) {
110 fClipLayout.addLayout(&fClipRow[i/2]);
111 } 85 }
112 } 86 }
113
114 return &fClipLayout;
115 } 87 }
OLDNEW
« no previous file with comments | « debugger/QT/SkInspectorWidget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698