22 #include <QCoreApplication> 
   27 #include <QStringList> 
   35     QString path = settings.value(type, QString()).toString();
 
   41             return QDir::homePath();
 
   46 void setPath(
const QString &type, 
const QString &value)
 
   49     settings.setValue(type, value);
 
   52 QString 
toFilterString(
const QMap<QString,QString>& filters, 
bool addAllSupported, 
bool addAll)
 
   56     if (addAllSupported) {
 
   57         entries << QCoreApplication::translate(
"toFilterString", 
"All supported files (%1)")
 
   58             .arg(QStringList(filters.values()).join(
" "));
 
   62         entries << QCoreApplication::translate(
"toFilterString", 
"All files (%1)").arg(
"*.*");
 
   68     for (
const auto& k: filters.keys()) {
 
   69         entries << QString(
"%1 (%2)").arg(k).arg(filters.value(k));
 
   72     return entries.join(
";;");
 
   78     const QString dataDir = settings.value(
"DATADIR", QString()).toString();
 
   79     if (!dataDir.isEmpty())
 
   81     const QString appPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath();
 
   82     if (QFileInfo::exists(appPath + 
"/std.cfg"))
 
   84     if (appPath.indexOf(
"/cppcheck/", 0, Qt::CaseInsensitive) > 0)
 
   85         return appPath.left(appPath.indexOf(
"/cppcheck/", 0, Qt::CaseInsensitive) + 9);
 
#define SETTINGS_LAST_CHECK_PATH
 
QString getPath(const QString &type)
Obtains the path of specified type Returns the path of specified type if not empty.
 
QString getDataDir()
Get configured data dir.
 
QString toFilterString(const QMap< QString, QString > &filters, bool addAllSupported, bool addAll)
Creates a string suitable for passing as the filter argument to methods like QFileDialog::getOpenFile...
 
void setPath(const QString &type, const QString &value)
Stores last used path of specified type Stores provided path as last used path for specified type.