forked from blue/squawk
trust summary gui delivery
This commit is contained in:
parent
fffef9876a
commit
4f295fee3c
13 changed files with 169 additions and 143 deletions
|
@ -226,61 +226,50 @@ Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path)
|
|||
}
|
||||
|
||||
|
||||
Shared::Global * Shared::Global::getInstance()
|
||||
{
|
||||
Shared::Global * Shared::Global::getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Message::State rl)
|
||||
{
|
||||
QString Shared::Global::getName(Message::State rl) {
|
||||
return instance->messageState[static_cast<int>(rl)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Shared::Affiliation af)
|
||||
{
|
||||
QString Shared::Global::getName(Shared::Affiliation af) {
|
||||
return instance->affiliation[static_cast<int>(af)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Shared::Availability av)
|
||||
{
|
||||
QString Shared::Global::getName(Shared::Availability av) {
|
||||
return instance->availability[static_cast<int>(av)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Shared::ConnectionState cs)
|
||||
{
|
||||
QString Shared::Global::getName(Shared::ConnectionState cs) {
|
||||
return instance->connectionState[static_cast<int>(cs)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Shared::Role rl)
|
||||
{
|
||||
QString Shared::Global::getName(Shared::Role rl) {
|
||||
return instance->role[static_cast<int>(rl)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Shared::SubscriptionState ss)
|
||||
{
|
||||
QString Shared::Global::getName(Shared::SubscriptionState ss) {
|
||||
return instance->subscriptionState[static_cast<int>(ss)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Shared::AccountPassword ap)
|
||||
{
|
||||
QString Shared::Global::getName(Shared::AccountPassword ap) {
|
||||
return instance->accountPassword[static_cast<int>(ap)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(Shared::TrustLevel tl)
|
||||
{
|
||||
QString Shared::Global::getName(Shared::TrustLevel tl) {
|
||||
return instance->trustLevel[static_cast<int>(tl)];
|
||||
}
|
||||
|
||||
void Shared::Global::setSupported(const QString& pluginName, bool support)
|
||||
{
|
||||
void Shared::Global::setSupported(const QString& pluginName, bool support) {
|
||||
std::map<QString, bool>::iterator itr = instance->pluginSupport.find(pluginName);
|
||||
if (itr != instance->pluginSupport.end()) {
|
||||
itr->second = support;
|
||||
}
|
||||
}
|
||||
|
||||
bool Shared::Global::supported(const QString& pluginName)
|
||||
{
|
||||
bool Shared::Global::supported(const QString& pluginName) {
|
||||
std::map<QString, bool>::iterator itr = instance->pluginSupport.find(pluginName);
|
||||
if (itr != instance->pluginSupport.end()) {
|
||||
return itr->second;
|
||||
|
@ -288,8 +277,7 @@ bool Shared::Global::supported(const QString& pluginName)
|
|||
return false;
|
||||
}
|
||||
|
||||
QString Shared::Global::getDescription(Shared::AccountPassword ap)
|
||||
{
|
||||
QString Shared::Global::getDescription(Shared::AccountPassword ap) {
|
||||
return instance->accountPasswordDescription[static_cast<int>(ap)];
|
||||
}
|
||||
|
||||
|
@ -355,8 +343,7 @@ void Shared::Global::highlightInFileManager(const QString& path)
|
|||
}
|
||||
}
|
||||
|
||||
QIcon Shared::Global::createThemePreview(const QString& path)
|
||||
{
|
||||
QIcon Shared::Global::createThemePreview(const QString& path) {
|
||||
if (supported("colorSchemeTools")) {
|
||||
QIcon* icon = createPreview(path);
|
||||
QIcon localIcon = *icon;
|
||||
|
@ -367,8 +354,7 @@ QIcon Shared::Global::createThemePreview(const QString& path)
|
|||
}
|
||||
}
|
||||
|
||||
QString Shared::Global::getColorSchemeName(const QString& path)
|
||||
{
|
||||
QString Shared::Global::getColorSchemeName(const QString& path) {
|
||||
if (supported("colorSchemeTools")) {
|
||||
QString res;
|
||||
colorSchemeName(path, res);
|
||||
|
@ -378,8 +364,7 @@ QString Shared::Global::getColorSchemeName(const QString& path)
|
|||
}
|
||||
}
|
||||
|
||||
void Shared::Global::setTheme(const QString& path)
|
||||
{
|
||||
void Shared::Global::setTheme(const QString& path) {
|
||||
if (supported("colorSchemeTools")) {
|
||||
if (path.toLower() == "system") {
|
||||
QApplication::setPalette(getInstance()->defaultSystemPalette);
|
||||
|
@ -391,8 +376,7 @@ void Shared::Global::setTheme(const QString& path)
|
|||
}
|
||||
}
|
||||
|
||||
void Shared::Global::setStyle(const QString& style)
|
||||
{
|
||||
void Shared::Global::setStyle(const QString& style) {
|
||||
if (style.toLower() == "system") {
|
||||
QApplication::setStyle(getInstance()->defaultSystemStyle);
|
||||
} else {
|
||||
|
@ -404,7 +388,7 @@ void Shared::Global::setStyle(const QString& style)
|
|||
template<> \
|
||||
Enum Shared::Global::fromInt(int src) \
|
||||
{ \
|
||||
if (src < static_cast<int>(Enum##Lowest) && src > static_cast<int>(Enum##Highest)) { \
|
||||
if (src < static_cast<int>(Enum##Lowest) || src > static_cast<int>(Enum##Highest)) { \
|
||||
throw EnumOutOfRange(#Enum); \
|
||||
} \
|
||||
return static_cast<Enum>(src); \
|
||||
|
|
|
@ -121,9 +121,7 @@ namespace Shared {
|
|||
template<typename T>
|
||||
static T fromInt(unsigned int src);
|
||||
|
||||
class EnumOutOfRange:
|
||||
public Utils::Exception
|
||||
{
|
||||
class EnumOutOfRange: public Utils::Exception {
|
||||
public:
|
||||
EnumOutOfRange(const std::string& p_name):Exception(), name(p_name) {}
|
||||
|
||||
|
|
|
@ -27,6 +27,17 @@ const std::set<Shared::TrustLevel> Shared::TrustSummary::untrustedLevels({
|
|||
Shared::TrustLevel::manuallyDistrusted
|
||||
});
|
||||
|
||||
const std::map<Shared::EncryptionProtocol, QString> Shared::TrustSummary::protocolKeys({
|
||||
{Shared::EncryptionProtocol::omemo, "eu.siacs.conversations.axolotl"},
|
||||
{Shared::EncryptionProtocol::omemo1, "urn:xmpp:omemo:1"},
|
||||
{Shared::EncryptionProtocol::omemo2, "urn:xmpp:omemo:2"}
|
||||
});
|
||||
const std::map<QString, Shared::EncryptionProtocol> Shared::TrustSummary::protocolValues({
|
||||
{"eu.siacs.conversations.axolotl", Shared::EncryptionProtocol::omemo},
|
||||
{"urn:xmpp:omemo:1", Shared::EncryptionProtocol::omemo1},
|
||||
{"urn:xmpp:omemo:2", Shared::EncryptionProtocol::omemo2}
|
||||
});
|
||||
|
||||
Shared::TrustSummary::TrustSummary():
|
||||
data()
|
||||
{}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#ifndef SHARED_TRUSTSUMMARY_H
|
||||
#define SHARED_TRUSTSUMMARY_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
|
@ -42,10 +44,18 @@ private:
|
|||
typedef std::map<EncryptionProtocol, Amounts> Data;
|
||||
|
||||
Data data;
|
||||
|
||||
public:
|
||||
static const std::map<EncryptionProtocol, QString> protocolKeys;
|
||||
static const std::map<QString, EncryptionProtocol> protocolValues;
|
||||
|
||||
private:
|
||||
static const std::set<TrustLevel> trustedLevels;
|
||||
static const std::set<TrustLevel> untrustedLevels;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(Shared::TrustSummary)
|
||||
|
||||
#endif // SHARED_TRUSTSUMMARY_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue