diff options
author | 2012-07-17 15:40:51 +0000 | |
---|---|---|
committer | 2012-07-17 15:40:51 +0000 | |
commit | 7e4cfbf144af7d530d552946cee2a21d30b9b50f (patch) | |
tree | 02bfbef3ccc1a1f8140d11e95e99cb39465bb90d /debugger/QT/SkDebuggerGUI.cpp | |
parent | 2a021292f5a024e6f6b99be375e8ec2bf61718a8 (diff) |
Added more features to deletes and breakpoints
Review URL: https://codereview.appspot.com/6406050
git-svn-id: http://skia.googlecode.com/svn/trunk@4637 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'debugger/QT/SkDebuggerGUI.cpp')
-rw-r--r-- | debugger/QT/SkDebuggerGUI.cpp | 99 |
1 files changed, 66 insertions, 33 deletions
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index 1c5b48c2df..ea9d687b85 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -14,6 +14,7 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : , fActionOpen(this) , fActionBreakpoint(this) , fActionCancel(this) + , fActionClearBreakpoints(this) , fActionClearDeletes(this) , fActionClose(this) , fActionCreateBreakpoint(this) @@ -23,8 +24,8 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : , fActionInspector(this) , fActionPlay(this) , fActionPause(this) - , fActionReload(this) , fActionRewind(this) + , fActionShowDeletes(this) , fActionStepBack(this) , fActionStepForward(this) , fCentralWidget(this) @@ -40,6 +41,9 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : , fMenuNavigate(this) , fMenuView(this) , fToolBar(this) + , fBreakpointsActivated(false) + , fDeletesActivated(false) + , fPause(false) { setupUi(this); connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, @@ -52,7 +56,6 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); - connect(&fActionReload, SIGNAL(triggered()), this, SLOT(actionReload())); connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleBreakpoint())); connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); @@ -69,6 +72,8 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString))); connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel())); + connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints())); + connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes())); connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); connect(fSettingsWidget.getVisibilityButton(), SIGNAL(toggled(bool)), this, SLOT(actionCommandFilter())); @@ -82,26 +87,29 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : connect(&fCanvasWidget, SIGNAL(hitChanged(int)), &fSettingsWidget, SLOT(updateHit(int))); connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint())); + connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())); + + fInspectorWidget.setDisabled(true); + fMenuBar.setDisabled(true); } SkDebuggerGUI::~SkDebuggerGUI() { } void SkDebuggerGUI::actionBreakpoints() { - if (!fBreakpointsActivated) { - fBreakpointsActivated = true; - } else { - fBreakpointsActivated = false; + fBreakpointsActivated = !fBreakpointsActivated; + for (int row = 0; row < fListWidget.count(); row++) { + QListWidgetItem *item = fListWidget.item(row); + item->setHidden(item->checkState() == Qt::Unchecked && fBreakpointsActivated); } +} +void SkDebuggerGUI::showDeletes() { + fDeletesActivated = !fDeletesActivated; for (int row = 0; row < fListWidget.count(); row++) { QListWidgetItem *item = fListWidget.item(row); - - if (item->checkState() == Qt::Unchecked && fBreakpointsActivated) { - item->setHidden(true); - } else { - item->setHidden(false); - } + bool isVisible = fCanvasWidget.commandIsVisibleAtIndex(row); + item->setHidden(isVisible && fDeletesActivated); } } @@ -111,6 +119,28 @@ void SkDebuggerGUI::actionCancel() { } } +void SkDebuggerGUI::actionClearBreakpoints() { + for (int row = 0; row < fListWidget.count(); row++) { + QListWidgetItem* item = fListWidget.item(row); + item->setCheckState(Qt::Unchecked); + item->setData(Qt::DecorationRole, + QPixmap(":/images/Icons/blank.png")); + } +} + +void SkDebuggerGUI::actionClearDeletes() { + for (int row = 0; row < fListWidget.count(); row++) { + QListWidgetItem* item = fListWidget.item(row); + item->setData(Qt::UserRole + 2, QPixmap(":/images/Icons/blank.png")); + fCanvasWidget.setCommandVisibliltyAtIndex(row, true); + } + if (fPause) { + fCanvasWidget.drawTo(fPausedRow); + } else { + fCanvasWidget.drawTo(fListWidget.currentRow()); + } +} + void SkDebuggerGUI::actionCommandFilter() { fCanvasWidget.toggleCurrentCommandFilter( fSettingsWidget.getVisibilityButton()->isChecked()); @@ -122,16 +152,17 @@ void SkDebuggerGUI::actionClose() { } void SkDebuggerGUI::actionDelete() { + int currentRow = fListWidget.currentRow(); QListWidgetItem* item = fListWidget.currentItem(); - if (item->data(Qt::UserRole + 2) == true) { - item->setData(Qt::UserRole + 2, false); - item->setData(Qt::UserRole + 3, QPixmap(":/images/Icons/delete.png")); + + if (fCanvasWidget.commandIsVisibleAtIndex(currentRow)) { + item->setData(Qt::UserRole + 2, QPixmap(":/images/Icons/delete.png")); + fCanvasWidget.setCommandVisibliltyAtIndex(currentRow, false); } else { - item->setData(Qt::UserRole + 2, true); - item->setData(Qt::UserRole + 3, QPixmap(":/images/Icons/blank.png")); + item->setData(Qt::UserRole + 2, QPixmap(":/images/Icons/blank.png")); + fCanvasWidget.setCommandVisibliltyAtIndex(currentRow, true); } - int currentRow = fListWidget.currentRow(); - fCanvasWidget.toggleCommand(currentRow); + if (fPause) { fCanvasWidget.drawTo(fPausedRow); } else { @@ -159,16 +190,6 @@ void SkDebuggerGUI::actionPlay() { fListWidget.setCurrentRow(fListWidget.count() - 1); } -void SkDebuggerGUI::actionReload() { - for (int row = 0; row < fListWidget.count(); row++) { - QListWidgetItem* item = fListWidget.item(row); - item->setData(Qt::UserRole + 2, true); - item->setData(Qt::DecorationRole, QPixmap(":/images/Icons/blank.png")); - fCanvasWidget.toggleCommand(row, true); - } - fCanvasWidget.drawTo(fListWidget.currentRow()); -} - void SkDebuggerGUI::actionRewind() { fListWidget.setCurrentRow(0); } @@ -316,7 +337,7 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) { QSize(), QIcon::Normal, QIcon::Off); fActionBreakpoint.setShortcut(QKeySequence(tr("Ctrl+B"))); fActionBreakpoint.setIcon(breakpoint); - fActionBreakpoint.setText("Show Breakpoints"); + fActionBreakpoint.setText("Breakpoints"); QIcon cancel; cancel.addFile(QString::fromUtf8(":/images/Ico/reload.png"), QSize(), @@ -324,6 +345,12 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) { fActionCancel.setIcon(cancel); fActionCancel.setText("Clear Filter"); + fActionClearBreakpoints.setShortcut(QKeySequence(tr("Alt+B"))); + fActionClearBreakpoints.setText("Clear Breakpoints"); + + fActionClearDeletes.setShortcut(QKeySequence(tr("Alt+X"))); + fActionClearDeletes.setText("Clear Deletes"); + fActionClose.setShortcuts(QKeySequence::Quit); fActionClose.setText("Exit"); @@ -358,8 +385,6 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) { fActionPause.setIcon(pause); fActionPause.setText("Pause"); - fActionReload.setText("Reset Picture"); - QIcon rewind; rewind.addFile(QString::fromUtf8(":/images/Ico/rewind.png"), QSize(), QIcon::Normal, QIcon::Off); @@ -367,6 +392,9 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) { fActionRewind.setIcon(rewind); fActionRewind.setText("Rewind"); + fActionShowDeletes.setShortcut(QKeySequence(tr("Ctrl+X"))); + fActionShowDeletes.setText("Deleted Commands"); + QIcon stepBack; stepBack.addFile(QString::fromUtf8(":/images/Ico/previous.png"), QSize(), QIcon::Normal, QIcon::Off); @@ -453,7 +481,10 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) { fMenuEdit.setTitle("Edit"); fMenuEdit.addAction(&fActionDelete); + fMenuEdit.addAction(&fActionClearDeletes); + fMenuEdit.addSeparator(); fMenuEdit.addAction(&fActionCreateBreakpoint); + fMenuEdit.addAction(&fActionClearBreakpoints); fMenuNavigate.setTitle("Navigate"); fMenuNavigate.addAction(&fActionRewind); @@ -465,6 +496,7 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) { fMenuView.setTitle("View"); fMenuView.addAction(&fActionBreakpoint); + fMenuView.addAction(&fActionShowDeletes); fMenuWindows.setTitle("Window"); fMenuWindows.addAction(&fActionInspector); @@ -504,7 +536,9 @@ void SkDebuggerGUI::loadPicture(QString fileName) { fSettingsWidget.getVisibilityButton()->isChecked()); setupListWidget(cv); setupComboBox(cv); + fInspectorWidget.setDisabled(false); fSettingsWidget.setDisabled(false); + fMenuBar.setDisabled(false); } void SkDebuggerGUI::setupListWidget(std::vector<std::string>* cv) { @@ -514,7 +548,6 @@ void SkDebuggerGUI::setupListWidget(std::vector<std::string>* cv) { QListWidgetItem *item = new QListWidgetItem(); item->setData(Qt::DisplayRole, (*cv)[i].c_str()); item->setData(Qt::UserRole + 1, counter++); - item->setData(Qt::UserRole + 2, true); fListWidget.addItem(item); } } |