You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.6 KiB
50 lines
1.6 KiB
#ifndef CONV_UTILS_H
|
|
#define CONV_UTILS_H
|
|
|
|
#include <QObject>
|
|
#include <QSettings>
|
|
#include <QRegExp>
|
|
#include <QStandardItemModel>
|
|
#include <QApplication>
|
|
#include <QTextCharFormat>
|
|
|
|
struct logMessage
|
|
{
|
|
logMessage(const QtMsgType &type, const QString &message, const QString &fn){
|
|
logMessage::type = type;
|
|
logMessage::message = message;
|
|
logMessage::fn = fn;
|
|
}
|
|
QtMsgType type;
|
|
QString message;
|
|
QString fn;
|
|
};
|
|
|
|
class Utils
|
|
{
|
|
|
|
public:
|
|
static bool portOpen(const QString &hostname, quint16 port);
|
|
static bool fileExists(const QString &path);
|
|
static QByteArray fileOpen(const QString &path);
|
|
static QByteArray fileOpenQRC(const QString &path);
|
|
static qint64 fileModifiedAge(const QString &path);
|
|
static bool fileWrite(const QString &path, const QString &data);
|
|
static bool validateJSON(const QByteArray &blob);
|
|
static bool readJsonFile(QIODevice &device, QSettings::SettingsMap &map);
|
|
static bool writeJsonFile(QIODevice &device, const QSettings::SettingsMap &map);
|
|
static bool dirExists(const QString &path);
|
|
static QString barrayToString(const QByteArray &data);
|
|
static QString getUnixAccountName();
|
|
static double roundSignificant(double N, double n);
|
|
static QString formatBytes(quint64 bytes);
|
|
static int maxLength(const QVector<QString> &array);
|
|
static double roundUp(double value, int decimal_places);
|
|
static QMap<QString, QLocale> localeCache;
|
|
static void applicationLogHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
|
};
|
|
|
|
class Conversations;
|
|
|
|
#endif
|