diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-01-30 22:40:16 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-01-30 22:40:16 (GMT) |
commit | 34029b7c0d076f96cd35c9a87ae6303f14d4ff14 (patch) | |
tree | 6d9476018ee124defc5dd727adbf017bd8108749 /Swift/QtUI | |
parent | 6c6d21d6fdec74ae97ea653aaad799524a13447d (diff) | |
download | swift-34029b7c0d076f96cd35c9a87ae6303f14d4ff14.zip swift-34029b7c0d076f96cd35c9a87ae6303f14d4ff14.tar.bz2 |
Clickable roster header for profile edits (incomplete)
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtNameWidget.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtNameWidget.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.h | 1 |
6 files changed, 20 insertions, 1 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index d313aba..ccf5a59 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -28,6 +28,7 @@ #include "Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h" #include "Swift/Controllers/UIEvents/RequestAddUserDialogUIEvent.h" #include "Swift/Controllers/UIEvents/RequestChatWithUserDialogUIEvent.h" +#include "Swift/Controllers/UIEvents/RequestProfileEditorUIEvent.h" #include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h" #include "Swift/Controllers/UIEvents/ToggleShowOfflineUIEvent.h" @@ -42,6 +43,7 @@ QtMainWindow::QtMainWindow(QtSettingsProvider* settings, UIEventStream* uiEventS meView_ = new QtRosterHeader(settings, this); mainLayout->addWidget(meView_); connect(meView_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleStatusChanged(StatusShow::Type, const QString&))); + connect(meView_, SIGNAL(onEditProfileRequest()), this, SLOT(handleEditProfileRequest())); tabs_ = new QtTabWidget(this); #if QT_VERSION >= 0x040500 @@ -121,6 +123,10 @@ void QtMainWindow::setRosterModel(Roster* roster) { treeWidget_->setRosterModel(roster); } +void QtMainWindow::handleEditProfileRequest() { + uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); +} + void QtMainWindow::handleEventCountUpdated(int count) { QColor eventTabColor = (count == 0) ? QColor() : QColor(255, 0, 0); // invalid resets to default int eventIndex = 1; @@ -147,7 +153,7 @@ void QtMainWindow::handleSignOutAction() { } void QtMainWindow::handleEditProfileAction() { - onEditProfileRequest(); + uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); } void QtMainWindow::handleJoinMUCAction() { diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index 938feff..67b89d8 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -58,6 +58,7 @@ namespace Swift { void handleAddUserActionTriggered(bool checked); void handleChatUserActionTriggered(bool checked); void handleEventCountUpdated(int count); + void handleEditProfileRequest(); private: std::vector<QMenu*> menus_; diff --git a/Swift/QtUI/QtNameWidget.cpp b/Swift/QtUI/QtNameWidget.cpp index 705d8af..c85b2e9 100644 --- a/Swift/QtUI/QtNameWidget.cpp +++ b/Swift/QtUI/QtNameWidget.cpp @@ -57,6 +57,9 @@ void QtNameWidget::mousePressEvent(QMouseEvent* event) { } menu.addAction(showAsJID); + QAction* editProfile = new QAction("Edit Profile", this); + menu.addAction(editProfile); + QAction* result = menu.exec(event->globalPos()); if (result == showAsJID) { mode = ShowJID; @@ -64,6 +67,9 @@ void QtNameWidget::mousePressEvent(QMouseEvent* event) { else if (result == showAsNick) { mode = ShowNick; } + else if (result == editProfile) { + emit onChangeNickRequest(); + } settings->storeBool("showNickInRosterHeader", mode == ShowNick); updateText(); } diff --git a/Swift/QtUI/QtNameWidget.h b/Swift/QtUI/QtNameWidget.h index 313108d..674d55c 100644 --- a/Swift/QtUI/QtNameWidget.h +++ b/Swift/QtUI/QtNameWidget.h @@ -21,6 +21,9 @@ namespace Swift { void setNick(const QString& text); void setJID(const QString& jid); + signals: + void onChangeNickRequest(); + private: void updateText(); virtual void mousePressEvent(QMouseEvent* event); diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index 855c861..0fad137 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -33,6 +33,7 @@ QtRosterHeader::QtRosterHeader(QtSettingsProvider* settings, QWidget* parent) : setAvatar(":/icons/avatar.png"); avatarLabel_->setScaledContents(false); topLayout->addWidget(avatarLabel_); + //connect(avatarLabel_, SIGNAL(clicked()), this, SIGNAL(onEditProfileRequest())); /* FIXME: clickableish signal for label */ QVBoxLayout* rightLayout = new QVBoxLayout(); rightLayout->setSpacing(4); @@ -40,6 +41,7 @@ QtRosterHeader::QtRosterHeader(QtSettingsProvider* settings, QWidget* parent) : topLayout->addLayout(rightLayout); nameWidget_ = new QtNameWidget(settings, this); + connect(nameWidget_, SIGNAL(onChangeNickRequest()), this, SIGNAL(onEditProfileRequest())); rightLayout->addWidget(nameWidget_); diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 5634bdf..6c76993 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -38,6 +38,7 @@ namespace Swift { void setConnecting(); signals: void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage); + void onEditProfileRequest(); private slots: void handleChangeStatusRequest(StatusShow::Type type, const QString &statusMessage); |