mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
refact1
This commit is contained in:
58
LibInstructorsAndTrainees/connectorToServer/Core/tools.cpp
Normal file
58
LibInstructorsAndTrainees/connectorToServer/Core/tools.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "tools.h"
|
||||
|
||||
#include <qdir.h>
|
||||
|
||||
|
||||
void Tools::printTime()
|
||||
{
|
||||
qDebug() << QTime::currentTime().toString("hh:mm:ss");
|
||||
}
|
||||
|
||||
QString Tools::getTime()
|
||||
{
|
||||
return QTime::currentTime().toString(("hh:mm:ss"));
|
||||
}
|
||||
|
||||
QString Tools::createLocalPath(QString path)
|
||||
{
|
||||
qDebug() << "Full path: " << path;
|
||||
qint8 pos = path.indexOf("Application");
|
||||
|
||||
QString localPath = path.remove(0,--pos);
|
||||
|
||||
qDebug() << "Local path: " << localPath;
|
||||
return localPath;
|
||||
}
|
||||
|
||||
QString Tools::createFullPath(QString path)
|
||||
{
|
||||
QString fullPath;
|
||||
qint8 pos = path.indexOf(additionalFilesFolderName);
|
||||
|
||||
QString localPath = path.remove(0,--pos);
|
||||
|
||||
qDebug() << "CLIENT: localPath" << localPath;
|
||||
fullPath = QDir::currentPath() + localPath;
|
||||
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
QString Tools::convertFileSize(quint64 fileSize)
|
||||
{
|
||||
quint64 megaByte = fileSize / (1024 * 1024);
|
||||
QString resultSize;
|
||||
|
||||
if (megaByte == 0)
|
||||
{
|
||||
auto kiloByte = fileSize / 1024;
|
||||
resultSize = QString::number(kiloByte) + "кб. ";
|
||||
}
|
||||
else
|
||||
{
|
||||
resultSize = QString::number(megaByte) + "мб. ";
|
||||
}
|
||||
|
||||
|
||||
QString result = resultSize;
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user