summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-10-07 20:37:01 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-12-22 14:29:24 (GMT)
commit8f922ebfe8b1fd8c7d394da0ebeaf02f04c8e48f (patch)
tree1926a516d3d643160c22925db7bea44e5712ba4f
parentfa500ac6870324e10ae90656c03a88666200634b (diff)
downloadswift-8f922ebfe8b1fd8c7d394da0ebeaf02f04c8e48f.zip
swift-8f922ebfe8b1fd8c7d394da0ebeaf02f04c8e48f.tar.bz2
Allow toggling of a more compact roster mode
Change-Id: I2da5116ab8467645b83afa1908f438301f326dbe
-rw-r--r--Swift/ChangeLog.md4
-rw-r--r--Swift/QtUI/QtMainWindow.cpp16
-rw-r--r--Swift/QtUI/QtMainWindow.h2
-rw-r--r--Swift/QtUI/Roster/RosterDelegate.cpp1
4 files changed, 23 insertions, 0 deletions
diff --git a/Swift/ChangeLog.md b/Swift/ChangeLog.md
index bef90f5..6046ba1 100644
--- a/Swift/ChangeLog.md
+++ b/Swift/ChangeLog.md
@@ -1,12 +1,16 @@
+3.0-beta1
+---------
+- Allow toggling of a more compact roster display.
+
2.0-beta2
---------
- Enable auto-completion of nicknames that don't start with a letter.
- Generate crash dumps on Windows.
- Connection timeouts are now on each connection separately, instead of on the complete connection process.
- Don't allow pressing `<Enter>` in the roster to trigger logins.
- Don't lose security labels when correcting a message.
- Don't crash when completing user search without selection.
- Always auto join MUC with a consistent nickname.
- Renamed `swift` binary to `swift-im` on Linux.
- Avoid woosh down and woosh up on Mac when opening chat windows.
- Improved MUC invitation dialog.
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index 5d50c1e..8f74a8d 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -86,24 +86,32 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr
tabs_->addTab(chatListWindow_, tr("C&hats"));
tabs_->addTab(eventWindow_, tr("&Notices"));
tabs_->setCurrentIndex(settings_->getSetting(QtUISettingConstants::CURRENT_ROSTER_TAB));
connect(tabs_, SIGNAL(currentChanged(int)), this, SLOT(handleTabChanged(int)));
this->setLayout(mainLayout);
QMenu* viewMenu = new QMenu(tr("&View"), this);
menus_.push_back(viewMenu);
+
+ compactRosterAction_ = new QAction(tr("&Compact Roster"), this);
+ compactRosterAction_->setCheckable(true);
+ compactRosterAction_->setChecked(false);
+ connect(compactRosterAction_, SIGNAL(toggled(bool)), SLOT(handleCompactRosterToggled(bool)));
+ viewMenu->addAction(compactRosterAction_);
+ handleCompactRosterToggled(settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER));
+
showOfflineAction_ = new QAction(tr("&Show offline contacts"), this);
showOfflineAction_->setCheckable(true);
showOfflineAction_->setChecked(false);
connect(showOfflineAction_, SIGNAL(toggled(bool)), SLOT(handleShowOfflineToggled(bool)));
viewMenu->addAction(showOfflineAction_);
handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE));
if (emoticonsExist) {
showEmoticonsAction_ = new QAction(tr("&Show Emoticons"), this);
showEmoticonsAction_->setCheckable(true);
showEmoticonsAction_->setChecked(false);
connect(showEmoticonsAction_, SIGNAL(toggled(bool)), SLOT(handleShowEmoticonsToggled(bool)));
@@ -252,24 +260,32 @@ void QtMainWindow::handleStatusChanged(StatusShow::Type showType, const QString
}
void QtMainWindow::handleSettingChanged(const std::string& settingPath) {
if (settingPath == SettingConstants::SHOW_OFFLINE.getKey()) {
handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE));
}
if (settingPath == QtUISettingConstants::SHOW_EMOTICONS.getKey()) {
handleShowEmoticonsToggled(settings_->getSetting(QtUISettingConstants::SHOW_EMOTICONS));
}
if (settingPath == SettingConstants::REQUEST_DELIVERYRECEIPTS.getKey()) {
toggleRequestDeliveryReceipts_->setChecked(settings_->getSetting(SettingConstants::REQUEST_DELIVERYRECEIPTS));
}
+ if (settingPath == QtUISettingConstants::COMPACT_ROSTER.getKey()) {
+ handleCompactRosterToggled(settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER));
+ }
+}
+
+void QtMainWindow::handleCompactRosterToggled(bool state) {
+ settings_->storeSetting(QtUISettingConstants::COMPACT_ROSTER, state);
+ compactRosterAction_->setChecked(settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER));
}
void QtMainWindow::handleShowOfflineToggled(bool state) {
settings_->storeSetting(SettingConstants::SHOW_OFFLINE, state);
showOfflineAction_->setChecked(settings_->getSetting(SettingConstants::SHOW_OFFLINE));
}
void QtMainWindow::handleShowEmoticonsToggled(bool state) {
settings_->storeSetting(QtUISettingConstants::SHOW_EMOTICONS, state);
showEmoticonsAction_->setChecked(settings_->getSetting(QtUISettingConstants::SHOW_EMOTICONS));
}
diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h
index 26d25e1..f91610a 100644
--- a/Swift/QtUI/QtMainWindow.h
+++ b/Swift/QtUI/QtMainWindow.h
@@ -46,24 +46,25 @@ namespace Swift {
void setMyStatusType(StatusShow::Type type);
void setConnecting();
void setStreamEncryptionStatus(bool tlsInPlaceAndValid);
void openCertificateDialog(const std::vector<Certificate::ref>& chain);
static void openCertificateDialog(const std::vector<Certificate::ref>& chain, QWidget* parent);
QtEventWindow* getEventWindow();
QtChatListWindow* getChatListWindow();
void setRosterModel(Roster* roster);
void setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& commands);
private slots:
void handleStatusChanged(StatusShow::Type showType, const QString &statusMessage);
void handleSettingChanged(const std::string& settingPath);
+ void handleCompactRosterToggled(bool);
void handleShowOfflineToggled(bool);
void handleShowEmoticonsToggled(bool);
void handleJoinMUCAction();
void handleViewLogsAction();
void handleSignOutAction();
void handleEditProfileAction();
void handleAddUserActionTriggered(bool checked);
void handleChatUserActionTriggered(bool checked);
void handleAdHocActionTriggered(bool checked);
void handleEventCountUpdated(int count);
void handleChatCountUpdated(int count);
void handleEditProfileRequest();
@@ -72,24 +73,25 @@ namespace Swift {
void handleShowCertificateInfo();
private:
SettingsProvider* settings_;
QtLoginWindow::QtMenus loginMenus_;
std::vector<QMenu*> menus_;
QtRosterWidget* treeWidget_;
QtRosterHeader* meView_;
QAction* addUserAction_;
QAction* editUserAction_;
QAction* chatUserAction_;
QAction* showOfflineAction_;
+ QAction* compactRosterAction_;
QAction* showEmoticonsAction_;
QAction* toggleRequestDeliveryReceipts_;
QMenu* serverAdHocMenu_;
QtTabWidget* tabs_;
QWidget* contactsTabWidget_;
QWidget* eventsTabWidget_;
QtEventWindow* eventWindow_;
QtChatListWindow* chatListWindow_;
UIEventStream* uiEventStream_;
std::vector<DiscoItems::Item> serverAdHocCommands_;
QList<QAction*> serverAdHocCommandActions_;
};
diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp
index 7e6428b..5c964ca 100644
--- a/Swift/QtUI/Roster/RosterDelegate.cpp
+++ b/Swift/QtUI/Roster/RosterDelegate.cpp
@@ -26,24 +26,25 @@ namespace Swift {
RosterDelegate::RosterDelegate(QtTreeWidget* tree, bool compact) : compact_(compact) {
tree_ = tree;
groupDelegate_ = new GroupItemDelegate();
}
RosterDelegate::~RosterDelegate() {
delete groupDelegate_;
}
void RosterDelegate::setCompact(bool compact) {
compact_ = compact;
+ emit sizeHintChanged(QModelIndex());
}
QSize RosterDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index ) const {
RosterItem* item = static_cast<RosterItem*>(index.internalPointer());
if (dynamic_cast<GroupRosterItem*>(item)) {
return groupDelegate_->sizeHint(option, index);
}
return contactSizeHint(option, index);
}
QSize RosterDelegate::contactSizeHint(const QStyleOptionViewItem& option, const QModelIndex& index ) const {
return common_.contactSizeHint(option, index, compact_);