2020-07-07 02:02:05 +08:00
|
|
|
#include <QMimeType>
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
#include <QMimeDatabase>
|
2020-08-19 14:34:35 +08:00
|
|
|
#include <QFileInfo>
|
2020-07-07 02:02:05 +08:00
|
|
|
#include "commonfunc.h"
|
|
|
|
|
|
|
|
|
|
bool ispicture(QString filepath)
|
|
|
|
|
{
|
2020-08-19 14:34:35 +08:00
|
|
|
QFileInfo file(filepath);
|
|
|
|
|
if(file.exists() == false)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
QMimeDatabase db;
|
|
|
|
|
QMimeType mime = db.mimeTypeForFile(filepath);
|
|
|
|
|
return mime.name().startsWith("image/");
|
2020-07-07 02:02:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString getSystemVersion()
|
|
|
|
|
{
|
|
|
|
|
QSettings settings("/etc/lsb-release", QSettings::IniFormat);
|
|
|
|
|
QString release = settings.value("DISTRIB_RELEASE").toString();
|
|
|
|
|
QString description = settings.value("DISTRIB_DESCRIPTION").toString();
|
|
|
|
|
if(description.right(3) == "LTS")
|
|
|
|
|
release = release + " LTS";
|
|
|
|
|
return release;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString getSystemDistrib()
|
|
|
|
|
{
|
|
|
|
|
QSettings settings("/etc/lsb-release", QSettings::IniFormat);
|
|
|
|
|
QString distribId = settings.value("DISTRIB_ID").toString();
|
|
|
|
|
return distribId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commonFunc::commonFunc()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|