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 #include "src/model/interface.h"
21 
22 #include <QObject>
23 
24 class ToxId;
25 
26 class IProfileInfo
27 {
28 public:
29     enum class RenameResult {
30         OK, EmptyName, ProfileAlreadyExists, Error
31     };
32 
33     enum class SaveResult {
34         OK, EmptyPath, NoWritePermission, Error
35     };
36 
37     enum class SetAvatarResult {
38         OK, EmptyPath, CanNotOpen, CanNotRead, TooLarge
39     };
40     virtual ~IProfileInfo() = default;
41 
42     virtual bool setPassword(const QString& password) = 0;
43     virtual bool deletePassword() = 0;
44     virtual bool isEncrypted() const = 0;
45 
46     virtual void copyId() const = 0;
47 
48     virtual void setUsername(const QString& name) = 0;
49     virtual void setStatusMessage(const QString& status) = 0;
50 
51     virtual QString getProfileName() const = 0;
52     virtual RenameResult renameProfile(const QString& name) = 0;
53     virtual SaveResult exportProfile(const QString& path) const = 0;
54     virtual QStringList removeProfile() = 0;
55     virtual void logout() = 0;
56 
57     virtual void copyQr(const QImage& image) const = 0;
58     virtual SaveResult saveQr(const QImage& image, const QString& path) const = 0;
59 
60     virtual SetAvatarResult setAvatar(const QString& path) = 0;
61     virtual void removeAvatar() = 0;
62 
63     DECLARE_SIGNAL(idChanged, const ToxId&);
64     DECLARE_SIGNAL(usernameChanged, const QString&);
65     DECLARE_SIGNAL(statusMessageChanged, const QString&);
66 };
67