1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 03:29:16 +02:00

Unified path -> name conversion

This commit is contained in:
2021-01-17 19:33:06 +01:00
parent 3033bc680d
commit 6d8ccd2216
18 changed files with 65 additions and 76 deletions

View File

@ -1,9 +1,10 @@
#include <cctype>
#include <cmath>
#include <QFileInfo>
#include "util.h"
int str2int(const char *str, int len)
int Util::str2int(const char *str, int len)
{
int res = 0;
@ -17,7 +18,7 @@ int str2int(const char *str, int len)
return res;
}
double niceNum(double x, bool round)
double Util::niceNum(double x, bool round)
{
int expv;
double f;
@ -48,3 +49,9 @@ double niceNum(double x, bool round)
return nf * pow(10.0, expv);
}
QString Util::file2name(const QString &path)
{
QFileInfo fi(path);
return fi.baseName().replace('_', ' ');
}

View File

@ -1,7 +1,13 @@
#ifndef UTIL_H
#define UTIL_H
int str2int(const char *str, int len);
double niceNum(double x, bool round);
#include <QString>
namespace Util
{
int str2int(const char *str, int len);
double niceNum(double x, bool round);
QString file2name(const QString &path);
}
#endif // UTIL_H