qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
profileform.h
Go to the documentation of this file.
1 /*
2  Copyright © 2014-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 "src/widget/qrwidget.h"
23 #include <QLabel>
24 #include <QLineEdit>
25 #include <QTimer>
26 #include <QVBoxLayout>
27 
28 class ContentLayout;
29 class CroppingLabel;
30 class IProfileInfo;
32 
33 namespace Ui {
34 class IdentitySettings;
35 }
36 class ToxId;
37 class ClickableTE : public QLabel
38 {
39  Q_OBJECT
40 public:
41 signals:
42  void clicked();
43 
44 protected:
45  void mouseReleaseEvent(QMouseEvent*) final
46  {
47  emit clicked();
48  }
49 };
50 
51 class ProfileForm : public QWidget
52 {
53  Q_OBJECT
54 public:
55  ProfileForm(IProfileInfo* profileInfo, QWidget* parent = nullptr);
56  ~ProfileForm();
57  void show(ContentLayout* contentLayout);
58  bool isShown() const;
59 
60 public slots:
61  void onSelfAvatarLoaded(const QPixmap& pic);
62  void onLogoutClicked();
63 
64 private slots:
66  void setToxId(const ToxId& id);
67  void copyIdClicked();
68  void onUserNameEdited();
69  void onStatusMessageEdited();
70  void onRenameClicked();
71  void onExportClicked();
72  void onDeleteClicked();
73  void onCopyQrClicked();
74  void onSaveQrClicked();
75  void onDeletePassClicked();
76  void onChangePassClicked();
77  void onAvatarClicked();
78  void showProfilePictureContextMenu(const QPoint& point);
79 
80 private:
81  void retranslateUi();
82  void prFileLabelUpdate();
83  bool eventFilter(QObject* object, QEvent* event);
84  void refreshProfiles();
85  static QString getSupportedImageFilter();
86 
87 private:
88  Ui::IdentitySettings* bodyUI;
90  QTimer timer;
91  bool hasCheck = false;
95 };
ProfileForm::onExportClicked
void onExportClicked()
Definition: profileform.cpp:342
IProfileInfo
Definition: iprofileinfo.h:28
ProfileForm::show
void show(ContentLayout *contentLayout)
Definition: profileform.cpp:208
QRWidget
Definition: qrwidget.h:25
ProfileForm::ProfileForm
ProfileForm(IProfileInfo *profileInfo, QWidget *parent=nullptr)
Definition: profileform.cpp:100
ProfileForm::setPasswordButtonsText
void setPasswordButtonsText()
Definition: profileform.cpp:393
CroppingLabel
Definition: croppinglabel.h:26
ProfileForm::onStatusMessageEdited
void onStatusMessageEdited()
Definition: profileform.cpp:269
ProfileForm::~ProfileForm
~ProfileForm()
Definition: profileform.cpp:191
ProfileForm::onSaveQrClicked
void onSaveQrClicked()
Definition: profileform.cpp:409
ProfileForm::onRenameClicked
void onRenameClicked()
Definition: profileform.cpp:323
ProfileForm
Definition: profileform.h:51
ProfileForm::hasCheck
bool hasCheck
Definition: profileform.h:91
ProfileForm::prFileLabelUpdate
void prFileLabelUpdate()
Definition: profileform.cpp:185
ProfileForm::setToxId
void setToxId(const ToxId &id)
Definition: profileform.cpp:279
Ui
Definition: filetransferwidget.h:30
ClickableTE::clicked
void clicked()
ProfileForm::onDeletePassClicked
void onDeletePassClicked()
Definition: profileform.cpp:428
ProfileForm::profileInfo
IProfileInfo * profileInfo
Definition: profileform.h:94
ProfileForm::copyIdClicked
void copyIdClicked()
Definition: profileform.cpp:253
MaskablePixmapWidget
Definition: maskablepixmapwidget.h:24
ProfileForm::retranslateUi
void retranslateUi()
Definition: profileform.cpp:461
ProfileForm::toxId
ClickableTE * toxId
Definition: profileform.h:93
ProfileForm::profilePicture
MaskablePixmapWidget * profilePicture
Definition: profileform.h:89
ClickableTE::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *) final
Definition: profileform.h:45
ProfileForm::onDeleteClicked
void onDeleteClicked()
Definition: profileform.cpp:362
ClickableTE
Definition: profileform.h:37
ToxId
This class represents a Tox ID.
Definition: toxid.h:29
ProfileForm::onSelfAvatarLoaded
void onSelfAvatarLoaded(const QPixmap &pic)
Definition: profileform.cpp:274
ProfileForm::showProfilePictureContextMenu
void showProfilePictureContextMenu(const QPoint &point)
Definition: profileform.cpp:239
ProfileForm::onCopyQrClicked
void onCopyQrClicked()
Definition: profileform.cpp:404
ProfileForm::onUserNameEdited
void onUserNameEdited()
Definition: profileform.cpp:264
ProfileForm::onChangePassClicked
void onChangePassClicked()
Definition: profileform.cpp:447
ContentLayout
Definition: contentlayout.h:25
ProfileForm::onLogoutClicked
void onLogoutClicked()
Definition: profileform.cpp:388
ProfileForm::onAvatarClicked
void onAvatarClicked()
Definition: profileform.cpp:306
ProfileForm::isShown
bool isShown() const
Definition: profileform.cpp:198
ProfileForm::eventFilter
bool eventFilter(QObject *object, QEvent *event)
Definition: profileform.cpp:229
ProfileForm::timer
QTimer timer
Definition: profileform.h:90
ProfileForm::getSupportedImageFilter
static QString getSupportedImageFilter()
Definition: profileform.cpp:296
qrwidget.h
ProfileForm::bodyUI
Ui::IdentitySettings * bodyUI
Definition: profileform.h:88
ProfileForm::refreshProfiles
void refreshProfiles()
ProfileForm::qr
QRWidget * qr
Definition: profileform.h:92