qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
iprofileinfo.h
Go to the documentation of this file.
1 /*
2  Copyright © 2017-2019 by The qTox Project Contributors
3 
4  This file is part of qTox, a Qt-based graphical interface for Tox.
5 
6  qTox is libre software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  qTox is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with qTox. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "util/interface.h"
23 
24 #include <QObject>
25 
26 class ToxId;
27 
29 {
30 public:
31  enum class RenameResult {
33  };
34 
35  enum class SaveResult {
37  };
38 
39  enum class SetAvatarResult {
41  };
42 
43  IProfileInfo() = default;
44  virtual ~IProfileInfo();
45  IProfileInfo(const IProfileInfo&) = default;
46  IProfileInfo& operator=(const IProfileInfo&) = default;
47  IProfileInfo(IProfileInfo&&) = default;
48  IProfileInfo& operator=(IProfileInfo&&) = default;
49 
50  virtual bool setPassword(const QString& password) = 0;
51  virtual bool deletePassword() = 0;
52  virtual bool isEncrypted() const = 0;
53 
54  virtual void copyId() const = 0;
55 
56  virtual void setUsername(const QString& name) = 0;
57  virtual void setStatusMessage(const QString& status) = 0;
58 
59  virtual QString getProfileName() const = 0;
60  virtual RenameResult renameProfile(const QString& name) = 0;
61  virtual SaveResult exportProfile(const QString& path) const = 0;
62  virtual QStringList removeProfile() = 0;
63  virtual void logout() = 0;
64 
65  virtual void copyQr(const QImage& image) const = 0;
66  virtual SaveResult saveQr(const QImage& image, const QString& path) const = 0;
67 
68  virtual SetAvatarResult setAvatar(const QString& path) = 0;
69  virtual void removeAvatar() = 0;
70 
71  DECLARE_SIGNAL(idChanged, const ToxId&);
72  DECLARE_SIGNAL(usernameChanged, const QString&);
73  DECLARE_SIGNAL(statusMessageChanged, const QString&);
74 };
IProfileInfo
Definition: iprofileinfo.h:28
IProfileInfo::SaveResult::EmptyPath
@ EmptyPath
IProfileInfo::~IProfileInfo
virtual ~IProfileInfo()
IProfileInfo::setPassword
virtual bool setPassword(const QString &password)=0
IProfileInfo::RenameResult
RenameResult
Definition: iprofileinfo.h:31
IProfileInfo::IProfileInfo
IProfileInfo()=default
IProfileInfo::SaveResult::NoWritePermission
@ NoWritePermission
IProfileInfo::renameProfile
virtual RenameResult renameProfile(const QString &name)=0
IProfileInfo::isEncrypted
virtual bool isEncrypted() const =0
IProfileInfo::getProfileName
virtual QString getProfileName() const =0
IProfileInfo::SetAvatarResult::TooLarge
@ TooLarge
IProfileInfo::deletePassword
virtual bool deletePassword()=0
IProfileInfo::copyQr
virtual void copyQr(const QImage &image) const =0
IProfileInfo::exportProfile
virtual SaveResult exportProfile(const QString &path) const =0
IProfileInfo::SetAvatarResult::CanNotRead
@ CanNotRead
IProfileInfo::logout
virtual void logout()=0
IProfileInfo::setAvatar
virtual SetAvatarResult setAvatar(const QString &path)=0
IProfileInfo::setUsername
virtual void setUsername(const QString &name)=0
IProfileInfo::setStatusMessage
virtual void setStatusMessage(const QString &status)=0
IProfileInfo::SaveResult
SaveResult
Definition: iprofileinfo.h:35
IProfileInfo::RenameResult::OK
@ OK
IProfileInfo::saveQr
virtual SaveResult saveQr(const QImage &image, const QString &path) const =0
IProfileInfo::RenameResult::EmptyName
@ EmptyName
ToxId
This class represents a Tox ID.
Definition: toxid.h:29
IProfileInfo::operator=
IProfileInfo & operator=(const IProfileInfo &)=default
IProfileInfo::SetAvatarResult
SetAvatarResult
Definition: iprofileinfo.h:39
IProfileInfo::SetAvatarResult::CanNotOpen
@ CanNotOpen
IProfileInfo::SetAvatarResult::OK
@ OK
IProfileInfo::RenameResult::Error
@ Error
IProfileInfo::copyId
virtual void copyId() const =0
IProfileInfo::DECLARE_SIGNAL
DECLARE_SIGNAL(idChanged, const ToxId &)
IProfileInfo::removeProfile
virtual QStringList removeProfile()=0
IProfileInfo::SaveResult::Error
@ Error
IProfileInfo::removeAvatar
virtual void removeAvatar()=0
IProfileInfo::RenameResult::ProfileAlreadyExists
@ ProfileAlreadyExists
IProfileInfo::SetAvatarResult::EmptyPath
@ EmptyPath
IProfileInfo::SaveResult::OK
@ OK