File: profiledialog.h

package info (click to toggle)
quaternion 0.0.97.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,800 kB
  • sloc: cpp: 8,380; xml: 172; sh: 5; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 1,900 bytes parent folder | download
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
61
62
63
64
65
66
/**************************************************************************
 *                                                                        *
 * SPDX-FileCopyrightText: 2019 Karol Kosek <krkkx@protonmail.com>        *
 *                                                                        *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *                                                                        *
 **************************************************************************/

#pragma once

#include "dialog.h"

#include <Quotient/settings.h>
#include <Quotient/csapi/definitions/client_device.h>

#include <QtCore/QPointer>

class AccountSelector;
class MainWindow;

class QComboBox;
class QLineEdit;

namespace Quotient {
class AccountRegistry;
class GetDevicesJob;
class Connection;
class KeyVerificationSession;
}

class ProfileDialog : public Dialog
{
    Q_OBJECT
public:
    explicit ProfileDialog(Quotient::AccountRegistry* accounts,
                           MainWindow* parent);
    ~ProfileDialog() override;

    void setAccount(Quotient::Connection* newAccount);
    Quotient::Connection* account() const;

private slots:
    void load() override;
    void apply() override;
    void uploadAvatar();
    Quotient::KeyVerificationSession* initiateVerification(const QString& deviceId,
                                                           QAction* verifyAction);

private:
    Quotient::SettingsGroup m_settings;

    class DeviceTable;
    DeviceTable* m_deviceTable;
    QPushButton* m_avatar;
    AccountSelector* m_accountSelector;
    QLineEdit* m_displayName;
    QLabel* m_accessTokenLabel;

    Quotient::Connection* m_currentAccount;
    QString m_newAvatarPath;
    QPointer<Quotient::GetDevicesJob> m_devicesJob;
    QVector<Quotient::Device> m_devices;

    void setVerifiedItem(int row, const QString& deviceId);
    void refreshDevices();
};