qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
paths.h
Go to the documentation of this file.
1 /*
2  Copyright © 2019 by The qTox Project Contributors
3 
4  This file is part of qTox, a Qt-based graphical interface for Tox.
5 
6  qTox is libre software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  qTox is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with qTox. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include <QString>
23 #include <QStringList>
24 #include <atomic>
25 
26 #define PATHS_VERSION_TCS_COMPLIANT 0
27 
28 class Paths
29 {
30 public:
31  enum class Portable {
32  Auto,
33  Portable,
35  };
36 
38 
39  bool setPortable(bool portable);
40  bool isPortable() const;
41 #if PATHS_VERSION_TCS_COMPLIANT
42  QString getGlobalSettingsPath() const;
43  QString getProfilesDir() const;
44  QString getToxSaveDir() const;
45  QString getAvatarsDir() const;
46  QString getTransfersDir() const;
47  QStringList getThemeDirs() const;
48  QString getScreenshotsDir() const;
49 #else
50  // to be removed when paths migration is complete.
51  QString getSettingsDirPath() const;
52  QString getAppDataDirPath() const;
53  QString getAppCacheDirPath() const;
54  QString getUserNodesFilePath() const;
55 #endif
56 
57 private:
58  QString basePath;
59  std::atomic_bool portable{false};
60 };
Paths::getSettingsDirPath
QString getSettingsDirPath() const
Get path to directory, where the settings files are stored.
Definition: paths.cpp:286
Paths::Portable::Portable
@ Portable
Paths::Paths
Paths(Portable mode=Portable::Auto)
Definition: paths.cpp:125
Paths
Definition: paths.h:28
Paths::portable
std::atomic_bool portable
Definition: paths.h:59
Paths::Portable::NonPortable
@ NonPortable
Paths::setPortable
bool setPortable(bool portable)
Set paths to passed portable or system wide.
Definition: paths.cpp:136
Paths::basePath
QString basePath
Definition: paths.h:58
Paths::isPortable
bool isPortable() const
Check if qTox is running in portable mode.
Definition: paths.cpp:149
Paths::getAppCacheDirPath
QString getAppCacheDirPath() const
Get path to directory, where the application cache are stored.
Definition: paths.cpp:346
Paths::Portable
Portable
Definition: paths.h:31
Paths::getUserNodesFilePath
QString getUserNodesFilePath() const
Definition: paths.cpp:368
Paths::Portable::Auto
@ Auto
Paths::getAppDataDirPath
QString getAppDataDirPath() const
Get path to directory, where the application data are stored.
Definition: paths.cpp:314