qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProfileInfo Class Reference

Implement interface, that provides invormation about self profile. Also, provide methods to work with profile file. More...

#include <profileinfo.h>

Inheritance diagram for ProfileInfo:
Inheritance graph
Collaboration diagram for ProfileInfo:
Collaboration graph

Public Member Functions

 ProfileInfo (Core *core, Profile *profile)
 ProfileInfo constructor. More...
 
bool setPassword (const QString &password) override
 Set a user password for profile. More...
 
bool deletePassword () override
 Delete a user password for profile. More...
 
bool isEncrypted () const override
 Check if current profile is encrypted. More...
 
void copyId () const override
 Copy self ToxId to clipboard. More...
 
void setUsername (const QString &name) override
 Set self user name. More...
 
void setStatusMessage (const QString &status) override
 Set self status message. More...
 
QString getProfileName () const override
 Get name of tox profile file. More...
 
RenameResult renameProfile (const QString &name) override
 Rename profile file. More...
 
SaveResult exportProfile (const QString &path) const override
 Save profile in custom place. More...
 
QStringList removeProfile () override
 Remove profile. More...
 
void logout () override
 Log out from current profile. More...
 
void copyQr (const QImage &image) const override
 Copy image to clipboard. More...
 
SaveResult saveQr (const QImage &image, const QString &path) const override
 Save image to file. More...
 
SetAvatarResult setAvatar (const QString &path) override
 Set self avatar. More...
 
void removeAvatar () override
 Remove self avatar. More...
 
- Public Member Functions inherited from IProfileInfo
 IProfileInfo ()=default
 
virtual ~IProfileInfo ()
 
 IProfileInfo (const IProfileInfo &)=default
 
IProfileInfooperator= (const IProfileInfo &)=default
 
 IProfileInfo (IProfileInfo &&)=default
 
IProfileInfooperator= (IProfileInfo &&)=default
 
 DECLARE_SIGNAL (idChanged, const ToxId &)
 
 DECLARE_SIGNAL (usernameChanged, const QString &)
 
 DECLARE_SIGNAL (statusMessageChanged, const QString &)
 

Private Member Functions

IProfileInfo::SetAvatarResult createAvatarFromFile (QFile &file, QByteArray &avatar)
 Create an avatar from an image file. More...
 
IProfileInfo::SetAvatarResult byteArrayToPng (QByteArray inData, QByteArray &outPng)
 Create a png from image data. More...
 
IProfileInfo::SetAvatarResult scalePngToAvatar (QByteArray &avatar)
 

Private Attributes

Profile *const profile
 
Core *const core
 

Additional Inherited Members

- Public Types inherited from IProfileInfo
enum  RenameResult { RenameResult::OK, RenameResult::EmptyName, RenameResult::ProfileAlreadyExists, RenameResult::Error }
 
enum  SaveResult { SaveResult::OK, SaveResult::EmptyPath, SaveResult::NoWritePermission, SaveResult::Error }
 
enum  SetAvatarResult {
  SetAvatarResult::OK, SetAvatarResult::EmptyPath, SetAvatarResult::CanNotOpen, SetAvatarResult::CanNotRead,
  SetAvatarResult::TooLarge
}
 

Detailed Description

Implement interface, that provides invormation about self profile. Also, provide methods to work with profile file.

Note
Should be used only when QAppliaction constructed.

Definition at line 32 of file profileinfo.h.

Constructor & Destructor Documentation

◆ ProfileInfo()

ProfileInfo::ProfileInfo ( Core core,
Profile profile 
)

ProfileInfo constructor.

Parameters
corePointer to Tox Core.
profilePointer to Profile.
Note
All pointers parameters shouldn't be null.

Definition at line 46 of file profileinfo.cpp.

Member Function Documentation

◆ byteArrayToPng()

IProfileInfo::SetAvatarResult ProfileInfo::byteArrayToPng ( QByteArray  inData,
QByteArray &  outPng 
)
private

Create a png from image data.

Parameters
inDatabyte array from an image file.
outPngbyte array which the png will be written to.
Returns
SetAvatarResult

Definition at line 334 of file profileinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyId()

void ProfileInfo::copyId ( ) const
overridevirtual

Copy self ToxId to clipboard.

Implements IProfileInfo.

Definition at line 88 of file profileinfo.cpp.

Here is the call graph for this function:

◆ copyQr()

void ProfileInfo::copyQr ( const QImage &  image) const
overridevirtual

Copy image to clipboard.

Parameters
imageImage to copy.

Implements IProfileInfo.

Definition at line 240 of file profileinfo.cpp.

◆ createAvatarFromFile()

IProfileInfo::SetAvatarResult ProfileInfo::createAvatarFromFile ( QFile &  file,
QByteArray &  avatar 
)
private

Create an avatar from an image file.

Parameters
fileImage file, which should be the new avatar.
avatarOutput avatar of correct file type and size.
Returns
SetAvatarResult

Definition at line 316 of file profileinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deletePassword()

bool ProfileInfo::deletePassword ( )
overridevirtual

Delete a user password for profile.

Returns
True on success, false otherwise.

Implements IProfileInfo.

Definition at line 70 of file profileinfo.cpp.

Here is the call graph for this function:

◆ exportProfile()

IProfileInfo::SaveResult ProfileInfo::exportProfile ( const QString &  path) const
overridevirtual

Save profile in custom place.

Parameters
pathPath to save profile.
Returns
Result code of save operation.

Implements IProfileInfo.

Definition at line 196 of file profileinfo.cpp.

Here is the call graph for this function:

◆ getProfileName()

QString ProfileInfo::getProfileName ( ) const
overridevirtual

Get name of tox profile file.

Returns
Profile name.

Implements IProfileInfo.

Definition at line 121 of file profileinfo.cpp.

Here is the call graph for this function:

◆ isEncrypted()

bool ProfileInfo::isEncrypted ( ) const
overridevirtual

Check if current profile is encrypted.

Returns
True if encrypted, false otherwise.

Implements IProfileInfo.

Definition at line 80 of file profileinfo.cpp.

Here is the call graph for this function:

◆ logout()

void ProfileInfo::logout ( )
overridevirtual

Log out from current profile.

Implements IProfileInfo.

Definition at line 228 of file profileinfo.cpp.

Here is the call graph for this function:

◆ removeAvatar()

void ProfileInfo::removeAvatar ( )
overridevirtual

Remove self avatar.

Implements IProfileInfo.

Definition at line 384 of file profileinfo.cpp.

Here is the call graph for this function:

◆ removeProfile()

QStringList ProfileInfo::removeProfile ( )
overridevirtual

Remove profile.

Returns
List of files, which couldn't be removed automaticaly.

Implements IProfileInfo.

Definition at line 218 of file profileinfo.cpp.

Here is the call graph for this function:

◆ renameProfile()

IProfileInfo::RenameResult ProfileInfo::renameProfile ( const QString &  name)
overridevirtual

Rename profile file.

Parameters
nameNew profile name.
Returns
Result code of rename operation.

Implements IProfileInfo.

Definition at line 157 of file profileinfo.cpp.

Here is the call graph for this function:

◆ saveQr()

IProfileInfo::SaveResult ProfileInfo::saveQr ( const QImage &  image,
const QString &  path 
) const
overridevirtual

Save image to file.

Parameters
imageImage to save.
pathPath to save.
Returns
Result code of save operation.

Implements IProfileInfo.

Definition at line 251 of file profileinfo.cpp.

Here is the call graph for this function:

◆ scalePngToAvatar()

IProfileInfo::SetAvatarResult ProfileInfo::scalePngToAvatar ( QByteArray &  avatar)
private

Definition at line 360 of file profileinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAvatar()

IProfileInfo::SetAvatarResult ProfileInfo::setAvatar ( const QString &  path)
overridevirtual

Set self avatar.

Parameters
pathPath to image, which should be the new avatar.
Returns
Code of set avatar operation.

Implements IProfileInfo.

Definition at line 291 of file profileinfo.cpp.

Here is the call graph for this function:

◆ setPassword()

bool ProfileInfo::setPassword ( const QString &  password)
overridevirtual

Set a user password for profile.

Parameters
passwordNew password.
Returns
True on success, false otherwise.

Implements IProfileInfo.

Definition at line 60 of file profileinfo.cpp.

Here is the call graph for this function:

◆ setStatusMessage()

void ProfileInfo::setStatusMessage ( const QString &  status)
overridevirtual

Set self status message.

Parameters
statusNew status message.

Implements IProfileInfo.

Definition at line 112 of file profileinfo.cpp.

Here is the call graph for this function:

◆ setUsername()

void ProfileInfo::setUsername ( const QString &  name)
overridevirtual

Set self user name.

Parameters
nameNew name.

Implements IProfileInfo.

Definition at line 103 of file profileinfo.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ core

Core* const ProfileInfo::core
private

Definition at line 68 of file profileinfo.h.

◆ profile

Profile* const ProfileInfo::profile
private

Definition at line 67 of file profileinfo.h.


The documentation for this class was generated from the following files: