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-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>
|
|
|
|
|
|
|
|
/** \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();
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
/**
|
|
|
|
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
|
|
|
|
the seleced file.
|
|
|
|
*/
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
QHBoxLayout fCanvasAndSettingsLayout;
|
|
|
|
|
|
|
|
QListWidget fListWidget;
|
|
|
|
QListWidget fDirectoryWidget;
|
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
SkDebugger fDebugger;
|
2012-07-10 13:19:25 +00:00
|
|
|
SkCanvasWidget fCanvasWidget;
|
|
|
|
SkInspectorWidget fInspectorWidget;
|
|
|
|
SkSettingsWidget fSettingsWidget;
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
QString fPath;
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
void loadPicture(QString fileName);
|
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
/**
|
|
|
|
Creates a picture of the current canvas.
|
|
|
|
*/
|
|
|
|
void saveToFile(QString filename);
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Populates the list widget with the vector of strings passed in.
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
void setupListWidget(SkTDArray<SkString*>* command);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Populates the combo box widget with the vector of strings passed in.
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
void setupComboBox(SkTDArray<SkString*>* command);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Updates the directory widget with the latest directory path stored in
|
|
|
|
the global class variable fPath.
|
|
|
|
*/
|
|
|
|
void setupDirectoryWidget();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SKDEBUGGERUI_H
|