blob: d0c8b3ad14c4c5e60b02267bbbf5df94cc952fe1 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
//===========================================
// Lumina-DE source code
// Copyright (c) 2012, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_LIBRARY_UTILS_H
#define _LUMINA_LIBRARY_UTILS_H
#include <QCoreApplication>
#include <QProcess>
#include <QTextStream>
#include <QFile>
#include <QDir>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QFileInfo>
#include <QObject>
#include <QTranslator>
#include <QApplication>
class LUtils{
public:
//Get the current version of the Lumina desktop
static QString LuminaDesktopVersion();
//Run an external command and return the exit code
static int runCmd(QString cmd, QStringList args = QStringList());
//Run an external command and return any text output (one line per entry)
static QStringList getCmdOutput(QString cmd, QStringList args = QStringList());
//Read a text file
static QStringList readFile(QString filepath);
//Write a text file
static bool writeFile(QString filepath, QStringList contents, bool overwrite=false);
//Check whether a file/path is a valid binary
static bool isValidBinary(QString bin); //full path or name only
//List all the sub-directories of a parent dir (recursive)
static QStringList listSubDirectories(QString dir, bool recursive = true);
//Load a translation file for a Lumina Project
static void LoadTranslation(QApplication *app, QString appname);
//Various functions for the favorites sub-system
// Formatting Note: "<name>::::[dir/file/app]::::<path>"
// the <name> field might not be used for "app" flagged entries
static QStringList listFavorites();
static bool saveFavorites(QStringList);
static bool isFavorite(QString path);
static bool addFavorite(QString path, QString name = "");
static void removeFavorite(QString path);
//Load the default setup for the system
static void LoadSystemDefaults(bool skipOS = false);
};
#endif
|