mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
refs #618, allow to set file name for saving in views
This commit is contained in:
@@ -15,6 +15,18 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
const QString &CFileUtils::jsonAppendix()
|
||||
{
|
||||
static const QString j(".json");
|
||||
return j;
|
||||
}
|
||||
|
||||
const QString &CFileUtils::jsonWildcardAppendix()
|
||||
{
|
||||
static const QString jw("*" + jsonAppendix());
|
||||
return jw;
|
||||
}
|
||||
|
||||
bool CFileUtils::writeStringToFile(const QString &content, const QString &fileNameAndPath)
|
||||
{
|
||||
if (fileNameAndPath.isEmpty()) { return false; }
|
||||
|
||||
@@ -25,6 +25,12 @@ namespace BlackMisc
|
||||
class BLACKMISC_EXPORT CFileUtils
|
||||
{
|
||||
public:
|
||||
//! Our JSON file name appendix
|
||||
static const QString &jsonAppendix();
|
||||
|
||||
//! JSON wildcard + appendix
|
||||
static const QString &jsonWildcardAppendix();
|
||||
|
||||
//! Write string to text file
|
||||
static bool writeStringToFile(const QString &content, const QString &fileNameAndPath);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <QStringList>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#if !defined(BLACK_VERSION)
|
||||
#error Missing version
|
||||
@@ -349,6 +350,22 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getDocumentationDirectoryImpl()
|
||||
{
|
||||
QStringList pathes(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation));
|
||||
QString d = pathes.first();
|
||||
d = CFileUtils::appendFilePaths(d, "/swift");
|
||||
QDir dir(d);
|
||||
if (dir.exists()) { return dir.absolutePath(); }
|
||||
return pathes.first();
|
||||
}
|
||||
|
||||
const QString &CProject::getDocumentationDirectory()
|
||||
{
|
||||
static const QString d(getDocumentationDirectoryImpl());
|
||||
return d;
|
||||
}
|
||||
|
||||
const QString &CProject::compiledWithInfo(bool shortVersion)
|
||||
{
|
||||
if (shortVersion)
|
||||
|
||||
@@ -105,6 +105,9 @@ namespace BlackMisc
|
||||
//! Where images are located
|
||||
static const QString &getImagesDir();
|
||||
|
||||
//! Directory where data can be stored
|
||||
static const QString &getDocumentationDirectory();
|
||||
|
||||
//! Info string about compilation
|
||||
static const QString &compiledWithInfo(bool shortVersion = true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user