Albert
|
Classes | |
class | BackgroundExecutor |
Provides a lean interface for recurring indexing tasks. More... | |
class | FileDownloader |
class | IndexItem |
An item utlized by ItemIndex. More... | |
class | IndexQueryHandler |
Index query handler class. More... | |
class | InputHistory |
Input history class. More... | |
class | Match |
Augmented match score. More... | |
class | MatchConfig |
Configuration for string matching. More... | |
class | Matcher |
Configurable string matcher. More... | |
class | Notification |
The notification class. More... | |
class | OAuth2 |
Provides OAuth2 authentication with support for the Authorization Code Flow with PKCE and refresh tokens. More... | |
class | OAuthConfigWidget |
class | StandardItem |
General purpose value type Item implememtation. More... | |
Functions | |
QPixmap | pixmapFromUrl (const QString &url, const QSize &requestedSize) |
URL based icon factory. | |
QPixmap | pixmapFromUrls (const QStringList &urls, const QSize &requestedSize) |
URL list based icon factory. | |
QIcon | iconFromUrl (const QString &url) |
URL based icon factory. | |
QIcon | iconFromUrls (const QStringList &urls) |
URL list based icon factory. | |
QPixmap | genericPixmap (int size, const QColor &bgcolor={}, const QColor &fgcolor=Qt::black, const QString &text={}, float scalar=1.) |
Generic pixmap factory. | |
QIcon | genericIcon (const QColor &bgcolor={}, const QColor &fgcolor=Qt::black, const QString &text={}, float scalar=1.) |
Generic icon factory. | |
QIcon | fileIcon (const QString &path) |
Create an icon for a file using QFileIconProvider. | |
const QRegularExpression | default_separator_regex (QStringLiteral("([\\s\\\\/\\-\\[\\](){}#!?<>\"'=+*.:,;_]+)")) |
QMessageBox::StandardButton | question (const QString &text, QMessageBox::StandardButtons buttons=QMessageBox::StandardButtons(QMessageBox::Yes|QMessageBox::No), QMessageBox::StandardButton default_button=QMessageBox::NoButton) |
Shows a question message box containing text with the given buttons and default_button. | |
QMessageBox::StandardButton | information (const QString &text, QMessageBox::StandardButtons buttons=QMessageBox::Ok, QMessageBox::StandardButton default_button=QMessageBox::NoButton) |
Shows an information message box containing text with the given buttons and default_button. | |
QMessageBox::StandardButton | warning (const QString &text, QMessageBox::StandardButtons buttons=QMessageBox::Ok, QMessageBox::StandardButton default_button=QMessageBox::NoButton) |
Shows a warning message box containing text with the given buttons and default_button. | |
QMessageBox::StandardButton | critical (const QString &text, QMessageBox::StandardButtons buttons=QMessageBox::Ok, QMessageBox::StandardButton default_button=QMessageBox::NoButton) |
Shows a critical message box containing text with the given buttons and default_button. | |
QNetworkAccessManager & | network () |
Returns a global, threadlocal QNetworkAccessManager. | |
QNetworkReply * | await (QNetworkReply *reply) |
Blocks until reply is finished. | |
QNetworkRequest | makeRestRequest (const QString &base_url, const QString &path, const QUrlQuery &query, const QByteArray &authorization_header) |
void | openUrl (const QString &url) |
Opens url with the default handler for the scheme. | |
void | open (const QUrl &url) |
Opens url with the default handler for the scheme. | |
void | open (const QString &path) |
Opens a file at path with the associated default application. | |
void | open (const std::filesystem::path &path) |
Opens a file at path with the associated default application. | |
void | setClipboardText (const QString &text) |
Sets the system clipboard to text . | |
bool | havePasteSupport () |
Returns the true if the platform supports pasting, else false . | |
void | setClipboardTextAndPaste (const QString &text) |
Sets the system clipboard to text and pastes text to the front-most window. | |
long long | runDetachedProcess (const QStringList &commandline) |
Run the commandline as detached process. Returns the process id. | |
long long | runDetachedProcess (const QStringList &commandline, const QString &working_dir) |
Run the commandline with working_dir as detached process. Returns the process id. | |
void | tryCreateDirectory (const std::filesystem::path &path) |
Tries to create a directory at path . | |
QNetworkReply * albert::util::await | ( | QNetworkReply * | reply | ) |
Blocks until reply
is finished.
QMessageBox::StandardButton albert::util::critical | ( | const QString & | text, |
QMessageBox::StandardButtons | buttons = QMessageBox::Ok , |
||
QMessageBox::StandardButton | default_button = QMessageBox::NoButton |
||
) |
Shows a critical message box containing text with the given buttons and default_button.
The message box modal will appear modal to the main window and have the app name as title.
Returns the button pressed by the user.
const QRegularExpression albert::util::default_separator_regex | ( | QStringLiteral("([\\s\\\\/\\-\\[\\](){}#!?<>\"'=+*.:,;_]+)") | ) |
QIcon albert::util::fileIcon | ( | const QString & | path | ) |
Create an icon for a file using QFileIconProvider.
path | The path to the file. |
QIcon albert::util::genericIcon | ( | const QColor & | bgcolor = {} , |
const QColor & | fgcolor = Qt::black , |
||
const QString & | text = {} , |
||
float | scalar = 1. |
||
) |
Generic icon factory.
Supports drawing a background circle with some text on it.
bgcolor | The background color. Default: none. |
fgcolor | The text color. Default: black. |
text | The text to display. Default: empty. |
scalar | Scalar for the default font size which is the pixmap height. Default: 1. |
QPixmap albert::util::genericPixmap | ( | int | size, |
const QColor & | bgcolor = {} , |
||
const QColor & | fgcolor = Qt::black , |
||
const QString & | text = {} , |
||
float | scalar = 1. |
||
) |
Generic pixmap factory.
Supports drawing a background circle with some text on it.
bgcolor | The background color. Default: none. |
fgcolor | The text color. Default: black. |
text | The text to display. Default: empty. |
scalar | Scalar for the default font size which is the pixmap height. Default: 1. |
bool albert::util::havePasteSupport | ( | ) |
Returns the true
if the platform supports pasting, else false
.
QIcon albert::util::iconFromUrl | ( | const QString & | url | ) |
URL based icon factory.
url | The icon URL. |
QIcon albert::util::iconFromUrls | ( | const QStringList & | urls | ) |
URL list based icon factory.
See iconFromUrl(const QString &url).
urls | The icon URLs. |
QMessageBox::StandardButton albert::util::information | ( | const QString & | text, |
QMessageBox::StandardButtons | buttons = QMessageBox::Ok , |
||
QMessageBox::StandardButton | default_button = QMessageBox::NoButton |
||
) |
Shows an information message box containing text with the given buttons and default_button.
The message box modal will appear modal to the main window and have the app name as title.
Returns the button pressed by the user.
QNetworkRequest albert::util::makeRestRequest | ( | const QString & | base_url, |
const QString & | path, | ||
const QUrlQuery & | query, | ||
const QByteArray & | authorization_header | ||
) |
QNetworkAccessManager & albert::util::network | ( | ) |
Returns a global, threadlocal QNetworkAccessManager.
void albert::util::open | ( | const QString & | path | ) |
Opens a file at path
with the associated default application.
void albert::util::open | ( | const QUrl & | url | ) |
Opens url
with the default handler for the scheme.
void albert::util::open | ( | const std::filesystem::path & | path | ) |
Opens a file at path
with the associated default application.
void albert::util::openUrl | ( | const QString & | url | ) |
Opens url
with the default handler for the scheme.
Does nothing if url
is not a valid URL.
QPixmap albert::util::pixmapFromUrl | ( | const QString & | url, |
const QSize & | requestedSize | ||
) |
URL based icon factory.
Supported URL schemes:
<path>
orfile:<path>
Use the file at path as icon.:<path>
orqrc:<path>
Use the file at path in the resource collection as icon.qfip:<path>
Uses fileIcon(const QString &path)qsp:<pixmap enumerator>
Get an icon from QStyle::StandardPixmap enum.xdg:<icon name>
Uses xdgIconLookup(const QString &name);gen:<>
Uses genericPixmapFactory. See also QColor::fromString.mask:?src=&radius=
Masks a given icon url.comp:?src1=<>&src2=<>
Composes two given icons.Examples
/absolute/path/to/a/local/image/file.png file:/absolute/path/to/a/local/image/file.png :path-to-a-qresource-file qrc:path-to-a-qresource-file qfip:/path/to/any/file/for/example/a.pdf qsp:SP_TrashIcon xdg:some-themed-icon-name gen:?background=blue&foreground=red&text=Hi&fontscalar=0.5
url | The icon URL. |
requestedSize | The size the pixmap should have if possible. |
QPixmap albert::util::pixmapFromUrls | ( | const QStringList & | urls, |
const QSize & | requestedSize | ||
) |
URL list based icon factory.
See pixmapFromUrl(const QString &url, QSize *size, const QSize &requestedSize).
urls | The icon URLs. |
requestedSize | The size the pixmap should have if possible. |
QMessageBox::StandardButton albert::util::question | ( | const QString & | text, |
QMessageBox::StandardButtons | buttons = QMessageBox::StandardButtons(QMessageBox::Yes|QMessageBox::No) , |
||
QMessageBox::StandardButton | default_button = QMessageBox::NoButton |
||
) |
Shows a question message box containing text with the given buttons and default_button.
The message box modal will appear modal to the main window and have the app name as title.
Returns the button pressed by the user.
long long albert::util::runDetachedProcess | ( | const QStringList & | commandline | ) |
Run the commandline
as detached process. Returns the process id.
long long albert::util::runDetachedProcess | ( | const QStringList & | commandline, |
const QString & | working_dir | ||
) |
Run the commandline
with working_dir
as detached process. Returns the process id.
void albert::util::setClipboardText | ( | const QString & | text | ) |
Sets the system clipboard to text
.
void albert::util::setClipboardTextAndPaste | ( | const QString & | text | ) |
Sets the system clipboard to text
and pastes text
to the front-most window.
Check albert::havePasteSupport before using this function.
void albert::util::tryCreateDirectory | ( | const std::filesystem::path & | path | ) |
Tries to create a directory at path
.
Throws std::runtime_error if the directory could not be created. This is a utility function for use with the *Location functions.
QMessageBox::StandardButton albert::util::warning | ( | const QString & | text, |
QMessageBox::StandardButtons | buttons = QMessageBox::Ok , |
||
QMessageBox::StandardButton | default_button = QMessageBox::NoButton |
||
) |
Shows a warning message box containing text with the given buttons and default_button.
The message box modal will appear modal to the main window and have the app name as title.
Returns the button pressed by the user.