![]() |
LeechCraft
%{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
|
Namespaces | |
CacheStrat | |
SvcAuth | |
SysInfo | |
XDG | |
Classes | |
class | AddressesModelManager |
class | AssocCache |
class | AutoResizeMixin |
Automatically moves a widget to fit a rectangle on resize. More... | |
class | BackendSelector |
A common dialog to select storage backend. More... | |
class | BaseHookInterconnector |
Base class for signal-slot relays in plugin APIs. More... | |
class | CategorySelector |
The CategorySelector widget provides a way to select amongst a group of items. More... | |
class | ClearLineEditAddon |
Provides a "clear text" action for line edits. More... | |
class | ColorButton |
A button for choosing a color. More... | |
class | ColorThemeProxy |
Proxy for QML files to use colors from current color theme. More... | |
class | CustomCookieJar |
A customized cookie jar with additional features. More... | |
class | CustomNetworkReply |
A network reply with customizable content and reply headers. More... | |
class | DBLock |
Provides database transaction lock. More... | |
class | DefaultHookProxy |
Standard implementation of IHookProxy. More... | |
class | DelayedExecutor |
class | DeleteLaterPolicy |
class | ExtensionsData |
class | ExtensionsDataImpl |
class | FileRemoveGuard |
QFile removing itself from file system on destruction. More... | |
class | FindNotification |
A horizontal bar with typical widgets for text search. More... | |
class | FindNotificationWk |
A helper class to aid connecting FindNotification with Qt WebKit. More... | |
class | FlattenFilterModel |
Proxy model flattening a hierarchical model. More... | |
class | FlatToFoldersProxyModel |
class | FlowLayout |
A simple flow layout implementation. More... | |
class | IDPool |
A simple pool of identificators of the given type. More... | |
class | LineEditButtonManager |
Manages additional overlay buttons in a QLineEdit. More... | |
class | MergeModel |
class | MimeDetector |
class | MimeDetectorImpl |
class | ModelItem |
class | ModelIterator |
class | NetworkDiskCache |
A thread-safe garbage-collected network disk cache. More... | |
class | NoDeletePolicy |
class | NotificationActionHandler |
Aids in adding actions to notifications. More... | |
class | PageNotification |
A horizontal widget embedding into the parent layout of the passed parent widget. More... | |
class | PlotItem |
class | QueueManager |
A simple scheduling manager for a queue of functors. More... | |
class | RegExp |
struct | RegExpImpl |
class | ResourceLoader |
Utility class for loading a file from a set of locations. More... | |
class | SelectableBrowser |
A "browser" that shows HTML either via QTextBrowser or a browser plugin. More... | |
class | SettableIconProvider |
class | ShortcutManager |
Aids in providing configurable shortcuts. More... | |
class | SlotClosure |
class | SlotClosureBase |
class | StandardNAMFactory |
class | StdDataFilterMenuCreator |
class | StlAssocIteratorAdaptor |
struct | StlAssocRange |
class | TagsCompleter |
Completer suitable for tag completion. More... | |
class | TagsCompletionModel |
A QStringListModel providing additional methods for tags. More... | |
class | TagsFilterModel |
Provides filter model with additional tags filter mode. More... | |
class | TagsLineEdit |
A line edit class suitable for use with TagsCompleter. More... | |
class | ThemeImageProvider |
Provides icons from the current theme by their FDO name. More... | |
class | ToolTipItem |
ToolTip for Qml objects. More... | |
class | TreeItem |
class | UnhideListModel |
class | UnhideListViewBase |
class | UnhoverDeleteMixin |
Allows to hide a widget or popup after mouse leave. More... | |
struct | ValueFinder |
class | WidthIconProvider |
Provides scalable icons to QML. More... | |
class | XWrapper |
Typedefs | |
typedef std::shared_ptr < XmlSettingsDialog > | XmlSettingsDialog_ptr |
typedef std::shared_ptr < ModelItem > | ModelItem_ptr |
typedef std::weak_ptr< ModelItem > | ModelItem_wtr |
typedef QVector< ModelItem_ptr > | ModelItemsList_t |
typedef std::shared_ptr< const ModelItem > | ModelItem_cptr |
typedef QList< QPair< QString, QString > > | AddrList_t |
using | OneTimeRunner = SlotClosure< DeleteLaterPolicy > |
typedef std::shared_ptr < QIODevice > | QIODevice_ptr |
typedef std::shared_ptr < DefaultHookProxy > | DefaultHookProxy_ptr |
Enumerations | |
enum | FitFlag { NoFlags, NoOverlap = 0x01 } |
enum | QueuePriority { QueuePriority::Normal, QueuePriority::High } |
enum | SysPath { SysPath::QML, SysPath::Share } |
Describes various root paths recognized by GetSysPath(). More... | |
enum | UserDir { UserDir::Cache, UserDir::LC } |
Describes various user-specific paths. More... | |
enum | WinStateFlag { NoState = 0, Modal = 1 << 0, Sticky = 1 << 1, MaximizedVert = 1 << 2, MaximizedHorz = 1 << 3, Shaded = 1 << 4, SkipTaskbar = 1 << 5, SkipPager = 1 << 6, Hidden = 1 << 7, Fullscreen = 1 << 8, OnTop = 1 << 9, OnBottom = 1 << 10, Attention = 1 << 11 } |
enum | AllowedActionFlag { NoAction = 0, Move = 1 << 0, Resize = 1 << 1, Minimize = 1 << 2, Shade = 1 << 3, Stick = 1 << 4, MaximizeHorz = 1 << 5, MaximizeVert = 1 << 6, ShowFullscreen = 1 << 7, ChangeDesktop = 1 << 8, Close = 1 << 9, MoveToTop = 1 << 10, MoveToBottom = 1 << 11 } |
Functions | |
QPoint | FitRectScreen (QPoint pos, const QSize &size, FitFlags flags=NoFlags, const QPoint &shiftAdd=QPoint(0, 0)) |
Tries to fit a rectangle (like a dialog or popup) into screen. More... | |
QPoint | FitRect (QPoint pos, const QSize &size, const QRect &geometry, FitFlags flags=NoFlags, const QPoint &shiftAdd=QPoint(0, 0)) |
Tries to fit a rectangle (like a dialog or popup) into geometry. More... | |
QLabel * | ShowPixmapLabel (const QPixmap &pixmap, const QPoint &pos=QPoint()) |
Shows a pixmap at the given pos. More... | |
Q_DECLARE_FLAGS (FitFlags, FitFlag) | |
AddrList_t | GetLocalAddresses (int port=0) |
Returns all local addresses. More... | |
QList< QHostAddress > | GetAllAddresses () |
Returns all addresses likely accessible "from the outside". More... | |
QString | GetSocketErrorString (QAbstractSocket::SocketError error) |
Returns an error string for the given socket error. More... | |
template<typename T1 , typename T2 , template< typename U > class Container, typename F > | |
auto | ZipWith (const Container< T1 > &c1, const Container< T2 > &c2, F f) -> Container< typename std::result_of< F(T1, T2)>::type > |
template<typename T1 , typename T2 , template< typename U > class Container, template< typename U1, typename U2 > class Pair = QPair> | |
auto | Zip (const Container< T1 > &c1, const Container< T2 > &c2) -> Container< Pair< T1, T2 >> |
template<typename T , template< typename U > class Container, typename F > | |
auto | Map (const Container< T > &c, F f) -> Container< decltype(f(T()))> |
template<template< typename K, typename V > class PairType = std::pair, typename Assoc > | |
StlAssocRange< typename Assoc::const_iterator, Assoc, PairType > | Stlize (const Assoc &assoc) |
QStringList | GetPathCandidates (SysPath path, QString subfolder) |
Returns possible full paths for the path and subfolder. More... | |
QString | GetSysPath (SysPath path, const QString &subfolder, const QString &filename) |
Returns path to the file in the given root path and subfolder. More... | |
QUrl | GetSysPathUrl (SysPath path, const QString &subfolder, const QString &filename) |
Returns path to the file in the given root path and subfolder. More... | |
QStringList | GetSystemPaths () |
Returns the components of the system PATH variable. More... | |
QString | FindInSystemPath (const QString &name, const QStringList &paths, const std::function< bool(QFileInfo)> &filter=std::function< bool(QFileInfo)>()) |
Searches for a file in system paths according to a filter. More... | |
QDir | GetUserDir (UserDir dir, const QString &subpath) |
QDir | CreateIfNotExists (QString path) |
Creates a path if it doesn't exist. More... | |
QString | GetTemporaryName (const QString &pattern=QString("lc_temp.XXXXXX")) |
Returns a temporary filename. More... | |
QString | FromStdString (const std::string &str) |
An utility function that creates a QString from UTF8-encoded std::string. More... | |
UTIL_API QString | GetAsBase64Src (const QImage &image) |
Returns the given image in a Base64-encoded form. More... | |
UTIL_API QString | GetUserText (const Entity &entity) |
Return the user-readable representation of the entity. More... | |
UTIL_API QString | MakePrettySize (qint64 sourceSize) |
Makes a formatted size from number. More... | |
UTIL_API QString | MakeTimeFromLong (ulong time) |
Makes a formatted time from number. More... | |
UTIL_API QTranslator * | LoadTranslator (const QString &base, const QString &locale, const QString &prefix="leechcraft", const QString &appname="leechcraft") |
UTIL_API QTranslator * | InstallTranslator (const QString &base, const QString &prefix="leechcraft", const QString &appname="leechcraft") |
Loads and installs a translator. More... | |
UTIL_API QString | GetLocaleName () |
Returns the current locale name, like en_US. More... | |
UTIL_API QString | GetInternetLocaleName (const QLocale &) |
UTIL_API QString | GetLanguage () |
Returns the current language name. More... | |
UTIL_API QModelIndexList | GetSummarySelectedRows (QObject *sender) |
UTIL_API QAction * | CreateSeparator (QObject *parent) |
Returns the action that is set to act as a separator. More... | |
UTIL_API QPixmap | DrawOverlayText (QPixmap px, const QString &text, QFont font, const QPen &pen, const QBrush &brush) |
UTIL_API uintptr_t | Handle2Num (Qt::HANDLE handle) |
Converts the handle to an integer. More... | |
template<typename TagGetter , typename TagSetter > | |
QDomElement | GetElementForTags (const QStringList &tags, QDomNode &node, QDomDocument &document, const QString &elementName, TagGetter tagGetter, TagSetter tagSetter) |
Returns an element for a given tags list. More... | |
template<typename K , typename V > | |
QMap< K, V > | MakeMap (std::initializer_list< QPair< K, V >> l) |
QString | GetPassword (const QString &keyName, const QString &dialogText, QObject *emitter, bool useStore=true) |
Returns password for the key, possibly asking the user. More... | |
void | SavePassword (const QString &password, const QString &keyName, QObject *emitter) |
Saves the password to be retrieved later via GetPassword(). More... | |
QList< ANFieldData > | GetStdANFields (const QString &type) |
Entity | MakeAN (const QString &header, const QString &text, Priority priority, const QString &senderID, const QString &cat, const QString &type, const QString &id, const QStringList &visualPath, int delta=1, int count=0, const QString &fullText=QString(), const QString &extendedText=QString()) |
Creates an Advanced Notifications-enabled notify entity. More... | |
Entity | MakeANRule (const QString &title, const QString &senderID, const QString &cat, const QStringList &types, AN::NotifyFlags flags, bool openConfiguration, const QList< QPair< QString, ANFieldValue >> &fields) |
QList< QObject * > | GetDataFilters (const QVariant &data, IEntityManager *manager) |
Returns the data filter plugins that can handle data. More... | |
Entity | MakeEntity (const QVariant &entity, const QString &location, TaskParameters tp, const QString &mime) |
Entity | MakeNotification (const QString &header, const QString &text, Priority priority) |
An utility function to make a Entity with notification. More... | |
Entity | MakeANCancel (const Entity &event) |
Makes an event for canceling another Advanced Notifications event. More... | |
Entity | MakeANCancel (const QString &senderId, const QString &eventId) |
Makes an event for canceling another Advanced Notifications event. More... | |
QVariantList | GetPersistentData (const QList< QVariant > &keys, QObject *object) |
UTIL_XPC_API Entity | MakeEntity (const QVariant &entity, const QString &location, LeechCraft::TaskParameters tp, const QString &mime=QString()) |
An utility function to make a Entity. More... | |
XmlSettingsDialog * | OpenXSD (const QString &title, const QString &filename, Util::BaseSettingsManager *bsm) |
Variables | |
const int | SourcePager = 2 |
const int | StateRemove = 0 |
const int | StateAdd = 1 |
typedef QList<QPair<QString, QString> > LeechCraft::Util::AddrList_t |
Definition at line 44 of file addresses.h.
typedef std::shared_ptr<DefaultHookProxy> LeechCraft::Util::DefaultHookProxy_ptr |
Definition at line 117 of file defaulthookproxy.h.
typedef std::shared_ptr<const ModelItem> LeechCraft::Util::ModelItem_cptr |
Definition at line 46 of file modelitem.h.
typedef std::shared_ptr<ModelItem> LeechCraft::Util::ModelItem_ptr |
Definition at line 41 of file modelitem.h.
typedef std::weak_ptr<ModelItem> LeechCraft::Util::ModelItem_wtr |
Definition at line 44 of file modelitem.h.
typedef QVector<ModelItem_ptr> LeechCraft::Util::ModelItemsList_t |
Definition at line 45 of file modelitem.h.
using LeechCraft::Util::OneTimeRunner = typedef SlotClosure<DeleteLaterPolicy> |
Definition at line 38 of file onetimerunner.h.
typedef std::shared_ptr<QIODevice> LeechCraft::Util::QIODevice_ptr |
Definition at line 50 of file resourceloader.h.
typedef std::shared_ptr<XmlSettingsDialog> LeechCraft::Util::XmlSettingsDialog_ptr |
Definition at line 39 of file ihavesettings.h.
Enumerator | |
---|---|
NoAction | |
Move | |
Resize | |
Minimize | |
Shade | |
Stick | |
MaximizeHorz | |
MaximizeVert | |
ShowFullscreen | |
ChangeDesktop | |
Close | |
MoveToTop | |
MoveToBottom |
Definition at line 57 of file winflags.h.
Additional fitting options used by FitRect() and FitRectScreen().
|
strong |
Enumerator | |
---|---|
Normal | |
High |
Definition at line 46 of file queuemanager.h.
|
strong |
Describes various root paths recognized by GetSysPath().
|
strong |
Describes various user-specific paths.
Enumerator | |
---|---|
Cache |
Cache for volatile data. |
LC |
Root LeechCraft directory (something like ~/.leechcraft). |
Enumerator | |
---|---|
NoState | |
Modal | |
Sticky | |
MaximizedVert | |
MaximizedHorz | |
Shaded | |
SkipTaskbar | |
SkipPager | |
Hidden | |
Fullscreen | |
OnTop | |
OnBottom | |
Attention |
Definition at line 38 of file winflags.h.
UTIL_SYS_API QDir LeechCraft::Util::CreateIfNotExists | ( | QString | path | ) |
Creates a path if it doesn't exist.
Creates a relative path ~/.leechcraft/path and throws an exception if this could not be done or if such path already exists and it is not readable.
[in] | path | The path to create. |
std::runtime_error | Throws if the path could not be created. |
QAction * LeechCraft::Util::CreateSeparator | ( | QObject * | parent | ) |
QPixmap LeechCraft::Util::DrawOverlayText | ( | QPixmap | px, |
const QString & | text, | ||
QFont | font, | ||
const QPen & | pen, | ||
const QBrush & | brush | ||
) |
UTIL_SYS_API QString LeechCraft::Util::FindInSystemPath | ( | const QString & | name, |
const QStringList & | paths, | ||
const std::function< bool(QFileInfo)> & | filter = std::function< bool(QFileInfo)>() |
||
) |
Searches for a file in system paths according to a filter.
This function searches for a file named name in system paths passed in paths and returns the full path for the first file that matches filter, or an empty string if nothing is found.
paths are most possibly obtained via GetSystemPaths(), but an arbitrary set of paths is fine too.
[in] | name | The name of the file to search for. |
[in] | paths | The paths to search in. |
[in] | filter | The filter function for the candidates. |
|
inline |
QString LeechCraft::Util::GetAsBase64Src | ( | const QImage & | image | ) |
UTIL_XPC_API QList< QObject * > LeechCraft::Util::GetDataFilters | ( | const QVariant & | data, |
IEntityManager * | manager | ||
) |
Returns the data filter plugins that can handle data.
This function queries all available data filters plugins if they can handle data and returns the list of object instances that can handle it. The object instances are guaranteed to implement the IDataFilter interface as well as IEntityHandler interface.
The manager is used to obtain the list of plugins. It can be obtained from the ICoreProxy_ptr object that is passed to your plugin's Init() function.
[in] | data | The data to query. |
[in] | manager | The manager used to get the plugins. |
Definition at line 90 of file util.cpp.
References IEntityManager::GetPossibleHandlers(), and MakeEntity().
QDomElement LeechCraft::Util::GetElementForTags | ( | const QStringList & | tags, |
QDomNode & | node, | ||
QDomDocument & | document, | ||
const QString & | elementName, | ||
TagGetter | tagGetter, | ||
TagSetter | tagSetter | ||
) |
Returns an element for a given tags list.
This function tries to implement projection from tags to a hierarchical structure in form of XML. It traverses the tags list and creates child nodes from the document, appending the hierarchical structure's tree root to the node. It returns the parent element to which the item should be appended.
For empty tags list it just returns node converted to the QDomElement.
tagSetter is a function or functor that should be able to take two parameters, a QDomElement and a QString, and set tags for it.
tagGetter is a function or functor that should be able to take one parameter, a QDomElement, and return a QString for it with tags previously set with tagSetter.
[in] | tags | List of tags. |
[in] | node | The parent-most node to which all other nodes are appended. |
[in] | document | The document containing all these nodes. |
[in] | elementName | The name of the XML element that carries info about the tags. |
[in] | tagSetter | Setter function for the tags for the given element. |
[in] | tagGetter | Getter function for the tags for the given element. |
QString LeechCraft::Util::GetInternetLocaleName | ( | const QLocale & | locale | ) |
QString LeechCraft::Util::GetLanguage | ( | ) |
Returns the current language name.
This function works as GetLocaleName() except it doesn't return (and doesn't query for) country name.
Definition at line 255 of file util.cpp.
References GetLocaleName().
QString LeechCraft::Util::GetLocaleName | ( | ) |
Returns the current locale name, like en_US.
First, this function checks the locale value stored in "Language" key of settings object with organizationName() and applicationName(). If it's equal to "system", this function queries the LANG environment variable, and if it is empty or in invalid format (not like en_US), it takes the value of QLocale::system().name().
Then, if the resulting name the name of the language only, GetLocaleName() tries to find any countries for that language. If any countries are found, the code of the first found country is appended, else "_00" is appended.
Definition at line 216 of file util.cpp.
Referenced by GetLanguage(), and InstallTranslator().
UTIL_XPC_API QString LeechCraft::Util::GetPassword | ( | const QString & | keyName, |
const QString & | dialogText, | ||
QObject * | emitter, | ||
bool | useStore = true |
||
) |
Returns password for the key, possibly asking the user.
This function returns password for the given keyName and using the given emitter object. The password is typically stored in a storage plugin like SecMan.
If the password isn't found in any password stores (or there are no password stores) or useStore is set to false, this function asks the user for the password instead using the dialogText for the dialog and returns the user input instead. If user has canceled the dialog it returns an null string. Otherwise, if the user has entered some text this function automatically stores the password under the keyName.
The emitter object is used to send the corresponding internal Entity objects around, so it should have its gotEntity() and delegateEntity() signals both relayed to the corresponding plugin instance object.
[in] | keyName | The name of the key uniquely identifying the password. |
[in] | dialogText | The text of the dialog to present to the user if the password isn't found or useStore is false. |
[in] | emitter | The object used to emit the gotEntity() and delegateEntity() signals. |
[in] | useStore | Whether stored password should be used at all. Calling code may explicitly set this to false if the saved password is known to be invalid, for instance. |
Definition at line 74 of file passutils.cpp.
References SavePassword().
UTIL_SYS_API QStringList LeechCraft::Util::GetPathCandidates | ( | SysPath | path, |
QString | subfolder | ||
) |
Returns possible full paths for the path and subfolder.
This function returns a list of paths formed as the given root path identified by path plus the subfolder in it. The paths in the returned list aren't checked for existence.
For example, on Linux
will return { "/usr/share/leechcraft/flags", "/usr/local/share/leechcraft/flags" }
.
The subfolder can actually be a relative path, like flags/countries
, not just a single subfolder name.
This function hardly needs to be called from user code, consider using GetSysPath() instead.
[in] | path | The root path. |
[in] | subfolder | The subfolder inside the root path. |
Definition at line 47 of file paths.cpp.
Referenced by GetSysPath(), and LeechCraft::Util::UnhideListViewBase::UnhideListViewBase().
UTIL_XPC_API QVariantList LeechCraft::Util::GetPersistentData | ( | const QList< QVariant > & | keys, |
QObject * | object | ||
) |
Definition at line 144 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::Internal, and MakeEntity().
UTIL_XPC_API QList< ANFieldData > LeechCraft::Util::GetStdANFields | ( | const QString & | type | ) |
Definition at line 41 of file stdanfields.cpp.
References LeechCraft::AN::CatMediaPlayer, LeechCraft::AN::CatTerminal, LeechCraft::AN::Field::MediaAlbum, LeechCraft::AN::Field::MediaArtist, LeechCraft::AN::Field::MediaLength, LeechCraft::AN::Field::MediaPlaybackStatus, LeechCraft::AN::Field::MediaPlayerURL, LeechCraft::AN::Field::MediaTitle, LeechCraft::AN::Field::TerminalActive, LeechCraft::AN::TypeMediaPlaybackStatus, LeechCraft::AN::TypeTerminalActivity, LeechCraft::AN::TypeTerminalBell, and LeechCraft::AN::TypeTerminalInactivity.
QModelIndexList LeechCraft::Util::GetSummarySelectedRows | ( | QObject * | sender | ) |
UTIL_SYS_API QString LeechCraft::Util::GetSysPath | ( | SysPath | path, |
const QString & | subfolder, | ||
const QString & | filename | ||
) |
Returns path to the file in the given root path and subfolder.
This function returns path to a file named filename and located in the path specified by path + subfolder. It actually checks whether the file exists and if it doesn't, returns a null string instead.
If LeechCraft is running on a system where multiple paths correspond to a single path, they are checked from more user-accessible to less user-accessible. For example, SysPath::Share corresponds to /usr/local/share/leechcraft
and then /usr/share/leechcraft
.
The subfolder can actually be a relative path, like flags/countries
, not just a single subfolder name.
Refer to GetPathCandidates() for more information.
[in] | path | The identifier of the root path. |
[in] | subfolder | The subfolder inside the path. |
[in] | filename | The filename inside the path + subfolder. |
Definition at line 78 of file paths.cpp.
References GetPathCandidates().
Referenced by GetSysPathUrl(), and LeechCraft::Util::UnhideListViewBase::UnhideListViewBase().
UTIL_SYS_API QUrl LeechCraft::Util::GetSysPathUrl | ( | SysPath | path, |
const QString & | subfolder, | ||
const QString & | filename | ||
) |
Returns path to the file in the given root path and subfolder.
This function behaves exactly like GetSysPath(), but it returns the path as QUrl via the QUrl::fromLocalFile
, so it is suitable, for example, for QML views.
[in] | path | The identifier of the root path. |
[in] | subfolder | The subfolder inside the path. |
[in] | filename | The filename inside the path + subfolder. |
Definition at line 91 of file paths.cpp.
References GetSysPath().
UTIL_SYS_API QStringList LeechCraft::Util::GetSystemPaths | ( | ) |
Returns the components of the system PATH variable.
This function gets the PATH variable from the environment, parses it and returns the list of the components to the caller.
UTIL_SYS_API QString LeechCraft::Util::GetTemporaryName | ( | const QString & | pattern = QString("lc_temp.XXXXXX") | ) |
UTIL_SYS_API QDir LeechCraft::Util::GetUserDir | ( | UserDir | dir, |
const QString & | subpath | ||
) |
Definition at line 119 of file paths.cpp.
Referenced by LeechCraft::Util::NetworkDiskCache::NetworkDiskCache().
QString LeechCraft::Util::GetUserText | ( | const Entity & | entity | ) |
Return the user-readable representation of the entity.
[in] | entity | The Entity from which to make the user-readable representation. |
Definition at line 60 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::Entity::Entity_, and LeechCraft::Entity::Mime_.
uintptr_t LeechCraft::Util::Handle2Num | ( | Qt::HANDLE | handle | ) |
Converts the handle to an integer.
Different handles are mapped to different integers. This way a handle can be used, for example, as a part of a DB connection ID string.
[in] | handle | The handle to convert. |
QTranslator * LeechCraft::Util::InstallTranslator | ( | const QString & | base, |
const QString & | prefix = "leechcraft" , |
||
const QString & | appname = "leechcraft" |
||
) |
Loads and installs a translator.
Attempts to load and install a translator for the current locale. The name is formed like this: 'prefix_' + base + '_' + locale If base is an empty string, the second _ isn't appended.
First resources are searched (:/), then APPDIR/translations on Windows and /usr/[local/]share/appname/translations on Unix.
[in] | base | Base name of the translation file. |
[in] | prefix | The optional prefix of the translation (useful if it's not LC's one). |
[in] | appname | Base name of the application. |
Definition at line 196 of file util.cpp.
References GetLocaleName(), and LoadTranslator().
QTranslator * LeechCraft::Util::LoadTranslator | ( | const QString & | base, |
const QString & | locale, | ||
const QString & | prefix = "leechcraft" , |
||
const QString & | appname = "leechcraft" |
||
) |
Definition at line 154 of file util.cpp.
Referenced by InstallTranslator().
UTIL_XPC_API Entity LeechCraft::Util::MakeAN | ( | const QString & | header, |
const QString & | text, | ||
Priority | priority, | ||
const QString & | senderID, | ||
const QString & | cat, | ||
const QString & | type, | ||
const QString & | id, | ||
const QStringList & | visualPath, | ||
int | delta = 1 , |
||
int | count = 0 , |
||
const QString & | fullText = QString() , |
||
const QString & | extendedText = QString() |
||
) |
Creates an Advanced Notifications-enabled notify entity.
Returns an entity with the given header, text and a bunch of other parameters that can be handled by Advanced Notifications.
The returned entity will also be handled by a visual notifications plugin if AN is not present. To avoid this set the MIME type of the result to x-leechcraft/notification+advanced.
Refer to the hand-written documentation for more information about using Advanced Notifications.
[in] | header | The header of the notification. This field will also be used if AN is not present. |
[in] | text | The text of the notification. This field will also be used if AN is not present. |
[in] | priority | The priority of this notification. |
[in] | senderID | The ID of the plugin sending this notification. |
[in] | cat | The category of this notification (one of Cat constants in interfaces/an/constants.h). |
[in] | type | The type of this notification (one of Type constants in interfaces/an/constants.h). |
[in] | id | The ID of this notification, used to group consecutive notifications about similar events like incoming message from the same IM contact. |
[in] | visualPath | The list of names for a menu-like structure wishing to show this notification. |
[in] | delta | The change of count of events with this id, or 0 to use count. |
[in] | count | The total count of events with this id, used if delta is 0. |
[in] | fullText | The full text of this notification. If null, the text parameter is used. |
[in] | extendedText | The extended text of this notification. If null, the text parameter is used. |
Definition at line 42 of file util.cpp.
References LeechCraft::AN::EF::Count, LeechCraft::AN::EF::DeltaCount, LeechCraft::AN::EF::EventCategory, LeechCraft::AN::EF::EventID, LeechCraft::AN::EF::EventType, LeechCraft::AN::EF::ExtendedText, LeechCraft::AN::EF::FullText, MakeNotification(), LeechCraft::AN::EF::SenderID, and LeechCraft::AN::EF::VisualPath.
UTIL_XPC_API Entity LeechCraft::Util::MakeANCancel | ( | const Entity & | event | ) |
Makes an event for canceling another Advanced Notifications event.
Creates an Entity that cancels a previously generated Advanced Notifications event. The returned entity can be then emitted to notify plugins that the given event has been canceled.
[in] | event | The event to cancel. |
Definition at line 126 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::AN::CatEventCancel, LeechCraft::Entity::Entity_, LeechCraft::AN::EF::EventCategory, LeechCraft::AN::EF::EventID, MakeNotification(), LeechCraft::PInfo_, and LeechCraft::AN::EF::SenderID.
UTIL_XPC_API Entity LeechCraft::Util::MakeANCancel | ( | const QString & | senderId, |
const QString & | eventId | ||
) |
Makes an event for canceling another Advanced Notifications event.
Creates an Entity that cancels a previously generated Advanced Notifications event. The returned entity can be then emitted to notify plugins that the given event has been canceled.
This function doesn't take a previously created entity as the other overload does. Instead, it plainly creates the required entity from the given senderId and eventId. They should match those of the event in question.
[in] | senderId | The ID of the sender of the event that is to be canceled. |
[in] | eventId | The ID of the event that is to be canceled. |
Definition at line 135 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::AN::CatEventCancel, LeechCraft::AN::EF::EventCategory, LeechCraft::AN::EF::EventID, MakeNotification(), LeechCraft::PInfo_, and LeechCraft::AN::EF::SenderID.
UTIL_XPC_API Entity LeechCraft::Util::MakeANRule | ( | const QString & | title, |
const QString & | senderID, | ||
const QString & | cat, | ||
const QStringList & | types, | ||
AN::NotifyFlags | flags, | ||
bool | openConfiguration, | ||
const QList< QPair< QString, ANFieldValue >> & | fields | ||
) |
Definition at line 63 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::AN::EF::EventCategory, LeechCraft::AN::EF::EventID, LeechCraft::AN::EF::EventType, LeechCraft::AN::EF::IsSingleShot, MakeNotification(), LeechCraft::AN::EF::NotifyAudio, LeechCraft::AN::NotifyAudio, LeechCraft::AN::EF::NotifyPersistent, LeechCraft::AN::NotifyPersistent, LeechCraft::AN::NotifySingleShot, LeechCraft::AN::EF::NotifyTransient, LeechCraft::AN::NotifyTransient, LeechCraft::AN::EF::OpenConfiguration, LeechCraft::PLog_, and LeechCraft::AN::EF::SenderID.
Entity LeechCraft::Util::MakeEntity | ( | const QVariant & | entity, |
const QString & | location, | ||
TaskParameters | tp, | ||
const QString & | mime | ||
) |
Definition at line 101 of file util.cpp.
References LeechCraft::Entity::Entity_, LeechCraft::Entity::Location_, LeechCraft::Entity::Mime_, and LeechCraft::Entity::Parameters_.
Referenced by LeechCraft::Util::XDG::Item::Execute(), GetDataFilters(), GetPersistentData(), MakeNotification(), LeechCraft::Util::ShortcutManager::RegisterGlobalShortcut(), SavePassword(), and LeechCraft::Util::StdDataFilterMenuCreator::StdDataFilterMenuCreator().
UTIL_XPC_API Entity LeechCraft::Util::MakeEntity | ( | const QVariant & | entity, |
const QString & | location, | ||
LeechCraft::TaskParameters | tp, | ||
const QString & | mime = QString() |
||
) |
An utility function to make a Entity.
Creates a Entity that wraps the given entity from given location with parameterrs identified by tp and given mime type (which is null by default).
This function is provided for convenience and is equivalent to manually filling the Entity.
[in] | entity | The Entity_ field of the Entity. |
[in] | location | The Location_ field of the Entity. |
[in] | tp | The Params_ field of the Entity. |
[in] | mime | The Mime_ field of the Entity. |
QMap<K, V> LeechCraft::Util::MakeMap | ( | std::initializer_list< QPair< K, V >> | l | ) |
UTIL_XPC_API Entity LeechCraft::Util::MakeNotification | ( | const QString & | header, |
const QString & | text, | ||
Priority | priority | ||
) |
An utility function to make a Entity with notification.
Creates a Entity that holds information about user-visible notification. These notifications have "x-leechcraft/notification" MIME.
You can further customize the returned Entity to suit your exact needs. See the documentation for Entity about such entities.
[in] | header | The header of the notification. |
[in] | text | The text of the notification. |
[in] | priority | The priority level of the notification. |
Definition at line 114 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::AutoAccept, MakeEntity(), and LeechCraft::OnlyHandle.
Referenced by MakeAN(), MakeANCancel(), and MakeANRule().
QString LeechCraft::Util::MakePrettySize | ( | qint64 | sourceSize | ) |
Makes a formatted size from number.
Converts, for example, 1048576 to 1.0 MB.
[in] | sourceSize | Size in bytes. |
QString LeechCraft::Util::MakeTimeFromLong | ( | ulong | time | ) |
Makes a formatted time from number.
Converts, for example 256 to 00:04:16.
[in] | time | Time interval in seconds. |
auto LeechCraft::Util::Map | ( | const Container< T > & | c, |
F | f | ||
) | -> Container<decltype (f (T ()))> |
UTIL_XSD_API XmlSettingsDialog * LeechCraft::Util::OpenXSD | ( | const QString & | title, |
const QString & | filename, | ||
Util::BaseSettingsManager * | bsm | ||
) |
LeechCraft::Util::Q_DECLARE_FLAGS | ( | FitFlags | , |
FitFlag | |||
) |
UTIL_XPC_API void LeechCraft::Util::SavePassword | ( | const QString & | password, |
const QString & | keyName, | ||
QObject * | emitter | ||
) |
Saves the password to be retrieved later via GetPassword().
This function stores the password under the given keyName and using the given emitter object. The password is typically stored in a storage plugin like SecMan.
If there are no storage plugins, this function does nothing.
The emitter object is used to send the corresponding internal Entity objects around, so it should have its gotEntity() and delegateEntity() signals both relayed to the corresponding plugin instance object.
[in] | password | The password string to save. |
[in] | keyName | The name of the key uniquely identifying the password. |
[in] | emitter | The object used to emit the gotEntity() and delegateEntity() signals. |
Definition at line 93 of file passutils.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::Internal, and MakeEntity().
Referenced by GetPassword().
StlAssocRange<typename Assoc::const_iterator, Assoc, PairType> LeechCraft::Util::Stlize | ( | const Assoc & | assoc | ) |
auto LeechCraft::Util::Zip | ( | const Container< T1 > & | c1, |
const Container< T2 > & | c2 | ||
) | -> Container<Pair<T1, T2>> |
auto LeechCraft::Util::ZipWith | ( | const Container< T1 > & | c1, |
const Container< T2 > & | c2, | ||
F | f | ||
) | -> Container<typename std::result_of<F (T1, T2)>::type> |
const int LeechCraft::Util::SourcePager = 2 |
Definition at line 50 of file xwrapper.cpp.
const int LeechCraft::Util::StateAdd = 1 |
Definition at line 53 of file xwrapper.cpp.
const int LeechCraft::Util::StateRemove = 0 |
Definition at line 52 of file xwrapper.cpp.
Referenced by LeechCraft::Util::XWrapper::MoveWindowTo().