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:
@ -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('_', ' ');
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user