-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utilities.h
44 lines (37 loc) · 1.38 KB
/
Utilities.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include <string>
#include <QString>
#include <QIcon>
#include <QTextStream>
#include <QFile>
#include <map>
#include "MiIni.h"
struct AppDef
{
inline AppDef(QString path, std::function<QIcon()> iconLoader): path(path), iconLoader(iconLoader) {}
AppDef() = default;
AppDef(const AppDef&) = default;
AppDef(AppDef&&) = default;
AppDef& operator=(const AppDef&) = default;
AppDef& operator=(AppDef&&) = default;
QString path;
std::function<QIcon()> iconLoader = {};
std::map<QString, AppDef> subApps;
};
QString getExeFileFilter();
QString getProgramPath();
QString getDesktopFileName();
QString getHomeDirectory();
QString getConfigDirectory();
QString getUsername();
QStringList getAppDirectories();
QStringList getRemovableDriveDirectories();
AppDef getApps();
QString getDrive(const QString& mountPoint);
size_t getDriveFileHeader(QString drive, char *headerBuffer, size_t charsToRead);// accepts drive letter (windows) or drive file (unix); returns chars read
bool fileExists(const QString& name);
bool directoryExists(const QString& name);
void replaceAll(std::wstring& str, const std::wstring& from, const std::wstring& to);
bool isAutoRun();
void setAutoRun(bool autorun);
void startProgram(const QString& path, const QString& options, const QString& workdir, const std::map<QString, QString>& envVars);