On 22/05/14 21:03, Jens Steinhauser wrote:
> ---
> main.cpp | 2 +-
> pv/mainwindow.cpp | 25 ++++++++++++++++++++++---
> 2 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/main.cpp b/main.cpp
> index 2c6a59e..5ff61d9 100644
> --- a/main.cpp
> +++ b/main.cpp
> @@ -69,7 +69,7 @@ int main(int argc, char *argv[])
> // Set some application metadata
> QApplication::setApplicationVersion(PV_VERSION_STRING);
> QApplication::setApplicationName("PulseView");
> - QApplication::setOrganizationDomain("http://www.sigrok.org");
> + QApplication::setOrganizationDomain("sigrok.org");
This should be split into a separate patch.
>
> // Parse arguments
> while (1) {
> diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp
> index 77e77a1..efb2f32 100644
> --- a/pv/mainwindow.cpp
> +++ b/pv/mainwindow.cpp
> @@ -35,6 +35,7 @@
> #include <QMessageBox>
> #include <QMenu>
> #include <QMenuBar>
> +#include <QSettings>
> #include <QStatusBar>
> #include <QVBoxLayout>
> #include <QWidget>
> @@ -340,13 +341,23 @@ void MainWindow::show_session_error(
>
> void MainWindow::on_actionOpen_triggered()
> {
> + // Get the directory containing the last file that was opened
> + const char* setting_name = "MainWindow/OpenDirectory";
> + QSettings settings;
> + QString dir = settings.value(setting_name).toString();
> +
> // Show the dialog
> const QString file_name = QFileDialog::getOpenFileName(
> - this, tr("Open File"), "", tr(
> + this, tr("Open File"), dir, tr(
> "Sigrok Sessions (*.sr);;"
> "All Files (*.*)"));
> - if (!file_name.isEmpty())
> +
> + if (!file_name.isEmpty()) {
> load_file(file_name);
> +
> + QString abs_path = QFileInfo(file_name).absolutePath();
> + settings.setValue(setting_name, abs_path);
> + }
> }
>
> void MainWindow::on_actionSaveAs_triggered()
> @@ -356,13 +367,21 @@ void MainWindow::on_actionSaveAs_triggered()
> // Stop any currently running capture session
> _session.stop_capture();
>
> + // Get the directory containing the last file that was saved
> + const char* setting_name = "MainWindow/SaveDirectory";
> + QSettings settings;
> + QString dir = settings.value(setting_name).toString();
> +
QString dir = QSettings().value("MainWindow/SaveDirectory").toString();
is more concise. Or even
const QString dir =
QSettings().value("MainWindow/SaveDirectory").toString();
> // Show the dialog
> const QString file_name = QFileDialog::getSaveFileName(
> - this, tr("Save File"), "", tr("Sigrok Sessions (*.sr)"));
> + this, tr("Save File"), dir, tr("Sigrok Sessions (*.sr)"));
>
> if (file_name.isEmpty())
> return;
>
> + QString abs_path = QFileInfo(file_name).absolutePath();
> + settings.setValue(setting_name, abs_path);
> +
> StoreProgress *dlg = new StoreProgress(file_name, _session, this);
> dlg->run();
> }
>
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel