currentaccountcombobox.h 3.15 KB
Newer Older
1
/***************************************************************************
2
 * Copyright (C) 2019-2019 by Savoir-faire Linux                                *
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 * Author: Isa Nanic <isa.nanic@savoirfairelinux.com>                      *
 * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>          *
 *                                                                         *
 * This program is free software; you can redistribute it and/or modify    *
 * it under the terms of the GNU General Public License as published by    *
 * the Free Software Foundation; either version 3 of the License, or       *
 * (at your option) any later version.                                     *
 *                                                                         *
 * This program is distributed in the hope that it will be useful,         *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 * GNU General Public License for more details.                            *
 *                                                                         *
 * You should have received a copy of the GNU General Public License       *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 **************************************************************************/
19

20
#pragma once
21

22 23
#include "accountlistmodel.h"
#include "accountitemdelegate.h"
24 25 26 27 28
#include "notifypushbutton.h"

#include <QComboBox>
#include <QLabel>
#include <QPushButton>
29 30 31 32 33 34 35 36

namespace Ui {
    class CurrentAccountComboBox;
}

class CurrentAccountComboBox : public QComboBox
{
    Q_OBJECT
37
    CurrentAccountComboBox(const CurrentAccountComboBox& cpy);
38 39 40 41

public:
    explicit CurrentAccountComboBox(QWidget* parent = nullptr);
    ~CurrentAccountComboBox();
42 43
    void accountListUpdate();
    void setCurrentIndex(int index);
44
    void updateComboBoxDisplay();
45
    void canPlaceAudioOnlyCall(const std::string& convUid) { emit placeAudioOnlyCall(convUid); }
46

47 48
signals:
    void settingsButtonClicked();
Andreas Traczyk's avatar
Andreas Traczyk committed
49
    void newAccountClicked();
50
    void placeAudioOnlyCall(const std::string& convUid);
51

52
protected:
53
    void paintEvent(QPaintEvent* e);
54
    void resizeEvent(QResizeEvent *event);
55
    void mousePressEvent(QMouseEvent* mouseEvent);
56
    void mouseMoveEvent(QMouseEvent* event);
57
    void leaveEvent(QEvent * event);
Andreas Traczyk's avatar
Andreas Traczyk committed
58 59
    void showPopup();
    void hidePopup();
60

61
private:
62
    void connectVoiceMail();
63 64
    void importLabelPhoto(int index);
    void setupSettingsButton();
65
    void setupVoicemailButton();
66 67 68 69 70

    AccountItemDelegate* accountItemDelegate_;
    std::unique_ptr<AccountListModel> accountListModel_;

    QPixmap currentAccountAvatarImage_;
71 72
    int cellHeight_ = 60; // [screen awareness]
    int avatarSize_ = 48; // [screen awareness]
73 74 75 76 77 78 79
    const int elidConst = 35; // [screen awareness]
    const int gearBorder_ = 4;
    const int gearSize_ = 24;
    bool popupPresent = false;

    QPoint gearPoint_;
    QLabel gearLabel_;
80 81 82 83 84 85 86

    QPoint voicemailPoint_;
    NotifyPushButton voicemailButton_;
    const int voicemailBorder_ = 4;
    const int voicemailSize_ = 24;

    std::map<std::string,std::pair<int,int>> voicemailMap_;
87
};