LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
paths.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <functional>
12 #include <QStringList>
13 #include <QFileInfo>
14 #include "sysconfig.h"
15 
16 class QDir;
17 class QUrl;
18 
19 namespace LC::Util
20 {
25  enum class SysPath
26  {
32  QML,
33 
39  Share
40  };
41 
68  UTIL_SYS_API QStringList GetPathCandidates (SysPath path, QString subfolder);
69 
98  UTIL_SYS_API QString GetSysPath (SysPath path, const QString& subfolder, const QString& filename);
99 
115  UTIL_SYS_API QUrl GetSysPathUrl (SysPath path, const QString& subfolder, const QString& filename);
116 
126  UTIL_SYS_API QStringList GetSystemPaths ();
127 
142  UTIL_SYS_API QString FindInSystemPath (const QString& name, const QStringList& paths,
143  const std::function<bool (QFileInfo)>& filter = {});
144 
147  enum class UserDir
148  {
151  Cache,
152 
155  LC
156  };
157 
158  UTIL_SYS_API QDir GetUserDir (UserDir dir, const QString& subpath);
159 
171  UTIL_SYS_API QDir CreateIfNotExists (QString path);
172 
181  UTIL_SYS_API QString GetTemporaryName (const QString& pattern = {});
182 
185  struct SpaceInfo
186  {
189  quint64 Capacity_;
190 
195  quint64 Free_;
196 
202  quint64 Available_;
203  };
204 
213  UTIL_SYS_API SpaceInfo GetSpaceInfo (const QString& path);
214 }
UTIL_SYS_API
#define UTIL_SYS_API
Definition: sysconfig.h:16
LC::Util::GetPathCandidates
QStringList GetPathCandidates(SysPath path, QString suffix)
Returns possible full paths for the path and subfolder.
Definition: paths.cpp:30
LC::Util::SpaceInfo
Contains information about a partition's disk space.
Definition: paths.h:185
LC::Util::SysPath
SysPath
Describes various root paths recognized by GetSysPath().
Definition: paths.h:25
LC::Util::FindInSystemPath
QString FindInSystemPath(const QString &name, const QStringList &paths, const std::function< bool(QFileInfo)> &filter)
Searches for a file in system paths according to a filter.
Definition: paths.cpp:85
LC::Util::GetUserDir
QDir GetUserDir(UserDir dir, const QString &subpath)
Definition: paths.cpp:103
LC::Util
Definition: icoreproxy.h:33
LC::Util::SpaceInfo::Capacity_
quint64 Capacity_
The capacity of the partition.
Definition: paths.h:189
LC::Util::SpaceInfo::Free_
quint64 Free_
How much free space there is.
Definition: paths.h:195
LC::Util::UserDir::Cache
@ Cache
Cache for volatile data.
LC::Util::CreateIfNotExists
QDir CreateIfNotExists(QString path)
Creates a path if it doesn't exist.
Definition: paths.cpp:132
sysconfig.h
LC::Util::SysPath::QML
@ QML
Root path for QML files.
LC::Util::GetSysPathUrl
QUrl GetSysPathUrl(SysPath path, const QString &subfolder, const QString &filename)
Returns path to the file in the given root path and subfolder.
Definition: paths.cpp:75
LC::Util::GetSysPath
QString GetSysPath(SysPath path, const QString &suffix, const QString &filename)
Returns path to the file in the given root path and subfolder.
Definition: paths.cpp:62
LC
Definition: constants.h:14
LC::Util::GetSystemPaths
QStringList GetSystemPaths()
Returns the components of the system PATH variable.
Definition: paths.cpp:80
LC::Util::SysPath::Share
@ Share
Directory with shared data files.
LC::Util::SpaceInfo::Available_
quint64 Available_
How much space is available to the current user.
Definition: paths.h:202
LC::Util::UserDir
UserDir
Describes various user-specific paths.
Definition: paths.h:147
LC::Util::GetTemporaryName
QString GetTemporaryName(const QString &pattern)
Returns a temporary filename.
Definition: paths.cpp:149
LC::Util::GetSpaceInfo
SpaceInfo GetSpaceInfo(const QString &path)
Returns the disk space info of the partition containing path.
Definition: paths.cpp:160