Albert
Loading...
Searching...
No Matches
albert.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Manuel Schneider
2// SPDX-License-Identifier: MIT
3
4#pragma once
5#include <QString>
6#include <albert/export.h>
7#include <filesystem>
8#ifdef QT_WIDGETS_LIB
9#include <QMessageBox>
10#endif
11class NotificationPrivate;
12class QNetworkAccessManager;
13class QSettings;
14class QUrl;
15
16namespace albert
17{
18class ExtensionRegistry;
19
23ALBERT_EXPORT void show(const QString &input_text = {});
24
28ALBERT_EXPORT void restart();
29
33ALBERT_EXPORT void quit();
34
40ALBERT_EXPORT QNetworkAccessManager &network();
41
44ALBERT_EXPORT void showSettings(QString plugin_id = {});
45
49ALBERT_EXPORT std::filesystem::path configLocation();
50
54ALBERT_EXPORT std::filesystem::path cacheLocation();
55
59ALBERT_EXPORT std::filesystem::path dataLocation();
60
63ALBERT_EXPORT std::unique_ptr<QSettings> settings();
64
67ALBERT_EXPORT std::unique_ptr<QSettings> state();
68
70ALBERT_EXPORT void openWebsite();
71
74ALBERT_EXPORT void openUrl(const QString &url);
75
81ALBERT_EXPORT void open(const QUrl &url);
82
88ALBERT_EXPORT void open(const QString &path);
89
97ALBERT_EXPORT void open(const std::string &path);
98
101ALBERT_EXPORT void setClipboardText(const QString &text);
102
106ALBERT_EXPORT bool havePasteSupport();
107
111ALBERT_EXPORT void setClipboardTextAndPaste(const QString &text);
112
117ALBERT_EXPORT long long runDetachedProcess(const QStringList &commandline, const QString &working_dir = {});
118
131
142ALBERT_EXPORT void tryCreateDirectory(const std::filesystem::path &path);
143
144#ifdef QT_WIDGETS_LIB
145
153ALBERT_EXPORT QMessageBox::StandardButton
154question(const QString &text,
155 QMessageBox::StandardButtons buttons
156 = QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No),
157 QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
158
166ALBERT_EXPORT QMessageBox::StandardButton
167information(const QString &text,
168 QMessageBox::StandardButtons buttons = QMessageBox::Ok,
169 QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
170
178ALBERT_EXPORT QMessageBox::StandardButton
179warning(const QString &text,
180 QMessageBox::StandardButtons buttons = QMessageBox::Ok,
181 QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
182
190ALBERT_EXPORT QMessageBox::StandardButton
191critical(const QString &text,
192 QMessageBox::StandardButtons buttons = QMessageBox::Ok,
193 QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
194
195#endif
196
197
198} // namespace albert
199
The common extension pool.
Definition extensionregistry.h:23
Definition action.h:10
std::unique_ptr< QSettings > settings()
Persistent app settings storage.
bool havePasteSupport()
Check paste support of the platform.
std::unique_ptr< QSettings > state()
The persistent app state storage.
void setClipboardText(const QString &text)
Set the system clipboard.
void show(const QString &input_text={})
Show the frontend.
void open(const QUrl &url)
Open URL with default handler.
QNetworkAccessManager & network()
The threadlocal, global QNetworkAccessManager.
void restart()
Restart the application.
std::filesystem::path dataLocation()
The app data location.
void setClipboardTextAndPaste(const QString &text)
Set the system clipboard and paste the content to the front-most window.
std::filesystem::path cacheLocation()
The app cache location.
std::filesystem::path configLocation()
The app config location.
void showSettings(QString plugin_id={})
Open/Show the settings window (of plugin).
void quit()
Quit the application.
long long runDetachedProcess(const QStringList &commandline, const QString &working_dir={})
Run a detached process.
void openUrl(const QString &url)
Open the specified url in default browser.
const ExtensionRegistry & extensionRegistry()
The extension registry.
void openWebsite()
Open the albert website in default browser.
void tryCreateDirectory(const std::filesystem::path &path)
Create a directory if it does not exist yet.