diff options
author | Alexander Trukhin <alxtry@gmail.com> | 2015-03-27 23:38:01 +0300 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2015-03-30 10:16:23 +0100 |
commit | d99ab92d0b829a6c78b5284481d5b236d3901f11 (patch) | |
tree | 758b19a724530b9fea31bd7cacedea71a2854df4 /gui/mainwindow.cpp | |
parent | eb1ad3c6675658d17f568160244bc154bd13e11b (diff) |
gui: Add Save As menu option.
https://github.com/apitrace/apitrace/issues/305
Signed-off-by: Alexander Trukhin <alxtry@gmail.com>
Diffstat (limited to 'gui/mainwindow.cpp')
-rw-r--r-- | gui/mainwindow.cpp | 24 |
1 files changed, 24 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); |