1
1
/****************************************************************************
2
* Copyright (C) 2009-2013 by Savoir-Faire Linux *
2
* Copyright (C) 2009-2014 by Savoir-Faire Linux *
3
3
* Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> *
4
4
* Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
22
22
#include "ui_dlgaccountsbase.h"
23
23
#include "../lib/account.h"
24
#include "../lib/callmanager_interface_singleton.h"
24
#include "../lib/dbus/callmanager.h"
25
#include "../lib/ringtonemodel.h"
26
#include <QtGui/QStyledItemDelegate>
30
32
class KConfigDialog;
33
typedef QHash<QString, QString> StringHash; //Needed to fix a Qt foreach macro argument parsing bug
35
///RingToneListItem: Ringtone list widget
36
class RingToneListItem : public QWidget
39
friend class DlgAccounts;
41
RingToneListItem(QString path, QString name) : QWidget(0),m_Path(path) {
42
QHBoxLayout* l = new QHBoxLayout(this);
43
m_pPlayPB = new QPushButton(this);
44
QLabel* lblName = new QLabel(name,this);
45
l->setContentsMargins(0,0,0,0);
46
m_pPlayPB->setIcon(KIcon("media-playback-start"));
47
m_pPlayPB->setVisible(false);
48
lblName->setStyleSheet("padding-left:5px;");
49
lblName->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
50
l->addWidget(lblName);
51
l->addWidget(m_pPlayPB);
52
connect(m_pPlayPB,SIGNAL(clicked()),this,SLOT(playRingtone()));
55
///Show the button when the cursor is over the item
56
virtual void enterEvent ( QEvent * event ) {
58
m_pPlayPB->setVisible(true);
60
///Hide the button when the mouse leave the button
61
virtual void leaveEvent ( QEvent * event ) {
63
m_pPlayPB->setVisible(false);
66
///Play the ringtone file when the button is clicked
68
CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
69
Q_NOREPLY callManager.startRecordedFilePlayback(m_Path);
73
QPushButton* m_pPlayPB;
77
39
* @author Jérémy Quentin <jeremy.quentin@gmail.com>
110
QList<StringHash> codecList ;
72
QList< QHash<QString, QString> > codecList ;
111
73
bool accountListHasChanged ;
112
74
QMap<QString,QString> m_hRingtonePath ;
76
TipManager* m_pTipManager ;
80
Account* currentAccount() const;
116
83
void loadAccountList ();
129
96
void addCredential ();
130
97
void removeCredential ();
131
98
void enablePublished ();
132
void updateAccountStates ();
99
// void updateAccountStates ();
133
100
void updateAccountListCommands ();
134
101
void main_password_field_changed ();
135
102
void main_credential_password_changed ();
143
110
void loadVidCodecDetails ( const QModelIndex& current, const QModelIndex& previous );
144
111
void selectedCodecChanged ( const QModelIndex& current, const QModelIndex& previous );
145
void updateStatusLabel ( QModelIndex item );
146
void accountListChanged ( QModelIndex current, QModelIndex previous );
147
void selectCredential ( QModelIndex item, QModelIndex previous );
112
void updateStatusLabel ( const QModelIndex& item );
113
void updateStatusLabel ( );
114
void accountListChanged ( const QModelIndex& current, const QModelIndex& previous );
115
void selectCredential ( const QModelIndex& item , const QModelIndex& previous );
148
116
void updateStatusLabel ( Account* account );
149
117
void updateCombo ( int value );
150
118
void saveCredential ( );