aboutsummaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-09-23 11:13:07 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-04 16:29:31 +0100
commita241393e7b465ec0f263a7afaf20f7b65617adae (patch)
tree4cb6886134bba214c1918c3bbd927f88058cfe89 /qthelper.cpp
parent3f900885df21200722b11bc09dad70af588e398e (diff)
downloadsubsurface-a241393e7b465ec0f263a7afaf20f7b65617adae.tar.gz
Print paths to internal files in verbose mode
When run with -v option, this prints local file names like the path to the local git repository and the hash file. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index 31ec43df7..ed23948ea 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -1078,9 +1078,19 @@ extern "C" char * hashstring(char * filename)
return hashOf[QString(filename)].toHex().data();
}
+const QString hashfile_name()
+{
+ return QString(system_default_directory()).append("/hashes");
+}
+
+extern "C" char *hashfile_name_string()
+{
+ return strdup(hashfile_name().toUtf8().data());
+}
+
void read_hashes()
{
- QFile hashfile(QString(system_default_directory()).append("/hashes"));
+ QFile hashfile(hashfile_name());
if (hashfile.open(QIODevice::ReadOnly)) {
QDataStream stream(&hashfile);
stream >> localFilenameOf;
@@ -1091,7 +1101,7 @@ void read_hashes()
void write_hashes()
{
- QSaveFile hashfile(QString(system_default_directory()).append("/hashes"));
+ QSaveFile hashfile(hashfile_name());
if (hashfile.open(QIODevice::WriteOnly)) {
QDataStream stream(&hashfile);
stream << localFilenameOf;
@@ -1210,13 +1220,22 @@ extern "C" bool picture_exists(struct picture *picture)
return same_string(hash.toHex().data(), picture->hash);
}
+const QString picturedir()
+{
+ return QString(system_default_directory()).append("/picturedata/");
+}
+
+extern "C" char *picturedir_string()
+{
+ return strdup(picturedir().toUtf8().data());
+}
+
/* when we get a picture from git storage (local or remote) and can't find the picture
* based on its hash, we create a local copy with the hash as filename and the appropriate
* suffix */
extern "C" void savePictureLocal(struct picture *picture, const char *data, int len)
{
- QString dirname(system_default_directory());
- dirname += "/picturedata/";
+ QString dirname = picturedir();
QDir localPictureDir(dirname);
localPictureDir.mkpath(dirname);
QString suffix(picture->filename);
@@ -1386,6 +1405,13 @@ int getCloudURL(QString &filename)
return 0;
}
+extern "C" char *cloud_url()
+{
+ QString filename;
+ getCloudURL(filename);
+ return strdup(filename.toUtf8().data());
+}
+
void loadPreferences()
{
QSettings s;