Porovnat revize
Žádné společné commity. „edb781580e9f6db5a78528ca218628403f15e40d“ a „5076f044a647fb518a188361ed2b44b353292b54“ mají zcela odlišnou historii.
edb781580e
...
5076f044a6
@ -75,34 +75,12 @@ EntryConfig EntryProvider::readFromDesktopFile(const QString &path)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(key == "nodisplay")
|
||||
{
|
||||
result.hidden = args == "true";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::optional<EntryConfig> EntryProvider::readEntryFromPath(const QString &path)
|
||||
{
|
||||
QFileInfo info(path);
|
||||
if(info.isFile())
|
||||
{
|
||||
QString suffix = info.suffix();
|
||||
if(suffix == "desktop")
|
||||
{
|
||||
return readFromDesktopFile(path);
|
||||
}
|
||||
if(suffix == "qsrun")
|
||||
{
|
||||
return readqsrunFile(path);
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
/* qsrun's own format */
|
||||
EntryConfig EntryProvider::readqsrunFile(const QString &path)
|
||||
/* qsrun own's config file */
|
||||
EntryConfig EntryProvider::readFromFile(const QString &path)
|
||||
{
|
||||
EntryConfig result;
|
||||
EntryConfig inheritedConfig;
|
||||
@ -181,11 +159,7 @@ EntryConfig EntryProvider::readqsrunFile(const QString &path)
|
||||
}
|
||||
if(key == "inherit")
|
||||
{
|
||||
auto entry = readEntryFromPath(resolveEntryPath(splitted[1]));
|
||||
if(entry)
|
||||
{
|
||||
inheritedConfig = *entry;
|
||||
}
|
||||
inheritedConfig = readFromDesktopFile(resolveEntryPath(splitted[1]));
|
||||
}
|
||||
}
|
||||
return result.update(inheritedConfig);
|
||||
@ -223,12 +197,17 @@ QVector<EntryConfig> EntryProvider::readConfig(QStringList paths)
|
||||
while(it.hasNext())
|
||||
{
|
||||
QString path = it.next();
|
||||
std::optional<EntryConfig> entry = readEntryFromPath(path);
|
||||
if(entry)
|
||||
QFileInfo info(path);
|
||||
if(info.isFile())
|
||||
{
|
||||
if(!entry->hidden)
|
||||
QString suffix = info.suffix();
|
||||
if(suffix == "desktop")
|
||||
{
|
||||
result.append(*entry);
|
||||
result.append(readFromDesktopFile(path));
|
||||
}
|
||||
if(suffix == "qsrun")
|
||||
{
|
||||
result.append(readFromFile(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define ENTRYPROVIDER_H
|
||||
#include <QIcon>
|
||||
#include <QSettings>
|
||||
#include <optional>
|
||||
|
||||
class ConfigFormatException : public std::runtime_error
|
||||
{
|
||||
@ -18,7 +17,6 @@ class ConfigFormatException : public std::runtime_error
|
||||
class EntryConfig
|
||||
{
|
||||
public:
|
||||
bool hidden = false;
|
||||
QString key;
|
||||
QString name;
|
||||
QString command;
|
||||
@ -36,9 +34,8 @@ class EntryProvider
|
||||
QStringList _desktopIgnoreArgs;
|
||||
QStringList userEntriesDirsPaths;
|
||||
QStringList systemEntriesDirsPaths;
|
||||
EntryConfig readqsrunFile(const QString &path);
|
||||
EntryConfig readFromFile(const QString &path);
|
||||
EntryConfig readFromDesktopFile(const QString &path);
|
||||
std::optional<EntryConfig> readEntryFromPath(const QString &path);
|
||||
QVector<EntryConfig> readConfig(QStringList paths);
|
||||
QString resolveEntryPath(QString path);
|
||||
|
||||
|
@ -23,5 +23,5 @@ SOURCES += calculationengine.cpp \
|
||||
QT += widgets sql network
|
||||
QT_CONFIG -= no-pkg-config
|
||||
LIBS += -lcln
|
||||
CONFIG += link_pkgconfig c++17
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += libqalculate
|
||||
|
Načítá se…
x
Odkázat v novém úkolu
Zablokovat Uživatele