Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.

Commit

Permalink
Append scheenshot number (1,2,3,etc) to default screenshot name, if i…
Browse files Browse the repository at this point in the history
…t is already exists (issu #6)
  • Loading branch information
DOOMer committed May 6, 2012
1 parent dad9834 commit 5f64b81
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
50 changes: 33 additions & 17 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "src/modules/uploader/uploader.h"
#include <QtCore/QChar>
#include <QtCore/QBuffer>
#include <QtCore/QFile>

#include "src/core/core.h"

Expand Down Expand Up @@ -320,28 +321,43 @@ QString Core::getSaveFilePath(QString format)
}
else
{
if (scrNum != 0)
do
{
#ifdef Q_WS_X11
initPath = conf->getSaveDir()+conf->getSaveFileName() +QString::number(scrNum) +"."+format;
#endif
#ifdef Q_WS_WIN
initPath = conf->getSaveDir()+conf->getSaveFileName()+QString::number(scrNum);
#endif
}
else
{
#ifdef Q_WS_X11
initPath = conf->getSaveDir() + conf->getSaveFileName()+"."+format;
#endif
#ifdef Q_WS_WIN
initPath = conf->getSaveDir()+conf->getSaveFileName();
#endif
}
if (scrNum != 0)
{
#ifdef Q_WS_X11
initPath = conf->getSaveDir()+conf->getSaveFileName() +QString::number(scrNum) +"."+format;
#endif
#ifdef Q_WS_WIN
initPath = conf->getSaveDir()+conf->getSaveFileName()+QString::number(scrNum);
#endif
}
else
{
#ifdef Q_WS_X11
initPath = conf->getSaveDir() + conf->getSaveFileName()+"."+format;
#endif
#ifdef Q_WS_WIN
initPath = conf->getSaveDir()+conf->getSaveFileName();
#endif
}
} while(checkExsistFile(initPath) == true);
}
return initPath;
}

bool Core::checkExsistFile(QString path)
{
bool exist = QFile::exists(path);

if (exist == true)
{
scrNum++;
}

return exist;
}

QString Core::getDateTimeFileName()
{
QString currentDateTime = QDateTime::currentDateTime().toString(conf->getDateTimeTpl());
Expand Down
1 change: 1 addition & 0 deletions src/core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public Q_SLOTS:
void getActiveWind_X11();
#endif

bool checkExsistFile(QString path);
QString copyFileNameToCliipboard(QString file);
// vars
QPixmap *pixelMap; // pixel map
Expand Down

0 comments on commit 5f64b81

Please sign in to comment.