GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
UserInterfaceUtils.h
1
29#ifndef GPGFRONTEND_USER_INTERFACE_UTILS_H
30#define GPGFRONTEND_USER_INTERFACE_UTILS_H
31
32#include "core/GpgModel.h"
33#include "core/function/result_analyse/GpgVerifyResultAnalyse.h"
34#include "ui/GpgFrontendUI.h"
35
36namespace GpgFrontend {
37class GpgResultAnalyse;
38}
39
40namespace GpgFrontend::UI {
41
42class InfoBoardWidget;
43class TextEdit;
44
53void show_verify_details(QWidget* parent, InfoBoardWidget* info_board,
54 GpgError error, const GpgVerifyResult& verify_result);
55
62void import_unknown_key_from_keyserver(QWidget* parent,
63 const GpgVerifyResultAnalyse& verify_res);
64
72void refresh_info_board(InfoBoardWidget* info_board, int status,
73 const std::string& report_text);
74
82void process_result_analyse(TextEdit* edit, InfoBoardWidget* info_board,
83 const GpgResultAnalyse& result_analyse);
84
93void process_result_analyse(TextEdit* edit, InfoBoardWidget* info_board,
94 const GpgResultAnalyse& result_analyse_a,
95 const GpgResultAnalyse& result_analyse_b);
96
104void process_operation(QWidget* parent, const std::string& waiting_title,
105 const std::function<void()>& func);
106
111class CommonUtils : public QWidget {
112 Q_OBJECT
113 public:
118 using ImportCallbackFunctiopn = std::function<void(
119 const std::string&, const std::string&, size_t, size_t)>;
120
125 CommonUtils();
126
132 static CommonUtils* GetInstance();
133
134 signals:
139 void SignalKeyStatusUpdated();
140
145 void SignalGnupgNotInstall();
146
147 public slots:
154 void SlotImportKeys(QWidget* parent, const std::string& in_buffer);
155
161 void SlotImportKeyFromFile(QWidget* parent);
162
168 void SlotImportKeyFromKeyServer(QWidget* parent);
169
175 void SlotImportKeyFromClipboard(QWidget* parent);
176
184 static void SlotImportKeyFromKeyServer(
185 const GpgFrontend::KeyIdArgsList& key_ids,
186 const GpgFrontend::UI::CommonUtils::ImportCallbackFunctiopn& callback);
187
195 const QStringList& arguments,
196 const std::function<void(QProcess*)>& interact_func);
197
198 private:
199 static std::unique_ptr<CommonUtils> instance_;
200};
201
202} // namespace GpgFrontend::UI
203
204#endif // GPGFRONTEND_USER_INTERFACE_UTILS_H
Definition: UserInterfaceUtils.h:111
void SlotImportKeyFromFile(QWidget *parent)
Definition: UserInterfaceUtils.cpp:156
void SlotImportKeyFromClipboard(QWidget *parent)
Definition: UserInterfaceUtils.cpp:177
void SlotImportKeys(QWidget *parent, const std::string &in_buffer)
Definition: UserInterfaceUtils.cpp:148
CommonUtils()
Construct a new Common Utils object.
Definition: UserInterfaceUtils.cpp:131
static CommonUtils * GetInstance()
Get the Instance object.
Definition: UserInterfaceUtils.cpp:124
void SlotImportKeyFromKeyServer(QWidget *parent)
Definition: UserInterfaceUtils.cpp:172
void SlotExecuteGpgCommand(const QStringList &arguments, const std::function< void(QProcess *)> &interact_func)
Definition: UserInterfaceUtils.cpp:183
Definition: VerifyDetailsDialog.cpp:33
void refresh_info_board(InfoBoardWidget *info_board, int status, const std::string &report_text)
Definition: UserInterfaceUtils.cpp:77
void show_verify_details(QWidget *parent, InfoBoardWidget *info_board, GpgError error, const GpgVerifyResult &verify_result)
Definition: UserInterfaceUtils.cpp:45
void process_operation(QWidget *parent, const std::string &waiting_title, const std::function< void()> &func)
Definition: UserInterfaceUtils.cpp:109
void import_unknown_key_from_keyserver(QWidget *parent, const GpgVerifyResultAnalyse &verify_res)
Definition: UserInterfaceUtils.cpp:54
void process_result_analyse(TextEdit *edit, InfoBoardWidget *info_board, const GpgResultAnalyse &result_analyse)
Definition: UserInterfaceUtils.cpp:89
Definition: CoreCommonUtil.cpp:29