summaryrefslogtreecommitdiffstats
blob: 5f9962b664277997a6ec0913844735e7c485fec1 (plain)
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
/*
 * Copyright (c) 2010-2014 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#pragma once

#include <QWidget>

namespace Swift {
	class QtElidingLabel;
	class SettingsProvider;

	class QtNameWidget : public QWidget {
			Q_OBJECT

		public:
			QtNameWidget(SettingsProvider* settings, QWidget *parent);

			void setNick(const QString& text);
			void setJID(const QString& jid);
			void setOnline(const bool isOnline);

		signals:
			void onChangeNickRequest();

		private:
			void updateText();
			virtual void mousePressEvent(QMouseEvent* event);

		private:
			enum Mode {
				ShowNick,
				ShowJID
			};

			SettingsProvider* settings;
			Mode mode;
			QtElidingLabel* textLabel;
			QString jid;
			QString nick;
			bool isOnline_;
	};
}