style(@desktop/cpp): apply clang-format on src-cpp/*

This commit is contained in:
Patryk Osmaczko 2022-02-21 19:03:38 +01:00 committed by osmaczko
parent f27fd6ea61
commit 00156cc9c0
111 changed files with 1679 additions and 1630 deletions

View File

@ -10,7 +10,7 @@
BasedOnStyle: WebKit
TabWidth: 4
IndentWidth: 4
UseTab: Always
UseTab: Never
ColumnLimit: 120
# Other languages JavaScript, Proto

View File

@ -1,8 +1,8 @@
#include "app_controller.h"
#include "accounts/service.h"
#include "app_service.h"
#include "modules/startup/module.h"
#include "modules/main/module.h"
#include "modules/startup/module.h"
#include <QDebug>
AppController::AppController()

View File

@ -3,12 +3,12 @@
#include <QObject>
#include "accounts/service.h"
#include "wallet_accounts/service.h"
#include "../modules/main/interfaces/module_access_interface.h"
#include "../modules/startup/module_access_interface.h"
#include "accounts/service.h"
#include "app_controller_delegate.h"
#include "app_service.h"
#include "wallet_accounts/service.h"
class AppController : public QObject, AppControllerDelegate
{
@ -37,6 +37,7 @@ public:
void start();
public slots:
void mainDidLoad();
private:
void connect();
void startupDidLoad() override;

View File

@ -21,4 +21,3 @@ public:
} // namespace Modules::Main
#endif // CONTROLLER_H

View File

@ -1,14 +1,15 @@
#include <QDebug>
#include <QQmlContext>
#include "module.h"
#include "singleton.h"
#include "modules/main/wallet/module.h"
#include "../shared/section_item.h"
#include "module.h"
#include "modules/main/wallet/module.h"
#include "singleton.h"
namespace Modules::Main
{
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject* parent): QObject(parent)
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject* parent)
: QObject(parent)
{
m_controllerPtr = new Controller(this);
m_viewPtr = new View(this);

View File

@ -1,7 +1,6 @@
#include "view.h"
#include "../global/app_sections_config.h"
namespace Modules::Main
{
View::View(QObject* parent)
@ -13,7 +12,15 @@ View::View(QObject* parent)
void View::load()
{
// Add Wallet Section to Sections model
auto walletSectionItem = new Shared::Models::SectionItem(WALLET_SECTION_ID, Shared::Models::SectionType::Wallet, WALLET_SECTION_NAME, "", "", WALLET_SECTION_ICON, "", false, this);
auto walletSectionItem = new Shared::Models::SectionItem(WALLET_SECTION_ID,
Shared::Models::SectionType::Wallet,
WALLET_SECTION_NAME,
"",
"",
WALLET_SECTION_ICON,
"",
false,
this);
addItem(walletSectionItem);
setActiveSection(WALLET_SECTION_ID);

View File

@ -36,4 +36,3 @@ private:
} // namespace Modules::Main
#endif // VIEW_H

View File

@ -4,21 +4,17 @@
namespace Modules::Main::Wallet::Accounts
{
Controller::Controller(std::shared_ptr<Wallets::ServiceInterface> walletService,
QObject* parent)
: m_walletServicePtr(walletService),
QObject(parent)
Controller::Controller(std::shared_ptr<Wallets::ServiceInterface> walletService, QObject* parent)
: m_walletServicePtr(walletService)
, QObject(parent)
{ }
void Controller::init()
{
}
void Controller::init() { }
QList<Wallets::WalletAccountDto> Controller::getWalletAccounts()
{
QList<Wallets::WalletAccountDto> wallet_accounts;
if(nullptr != m_walletServicePtr)
wallet_accounts = m_walletServicePtr->getWalletAccounts();
if(nullptr != m_walletServicePtr) wallet_accounts = m_walletServicePtr->getWalletAccounts();
return wallet_accounts;
}

View File

@ -3,10 +3,10 @@
#include <QObject>
#include "wallet_accounts/wallet_account.h"
#include "wallet_accounts/service_interface.h"
#include "interfaces/controller_interface.h"
#include "signals.h"
#include "wallet_accounts/service_interface.h"
#include "wallet_accounts/wallet_account.h"
namespace Modules::Main::Wallet::Accounts
{

View File

@ -2,16 +2,24 @@
namespace Modules::Main::Wallet::Accounts
{
Item::Item(QString name, QString address, QString path, QString color, QString publicKey, QString walletType, bool isWallet, bool isChat, float currencyBalance)
: m_name(name),
m_address(address),
m_path(path),
m_color(color),
m_publicKey(publicKey),
m_walletType(walletType),
m_isWallet(isWallet),
m_isChat(isChat),
m_currencyBalance(currencyBalance)
Item::Item(QString name,
QString address,
QString path,
QString color,
QString publicKey,
QString walletType,
bool isWallet,
bool isChat,
float currencyBalance)
: m_name(name)
, m_address(address)
, m_path(path)
, m_color(color)
, m_publicKey(publicKey)
, m_walletType(walletType)
, m_isWallet(isWallet)
, m_isChat(isChat)
, m_currencyBalance(currencyBalance)
{ }
const QString& Item::getName() const

View File

@ -19,7 +19,15 @@ private:
float m_currencyBalance;
public:
Item(QString name, QString address, QString path, QString color, QString publicKey, QString walletType, bool isWallet, bool isChat, float currencyBalance);
Item(QString name,
QString address,
QString path,
QString color,
QString publicKey,
QString walletType,
bool isWallet,
bool isChat,
float currencyBalance);
~Item() = default;
const QString& getName() const;

View File

@ -50,7 +50,8 @@ QVariant Model::data(const QModelIndex& index, int role) const
case PublicKey: return QVariant(item.getPublicKey());
case WalletType: return QVariant(item.getWalletType());
case IsWallet: return QVariant(item.getIsWallet());
case IsChat: return QVariant(item.getIsChat());
case IsChat:
return QVariant(item.getIsChat());
// case Assets: return QVariant(item.ge());
case CurrencyBalance: return QVariant(item.getCurrencyBalance());
}

View File

@ -6,7 +6,8 @@
namespace Modules::Main::Wallet::Accounts
{
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject *parent): QObject(parent)
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject* parent)
: QObject(parent)
{
m_controllerPtr = new Controller(walletsService, this);
m_viewPtr = new View(this);
@ -49,7 +50,8 @@ void Module::refreshWalletAccounts()
QVector<Item> items;
foreach(const auto& acc, walletAccounts)
{
items << Item(acc.name, acc.address, acc.path, acc.color, acc.publicKey, acc.walletType, acc.isWallet, acc.isChat, 0);
items << Item(
acc.name, acc.address, acc.path, acc.color, acc.publicKey, acc.walletType, acc.isWallet, acc.isChat, 0);
}
m_viewPtr->setModelItems(items);

View File

@ -3,10 +3,10 @@
#include <QObject>
#include "wallet_accounts/service_interface.h"
#include "interfaces/module_access_interface.h"
#include "controller.h"
#include "interfaces/module_access_interface.h"
#include "view.h"
#include "wallet_accounts/service_interface.h"
namespace Modules::Main::Wallet::Accounts
{
@ -23,6 +23,7 @@ private:
void connect();
void refreshWalletAccounts();
public:
explicit Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject* parent);
~Module() = default;

View File

@ -20,7 +20,8 @@ Model* View::getModel()
return m_modelPtr;
}
void View::setModelItems(QVector<Item> &accounts) {
void View::setModelItems(QVector<Item>& accounts)
{
m_modelPtr->setItems(accounts);
modelChanged();
}

View File

@ -4,13 +4,10 @@
namespace Modules::Main::Wallet
{
Controller::Controller(std::shared_ptr<Wallets::ServiceInterface> walletService,
QObject* parent)
: m_walletService(walletService),
QObject(parent)
Controller::Controller(std::shared_ptr<Wallets::ServiceInterface> walletService, QObject* parent)
: m_walletService(walletService)
, QObject(parent)
{ }
void Controller::init()
{
}
void Controller::init() { }
} // namespace Modules::Main::Wallet

View File

@ -3,9 +3,9 @@
#include <QObject>
#include "wallet_accounts/service_interface.h"
#include "interfaces/controller_interface.h"
#include "signals.h"
#include "wallet_accounts/service_interface.h"
namespace Modules::Main::Wallet
{

View File

@ -1,13 +1,14 @@
#include <QDebug>
#include <QQmlContext>
#include "accounts/module.h"
#include "module.h"
#include "singleton.h"
#include "accounts/module.h"
namespace Modules::Main::Wallet
{
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject *parent): QObject(parent)
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject* parent)
: QObject(parent)
{
m_controllerPtr = new Controller(walletsService, this);
m_viewPtr = new View(this);

View File

@ -24,6 +24,7 @@ private:
bool m_moduleLoaded;
void connect();
public:
explicit Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject* parent);
~Module() = default;

View File

@ -6,8 +6,7 @@ namespace Modules::Main::Wallet
{
View::View(QObject* parent)
: QObject(parent)
{
}
{ }
void View::load()
{

View File

@ -21,4 +21,3 @@ signals:
} // namespace Modules::Main::Wallet
#endif // WALLET_VIEW_H

View File

@ -23,29 +23,28 @@ SectionItem::SectionItem(QString id,
bool canRequestAccess,
int access,
bool ensOnly,
QObject *parent):
QObject(parent),
m_id(id),
m_sectionType(sectionType) ,
m_name(name),
m_amISectionAdmin(amISectionAdmin),
m_description(description),
m_image(image),
m_icon(icon),
m_color(color),
m_hasNotification(hasNotification),
m_notificationsCount(notificationsCount),
m_active(active),
m_enabled(enabled),
m_isMember(isMember),
m_joined(joined),
m_canJoin(canJoin),
m_canManageUsers(canManageUsers),
m_canRequestAccess(canRequestAccess),
m_access(access),
m_ensOnly(ensOnly)
{
}
QObject* parent)
: QObject(parent)
, m_id(id)
, m_sectionType(sectionType)
, m_name(name)
, m_amISectionAdmin(amISectionAdmin)
, m_description(description)
, m_image(image)
, m_icon(icon)
, m_color(color)
, m_hasNotification(hasNotification)
, m_notificationsCount(notificationsCount)
, m_active(active)
, m_enabled(enabled)
, m_isMember(isMember)
, m_joined(joined)
, m_canJoin(canJoin)
, m_canManageUsers(canManageUsers)
, m_canRequestAccess(canRequestAccess)
, m_access(access)
, m_ensOnly(ensOnly)
{ }
SectionType SectionItem::getSectionType() const
{

View File

@ -73,7 +73,8 @@ QVariant SectionModel::data(const QModelIndex& index, int role) const
case CanManageUsers: return QVariant(item->getCanManageUsers());
case CanRequestAccess: return QVariant(item->getCanRequestAccess());
case Access: return QVariant(item->getAccess());
case EnsOnly: return QVariant(item->getIsEnsOnly());
case EnsOnly:
return QVariant(item->getIsEnsOnly());
// To Do
case MembersModel: return QVariant();
case PendingRequestsToJoinModel: return QVariant();
@ -92,13 +93,13 @@ void SectionModel::addItem(SectionItem* item)
void SectionModel::setActiveSection(const QString& Id)
{
for (int i = 0; i < m_items.size(); ++i) {
for(int i = 0; i < m_items.size(); ++i)
{
auto newIndex = createIndex(i, 0, nullptr);
if(m_items.at(i)->getIsActive())
{
m_items.at(i)->setIsActive(false);
dataChanged(newIndex, newIndex, QVector<int>(ModelRole::Active));
}
if(m_items.at(i)->getId() == Id)
{

View File

@ -3,9 +3,9 @@
#include <QAbstractListModel>
#include <QHash>
#include <QPointer>
#include <QVector>
#include <memory>
#include <QPointer>
#include "section_item.h"

View File

@ -1,8 +1,8 @@
#pragma once
#include "item.h"
#include <QObject>
#include <QString>
#include "item.h"
namespace Modules
{

View File

@ -1,9 +1,9 @@
#pragma once
#include "item.h"
#include <QAbstractListModel>
#include <QHash>
#include <QVector>
#include "item.h"
namespace Modules
{

View File

@ -6,7 +6,6 @@
// TODO: merge with constants from backend/
QString Constants::applicationPath(QString path)
{
return QFileInfo(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + path).absoluteFilePath();
@ -21,4 +20,3 @@ QString Constants::cachePath(QString path)
{
return QFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + path).absoluteFilePath();
}

View File

@ -1,7 +1,7 @@
#pragma once
#include <QString>
#include <QJsonDocument>
#include <QString>
namespace Accounts
{

View File

@ -28,7 +28,6 @@ const QString Websocket = "websocket";
const QString DefaultNetworkName = "mainnet_rpc";
//const DEFAULT_NETWORKS_IDS* = @["mainnet_rpc", "testnet_rpc", "rinkeby_rpc", "goerli_rpc", "xdai_rpc", "poa_rpc" ]
const QString DataDir = "/data";
const QString Keystore = "/data/keystore";
@ -36,5 +35,4 @@ QString applicationPath(QString path = "");
QString tmpPath(QString path = "");
QString cachePath(QString path = "");
} // namespace Constants

View File

@ -2,38 +2,48 @@
#include <array>
const std::array phrases{
"area", "army", "atom", "aunt", "babe", "baby", "back", "bail", "bait", "bake", "ball", "band", "bank", "barn", "base", "bass", "bath", "bead",
"beak", "beam", "bean", "bear", "beat", "beef", "beer", "beet", "bell", "belt", "bend", "bike", "bill", "bird", "bite", "blow", "blue", "boar",
"boat", "body", "bolt", "bomb", "bone", "book", "boot", "bore", "boss", "bowl", "brow", "bulb", "bull", "burn", "bush", "bust", "cafe", "cake",
"calf", "call", "calm", "camp", "cane", "cape", "card", "care", "carp", "cart", "case", "cash", "cast", "cave", "cell", "cent", "chap", "chef",
"chin", "chip", "chop", "chub", "chug", "city", "clam", "clef", "clip", "club", "clue", "coal", "coat", "code", "coil", "coin", "coke", "cold",
"colt", "comb", "cone", "cook", "cope", "copy", "cord", "cork", "corn", "cost", "crab", "craw", "crew", "crib", "crop", "crow", "curl", "cyst",
"dame", "dare", "dark", "dart", "dash", "data", "date", "dead", "deal", "dear", "debt", "deck", "deep", "deer", "desk", "dhow", "diet", "dill",
"dime", "dirt", "dish", "disk", "dock", "doll", "door", "dory", "drag", "draw", "drop", "drug", "drum", "duck", "dump", "dust", "duty", "ease",
"east", "eave", "eddy", "edge", "envy", "epee", "exam", "exit", "face", "fact", "fail", "fall", "fame", "fang", "farm", "fawn", "fear", "feed",
"feel", "feet", "file", "fill", "film", "find", "fine", "fire", "fish", "flag", "flat", "flax", "flow", "foam", "fold", "font", "food", "foot",
"fork", "form", "fort", "fowl", "frog", "fuel", "full", "gain", "gale", "galn", "game", "garb", "gate", "gear", "gene", "gift", "girl", "give",
"glad", "glen", "glue", "glut", "goal", "goat", "gold", "golf", "gong", "good", "gown", "grab", "gram", "gray", "grey", "grip", "grit", "gyro",
"hail", "hair", "half", "hall", "hand", "hang", "harm", "harp", "hate", "hawk", "head", "heat", "heel", "hell", "helo", "help", "hemp", "herb",
"hide", "high", "hill", "hire", "hive", "hold", "hole", "home", "hood", "hoof", "hook", "hope", "hops", "horn", "hose", "host", "hour", "hunt",
"hurt", "icon", "idea", "inch", "iris", "iron", "item", "jail", "jeep", "jeff", "joey", "join", "joke", "judo", "jump", "junk", "jury", "jute",
"kale", "keep", "kick", "kill", "kilt", "kind", "king", "kiss", "kite", "knee", "knot", "lace", "lack", "lady", "lake", "lamb", "lamp", "land",
"lark", "lava", "lawn", "lead", "leaf", "leek", "lier", "life", "lift", "lily", "limo", "line", "link", "lion", "lisa", "list", "load", "loaf",
"loan", "lock", "loft", "long", "look", "loss", "lout", "love", "luck", "lung", "lute", "lynx", "lyre", "maid", "mail", "main", "make", "male",
"mall", "manx", "many", "mare", "mark", "mask", "mass", "mate", "math", "meal", "meat", "meet", "menu", "mess", "mice", "midi", "mile", "milk",
"mime", "mind", "mine", "mini", "mint", "miss", "mist", "moat", "mode", "mole", "mood", "moon", "most", "moth", "move", "mule", "mutt", "nail",
"name", "neat", "neck", "need", "neon", "nest", "news", "node", "nose", "note", "oboe", "okra", "open", "oval", "oven", "oxen", "pace", "pack",
"page", "pail", "pain", "pair", "palm", "pard", "park", "part", "pass", "past", "path", "peak", "pear", "peen", "peer", "pelt", "perp", "pest",
"pick", "pier", "pike", "pile", "pimp", "pine", "ping", "pink", "pint", "pipe", "piss", "pith", "plan", "play", "plot", "plow", "poem", "poet",
"pole", "polo", "pond", "pony", "poof", "pool", "port", "post", "prow", "pull", "puma", "pump", "pupa", "push", "quit", "race", "rack", "raft",
"rage", "rail", "rain", "rake", "rank", "rate", "read", "rear", "reef", "rent", "rest", "rice", "rich", "ride", "ring", "rise", "risk", "road",
"robe", "rock", "role", "roll", "roof", "room", "root", "rope", "rose", "ruin", "rule", "rush", "ruth", "sack", "safe", "sage", "sail", "sale",
"salt", "sand", "sari", "sash", "save", "scow", "seal", "seat", "seed", "self", "sell", "shed", "shin", "ship", "shoe", "shop", "shot", "show",
"sick", "side", "sign", "silk", "sill", "silo", "sing", "sink", "site", "size", "skin", "sled", "slip", "smog", "snob", "snow", "soap", "sock",
"soda", "sofa", "soft", "soil", "song", "soot", "sort", "soup", "spot", "spur", "stag", "star", "stay", "stem", "step", "stew", "stop", "stud",
"suck", "suit", "swan", "swim", "tail", "tale", "talk", "tank", "tard", "task", "taxi", "team", "tear", "teen", "tell", "temp", "tent", "term",
"test", "text", "thaw", "tile", "till", "time", "tire", "toad", "toga", "togs", "tone", "tool", "toot", "tote", "tour", "town", "tram", "tray",
"tree", "trim", "trip", "tuba", "tube", "tuna", "tune", "turn", "tutu", "twig", "type", "unit", "user", "vane", "vase", "vast", "veal", "veil",
"vein", "vest", "vibe", "view", "vise", "wait", "wake", "walk", "wall", "wash", "wasp", "wave", "wear", "weed", "week", "well", "west", "whip",
"wife", "will", "wind", "wine", "wing", "wire", "wish", "wolf", "wood", "wool", "word", "work", "worm", "wrap", "wren", "yard", "yarn", "yawl",
"year", "yoga", "yoke", "yurt", "zinc", "zone"};
"area", "army", "atom", "aunt", "babe", "baby", "back", "bail", "bait", "bake", "ball", "band", "bank", "barn",
"base", "bass", "bath", "bead", "beak", "beam", "bean", "bear", "beat", "beef", "beer", "beet", "bell", "belt",
"bend", "bike", "bill", "bird", "bite", "blow", "blue", "boar", "boat", "body", "bolt", "bomb", "bone", "book",
"boot", "bore", "boss", "bowl", "brow", "bulb", "bull", "burn", "bush", "bust", "cafe", "cake", "calf", "call",
"calm", "camp", "cane", "cape", "card", "care", "carp", "cart", "case", "cash", "cast", "cave", "cell", "cent",
"chap", "chef", "chin", "chip", "chop", "chub", "chug", "city", "clam", "clef", "clip", "club", "clue", "coal",
"coat", "code", "coil", "coin", "coke", "cold", "colt", "comb", "cone", "cook", "cope", "copy", "cord", "cork",
"corn", "cost", "crab", "craw", "crew", "crib", "crop", "crow", "curl", "cyst", "dame", "dare", "dark", "dart",
"dash", "data", "date", "dead", "deal", "dear", "debt", "deck", "deep", "deer", "desk", "dhow", "diet", "dill",
"dime", "dirt", "dish", "disk", "dock", "doll", "door", "dory", "drag", "draw", "drop", "drug", "drum", "duck",
"dump", "dust", "duty", "ease", "east", "eave", "eddy", "edge", "envy", "epee", "exam", "exit", "face", "fact",
"fail", "fall", "fame", "fang", "farm", "fawn", "fear", "feed", "feel", "feet", "file", "fill", "film", "find",
"fine", "fire", "fish", "flag", "flat", "flax", "flow", "foam", "fold", "font", "food", "foot", "fork", "form",
"fort", "fowl", "frog", "fuel", "full", "gain", "gale", "galn", "game", "garb", "gate", "gear", "gene", "gift",
"girl", "give", "glad", "glen", "glue", "glut", "goal", "goat", "gold", "golf", "gong", "good", "gown", "grab",
"gram", "gray", "grey", "grip", "grit", "gyro", "hail", "hair", "half", "hall", "hand", "hang", "harm", "harp",
"hate", "hawk", "head", "heat", "heel", "hell", "helo", "help", "hemp", "herb", "hide", "high", "hill", "hire",
"hive", "hold", "hole", "home", "hood", "hoof", "hook", "hope", "hops", "horn", "hose", "host", "hour", "hunt",
"hurt", "icon", "idea", "inch", "iris", "iron", "item", "jail", "jeep", "jeff", "joey", "join", "joke", "judo",
"jump", "junk", "jury", "jute", "kale", "keep", "kick", "kill", "kilt", "kind", "king", "kiss", "kite", "knee",
"knot", "lace", "lack", "lady", "lake", "lamb", "lamp", "land", "lark", "lava", "lawn", "lead", "leaf", "leek",
"lier", "life", "lift", "lily", "limo", "line", "link", "lion", "lisa", "list", "load", "loaf", "loan", "lock",
"loft", "long", "look", "loss", "lout", "love", "luck", "lung", "lute", "lynx", "lyre", "maid", "mail", "main",
"make", "male", "mall", "manx", "many", "mare", "mark", "mask", "mass", "mate", "math", "meal", "meat", "meet",
"menu", "mess", "mice", "midi", "mile", "milk", "mime", "mind", "mine", "mini", "mint", "miss", "mist", "moat",
"mode", "mole", "mood", "moon", "most", "moth", "move", "mule", "mutt", "nail", "name", "neat", "neck", "need",
"neon", "nest", "news", "node", "nose", "note", "oboe", "okra", "open", "oval", "oven", "oxen", "pace", "pack",
"page", "pail", "pain", "pair", "palm", "pard", "park", "part", "pass", "past", "path", "peak", "pear", "peen",
"peer", "pelt", "perp", "pest", "pick", "pier", "pike", "pile", "pimp", "pine", "ping", "pink", "pint", "pipe",
"piss", "pith", "plan", "play", "plot", "plow", "poem", "poet", "pole", "polo", "pond", "pony", "poof", "pool",
"port", "post", "prow", "pull", "puma", "pump", "pupa", "push", "quit", "race", "rack", "raft", "rage", "rail",
"rain", "rake", "rank", "rate", "read", "rear", "reef", "rent", "rest", "rice", "rich", "ride", "ring", "rise",
"risk", "road", "robe", "rock", "role", "roll", "roof", "room", "root", "rope", "rose", "ruin", "rule", "rush",
"ruth", "sack", "safe", "sage", "sail", "sale", "salt", "sand", "sari", "sash", "save", "scow", "seal", "seat",
"seed", "self", "sell", "shed", "shin", "ship", "shoe", "shop", "shot", "show", "sick", "side", "sign", "silk",
"sill", "silo", "sing", "sink", "site", "size", "skin", "sled", "slip", "smog", "snob", "snow", "soap", "sock",
"soda", "sofa", "soft", "soil", "song", "soot", "sort", "soup", "spot", "spur", "stag", "star", "stay", "stem",
"step", "stew", "stop", "stud", "suck", "suit", "swan", "swim", "tail", "tale", "talk", "tank", "tard", "task",
"taxi", "team", "tear", "teen", "tell", "temp", "tent", "term", "test", "text", "thaw", "tile", "till", "time",
"tire", "toad", "toga", "togs", "tone", "tool", "toot", "tote", "tour", "town", "tram", "tray", "tree", "trim",
"trip", "tuba", "tube", "tuna", "tune", "turn", "tutu", "twig", "type", "unit", "user", "vane", "vase", "vast",
"veal", "veil", "vein", "vest", "vibe", "view", "vise", "wait", "wake", "walk", "wall", "wash", "wasp", "wave",
"wear", "weed", "week", "well", "west", "whip", "wife", "will", "wind", "wine", "wing", "wire", "wish", "wolf",
"wood", "wool", "word", "work", "worm", "wrap", "wren", "yard", "yarn", "yawl", "year", "yoga", "yoke", "yurt",
"zinc", "zone"};

View File

@ -1,11 +1,11 @@
#ifndef WALLETACCOUNTSSERVICE_H
#define WALLETACCOUNTSSERVICE_H
#include <QString>
#include <QMap>
#include <QString>
#include "wallet_account.h"
#include "service_interface.h"
#include "wallet_account.h"
namespace Wallets
{

View File

@ -1,10 +1,10 @@
#ifndef WALLETACCOUNTDTO_H
#define WALLETACCOUNTDTO_H
#include "wallet_token.h"
#include <QJsonValue>
#include <QString>
#include <QVector>
#include "wallet_token.h"
namespace Wallets
{
@ -27,6 +27,6 @@ WalletAccountDto toWalletAccountDto(const QJsonValue jsonObj);
//WalletAccountDto getCurrencyBalance*(): float =
// return self.tokens.map(t => t.currencyBalance).foldl(a + b, 0.0)
} // namespace Wallet
} // namespace Wallets
#endif // WALLETACCOUNTDTO_H

View File

@ -21,6 +21,6 @@ public:
float currencyBalance;
};
} // namespace Wallet
} // namespace Wallets
#endif // WALLETTOKENDTO_H

View File

@ -26,8 +26,7 @@ void Service::fetchAccounts()
foreach(const QJsonValue& value, response.m_result)
{
auto account = toWalletAccountDto(value);
if(!account.isChat)
m_walletAccounts[account.address] = account;
if(!account.isChat) m_walletAccounts[account.address] = account;
}
}
catch(Backend::RpcException& e)

View File

@ -1,13 +1,13 @@
#include "backend/accounts.h"
#include "backend/types.h"
#include "backend/utils.h"
#include "libstatus.h"
#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QString>
#include <QVector>
#include "libstatus.h"
const int NUMBER_OF_ADDRESSES_TO_GENERATE = 5;
const int MNEMONIC_PHRASE_LENGTH = 12;

View File

@ -16,6 +16,7 @@ struct RpcException : public std::exception
{
private:
std::string m_message;
public:
explicit RpcException(const std::string& message);
const char* what() const throw();

View File

@ -8,6 +8,6 @@
namespace Backend::Wallet::Accounts
{
Backend::RpcResponse<QJsonArray> getAccounts();
} // Backend::Wallet::Accounts
} // namespace Backend::Wallet::Accounts
#endif // WALLETACCOUNT_BACKEND_H

View File

@ -1,12 +1,12 @@
#include "backend/utils.h"
#include "backend/types.h"
#include <QCryptographicHash>
#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QString>
#include <QVector>
#include <QDebug>
QJsonArray Backend::Utils::toJsonArray(const QVector<QString>& value)
{
@ -43,8 +43,10 @@ QString Backend::Utils::hashString(QString str)
return "0x" + QString::fromUtf8(QCryptographicHash::hash(str.toUtf8(), QCryptographicHash::Keccak_256).toHex());
}
void Backend::Utils::throwOnError(QJsonObject response) {
if(!response["error"].isUndefined() && !response["error"].toString().isEmpty()){
void Backend::Utils::throwOnError(QJsonObject response)
{
if(!response["error"].isUndefined() && !response["error"].toString().isEmpty())
{
qWarning() << "RpcException: " << response["error"].toString();
throw Backend::RpcException(response["error"].toString().toStdString());
}

View File

@ -2,9 +2,9 @@
#include <QJsonDocument>
#include <QJsonObject>
#include "backend/wallet_accounts.h"
#include "backend/types.h"
#include "backend/utils.h"
#include "backend/wallet_accounts.h"
#include "libstatus.h"
namespace Backend::Wallet::Accounts
@ -16,6 +16,4 @@ RpcResponse<QJsonArray> getAccounts()
return RpcResponse<QJsonArray>(result, QJsonDocument::fromJson(result)["result"].toArray());
}
} // namespace Backend::Wallet::Accounts

View File

@ -7,7 +7,6 @@
// TODO: merge with constants from backend/
QString Constants::applicationPath(QString path)
{
return QFileInfo(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + path).absoluteFilePath();

View File

@ -1,6 +1,7 @@
#pragma once
class DOtherSide {
class DOtherSide
{
public:
static void registerMetaTypes();
};

View File

@ -28,5 +28,4 @@ private:
QLocalServer* m_localServer;
};
#endif // SINGLEINSTANCE_H

View File

@ -4,14 +4,14 @@
# include "hunspell/hunspell.hxx"
#endif
#include <QTextCodec>
#include <QFile>
#include <QDebug>
#include <QFile>
#include <QLocale>
#include <QTextCodec>
#include <QRegularExpression>
#include <QGuiApplication>
#include <QDir>
#include <QGuiApplication>
#include <QRegularExpression>
#include <QInputMethod>
@ -21,9 +21,7 @@ SpellChecker::SpellChecker(QObject *parent)
, m_hunspell(nullptr)
#endif
, m_userDict("userDict_")
{
}
{ }
SpellChecker::~SpellChecker()
{
@ -53,7 +51,8 @@ bool SpellChecker::isInit() const
void SpellChecker::initHunspell()
{
#ifdef Q_OS_MACOS
if (m_hunspell) {
if(m_hunspell)
{
delete m_hunspell;
}
@ -61,24 +60,28 @@ void SpellChecker::initHunspell()
QString affixFile = QGuiApplication::applicationDirPath() + "/dictionaries/" + m_lang + "/index.aff";
QByteArray dictFilePathBA = dictFile.toLocal8Bit();
QByteArray affixFilePathBA = affixFile.toLocal8Bit();
m_hunspell = new Hunspell(affixFilePathBA.constData(),
dictFilePathBA.constData());
m_hunspell = new Hunspell(affixFilePathBA.constData(), dictFilePathBA.constData());
// detect encoding analyzing the SET option in the affix file
auto encoding = QStringLiteral("ISO8859-15");
QFile _affixFile(affixFile);
if (_affixFile.open(QIODevice::ReadOnly)) {
if(_affixFile.open(QIODevice::ReadOnly))
{
QTextStream stream(&_affixFile);
QRegularExpression enc_detector(
QStringLiteral("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*"),
QRegularExpression enc_detector(QStringLiteral("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*"),
QRegularExpression::CaseInsensitiveOption);
QString sLine;
QRegularExpressionMatch match;
while (!stream.atEnd()) {
while(!stream.atEnd())
{
sLine = stream.readLine();
if (sLine.isEmpty()) { continue; }
if(sLine.isEmpty())
{
continue;
}
match = enc_detector.match(sLine);
if (match.hasMatch()) {
if(match.hasMatch())
{
encoding = match.captured(1);
qDebug() << "Encoding set to " + encoding;
break;
@ -90,20 +93,23 @@ void SpellChecker::initHunspell()
QString userDict = m_userDict + m_lang + ".txt";
if (!userDict.isEmpty()) {
if(!userDict.isEmpty())
{
QFile userDictonaryFile(userDict);
if (userDictonaryFile.open(QIODevice::ReadOnly)) {
if(userDictonaryFile.open(QIODevice::ReadOnly))
{
QTextStream stream(&userDictonaryFile);
for (QString word = stream.readLine();
!word.isEmpty();
word = stream.readLine())
for(QString word = stream.readLine(); !word.isEmpty(); word = stream.readLine())
ignoreWord(word);
userDictonaryFile.close();
} else {
qWarning() << "User dictionary in " << userDict
<< "could not be opened";
}
} else {
else
{
qWarning() << "User dictionary in " << userDict << "could not be opened";
}
}
else
{
qDebug() << "User dictionary not set.";
}
#endif
@ -118,11 +124,12 @@ QVariantList SpellChecker::suggest(const QString &word)
wordlist = m_hunspell->suggest(m_codec->fromUnicode(word).toStdString());
numSuggestions = static_cast<int>(wordlist.size());
if (numSuggestions > 0) {
if(numSuggestions > 0)
{
suggestions.reserve(numSuggestions);
for (int i = 0; i < numSuggestions; i++) {
suggestions << m_codec->toUnicode(
QByteArray::fromStdString(wordlist[i]));
for(int i = 0; i < numSuggestions; i++)
{
suggestions << m_codec->toUnicode(QByteArray::fromStdString(wordlist[i]));
}
}
#endif
@ -141,17 +148,22 @@ void SpellChecker::addToUserWordlist(const QString &word)
{
#ifdef Q_OS_MACOS
QString userDict = m_userDict + m_lang + ".txt";
if (!userDict.isEmpty()) {
if(!userDict.isEmpty())
{
QFile userDictonaryFile(userDict);
if (userDictonaryFile.open(QIODevice::Append)) {
if(userDictonaryFile.open(QIODevice::Append))
{
QTextStream stream(&userDictonaryFile);
stream << word << "\n";
userDictonaryFile.close();
} else {
qWarning() << "User dictionary in " << userDict
<< "could not be opened for appending a new word";
}
} else {
else
{
qWarning() << "User dictionary in " << userDict << "could not be opened for appending a new word";
}
}
else
{
qDebug() << "User dictionary not set.";
}
#endif
@ -164,7 +176,8 @@ const QString& SpellChecker::lang() const
void SpellChecker::setLang(const QString& lang)
{
if (m_lang != lang) {
if(m_lang != lang)
{
m_lang = lang;
initHunspell();
emit langChanged();
@ -178,7 +191,8 @@ const QString& SpellChecker::userDict() const
void SpellChecker::setUserDict(const QString& userDict)
{
if (m_userDict != userDict) {
if(m_userDict != userDict)
{
m_userDict = userDict;
emit userDictChanged();
}

View File

@ -1,9 +1,9 @@
#pragma once
#include <QObject>
#include <QVariant>
#include <QQuickTextDocument>
#include <QSyntaxHighlighter>
#include <QVariant>
#ifdef Q_OS_MACOS
class Hunspell;

View File

@ -44,9 +44,11 @@ StatusSyntaxHighlighter::StatusSyntaxHighlighter(QTextDocument *parent)
void StatusSyntaxHighlighter::highlightBlock(const QString& text)
{
for (const HighlightingRule &rule : qAsConst(highlightingRules)) {
for(const HighlightingRule& rule : qAsConst(highlightingRules))
{
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
while (matchIterator.hasNext()) {
while(matchIterator.hasNext())
{
QRegularExpressionMatch match = matchIterator.next();
setFormat(match.capturedStart(), match.capturedLength(), rule.format);
}
@ -54,14 +56,16 @@ void StatusSyntaxHighlighter::highlightBlock(const QString &text)
setCurrentBlockState(0);
}
QQuickTextDocument *StatusSyntaxHighlighterHelper::quickTextDocument() const {
QQuickTextDocument* StatusSyntaxHighlighterHelper::quickTextDocument() const
{
return m_quicktextdocument;
}
void StatusSyntaxHighlighterHelper::setQuickTextDocument(
QQuickTextDocument *quickTextDocument) {
void StatusSyntaxHighlighterHelper::setQuickTextDocument(QQuickTextDocument* quickTextDocument)
{
m_quicktextdocument = quickTextDocument;
if (m_quicktextdocument) {
if(m_quicktextdocument)
{
new StatusSyntaxHighlighter(m_quicktextdocument->textDocument());
}
}

View File

@ -1,8 +1,8 @@
#pragma once
#include <QRegularExpression>
#include <QSyntaxHighlighter>
#include <QTextCharFormat>
#include <QRegularExpression>
class QQuickTextDocument;
@ -31,13 +31,16 @@ private:
QTextCharFormat multiLineCodeBlockFormat;
};
class StatusSyntaxHighlighterHelper : public QObject {
class StatusSyntaxHighlighterHelper : public QObject
{
Q_OBJECT
Q_PROPERTY(QQuickTextDocument *quickTextDocument READ quickTextDocument WRITE
setQuickTextDocument NOTIFY quickTextDocumentChanged)
Q_PROPERTY(QQuickTextDocument* quickTextDocument READ quickTextDocument WRITE setQuickTextDocument NOTIFY
quickTextDocumentChanged)
public:
StatusSyntaxHighlighterHelper(QObject* parent = nullptr)
: QObject(parent), m_quicktextdocument(nullptr) {}
: QObject(parent)
, m_quicktextdocument(nullptr)
{ }
QQuickTextDocument* quickTextDocument() const;
void setQuickTextDocument(QQuickTextDocument* quickTextDocument);
signals:

View File

@ -1,17 +1,20 @@
#include "StatusWindow.h"
StatusWindow::StatusWindow(QWindow* parent)
: QQuickWindow(parent),
m_isFullScreen(false)
: QQuickWindow(parent)
, m_isFullScreen(false)
{
removeTitleBar();
connect(this, &QQuickWindow::windowStateChanged, [&](Qt::WindowState windowState) {
if (windowState == Qt::WindowNoState) {
if(windowState == Qt::WindowNoState)
{
removeTitleBar();
m_isFullScreen = false;
emit isFullScreenChanged();
} else if (windowState == Qt::WindowFullScreen) {
}
else if(windowState == Qt::WindowFullScreen)
{
m_isFullScreen = true;
emit isFullScreenChanged();
showTitleBar();
@ -21,9 +24,12 @@ StatusWindow::StatusWindow(QWindow *parent)
void StatusWindow::toggleFullScreen()
{
if (m_isFullScreen) {
if(m_isFullScreen)
{
showNormal();
} else {
}
else
{
showFullScreen();
}
}

View File

@ -10,16 +10,18 @@ class StatusWindow: public QQuickWindow
Q_PROPERTY(bool isFullScreen READ isFullScreen NOTIFY isFullScreenChanged)
public:
explicit StatusWindow(QWindow* parent = nullptr);
Q_INVOKABLE void toggleFullScreen();
bool isFullScreen() const;
Q_INVOKABLE void updatePosition() {
auto point = QPoint(screen()->geometry().center().x() - geometry().width() / 2, screen()->geometry().center().y() - geometry().height() / 2);
if (point != this->position()) {
Q_INVOKABLE void updatePosition()
{
auto point = QPoint(screen()->geometry().center().x() - geometry().width() / 2,
screen()->geometry().center().y() - geometry().height() / 2);
if(point != this->position())
{
this->setPosition(point);
}
}
@ -36,4 +38,3 @@ private:
private:
bool m_isFullScreen;
};

View File

@ -1,11 +1,5 @@
#include "StatusWindow.h"
void StatusWindow::removeTitleBar()
{
void StatusWindow::removeTitleBar() { }
}
void StatusWindow::showTitleBar()
{
}
void StatusWindow::showTitleBar() { }

View File

@ -6,7 +6,9 @@ void logFormatter(QtMsgType type, const QMessageLogContext& context, const QStri
{
QByteArray localMsg = msg.toLocal8Bit();
const char* file = context.file ? context.file : "";
QByteArray function = context.function ? (QString(QStringLiteral("\033[0;33mfunction=\033[94m") + QString(context.function)).toLocal8Bit())
QByteArray function =
context.function
? (QString(QStringLiteral("\033[0;33mfunction=\033[94m") + QString(context.function)).toLocal8Bit())
: QString("").toLocal8Bit();
QByteArray timestamp = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toLocal8Bit();

View File

@ -49,7 +49,6 @@ int main(int argc, char* argv[])
qRegisterMetaType<Signals::Signal>("Signal");
qRegisterMetaType<Signals::NodeSignal>("NodeSignal");
qInfo("starting application controller...");
AppController appController = AppController();
appController.start();