mirror of
https://github.com/huderlem/porymap.git
synced 2026-03-21 17:45:44 -05:00
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#pragma once
|
|
#ifndef UTILITY_H
|
|
#define UTILITY_H
|
|
|
|
#include <QString>
|
|
#include <QLineEdit>
|
|
#include <QColorSpace>
|
|
|
|
namespace Util {
|
|
void numericalModeSort(QStringList &list);
|
|
int roundUpToMultiple(int numToRound, int multiple);
|
|
QString toDefineCase(QString input);
|
|
QString toHexString(uint32_t value, int minLength = 0);
|
|
QString toHtmlParagraph(const QString &text);
|
|
QString stripPrefix(const QString &s, const QString &prefix);
|
|
Qt::Orientations getOrientation(bool xflip, bool yflip);
|
|
QString replaceExtension(const QString &path, const QString &newExtension);
|
|
void setErrorStylesheet(QLineEdit *lineEdit, bool isError);
|
|
QString toStylesheetString(const QFont &font);
|
|
void show(QWidget *w);
|
|
QString mkpath(const QString& dirPath);
|
|
QString getFileHash(const QString &filepath);
|
|
|
|
// Given a QMap<T,QString>, erases all entries with empty strings.
|
|
// Returns the number of entries erased.
|
|
template <typename T>
|
|
int removeEmptyStrings(QMap<T,QString> *map) {
|
|
if (!map) return 0;
|
|
int numRemoved = 0;
|
|
for (auto it = map->begin(); it != map->end();) {
|
|
if (it.value().isEmpty()) it = map->erase(it);
|
|
else {it++; numRemoved++;}
|
|
}
|
|
return numRemoved;
|
|
}
|
|
}
|
|
|
|
#endif // UTILITY_H
|