Commit 33bac51e authored by Dirk Wilden's avatar Dirk Wilden

fixed snapshot dir/counter problem

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8392 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 48fb6cc6
......@@ -111,7 +111,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
drawGroupViewer_(0),
viewerDrawMenu_(0),
coordSysMenu_(0),
snapshotName_("snap.png"),
snapshotName_(""),
snapshotCounter_(0),
stackMenu_(0),
helpWidget_(0),
......
......@@ -278,13 +278,16 @@ void CoreWidget::slotSnapshot() {
void CoreWidget::applicationSnapshotDialog() {
QFileInfo fi(snapshotName_);
if (snapshotName_ == "")
fi.setFile( OpenFlipperSettings().value("Core/CurrentDir").toString() + QDir::separator() + "snap.png" );
// Add leading zeros
QString number = QString::number(snapshotCounter_);
while ( number.size() < 7 )
number = "0" + number;
QString suggest = fi.baseName() + "." + number + ".";
QString suggest = fi.path() + QDir::separator() + fi.baseName() + "." + number + ".";
QString format="png";
......@@ -312,9 +315,12 @@ void CoreWidget::applicationSnapshotDialog() {
if ( ok ){
QString newName = dialog.filename->text();
if (newName != fi.path() + OpenFlipper::Options::dirSeparator() + suggest){
if (newName != suggest){
OpenFlipperSettings().setValue("Core/CurrentDir", QFileInfo(newName).absolutePath() );
snapshotName_ = newName;
snapshotCounter_ = 0;
snapshotCounter_ = 1;
}else
snapshotCounter_++;
......@@ -362,13 +368,16 @@ void CoreWidget::applicationSnapshot() {
void CoreWidget::viewerSnapshotDialog() {
QFileInfo fi(snapshotName_);
if (snapshotName_ == "")
fi.setFile( OpenFlipperSettings().value("Core/CurrentDir").toString() + QDir::separator() + "snap.png" );
// Add leading zeros
QString number = QString::number(snapshotCounter_);
while ( number.size() < 7 )
number = "0" + number;
QString suggest = fi.baseName() + "." + number + ".";
QString suggest = fi.path() + QDir::separator() + fi.baseName() + "." + number + ".";
QString format="png";
......@@ -395,9 +404,13 @@ void CoreWidget::viewerSnapshotDialog() {
if (ok){
QString newName = dialog.filename->text();
if (newName != fi.path() + OpenFlipper::Options::dirSeparator() + suggest){
if (newName != suggest){
OpenFlipperSettings().setValue("Core/CurrentDir", QFileInfo(newName).absolutePath() );
snapshotName_ = newName;
snapshotCounter_ = 0;
snapshotCounter_ = 1;
}else
snapshotCounter_++;
......
......@@ -233,7 +233,7 @@ void LoadWidget::loadFile(){
QFileInfo fi(files[i]);
QString filename = fi.absoluteFilePath();
OpenFlipperSettings().setValue("Core/CurrentDir", filename);
OpenFlipperSettings().setValue("Core/CurrentDir", fi.absolutePath());
QFile file(filename);
if (fi.isDir() || !file.exists()) continue; //do nothing if its a not a valid file
......
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