Add command line options to debugger
https://codereview.appspot.com/7221048/
git-svn-id: http://skia.googlecode.com/svn/trunk@7418 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index 4486434..7e04657 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -581,12 +581,15 @@
void SkDebuggerGUI::openFile() {
QString temp = QFileDialog::getOpenFileName(this, tr("Open File"), "",
tr("Files (*.*)"));
+ openFile(temp);
+}
+
+void SkDebuggerGUI::openFile(const QString &filename) {
fDirectoryWidgetActive = false;
- if (!temp.isEmpty()) {
- QFileInfo pathInfo(temp);
- fPath = pathInfo.path();
- loadPicture(SkString(temp.toAscii().data()));
- setupDirectoryWidget();
+ if (!filename.isEmpty()) {
+ QFileInfo pathInfo(filename);
+ loadPicture(SkString(filename.toAscii().data()));
+ setupDirectoryWidget(pathInfo.path());
}
fDirectoryWidgetActive = true;
}
@@ -838,9 +841,8 @@
// TODO(chudy): Remove static call.
fDirectoryWidgetActive = false;
- fPath = "";
fFileName = "";
- setupDirectoryWidget();
+ setupDirectoryWidget("");
fDirectoryWidgetActive = true;
// Menu Bar
@@ -889,8 +891,9 @@
QMetaObject::connectSlotsByName(SkDebuggerGUI);
}
-void SkDebuggerGUI::setupDirectoryWidget() {
- QDir dir(fPath);
+void SkDebuggerGUI::setupDirectoryWidget(const QString& path) {
+ fPath = path;
+ QDir dir(path);
QRegExp r(".skp");
fDirectoryWidget.clear();
const QStringList files = dir.entryList();