Commit e95fc655 authored by Jan Möbius's avatar Jan Möbius
Browse files

Some More directory settings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11167 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4fa06162
......@@ -43,7 +43,6 @@
#include "PluginDialog.hh"
#include <QtGui>
#include <QMessageBox>
#include <QFileDialog>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
......
......@@ -637,11 +637,19 @@ void CoreWidget::slotSnapshotName() {
QString fname = PluginFunctions::viewerProperties().snapshotName();
fname.replace('%', '$');
fname = QFileDialog::getSaveFileName ( 0, tr("Save snapshot name") );
fname = QFileDialog::getSaveFileName ( 0,
tr("Save snapshot name"),
OpenFlipperSettings().value("Core/CurrentDir").toString());
if (!fname.isEmpty())
{
fname.replace('$', '%');
// Get the chosen directory and remember it.
QFileInfo fileInfo(fname);
OpenFlipperSettings().setValue("Core/CurrentDir", fileInfo.absolutePath() );
PluginFunctions::viewerProperties().snapshotBaseFileName(fname);
QString msg=tr("next snapshot: ");
statusBar()->showMessage(msg);
......
......@@ -75,7 +75,6 @@
#include <QLabel>
#include <QImage>
#include <QColorDialog>
#include <QFileDialog>
#include <QToolTip>
#include <QTextStream>
#include <QDateTime>
......
......@@ -259,12 +259,18 @@ void VSI::BaseWidget::load()
if (!saveIfChanged ())
return;
QString filename = QFileDialog::getOpenFileName (this, tr("Load Visual Script"), QString (),
QString filename = QFileDialog::getOpenFileName (this,
tr("Load Visual Script"),
OpenFlipperSettings().value("Core/CurrentDir").toString(),
tr("Visual Script File (*.ofvs)"));
if (filename.isEmpty ())
return;
// Get the chosen directory and remember it.
QFileInfo fileInfo(filename);
OpenFlipperSettings().setValue("Core/CurrentDir", fileInfo.absolutePath() );
QFile f (filename);
if (!f.open (QFile::ReadOnly))
{
......@@ -309,11 +315,13 @@ void VSI::BaseWidget::load()
/// Save file
bool BaseWidget::save(bool _newName)
{
QString filename;
if (fileName_.isEmpty () || _newName)
{
QFileDialog *d = new QFileDialog (this, tr("Save Visual Script"), QString (),
QFileDialog *d = new QFileDialog (this, tr("Save Visual Script"),
OpenFlipperSettings().value("Core/CurrentDir").toString(),
tr("Visual Script File (*.ofvs)"));
d->setAcceptMode (QFileDialog::AcceptSave);
......@@ -328,6 +336,10 @@ bool BaseWidget::save(bool _newName)
if (filename.isEmpty ())
return false;
// Get the chosen directory and remember it.
QFileInfo fileInfo(filename);
OpenFlipperSettings().setValue("Core/CurrentDir", fileInfo.absolutePath() );
QFile f (filename);
if (!f.open (QFile::WriteOnly))
{
......
......@@ -144,7 +144,8 @@ void FilenameWidget::toDefault()
// Show file dialog
void FilenameWidget::showDialog()
{
QFileDialog d (this, tr("Select File"), QString (), filter_);
QFileDialog d (this, tr("Select File"), QString() , filter_);
d.setAcceptMode (mode_);
d.setDefaultSuffix (defaultSuffix_);
if (dirOnly_)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment