diff options
-rw-r--r-- | gui/mainwindow.cpp | 24 | ||||
-rw-r--r-- | gui/mainwindow.h | 1 | ||||
-rw-r--r-- | gui/ui/mainwindow.ui | 13 |
3 files changed, 38 insertions, 0 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 9bf5024a..ba1cc798 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -102,6 +102,22 @@ void MainWindow::openTrace() } } +void MainWindow::saveTrace() +{ + QString localFile = m_trace->fileName(); + + QString fileName = + QFileDialog::getSaveFileName( + this, + tr("Save Trace As"), + QFileInfo(localFile).fileName(), + tr("Trace Files (*.trace);;All Files (*)")); + + if (!fileName.isEmpty()) { + QFile::copy(localFile, fileName); + } +} + void MainWindow::pullTrace() { QString androidFile = AndroidFileDialog::getOpenFileName(this, tr("Open trace file"), _("/sdcard"), _(".trace")); @@ -1027,6 +1043,8 @@ void MainWindow::initConnections() this, SLOT(createTrace())); connect(m_ui.actionOpen, SIGNAL(triggered()), this, SLOT(openTrace())); + connect(m_ui.actionSave, SIGNAL(triggered()), + this, SLOT(saveTrace())); connect(m_ui.actionPullTrace, SIGNAL(triggered()), this, SLOT(pullTrace())); connect(m_ui.actionPushTrace, SIGNAL(triggered()), @@ -1138,6 +1156,9 @@ void MainWindow::updateActionsState(bool traceLoaded, bool stopped) m_ui.actionLinkTrace->setEnabled(false); m_ui.actionRetraceOnAndroid->setEnabled(false); if (traceLoaded) { + /* File */ + m_ui.actionSave ->setEnabled(true); + /* Edit */ m_ui.actionFind ->setEnabled(true); m_ui.actionGo ->setEnabled(true); @@ -1160,6 +1181,9 @@ void MainWindow::updateActionsState(bool traceLoaded, bool stopped) m_ui.actionTrim ->setEnabled(true); } else { + /* File */ + m_ui.actionSave ->setEnabled(false); + /* Edit */ m_ui.actionFind ->setEnabled(false); m_ui.actionGo ->setEnabled(false); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index cd16faf1..22799ff9 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -52,6 +52,7 @@ private slots: void callItemActivated(const QModelIndex &index); void createTrace(); void openTrace(); + void saveTrace(); void pullTrace(); void pushTrace(); void linkTrace(); diff --git a/gui/ui/mainwindow.ui b/gui/ui/mainwindow.ui index 475db578..af7eadc1 100644 --- a/gui/ui/mainwindow.ui +++ b/gui/ui/mainwindow.ui @@ -67,6 +67,7 @@ </widget> <addaction name="actionNew"/> <addaction name="actionOpen"/> + <addaction name="actionSave"/> <addaction name="separator"/> <addaction name="menu_Android"/> <addaction name="separator"/> @@ -560,6 +561,18 @@ <string>Ctrl+O</string> </property> </action> + <action name="actionSave"> + <property name="icon"> + <iconset resource="../qapitrace.qrc"> + <normaloff>:/resources/document-edit.png</normaloff>:/resources/document-edit.png</iconset> + </property> + <property name="text"> + <string>&Save As...</string> + </property> + <property name="shortcut"> + <string>Ctrl+S</string> + </property> + </action> <action name="actionQuit"> <property name="icon"> <iconset resource="../qapitrace.qrc"> |