diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-12-12 12:29:20 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-12-12 16:00:53 (GMT) |
commit | 4315ccbd51f63e408d69d944f162d0ead4f9addd (patch) | |
tree | 046b3734d18c7c5e76040e8798a6f4af5e5045cb /Swift/QtUI/QtNameWidget.h | |
parent | aaf38fe2e6804bd87ea5e99a05ed57070cbe1c57 (diff) | |
download | swift-contrib-4315ccbd51f63e408d69d944f162d0ead4f9addd.zip swift-contrib-4315ccbd51f63e408d69d944f162d0ead4f9addd.tar.bz2 |
Refactored own nickname handling.
Diffstat (limited to 'Swift/QtUI/QtNameWidget.h')
-rw-r--r-- | Swift/QtUI/QtNameWidget.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Swift/QtUI/QtNameWidget.h b/Swift/QtUI/QtNameWidget.h new file mode 100644 index 0000000..c1c3e07 --- /dev/null +++ b/Swift/QtUI/QtNameWidget.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <QWidget> + +class QLabel; +class QStackedWidget; + +namespace Swift { + class QtElidingLabel; + class QtLineEdit; + + class QtNameWidget : public QWidget { + Q_OBJECT + + public: + QtNameWidget(QWidget *parent); + + void setNick(const QString& text); + void setJID(const QString& jid); + + signals: + /** + * When this is emitted, the widget is disabled until + * setNick() is called. + */ + void onChangeNickRequest(const QString& nick); + + private slots: + void handleEditComplete(); + void handleEditCancelled(); + virtual void mouseDoubleClickEvent(QMouseEvent* event); + + private: + void updateText(); + + private: + QStackedWidget* stack; + QtElidingLabel* textLabel; + QtLineEdit* nickEdit; + QString jid; + QString nick; + }; +} + |