aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/struct
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/struct')
-rw-r--r--src/ui/struct/GpgOperaResultContext.cpp37
-rw-r--r--src/ui/struct/GpgOperaResultContext.h31
2 files changed, 29 insertions, 39 deletions
diff --git a/src/ui/struct/GpgOperaResultContext.cpp b/src/ui/struct/GpgOperaResultContext.cpp
index b1dfba63..5640a204 100644
--- a/src/ui/struct/GpgOperaResultContext.cpp
+++ b/src/ui/struct/GpgOperaResultContext.cpp
@@ -28,30 +28,24 @@
#include "GpgOperaResultContext.h"
+#include <utility>
+
namespace GpgFrontend::UI {
-GpgOperaContext::GpgOperaContext(QContainer<OperaWaitingCb>& operas,
- QContainer<GpgOperaResult>& opera_results,
- GpgKeyList& keys, GpgKeyList& singer_keys,
- QStringList& unknown_fprs, bool ascii)
- : operas(operas),
- opera_results(opera_results),
- keys(keys),
- singer_keys(singer_keys),
- unknown_fprs(unknown_fprs),
- ascii(ascii) {}
+GpgOperaContext::GpgOperaContext(QSharedPointer<GpgOperaContextBasement> base)
+ : base(std::move(base)) {}
-auto GpgOperaContexts::GetContextPath(int category) -> QStringList& {
+auto GpgOperaContextBasement::GetContextPath(int category) -> QStringList& {
if (!categories.contains(category)) categories[category] = {};
return categories[category].paths;
}
-auto GpgOperaContexts::GetContextOutPath(int category) -> QStringList& {
+auto GpgOperaContextBasement::GetContextOutPath(int category) -> QStringList& {
if (!categories.contains(category)) categories[category] = {};
return categories[category].o_paths;
}
-auto GpgOperaContexts::GetAllPath() -> QStringList {
+auto GpgOperaContextBasement::GetAllPath() -> QStringList {
QStringList res;
for (auto& category : categories) {
@@ -60,7 +54,7 @@ auto GpgOperaContexts::GetAllPath() -> QStringList {
return res;
}
-auto GpgOperaContexts::GetAllOutPath() -> QStringList {
+auto GpgOperaContextBasement::GetAllOutPath() -> QStringList {
QStringList res;
for (auto& category : categories) {
@@ -69,16 +63,15 @@ auto GpgOperaContexts::GetAllOutPath() -> QStringList {
return res;
}
-auto GpgOperaContexts::GetContext(int category)
- -> QSharedPointer<GpgOperaContext> {
- if (GetContextPath(category).empty()) return nullptr;
+auto GetGpgOperaContextFromBasement(
+ const QSharedPointer<GpgOperaContextBasement>& base,
+ int category) -> QSharedPointer<GpgOperaContext> {
+ if (base->GetContextPath(category).empty()) return nullptr;
- auto context = QSharedPointer<GpgOperaContext>::create(
- operas, opera_results, keys, singer_keys, unknown_fprs, ascii);
- context->ascii = ascii;
+ auto context = QSharedPointer<GpgOperaContext>::create(base);
- context->paths = GetContextPath(category);
- context->o_paths = GetContextOutPath(category);
+ context->paths = base->GetContextPath(category);
+ context->o_paths = base->GetContextOutPath(category);
return context;
}
} // namespace GpgFrontend::UI \ No newline at end of file
diff --git a/src/ui/struct/GpgOperaResultContext.h b/src/ui/struct/GpgOperaResultContext.h
index 25a6ff28..526c1ef7 100644
--- a/src/ui/struct/GpgOperaResultContext.h
+++ b/src/ui/struct/GpgOperaResultContext.h
@@ -38,23 +38,9 @@ struct GpgOperaCategory {
QStringList o_paths;
};
-struct GpgOperaContext {
- QContainer<OperaWaitingCb>& operas;
- QContainer<GpgOperaResult>& opera_results;
- GpgKeyList& keys;
- GpgKeyList& singer_keys;
- QStringList& unknown_fprs;
- bool ascii;
-
- QStringList paths;
- QStringList o_paths;
-
- GpgOperaContext(QContainer<OperaWaitingCb>& operas,
- QContainer<GpgOperaResult>& opera_results, GpgKeyList& keys,
- GpgKeyList& singer_keys, QStringList& unknown_fprs, bool ascii);
-};
+struct GpgOperaContext;
-struct GpgOperaContexts {
+struct GpgOperaContextBasement {
QContainer<OperaWaitingCb> operas;
QContainer<GpgOperaResult> opera_results;
GpgKeyList keys;
@@ -71,8 +57,19 @@ struct GpgOperaContexts {
auto GetAllPath() -> QStringList;
auto GetAllOutPath() -> QStringList;
+};
+
+struct GpgOperaContext {
+ QSharedPointer<GpgOperaContextBasement> base;
- auto GetContext(int category) -> QSharedPointer<GpgOperaContext>;
+ QStringList paths;
+ QStringList o_paths;
+
+ explicit GpgOperaContext(QSharedPointer<GpgOperaContextBasement> base);
};
+auto GetGpgOperaContextFromBasement(
+ const QSharedPointer<GpgOperaContextBasement>& base,
+ int category) -> QSharedPointer<GpgOperaContext>;
+
} // namespace GpgFrontend::UI \ No newline at end of file