, fToolBar(this)
, fActionOpen(this)
, fActionBreakpoint(this)
+ , fActionProfile(this)
, fActionCancel(this)
, fActionClearBreakpoints(this)
, fActionClearDeletes(this)
connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector()));
connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionSettings()));
connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString)));
+ connect(&fActionProfile, SIGNAL(triggered()), this, SLOT(actionProfile()));
connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel()));
connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints()));
connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes()));
}
}
+void SkDebuggerGUI::actionProfile() {
+}
+
void SkDebuggerGUI::actionCancel() {
for (int row = 0; row < fListWidget.count(); row++) {
fListWidget.item(row)->setHidden(false);
}
void SkDebuggerGUI::actionSave() {
- QString filename;
- filename.append(fPath);
- filename.append("/");
- filename.append(fDirectoryWidget.currentItem()->text());
- saveToFile(filename);
+ fFileName = fPath.toAscii();
+ fFileName.append("/");
+ fFileName.append(fDirectoryWidget.currentItem()->text().toAscii());
+ saveToFile(fFileName);
}
void SkDebuggerGUI::actionSaveAs() {
if (!filename.endsWith(".skp", Qt::CaseInsensitive)) {
filename.append(".skp");
}
- saveToFile(filename);
+ saveToFile(SkString(filename.toAscii()));
}
void SkDebuggerGUI::actionScale(float scaleFactor) {
fInspectorWidget.setClip(fDebugger.getCurrentClip());
}
-void SkDebuggerGUI::saveToFile(QString filename) {
- SkFILEWStream file(filename.toAscii());
+void SkDebuggerGUI::saveToFile(const SkString& filename) {
+ SkFILEWStream file(filename.c_str());
fDebugger.makePicture()->serialize(&file);
}
void SkDebuggerGUI::loadFile(QListWidgetItem *item) {
if (fDirectoryWidgetActive) {
- QString fileName;
- fileName.append(fPath);
- fileName.append("/");
- fileName.append(item->text());
- loadPicture(fileName);
+ fFileName = fPath.toAscii();
+ fFileName.append("/");
+ fFileName.append(item->text().toAscii());
+ loadPicture(fFileName);
}
}
void SkDebuggerGUI::openFile() {
- QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
+ QString temp = QFileDialog::getOpenFileName(this, tr("Open File"), "",
tr("Files (*.*)"));
fDirectoryWidgetActive = false;
- if (!fileName.isNull()) {
- QFileInfo pathInfo(fileName);
+ if (!temp.isEmpty()) {
+ QFileInfo pathInfo(temp);
fPath = pathInfo.path();
- loadPicture(fileName);
+ loadPicture(SkString(temp.toAscii()));
setupDirectoryWidget();
}
fDirectoryWidgetActive = true;
fActionDirectory.setShortcut(QKeySequence(tr("Ctrl+D")));
fActionDirectory.setText("Directory");
+ QIcon profile;
+ profile.addFile(QString::fromUtf8(":/images/Ico/reload.png"), QSize(),
+ QIcon::Normal, QIcon::Off);
+ fActionProfile.setIcon(profile);
+ fActionProfile.setText("Profile");
+
QIcon inspector;
inspector.addFile(QString::fromUtf8(":/images/Ico/inspector.png"),
QSize(), QIcon::Normal, QIcon::Off);
fToolBar.addSeparator();
fToolBar.addAction(&fActionInspector);
fToolBar.addSeparator();
+ fToolBar.addAction(&fActionProfile);
+
+ fToolBar.addSeparator();
fToolBar.addWidget(&fSpacer);
fToolBar.addWidget(&fFilter);
fToolBar.addAction(&fActionCancel);
// TODO(chudy): Remove static call.
fDirectoryWidgetActive = false;
- fPath = "/usr/local/google/home/chudy/trunk-git/trunk/skp";
+ fPath = "";
+ fFileName = "";
setupDirectoryWidget();
fDirectoryWidgetActive = true;
}
}
-void SkDebuggerGUI::loadPicture(QString fileName) {
+void SkDebuggerGUI::loadPicture(const SkString& fileName) {
+ fFileName = fileName;
fLoading = true;
- SkStream* stream = SkNEW_ARGS(SkFILEStream, (fileName.toAscii()));
+ SkStream* stream = SkNEW_ARGS(SkFILEStream, (fileName.c_str()));
SkPicture* picture = SkNEW_ARGS(SkPicture, (stream, NULL, &SkImageDecoder::DecodeStream));
fCanvasWidget.resetWidgetTransform();
fDebugger.loadPicture(picture);
indent += 10;
}
+ item->setData(Qt::UserRole + 4, -1.0);
+
fListWidget.addItem(item);
}
}
QString drawCommandText = index.data(Qt::DisplayRole).toString();
QString drawCommandNumber = index.data(Qt::UserRole + 1).toString();
+ float time = index.data(Qt::UserRole + 4).toFloat();
+ QString drawTime;
+ drawTime.setNum(time, 'g', 3);
/* option.rect is a struct that Qt uses as a target to draw into. Following
* the format (x1,y1,x2,y2) x1 and y1 represent where the painter can start
* affect size of text but will scale icons. */
static const int kImageSpace = 35;
static const int kCommandNumberSpace = 30;
+ static const int kTimeSpace = 30;
// Breakpoint Icon
r = option.rect.adjusted(5, 10, -10, -10);
deleteIcon.paint(painter, r, Qt::AlignVCenter|Qt::AlignLeft);
// Draw Command
- r = option.rect.adjusted(kImageSpace+kCommandNumberSpace+indent, 0, -10, -7);
+ if (time >= 0.0) {
+ r = option.rect.adjusted(kImageSpace+kCommandNumberSpace+kTimeSpace+indent, 0, -10, -7);
+ } else {
+ // don't need time offset
+ r = option.rect.adjusted(kImageSpace+kCommandNumberSpace+indent, 0, -10, -7);
+ }
painter->drawText(r.left(), r.top(), r.width(), r.height(),
Qt::AlignBottom|Qt::AlignLeft, drawCommandText, &r);
r = option.rect.adjusted(kImageSpace, 0, -10, -7);
painter->drawText(r.left(), r.top(), r.width(), r.height(),
Qt::AlignBottom|Qt::AlignLeft, drawCommandNumber, &r);
+
+ if (time >= 0.0) {
+ // Draw time
+ r = option.rect.adjusted(kImageSpace+kCommandNumberSpace, 0, -10, -7);
+ painter->drawText(r.left(), r.top(), r.width(), r.height(),
+ Qt::AlignBottom|Qt::AlignLeft, drawTime, &r);
+ }
}
QSize SkListWidget::sizeHint ( const QStyleOptionViewItem & option,