![]() |
LeechCraft
%{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
|
Namespaces | |
SysInfo | |
Classes | |
class | BackendSelector |
A common dialog to select storage backend. More... | |
class | BaseHookInterconnector |
Base class for signal-slot relays in plugin APIs. 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 | FileRemoveGuard |
QFile removing itself from file system on destruction. More... | |
class | AutoResizeMixin |
class | ClearLineEditAddon |
Provides a "clear text" action for line edits. More... | |
class | FindNotification |
A horizontal bar with typical widgets for text search. More... | |
class | FlowLayout |
A simple flow layout implementation. More... | |
class | PageNotification |
class | SelectableBrowser |
A "browser" that shows HTML either via QTextBrowser or a browser plugin. More... | |
class | UnhoverDeleteMixin |
Allows to hide a widget or popup after mouse leave. More... | |
class | IDPool |
A simple pool of identificators of the given type. More... | |
class | FlattenFilterModel |
class | FlatToFoldersProxyModel |
class | ListModelItem |
class | ListModel |
class | MergeModel |
class | TreeItem |
class | NotificationActionHandler |
Aids in adding actions to notifications. More... | |
class | ColorThemeProxy |
Proxy for QML files to use colors from current color theme. More... | |
class | ThemeImageProvider |
Provides icons from the current theme by their FDO name. More... | |
class | UnhideListModel |
class | UnhideListViewBase |
class | WidthIconProvider |
Provides scalable icons to QML. More... | |
class | QueueManager |
A simple scheduling manager for a queue of functors. More... | |
class | ResourceLoader |
Utility class for loading a file from a set of locations. More... | |
class | ShortcutManager |
Aids in providing configurable shortcuts. More... | |
class | SyncDeltaManager |
class | VersionActionMapper |
class | CategorySelector |
The CategorySelector widget provides a way to select amongst a group of items. More... | |
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... | |
struct | ValueFinder |
class | StdDataFilterMenuCreator |
Typedefs | |
typedef std::shared_ptr < XmlSettingsDialog > | XmlSettingsDialog_ptr |
typedef std::shared_ptr < DefaultHookProxy > | DefaultHookProxy_ptr |
typedef std::shared_ptr < QIODevice > | QIODevice_ptr |
Enumerations | |
enum | FitFlag { NoFlags, NoOverlap = 0x01 } |
enum | SysPath { SysPath::QML, SysPath::Share } |
Describes various root paths recognized by GetSysPath(). More... | |
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) | |
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... | |
QString | GetSocketErrorString (QAbstractSocket::SocketError error) |
Returns an error string for the given socket error. More... | |
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... | |
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) |
Makes a formatted size from number. More... | |
UTIL_API QString | MakeTimeFromLong (ulong) |
Makes a formatted time from number. More... | |
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 QDir | CreateIfNotExists (const QString &path) |
Creates a path if it doesn't exist. More... | |
UTIL_API QDir | GetUserDir (const QString &path) |
Returns the path relative to user directory. More... | |
UTIL_API QString | GetTemporaryName (const QString &pattern=QString("lc_temp.XXXXXX")) |
Returns a temporary filename. More... | |
UTIL_API Entity | MakeEntity (const QVariant &entity, const QString &location, LeechCraft::TaskParameters tp, const QString &mime=QString()) |
An utility function to make a Entity. More... | |
UTIL_API Entity | MakeNotification (const QString &header, const QString &text, Priority priority) |
An utility function to make a Entity with notification. More... | |
UTIL_API Entity | MakeANCancel (const Entity &event) |
Makes an event for canceling another Advanced Notifications event. More... | |
UTIL_API Entity | MakeANCancel (const QString &senderId, const QString &eventId) |
Makes an event for canceling another Advanced Notifications event. 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 QVariantList | GetPersistentData (const QList< QVariant > &keys, QObject *object) |
UTIL_API QPixmap | DrawOverlayText (QPixmap px, const QString &text, QFont font, const QPen &pen, const QBrush &brush) |
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) |
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... | |
typedef std::shared_ptr<DefaultHookProxy> LeechCraft::Util::DefaultHookProxy_ptr |
Definition at line 117 of file defaulthookproxy.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.
Additional fitting options used by FitRect() and FitRectScreen().
|
strong |
Describes various root paths recognized by GetSysPath().
QDir LeechCraft::Util::CreateIfNotExists | ( | const 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_API QPoint LeechCraft::Util::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.
This function tries to move the rectangle with top left point at pos and with given size so that it fits completely into the rectangle given by the geometry parameter. It leaves the size intact, instead returning the new top left position.
If the rectangle is actually moved by this function, the shiftAdd parameter is used to customize how it is moved: the shiftAdd.x()
component is added to the result iff pos.x()
is changed, and shiftAdd.y()
is added to the result iff pos.y()
is changed.
[in] | pos | The original top left position of the rect to fit. |
[in] | size | The size of the rectangle to fit. |
[in] | geometry | The rectangle into which the source rectangle should be fitted. |
[in] | flags | Additional fitting parameters. |
[in] | shiftAdd | Additional components to be added if the rectangle is actually moved in the corresponding directions. |
Definition at line 49 of file util.cpp.
References NoOverlap.
Referenced by FitRectScreen().
UTIL_API QPoint LeechCraft::Util::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.
This function tries to move the rectangle with top left point at pos and with given size so that it fits completely into the available geometry of the screen that contains the point pos. It leaves the rectangle size intact, instead returning the new top left position.
Calling this function is equivalent to calling FitRect() with the geometry parameter set to QDesktopWidget::availableGeometry(pos)
. See the documentation for FitRect() for more details.
[in] | pos | The original top left position of the rect to fit. |
[in] | size | The size of the rectangle to fit. |
[in] | flags | Additional fitting parameters. |
[in] | shiftAdd | Additional components to be added if the rectangle is actually moved in the corresponding directions. |
Definition at line 44 of file util.cpp.
References FitRect().
|
inline |
QString LeechCraft::Util::GetAsBase64Src | ( | const QImage & | image | ) |
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 228 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 189 of file util.cpp.
Referenced by GetLanguage(), and InstallTranslator().
UTIL_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_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 41 of file paths.cpp.
Referenced by GetSysPath(), and LeechCraft::Util::UnhideListViewBase::UnhideListViewBase().
QVariantList LeechCraft::Util::GetPersistentData | ( | const QList< QVariant > & | keys, |
QObject * | object | ||
) |
Definition at line 347 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::Internal, and MakeEntity().
UTIL_API QString LeechCraft::Util::GetSocketErrorString | ( | QAbstractSocket::SocketError | error | ) |
Returns an error string for the given socket error.
This function returns a human-readable localized string describing the given socket error.
[in] | error | The socket error to describe. |
Definition at line 37 of file socketerrorstrings.cpp.
QModelIndexList LeechCraft::Util::GetSummarySelectedRows | ( | QObject * | sender | ) |
UTIL_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 77 of file paths.cpp.
References GetPathCandidates().
Referenced by LeechCraft::Util::UnhideListViewBase::UnhideListViewBase().
QString LeechCraft::Util::GetTemporaryName | ( | const QString & | pattern = QString ("lc_temp.XXXXXX") | ) |
QDir LeechCraft::Util::GetUserDir | ( | const QString & | path | ) |
Returns the path relative to user directory.
Returns a QDir object that represents the ~/.leechcraft/path or throws an exceptions if this path doesn't exist.
[in] | path | The path to return relative to ~/.leechcraft |
std::runtime_error | Throws if the path doesn't exist. |
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 63 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::Entity::Entity_, and LeechCraft::Entity::Mime_.
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 145 of file util.cpp.
References GetLocaleName().
UTIL_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 37 of file util.cpp.
References MakeNotification().
LeechCraft::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 304 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::Entity::Entity_, MakeNotification(), and LeechCraft::PInfo_.
LeechCraft::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 313 of file util.cpp.
References LeechCraft::Entity::Additional_, MakeNotification(), and LeechCraft::PInfo_.
LeechCraft::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. |
Definition at line 279 of file util.cpp.
References LeechCraft::Entity::Entity_, LeechCraft::Entity::Location_, LeechCraft::Entity::Mime_, and LeechCraft::Entity::Parameters_.
Referenced by GetPersistentData(), MakeNotification(), SavePassword(), and LeechCraft::Util::StdDataFilterMenuCreator::StdDataFilterMenuCreator().
QMap<K, V> LeechCraft::Util::MakeMap | ( | std::initializer_list< QPair< K, V >> | l | ) |
LeechCraft::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 292 of file util.cpp.
References LeechCraft::Entity::Additional_, LeechCraft::AutoAccept, MakeEntity(), and LeechCraft::OnlyHandle.
Referenced by MakeAN(), and MakeANCancel().
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. |
LeechCraft::Util::Q_DECLARE_FLAGS | ( | FitFlags | , |
FitFlag | |||
) |
UTIL_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().
UTIL_API QLabel * LeechCraft::Util::ShowPixmapLabel | ( | const QPixmap & | pixmap, |
const QPoint & | pos = QPoint() |
||
) |
Shows a pixmap at the given pos.
This function shows a dialog with the given pixmap at the given position. If the pixmap is too big, it is scaled down. A QLabel created with window decorations is used as the dialog. The created label is returned from the function, so one could also set the window title and further customize the label.
This function is useful to display full version of album art in a media player or a user avatar in an IM application.
[in] | pixmap | The pixmap to show. |
[in] | pos | The position where the dialog should be shown. |