aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/UserInterfaceUtils.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-01-27 23:07:49 +0000
committersaturneric <[email protected]>2025-01-27 23:14:21 +0000
commit0a8a116d2dabedae09995906bef7a4a25af2fd61 (patch)
tree8c9334041a08fb244aa5686f1413915dd9a24365 /src/ui/UserInterfaceUtils.cpp
parentfix: tiny fixes (diff)
downloadGpgFrontend-0a8a116d2dabedae09995906bef7a4a25af2fd61.tar.gz
GpgFrontend-0a8a116d2dabedae09995906bef7a4a25af2fd61.zip
refactor: code clean up
Diffstat (limited to 'src/ui/UserInterfaceUtils.cpp')
-rw-r--r--src/ui/UserInterfaceUtils.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp
index 74e2c82a..379c2a2d 100644
--- a/src/ui/UserInterfaceUtils.cpp
+++ b/src/ui/UserInterfaceUtils.cpp
@@ -194,63 +194,6 @@ CommonUtils::CommonUtils() : QWidget(nullptr) {
});
}
-void CommonUtils::WaitForOpera(QWidget *parent,
- const QString &waiting_dialog_title,
- const OperaWaitingCb &opera) {
- QEventLoop looper;
- QPointer<WaitingDialog> const dialog =
- new WaitingDialog(waiting_dialog_title, parent);
- connect(dialog, &QDialog::finished, &looper, &QEventLoop::quit);
- connect(dialog, &QDialog::finished, dialog, &QDialog::deleteLater);
- dialog->show();
-
- QTimer::singleShot(64, parent, [=]() {
- opera([dialog]() {
- if (dialog != nullptr) {
- dialog->close();
- dialog->accept();
- }
- });
- });
-
- looper.exec();
-}
-
-void CommonUtils::WaitForMultipleOperas(
- QWidget *parent, const QString &waiting_dialog_title,
- const QContainer<OperaWaitingCb> &operas) {
- QEventLoop looper;
- QPointer<WaitingDialog> const dialog =
- new WaitingDialog(waiting_dialog_title, true, parent);
- connect(dialog, &QDialog::finished, &looper, &QEventLoop::quit);
- connect(dialog, &QDialog::finished, dialog, &QDialog::deleteLater);
- dialog->show();
-
- std::atomic<int> remaining_tasks(static_cast<int>(operas.size()));
- const auto tasks_count = operas.size();
-
- for (const auto &opera : operas) {
- QTimer::singleShot(64, parent, [=, &remaining_tasks]() {
- opera([dialog, &remaining_tasks, tasks_count]() {
- if (dialog == nullptr) return;
-
- const auto pg_value =
- static_cast<double>(tasks_count - remaining_tasks + 1) * 100.0 /
- static_cast<double>(tasks_count);
- emit dialog->SignalUpdateValue(static_cast<int>(pg_value));
- QCoreApplication::processEvents();
-
- if (--remaining_tasks == 0) {
- dialog->close();
- dialog->accept();
- }
- });
- });
- }
-
- looper.exec();
-}
-
void CommonUtils::RaiseMessageBox(QWidget *parent, GpgError err) {
GpgErrorDesc desc = DescribeGpgErrCode(err);
GpgErrorCode err_code = CheckGpgError2ErrCode(err);