Albert
|
Albert utility namespace. More...
Classes | |
class | BackgroundExecutor |
Provides a lean interface for recurring indexing tasks. More... | |
class | Dependency |
class | Download |
Downloads a file from the given URL to the given path. More... | |
class | ExtensionPlugin |
Convenience base class for extension plugins. More... | |
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 Item implementation. More... | |
class | StrongDependency |
Convenience holder class for plugin hard dependencies. More... | |
class | WeakDependency |
Convenience holder class for plugin soft dependencies. More... | |
Functions | |
const QRegularExpression | default_separator_regex (QStringLiteral("([\\s\\\\/\\-\\[\\](){}#!?<>\"'=+*.:,;_]+)")) |
bool | question (const QString &text, QWidget *parent=nullptr) |
Shows a question message box with Yes and No buttons. | |
void | information (const QString &text, QWidget *parent=nullptr) |
Shows an information message box with a single Ok button. | |
void | warning (const QString &text, QWidget *parent=nullptr) |
Shows a warning message box with a single Ok button. | |
void | critical (const QString &text, QWidget *parent=nullptr) |
Shows a critical message box with a single Ok button. | |
QNetworkAccessManager & | network () |
Returns a global, threadlocal QNetworkAccessManager. | |
QNetworkReply * | await (QNetworkReply *reply) |
Blocks until reply is finished. | |
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 . | |
QString | toQString (const std::filesystem::path &path) |
Returns a QString representation of path . | |
template<typename T , typename GET , typename SET > | |
void | bind (QCheckBox *checkbox, T *object, GET get, SET set) |
Binds a property of type bool of object to checkbox. | |
template<typename T , typename GET , typename SET , typename SIG > | |
void | bind (QCheckBox *checkbox, T *object, GET get, SET set, SIG sig) |
Binds a property of type bool of object to checkbox. | |
template<typename T , typename GET , typename SET > | |
void | bind (QLineEdit *lineedit, T *object, GET get, SET set) |
Binds a property of type QString of object to lineedit. | |
template<typename T , typename GET , typename SET , typename SIG > | |
void | bind (QLineEdit *lineedit, T *object, GET get, SET set, SIG sig) |
Binds a property of type QString of object to lineedit. | |
template<typename T , typename GET , typename SET > | |
void | bind (QSpinBox *spinbox, T *object, GET get, SET set) |
Binds a property of type int of object to spinbox. | |
template<typename T , typename GET , typename SET , typename SIG > | |
void | bind (QSpinBox *spinbox, T *object, GET get, SET set, SIG sig) |
Binds a property of type int of object to spinbox. | |
template<typename T , typename GET , typename SET > | |
void | bind (QDoubleSpinBox *spinbox, T *object, GET get, SET set) |
Binds a property of type double of object to spinbox. | |
template<typename T , typename GET , typename SET , typename SIG > | |
void | bind (QDoubleSpinBox *spinbox, T *object, GET get, SET set, SIG sig) |
Binds a property of type double of object to spinbox. | |
Albert utility namespace.
QNetworkReply * albert::util::await | ( | QNetworkReply * | reply | ) |
Blocks until reply
is finished.
void albert::util::bind | ( | QCheckBox * | checkbox, |
T * | object, | ||
GET | get, | ||
SET | set | ||
) |
Binds a property of type bool
of object to checkbox.
Initializes checkbox using get and connects the toggled
signal to set.
void albert::util::bind | ( | QCheckBox * | checkbox, |
T * | object, | ||
GET | get, | ||
SET | set, | ||
SIG | sig | ||
) |
Binds a property of type bool
of object to checkbox.
Initializes checkbox using get, connects the toggled
signal to set and connects the signal sig to setChecked
.
void albert::util::bind | ( | QDoubleSpinBox * | spinbox, |
T * | object, | ||
GET | get, | ||
SET | set | ||
) |
Binds a property of type double
of object to spinbox.
Initializes spinbox using get and connects the valueChanged
signal to set.
void albert::util::bind | ( | QDoubleSpinBox * | spinbox, |
T * | object, | ||
GET | get, | ||
SET | set, | ||
SIG | sig | ||
) |
Binds a property of type double
of object to spinbox.
Initializes spinbox using get, connects the valueChanged
signal to set and connects the signal sig to setValue
.
void albert::util::bind | ( | QLineEdit * | lineedit, |
T * | object, | ||
GET | get, | ||
SET | set | ||
) |
Binds a property of type QString
of object to lineedit.
Initializes lineedit using get and connects the editingFinished
signal to set.
void albert::util::bind | ( | QLineEdit * | lineedit, |
T * | object, | ||
GET | get, | ||
SET | set, | ||
SIG | sig | ||
) |
Binds a property of type QString
of object to lineedit.
Initializes lineedit using get, connects the editingFinished
signal to set and connects the signal sig to setText
.
void albert::util::bind | ( | QSpinBox * | spinbox, |
T * | object, | ||
GET | get, | ||
SET | set | ||
) |
Binds a property of type int
of object to spinbox.
Initializes spinbox using get and connects the valueChanged
signal to set.
void albert::util::bind | ( | QSpinBox * | spinbox, |
T * | object, | ||
GET | get, | ||
SET | set, | ||
SIG | sig | ||
) |
Binds a property of type int
of object to spinbox.
Initializes spinbox using get, connects the valueChanged
signal to set and connects the signal sig to setValue
.
void albert::util::critical | ( | const QString & | text, |
QWidget * | parent = nullptr |
||
) |
Shows a critical message box with a single Ok button.
The title of the message box is set to the application name and the message to text. The message box will appear modal to parent or the main window if undefined.
const QRegularExpression albert::util::default_separator_regex | ( | QStringLiteral("([\\s\\\\/\\-\\[\\](){}#!?<>\"'=+*.:,;_]+)") | ) |
bool albert::util::havePasteSupport | ( | ) |
Returns the true
if the platform supports pasting, else false
.
void albert::util::information | ( | const QString & | text, |
QWidget * | parent = nullptr |
||
) |
Shows an information message box with a single Ok button.
The title of the message box is set to the application name and the message to text. The message box will appear modal to parent or the main window if undefined.
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.
bool albert::util::question | ( | const QString & | text, |
QWidget * | parent = nullptr |
||
) |
Shows a question message box with Yes and No buttons.
The title of the message box is set to the application name and the message to text. The message box will appear modal to parent or the main window if undefined. Returns true
if the user pressed yes, false
otherwise.
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.
QString albert::util::toQString | ( | const std::filesystem::path & | path | ) |
Returns a QString representation of path
.
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.
void albert::util::warning | ( | const QString & | text, |
QWidget * | parent = nullptr |
||
) |
Shows a warning message box with a single Ok button.
The title of the message box is set to the application name and the message to text. The message box will appear modal to parent or the main window if undefined.