2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SKDEBUGGERUI_H
|
|
|
|
#define SKDEBUGGERUI_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "SkCanvas.h"
|
2012-07-26 19:38:22 +00:00
|
|
|
#include "SkCanvasWidget.h"
|
2012-08-07 16:12:23 +00:00
|
|
|
#include "SkDebugger.h"
|
2012-07-26 19:38:22 +00:00
|
|
|
#include "SkGLWidget.h"
|
2012-06-29 14:21:22 +00:00
|
|
|
#include "SkListWidget.h"
|
|
|
|
#include "SkInspectorWidget.h"
|
2012-07-26 19:38:22 +00:00
|
|
|
#include "SkRasterWidget.h"
|
2012-11-21 17:11:02 +00:00
|
|
|
#include "SkImageWidget.h"
|
2012-06-29 14:21:22 +00:00
|
|
|
#include "SkSettingsWidget.h"
|
|
|
|
#include <QtCore/QVariant>
|
|
|
|
#include <QtGui/QAction>
|
|
|
|
#include <QtGui/QApplication>
|
|
|
|
#include <QtGui/QButtonGroup>
|
|
|
|
#include <QtGui/QHBoxLayout>
|
|
|
|
#include <QtGui/QHeaderView>
|
|
|
|
#include <QtGui/QListView>
|
|
|
|
#include <QtGui/QListWidget>
|
|
|
|
#include <QtGui/QMainWindow>
|
|
|
|
#include <QtGui/QStatusBar>
|
|
|
|
#include <QtGui/QToolBar>
|
|
|
|
#include <QtGui/QVBoxLayout>
|
|
|
|
#include <QtGui/QWidget>
|
|
|
|
#include <QtGui/QMenu>
|
|
|
|
#include <QtGui/QMenuBar>
|
|
|
|
#include <vector>
|
|
|
|
|
2012-11-19 20:44:29 +00:00
|
|
|
class SkTimedPicture;
|
|
|
|
namespace sk_tools {
|
|
|
|
class PictureRenderer;
|
|
|
|
}
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/** \class SkDebuggerGUI
|
|
|
|
|
|
|
|
Container for the UI and it's functions.
|
|
|
|
*/
|
|
|
|
class SkDebuggerGUI : public QMainWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructs the view of the application.
|
|
|
|
@param parent The parent container of this widget.
|
|
|
|
*/
|
|
|
|
SkDebuggerGUI(QWidget *parent = 0);
|
|
|
|
|
|
|
|
~SkDebuggerGUI();
|
|
|
|
|
2013-01-28 17:43:26 +00:00
|
|
|
/**
|
|
|
|
Updates the directory widget with the latest directory path stored in
|
|
|
|
the global class variable fPath.
|
|
|
|
*/
|
|
|
|
void setupDirectoryWidget(const QString& path);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Loads the specified file.
|
|
|
|
*/
|
|
|
|
void openFile(const QString& filename);
|
|
|
|
|
2012-07-09 20:26:53 +00:00
|
|
|
signals:
|
|
|
|
void commandChanged(int command);
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private slots:
|
|
|
|
/**
|
|
|
|
Toggles breakpoint view in the list widget.
|
|
|
|
*/
|
|
|
|
void actionBreakpoints();
|
|
|
|
|
2012-11-12 20:42:12 +00:00
|
|
|
/**
|
|
|
|
Profile the commands
|
|
|
|
*/
|
|
|
|
void actionProfile();
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Cancels the command filter in the list widget.
|
|
|
|
*/
|
|
|
|
void actionCancel();
|
|
|
|
|
2012-07-17 15:40:51 +00:00
|
|
|
/**
|
|
|
|
Clears the breakpoint state off of all commands marked as breakpoints.
|
|
|
|
*/
|
|
|
|
void actionClearBreakpoints();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Clears the deleted state off of all commands marked as deleted.
|
|
|
|
*/
|
|
|
|
void actionClearDeletes();
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Applies a visible filter to all drawing commands other than the previous.
|
|
|
|
*/
|
|
|
|
void actionCommandFilter();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Closes the application.
|
|
|
|
*/
|
|
|
|
void actionClose();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes the command in question.
|
|
|
|
*/
|
|
|
|
void actionDelete();
|
|
|
|
|
2012-07-26 19:38:22 +00:00
|
|
|
/**
|
|
|
|
Toggles the visibility of the GL canvas widget.
|
|
|
|
*/
|
|
|
|
void actionGLWidget(bool isToggled);
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Toggles the visibility of the inspector widget.
|
|
|
|
*/
|
|
|
|
void actionInspector();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Plays from the current step to the next breakpoint if it exists, otherwise
|
|
|
|
executes all remaining draw commands.
|
|
|
|
*/
|
|
|
|
void actionPlay();
|
|
|
|
|
2012-07-26 19:38:22 +00:00
|
|
|
/**
|
|
|
|
Toggles the visibility of the raster canvas widget.
|
|
|
|
*/
|
|
|
|
void actionRasterWidget(bool isToggled);
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Rewinds from the current step back to the start of the commands.
|
|
|
|
*/
|
|
|
|
void actionRewind();
|
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
/**
|
|
|
|
Saves the current SKP with all modifications.
|
|
|
|
*/
|
|
|
|
void actionSave();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Saves the current SKP under a different name and/or location.
|
|
|
|
*/
|
|
|
|
void actionSaveAs();
|
|
|
|
|
2012-07-09 20:26:53 +00:00
|
|
|
/**
|
|
|
|
Sends the scale factor information to the settings widget.
|
|
|
|
*/
|
|
|
|
void actionScale(float scaleFactor);
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Toggles the settings widget visibility.
|
|
|
|
*/
|
|
|
|
void actionSettings();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Steps forward to the next draw command.
|
|
|
|
*/
|
|
|
|
void actionStepBack();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Steps backwards to the next draw command.
|
|
|
|
*/
|
|
|
|
void actionStepForward();
|
|
|
|
|
2012-08-03 17:32:05 +00:00
|
|
|
/**
|
|
|
|
Called when the canvas is done being drawn to by SkCanvasWidget.
|
|
|
|
*/
|
|
|
|
void drawComplete();
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Loads an skpicture selected from the directory.
|
|
|
|
*/
|
|
|
|
void loadFile(QListWidgetItem *item);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Toggles a dialog with a file browser for navigating to a skpicture. Loads
|
2013-01-28 17:43:26 +00:00
|
|
|
the selected file.
|
2012-06-29 14:21:22 +00:00
|
|
|
*/
|
|
|
|
void openFile();
|
|
|
|
|
2012-07-09 20:26:53 +00:00
|
|
|
/**
|
|
|
|
Toggles whether drawing to a new command requires a double click
|
|
|
|
or simple focus.
|
|
|
|
*/
|
2012-07-16 18:35:23 +00:00
|
|
|
void pauseDrawing(bool isPaused = true);
|
2012-07-09 20:26:53 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Executes draw commands up to the selected command
|
|
|
|
*/
|
|
|
|
void registerListClick(QListWidgetItem *item);
|
|
|
|
|
2012-07-12 21:58:14 +00:00
|
|
|
/**
|
|
|
|
Sets the command to active in the list widget.
|
|
|
|
*/
|
|
|
|
void selectCommand(int command);
|
|
|
|
|
2012-07-17 15:40:51 +00:00
|
|
|
/**
|
|
|
|
Toggles the exclusive listing of commands set as deleted.
|
|
|
|
*/
|
|
|
|
void showDeletes();
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Toggles a breakpoint on the current step in the list widget.
|
|
|
|
*/
|
|
|
|
void toggleBreakpoint();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Toggles the visibility of the directory widget.
|
|
|
|
*/
|
|
|
|
void toggleDirectory();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Filters the list widgets command visibility based on the currently
|
|
|
|
active selection.
|
|
|
|
*/
|
|
|
|
void toggleFilter(QString string);
|
|
|
|
|
|
|
|
private:
|
2012-07-31 12:49:52 +00:00
|
|
|
QWidget fCentralWidget;
|
|
|
|
QStatusBar fStatusBar;
|
|
|
|
QToolBar fToolBar;
|
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QAction fActionOpen;
|
|
|
|
QAction fActionBreakpoint;
|
2012-11-12 20:42:12 +00:00
|
|
|
QAction fActionProfile;
|
2012-07-10 13:19:25 +00:00
|
|
|
QAction fActionCancel;
|
2012-07-17 15:40:51 +00:00
|
|
|
QAction fActionClearBreakpoints;
|
2012-07-16 18:35:23 +00:00
|
|
|
QAction fActionClearDeletes;
|
2012-07-10 13:19:25 +00:00
|
|
|
QAction fActionClose;
|
2012-07-16 18:35:23 +00:00
|
|
|
QAction fActionCreateBreakpoint;
|
2012-07-10 13:19:25 +00:00
|
|
|
QAction fActionDelete;
|
|
|
|
QAction fActionDirectory;
|
|
|
|
QAction fActionGoToLine;
|
|
|
|
QAction fActionInspector;
|
|
|
|
QAction fActionPlay;
|
2012-07-16 18:35:23 +00:00
|
|
|
QAction fActionPause;
|
2012-07-10 13:19:25 +00:00
|
|
|
QAction fActionRewind;
|
2012-07-28 20:16:11 +00:00
|
|
|
QAction fActionSave;
|
|
|
|
QAction fActionSaveAs;
|
2012-07-17 15:40:51 +00:00
|
|
|
QAction fActionShowDeletes;
|
2012-07-10 13:19:25 +00:00
|
|
|
QAction fActionStepBack;
|
|
|
|
QAction fActionStepForward;
|
2012-07-26 20:26:44 +00:00
|
|
|
QAction fActionZoomIn;
|
|
|
|
QAction fActionZoomOut;
|
|
|
|
QSignalMapper fMapper;
|
2012-07-31 12:49:52 +00:00
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
QWidget fSpacer;
|
2012-07-10 13:19:25 +00:00
|
|
|
QComboBox fFilter;
|
|
|
|
|
2012-07-31 12:49:52 +00:00
|
|
|
QHBoxLayout fContainerLayout;
|
2012-07-10 13:19:25 +00:00
|
|
|
QVBoxLayout fLeftColumnLayout;
|
|
|
|
QVBoxLayout fMainAndRightColumnLayout;
|
2012-11-21 17:11:02 +00:00
|
|
|
QHBoxLayout fCanvasSettingsAndImageLayout;
|
|
|
|
QVBoxLayout fSettingsAndImageLayout;
|
2012-07-10 13:19:25 +00:00
|
|
|
|
|
|
|
QListWidget fListWidget;
|
|
|
|
QListWidget fDirectoryWidget;
|
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
SkDebugger fDebugger;
|
2012-07-10 13:19:25 +00:00
|
|
|
SkCanvasWidget fCanvasWidget;
|
2012-11-21 17:11:02 +00:00
|
|
|
SkImageWidget fImageWidget;
|
2012-07-10 13:19:25 +00:00
|
|
|
SkInspectorWidget fInspectorWidget;
|
|
|
|
SkSettingsWidget fSettingsWidget;
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
QString fPath;
|
2012-11-12 20:42:12 +00:00
|
|
|
SkString fFileName;
|
2012-11-15 14:57:57 +00:00
|
|
|
SkTDArray<size_t> fOffsets; // the offset of each command in the SkPicture
|
2012-12-07 20:48:56 +00:00
|
|
|
SkTDArray<bool> fSkipCommands; // has a specific command been deleted?
|
2012-06-29 14:21:22 +00:00
|
|
|
bool fDirectoryWidgetActive;
|
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QMenuBar fMenuBar;
|
|
|
|
QMenu fMenuFile;
|
2012-07-16 18:35:23 +00:00
|
|
|
QMenu fMenuEdit;
|
2012-07-10 13:19:25 +00:00
|
|
|
QMenu fMenuNavigate;
|
|
|
|
QMenu fMenuView;
|
2012-07-16 18:35:23 +00:00
|
|
|
QMenu fMenuWindows;
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
bool fBreakpointsActivated;
|
2012-07-17 15:40:51 +00:00
|
|
|
bool fDeletesActivated;
|
2012-07-09 20:26:53 +00:00
|
|
|
bool fPause;
|
2012-07-19 13:41:27 +00:00
|
|
|
bool fLoading;
|
2012-07-31 12:49:52 +00:00
|
|
|
int fPausedRow;
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the entire UI.
|
|
|
|
*/
|
|
|
|
void setupUi(QMainWindow *SkDebuggerGUI);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Pipes a QString in with the location of the filename, proceeds to updating
|
|
|
|
the listwidget, combowidget and inspectorwidget.
|
|
|
|
*/
|
2012-11-12 20:42:12 +00:00
|
|
|
void loadPicture(const SkString& fileName);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
/**
|
|
|
|
Creates a picture of the current canvas.
|
|
|
|
*/
|
2012-11-12 20:42:12 +00:00
|
|
|
void saveToFile(const SkString& filename);
|
2012-07-28 20:16:11 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Populates the list widget with the vector of strings passed in.
|
|
|
|
*/
|
2012-11-19 20:44:29 +00:00
|
|
|
void setupListWidget(SkTArray<SkString>* command);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Populates the combo box widget with the vector of strings passed in.
|
|
|
|
*/
|
2012-11-19 20:44:29 +00:00
|
|
|
void setupComboBox(SkTArray<SkString>* command);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Fills in the overview pane with text
|
|
|
|
*/
|
|
|
|
void setupOverviewText(const SkTDArray<double>* typeTimes, double totTime);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-11-19 20:44:29 +00:00
|
|
|
/**
|
|
|
|
Render the supplied picture several times tracking the time consumed
|
|
|
|
by each command.
|
|
|
|
*/
|
2012-11-20 02:01:23 +00:00
|
|
|
void run(SkTimedPicture* pict,
|
|
|
|
sk_tools::PictureRenderer* renderer,
|
2012-11-19 20:44:29 +00:00
|
|
|
int repeats);
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SKDEBUGGERUI_H
|