2007-09-14 22:16:22 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Wenger
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-09-14 22:16:22 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef UTILS_H
|
|
|
|
#define UTILS_H
|
|
|
|
|
2010-06-18 19:04:06 +00:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
2007-09-14 22:16:22 +00:00
|
|
|
#include <QString>
|
2008-01-23 21:54:40 +00:00
|
|
|
#include <QUrl>
|
2007-09-14 22:16:22 +00:00
|
|
|
|
2010-06-18 19:04:06 +00:00
|
|
|
class Utils : public QObject
|
2009-03-21 16:30:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-07-15 18:13:31 +00:00
|
|
|
enum Size {
|
|
|
|
FilesystemTotal,
|
2011-07-26 20:54:44 +00:00
|
|
|
FilesystemFree,
|
|
|
|
FilesystemClusterSize,
|
2011-07-15 18:13:31 +00:00
|
|
|
};
|
2013-04-01 18:37:13 +00:00
|
|
|
enum MountpointsFilter {
|
|
|
|
MountpointsAll,
|
|
|
|
MountpointsSupported,
|
|
|
|
};
|
2011-07-15 18:13:31 +00:00
|
|
|
|
2010-04-02 21:24:19 +00:00
|
|
|
static bool recursiveRmdir(const QString &dirName);
|
|
|
|
static QString resolvePathCase(QString path);
|
|
|
|
static qulonglong filesystemFree(QString path);
|
2011-07-15 18:13:31 +00:00
|
|
|
static qulonglong filesystemTotal(QString path);
|
|
|
|
static qulonglong filesystemSize(QString path, enum Size type);
|
2020-10-04 09:26:40 +00:00
|
|
|
static QString filesystemType(QString path);
|
2010-04-02 21:24:19 +00:00
|
|
|
static QString findExecutable(QString name);
|
|
|
|
static QString checkEnvironment(bool permission);
|
2010-06-11 19:18:13 +00:00
|
|
|
static int compareVersionStrings(QString s1, QString s2);
|
2015-01-31 17:30:42 +00:00
|
|
|
static QString trimVersionString(QString s);
|
2011-07-15 20:03:05 +00:00
|
|
|
static QString filesystemName(QString path);
|
2013-04-01 18:37:13 +00:00
|
|
|
static QStringList mountpoints(enum MountpointsFilter type = MountpointsAll);
|
2011-07-17 08:08:58 +00:00
|
|
|
static QString resolveDevicename(QString path);
|
|
|
|
static QString resolveMountPoint(QString device);
|
2015-12-30 17:27:13 +00:00
|
|
|
static QMap<QString, QList<int> > findRunningProcess(QStringList names);
|
2016-02-04 23:03:09 +00:00
|
|
|
static QList<int> suspendProcess(QList<int> pidlist, bool suspend);
|
2012-09-08 18:34:36 +00:00
|
|
|
static bool ejectDevice(QString device);
|
2009-03-21 16:30:40 +00:00
|
|
|
};
|
|
|
|
|
2007-09-14 22:16:22 +00:00
|
|
|
#endif
|
|
|
|
|