qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
Go to the documentation of this file.
55 if (lockfile && curLockName == profile)
58 QLockFile newLock(lockPathFromName(profile));
59 return newLock.tryLock();
69 if (lockfile && curLockName == profile)
72 QLockFile* newLock =
new QLockFile(lockPathFromName(profile));
73 newLock->setStaleLockTime(0);
74 if (!newLock->tryLock()) {
80 lockfile.reset(newLock);
81 curLockName = profile;
107 qCritical() <<
"assertLock: We don't seem to own any lock!";
111 if (!QFile(lockPathFromName(curLockName)).exists()) {
112 QString tmp = curLockName;
115 qCritical() <<
"assertLock: Lock file was lost, but could be restored";
117 qCritical() <<
"assertLock: Lock file was lost, and could *NOT* be restored";
128 qCritical() <<
"Lock is *BROKEN*, exiting immediately";
138 return lockfile.operator bool();
QString getSettingsDirPath() const
Get path to directory, where the settings files are stored.
static void unlock()
Releases the lock on the current profile.
static QString getCurLockName()
Get current locked profile name.
static void deathByBrokenLock()
Print an error then exit immediately.
static bool lock(QString profile)
Tries to acquire the lock on a profile, will not block.
static void assertLock()
Check that we actually own the lock. In case the file was deleted on disk, restore it....
static std::unique_ptr< QLockFile > lockfile
static bool hasLock()
Chacks, that profile locked.
static Settings & getInstance()
Returns the singleton instance.
static bool isLockable(QString profile)
Checks if a profile is currently locked by another instance. If we own the lock, we consider it locka...
static QString lockPathFromName(const QString &name)
static QString curLockName