forked from Silverfish/proton-bridge
Other: C++ Code reformat.
This commit is contained in:
@ -19,15 +19,13 @@
|
||||
#include "User.h"
|
||||
|
||||
|
||||
namespace bridgepp
|
||||
{
|
||||
namespace bridgepp {
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] parent The parent object of the user.
|
||||
//****************************************************************************************************************************************************
|
||||
SPUser User::newUser(QObject *parent)
|
||||
{
|
||||
SPUser User::newUser(QObject *parent) {
|
||||
return SPUser(new User(parent));
|
||||
}
|
||||
|
||||
@ -36,8 +34,7 @@ SPUser User::newUser(QObject *parent)
|
||||
/// \param[in] parent The parent object.
|
||||
//****************************************************************************************************************************************************
|
||||
User::User(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
: QObject(parent) {
|
||||
|
||||
}
|
||||
|
||||
@ -45,8 +42,7 @@ User::User(QObject *parent)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] user The user to copy from
|
||||
//****************************************************************************************************************************************************
|
||||
void User::update(User const &user)
|
||||
{
|
||||
void User::update(User const &user) {
|
||||
this->setID(user.id());
|
||||
this->setUsername(user.username());
|
||||
this->setPassword(user.password());
|
||||
@ -62,8 +58,7 @@ void User::update(User const &user)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] makeItActive Should split mode be made active.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::toggleSplitMode(bool makeItActive)
|
||||
{
|
||||
void User::toggleSplitMode(bool makeItActive) {
|
||||
emit toggleSplitModeForUser(id_, makeItActive);
|
||||
}
|
||||
|
||||
@ -71,8 +66,7 @@ void User::toggleSplitMode(bool makeItActive)
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void User::logout()
|
||||
{
|
||||
void User::logout() {
|
||||
emit logoutUser(id_);
|
||||
}
|
||||
|
||||
@ -80,8 +74,7 @@ void User::logout()
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void User::remove()
|
||||
{
|
||||
void User::remove() {
|
||||
emit removeUser(id_);
|
||||
}
|
||||
|
||||
@ -89,8 +82,7 @@ void User::remove()
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] address The email address to configure Apple Mail for.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::configureAppleMail(QString const &address)
|
||||
{
|
||||
void User::configureAppleMail(QString const &address) {
|
||||
emit configureAppleMailForUser(id_, address);
|
||||
}
|
||||
|
||||
@ -99,8 +91,7 @@ void User::configureAppleMail(QString const &address)
|
||||
// The only purpose of this call is to forward to the QML application the toggleSplitModeFinished(userID) event
|
||||
// that was received by the UserList model.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::emitToggleSplitModeFinished()
|
||||
{
|
||||
void User::emitToggleSplitModeFinished() {
|
||||
emit toggleSplitModeFinished();
|
||||
}
|
||||
|
||||
@ -108,8 +99,7 @@ void User::emitToggleSplitModeFinished()
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The userID.
|
||||
//****************************************************************************************************************************************************
|
||||
QString User::id() const
|
||||
{
|
||||
QString User::id() const {
|
||||
return id_;
|
||||
}
|
||||
|
||||
@ -117,10 +107,10 @@ QString User::id() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] id The userID.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setID(QString const &id)
|
||||
{
|
||||
if (id == id_)
|
||||
void User::setID(QString const &id) {
|
||||
if (id == id_) {
|
||||
return;
|
||||
}
|
||||
|
||||
id_ = id;
|
||||
emit idChanged(id_);
|
||||
@ -130,8 +120,7 @@ void User::setID(QString const &id)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The username.
|
||||
//****************************************************************************************************************************************************
|
||||
QString User::username() const
|
||||
{
|
||||
QString User::username() const {
|
||||
return username_;
|
||||
}
|
||||
|
||||
@ -139,10 +128,10 @@ QString User::username() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] username The username.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setUsername(QString const &username)
|
||||
{
|
||||
if (username == username_)
|
||||
void User::setUsername(QString const &username) {
|
||||
if (username == username_) {
|
||||
return;
|
||||
}
|
||||
|
||||
username_ = username;
|
||||
emit usernameChanged(username_);
|
||||
@ -152,8 +141,7 @@ void User::setUsername(QString const &username)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The password.
|
||||
//****************************************************************************************************************************************************
|
||||
QString User::password() const
|
||||
{
|
||||
QString User::password() const {
|
||||
return password_;
|
||||
}
|
||||
|
||||
@ -161,10 +149,10 @@ QString User::password() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] password The password.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setPassword(QString const &password)
|
||||
{
|
||||
if (password == password_)
|
||||
void User::setPassword(QString const &password) {
|
||||
if (password == password_) {
|
||||
return;
|
||||
}
|
||||
|
||||
password_ = password;
|
||||
emit passwordChanged(password_);
|
||||
@ -174,8 +162,7 @@ void User::setPassword(QString const &password)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The addresses.
|
||||
//****************************************************************************************************************************************************
|
||||
QStringList User::addresses() const
|
||||
{
|
||||
QStringList User::addresses() const {
|
||||
return addresses_;
|
||||
}
|
||||
|
||||
@ -183,10 +170,10 @@ QStringList User::addresses() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] addresses The addresses.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setAddresses(QStringList const &addresses)
|
||||
{
|
||||
if (addresses == addresses_)
|
||||
void User::setAddresses(QStringList const &addresses) {
|
||||
if (addresses == addresses_) {
|
||||
return;
|
||||
}
|
||||
|
||||
addresses_ = addresses;
|
||||
emit addressesChanged(addresses_);
|
||||
@ -196,8 +183,7 @@ void User::setAddresses(QStringList const &addresses)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The avatar text.
|
||||
//****************************************************************************************************************************************************
|
||||
QString User::avatarText() const
|
||||
{
|
||||
QString User::avatarText() const {
|
||||
return avatarText_;
|
||||
}
|
||||
|
||||
@ -205,10 +191,10 @@ QString User::avatarText() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] avatarText The avatar text.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setAvatarText(QString const &avatarText)
|
||||
{
|
||||
if (avatarText == avatarText_)
|
||||
void User::setAvatarText(QString const &avatarText) {
|
||||
if (avatarText == avatarText_) {
|
||||
return;
|
||||
}
|
||||
|
||||
avatarText_ = avatarText;
|
||||
emit usernameChanged(avatarText_);
|
||||
@ -218,8 +204,7 @@ void User::setAvatarText(QString const &avatarText)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The user state.
|
||||
//****************************************************************************************************************************************************
|
||||
UserState User::state() const
|
||||
{
|
||||
UserState User::state() const {
|
||||
return state_;
|
||||
}
|
||||
|
||||
@ -227,10 +212,10 @@ UserState User::state() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] state The user state.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setState(UserState state)
|
||||
{
|
||||
if (state_ == state)
|
||||
void User::setState(UserState state) {
|
||||
if (state_ == state) {
|
||||
return;
|
||||
}
|
||||
|
||||
state_ = state;
|
||||
emit stateChanged(state);
|
||||
@ -240,8 +225,7 @@ void User::setState(UserState state)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The split mode status.
|
||||
//****************************************************************************************************************************************************
|
||||
bool User::splitMode() const
|
||||
{
|
||||
bool User::splitMode() const {
|
||||
return splitMode_;
|
||||
}
|
||||
|
||||
@ -249,10 +233,10 @@ bool User::splitMode() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] splitMode The split mode status.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setSplitMode(bool splitMode)
|
||||
{
|
||||
if (splitMode == splitMode_)
|
||||
void User::setSplitMode(bool splitMode) {
|
||||
if (splitMode == splitMode_) {
|
||||
return;
|
||||
}
|
||||
|
||||
splitMode_ = splitMode;
|
||||
emit splitModeChanged(splitMode_);
|
||||
@ -262,8 +246,7 @@ void User::setSplitMode(bool splitMode)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The used bytes.
|
||||
//****************************************************************************************************************************************************
|
||||
float User::usedBytes() const
|
||||
{
|
||||
float User::usedBytes() const {
|
||||
return usedBytes_;
|
||||
}
|
||||
|
||||
@ -271,10 +254,10 @@ float User::usedBytes() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] usedBytes The used bytes.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setUsedBytes(float usedBytes)
|
||||
{
|
||||
if (usedBytes == usedBytes_)
|
||||
void User::setUsedBytes(float usedBytes) {
|
||||
if (usedBytes == usedBytes_) {
|
||||
return;
|
||||
}
|
||||
|
||||
usedBytes_ = usedBytes;
|
||||
emit usedBytesChanged(usedBytes_);
|
||||
@ -284,8 +267,7 @@ void User::setUsedBytes(float usedBytes)
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The total bytes.
|
||||
//****************************************************************************************************************************************************
|
||||
float User::totalBytes() const
|
||||
{
|
||||
float User::totalBytes() const {
|
||||
return totalBytes_;
|
||||
}
|
||||
|
||||
@ -293,10 +275,10 @@ float User::totalBytes() const
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] totalBytes The total bytes.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::setTotalBytes(float totalBytes)
|
||||
{
|
||||
if (totalBytes == totalBytes_)
|
||||
void User::setTotalBytes(float totalBytes) {
|
||||
if (totalBytes == totalBytes_) {
|
||||
return;
|
||||
}
|
||||
|
||||
totalBytes_ = totalBytes;
|
||||
emit totalBytesChanged(totalBytes_);
|
||||
@ -307,13 +289,16 @@ void User::setTotalBytes(float totalBytes)
|
||||
/// \param[in] state The user state.
|
||||
/// \return A string describing the state.
|
||||
//****************************************************************************************************************************************************
|
||||
QString User::stateToString(UserState state)
|
||||
{
|
||||
QString User::stateToString(UserState state) {
|
||||
switch (state) {
|
||||
case UserState::SignedOut: return "Signed out";
|
||||
case UserState::Locked: return "Locked";
|
||||
case UserState::Connected: return "Connected";
|
||||
default: return "Unknown";
|
||||
case UserState::SignedOut:
|
||||
return "Signed out";
|
||||
case UserState::Locked:
|
||||
return "Locked";
|
||||
case UserState::Connected:
|
||||
return "Connected";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,8 +20,7 @@
|
||||
#define BRIDGE_PP_USER_H
|
||||
|
||||
|
||||
namespace bridgepp
|
||||
{
|
||||
namespace bridgepp {
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
@ -29,25 +28,25 @@ namespace bridgepp
|
||||
/// See https://qml.guide/enums-in-qt-qml/ for details (we used Q_OBJECT instead of Q_GADGET as in the reference document avoid a QML warning
|
||||
/// complaining about the case of the data type).
|
||||
//****************************************************************************************************************************************************
|
||||
class EUserState: public QObject
|
||||
{
|
||||
class EUserState : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum class State
|
||||
{
|
||||
enum class State {
|
||||
SignedOut = 0,
|
||||
Locked = 1,
|
||||
Connected = 2
|
||||
};
|
||||
|
||||
|
||||
Q_ENUM(State)
|
||||
|
||||
|
||||
EUserState() = delete; ///< Default constructor.
|
||||
EUserState(EUserState const&) = delete; ///< Disabled copy-constructor.
|
||||
EUserState(EUserState&&) = delete; ///< Disabled assignment copy-constructor.
|
||||
EUserState(EUserState const &) = delete; ///< Disabled copy-constructor.
|
||||
EUserState(EUserState &&) = delete; ///< Disabled assignment copy-constructor.
|
||||
~EUserState() = default; ///< Destructor.
|
||||
EUserState& operator=(EUserState const&) = delete; ///< Disabled assignment operator.
|
||||
EUserState& operator=(EUserState&&) = delete; ///< Disabled move assignment operator.
|
||||
EUserState &operator=(EUserState const &) = delete; ///< Disabled assignment operator.
|
||||
EUserState &operator=(EUserState &&) = delete; ///< Disabled move assignment operator.
|
||||
};
|
||||
|
||||
|
||||
@ -60,8 +59,7 @@ typedef std::shared_ptr<class User> SPUser; ///< Type definition for shared poin
|
||||
//****************************************************************************************************************************************************
|
||||
/// \brief User class.
|
||||
//****************************************************************************************************************************************************
|
||||
class User : public QObject
|
||||
{
|
||||
class User : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
public: // static member function
|
||||
|
||||
Reference in New Issue
Block a user