mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
Changed: Remove nameToId
This commit is contained in:
parent
32e71c4b97
commit
3f2b4f3a22
2 changed files with 0 additions and 31 deletions
|
@ -41,36 +41,6 @@ QString qBytesToHumanReadable(qint64 bytes)
|
|||
return QString::fromUtf8(NLMISC::bytesToHumanReadableUnits(bytes, units).c_str());
|
||||
}
|
||||
|
||||
QString nameToId(const QString &name)
|
||||
{
|
||||
QString res;
|
||||
|
||||
// only allows simple characters
|
||||
QRegExp allowedCharacters("^[0-9a-zA-Z-]$");
|
||||
|
||||
for (int i = 0, len = name.length(); i < len; ++i)
|
||||
{
|
||||
if (allowedCharacters.indexIn(name.at(i)) > -1)
|
||||
{
|
||||
// allowed character
|
||||
res += name[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
// not allowed, replace by a space
|
||||
res += " ";
|
||||
}
|
||||
}
|
||||
|
||||
// simplify all spaces
|
||||
res = res.simplified();
|
||||
|
||||
// replace spaces by minus
|
||||
res.replace(" ", "-");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool isDirectoryEmpty(const QString &directory, bool recursize)
|
||||
{
|
||||
bool res = true;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
// convert a size in bytes to a QString with larger unit (KiB, MiB, etc...)
|
||||
QString qBytesToHumanReadable(qint64 bytes);
|
||||
QString nameToId(const QString &name);
|
||||
|
||||
// return true is the specified directory is empty (has no file inside) (and all its subdirectories if recursize is true)
|
||||
bool isDirectoryEmpty(const QString &directory, bool recursize);
|
||||
|
|
Loading…
Reference in a new issue