summaryrefslogtreecommitdiff
path: root/ui/qt5/useraccountwidget.hh
blob: 8fc12b443a1dcafb95898d84ebd0d0cbcc9e8243 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * useraccountwidget.cc - Implementation of a widget for managing user accounts
 * horizon-qt5, the Qt 5 user interface for
 * Project Horizon
 *
 * Copyright (c) 2019 Adélie Linux and contributors.  All rights reserved.
 * This code is licensed under the AGPL 3.0 license, as noted in the
 * LICENSE-code file in the root directory of this repository.
 *
 * SPDX-License-Identifier: AGPL-3.0-only
 */

#ifndef USERACCOUNTWIDGET_HH
#define USERACCOUNTWIDGET_HH

#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QWidget>

class UserAccountWidget : public QWidget {
    Q_OBJECT
public:
    /*! Constructs a new User Account widget. */
    UserAccountWidget(QWidget *parent = nullptr);

    /*! Returns the current text in the Account Name text entry. */
    QString accountText(void) const;
    /*! Sets the current text in the Account Name text entry. */
    void setAccountText(QString);
    /*! Returns the current avatar location (or an empty string). */
    QString avatarPath(void) const;
    /*! Returns the current text in the passphrase entry. */
    QString passphraseText(void) const;
    /*! Returns the current text in the Personal Name text entry. */
    QString personalText(void) const;
    /*! Sets the current text in the Personal Name text entry. */
    void setPersonalText(QString);

    /*! Returns whether the Admin tickbox is ticked or not. */
    bool isAdmin(void) const;
    /*! Changes whether the Admin tickbox is ticked or not. */
    void setAdmin(bool);

    /*! Returns whether the widget defines a valid account. */
    bool isValid(void) const;
signals:
    void validityChanged();
private:
    QLineEdit *accountName;
    QLineEdit *personalName;
    QLineEdit *passphrase;
    QPushButton *aviButton;
    QCheckBox *adminTick;
    QString aviPath;
    /*! When set, auto-update of accountName from personalName is prevented. */
    bool acctEverTouched;
};

#endif  /* !USERACCOUNTWIDGET_HH */