diff options
| author | Edwin Mons <edwin.mons@isode.com> | 2018-11-08 14:12:36 (GMT) |
|---|---|---|
| committer | Edwin Mons <edwin.mons@isode.com> | 2018-11-08 15:30:19 (GMT) |
| commit | 0b4e062a59613b2597b712c0106c3ed08b747637 (patch) | |
| tree | 7b062a8123d37be7226d4eb36c553b04563255c6 /Swift/QtUI | |
| parent | cf3d517763a3d74a2ec9fd6f7bdee8cbaee3550f (diff) | |
| download | swift-0b4e062a59613b2597b712c0106c3ed08b747637.zip swift-0b4e062a59613b2597b712c0106c3ed08b747637.tar.bz2 | |
Change unread counters to size_t
Since the counters cannot be negative, changing the type used for unread
counters to size_t seems a better fit, and it avoids the need for
numeric_casts.
Test-Information:
Unit tests pass on macOS 10.13
Change-Id: I61badcfc410f0cce7f922da90b50ef5a809c6521
Diffstat (limited to 'Swift/QtUI')
| -rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.cpp | 2 | ||||
| -rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.h | 4 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 4 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatWindow.h | 6 | ||||
| -rw-r--r-- | Swift/QtUI/QtTabbable.h | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index e92ba0d..2fd05c4 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp | |||
| @@ -130,7 +130,7 @@ void QtChatListWindow::setRecents(const std::list<ChatListWindow::Chat>& recents | |||
| 130 | model_->setRecents(recents); | 130 | model_->setRecents(recents); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | void QtChatListWindow::setUnreadCount(int unread) { | 133 | void QtChatListWindow::setUnreadCount(size_t unread) { |
| 134 | emit onCountUpdated(unread); | 134 | emit onCountUpdated(unread); |
| 135 | } | 135 | } |
| 136 | 136 | ||
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h index 001650c..3322001 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.h +++ b/Swift/QtUI/ChatList/QtChatListWindow.h | |||
| @@ -27,12 +27,12 @@ namespace Swift { | |||
| 27 | void removeWhiteboardSession(const JID& jid); | 27 | void removeWhiteboardSession(const JID& jid); |
| 28 | void setBookmarksEnabled(bool enabled); | 28 | void setBookmarksEnabled(bool enabled); |
| 29 | void setRecents(const std::list<ChatListWindow::Chat>& recents); | 29 | void setRecents(const std::list<ChatListWindow::Chat>& recents); |
| 30 | void setUnreadCount(int unread); | 30 | void setUnreadCount(size_t unread); |
| 31 | void clearBookmarks(); | 31 | void clearBookmarks(); |
| 32 | virtual void setOnline(bool isOnline); | 32 | virtual void setOnline(bool isOnline); |
| 33 | 33 | ||
| 34 | signals: | 34 | signals: |
| 35 | void onCountUpdated(int count); | 35 | void onCountUpdated(size_t count); |
| 36 | private slots: | 36 | private slots: |
| 37 | void handleItemActivated(const QModelIndex&); | 37 | void handleItemActivated(const QModelIndex&); |
| 38 | void handleEditBookmark(); | 38 | void handleEditBookmark(); |
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index a413b4d..82c65ce 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp | |||
| @@ -505,7 +505,7 @@ void QtChatWindow::showEvent(QShowEvent* event) { | |||
| 505 | QWidget::showEvent(event); | 505 | QWidget::showEvent(event); |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | void QtChatWindow::setUnreadMessageCount(int count) { | 508 | void QtChatWindow::setUnreadMessageCount(size_t count) { |
| 509 | if (unreadCount_ != count) { | 509 | if (unreadCount_ != count) { |
| 510 | unreadCount_ = count; | 510 | unreadCount_ = count; |
| 511 | updateTitleWithUnreadCount(); | 511 | updateTitleWithUnreadCount(); |
| @@ -547,7 +547,7 @@ void QtChatWindow::flash() { | |||
| 547 | emit requestFlash(); | 547 | emit requestFlash(); |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | int QtChatWindow::getCount() { | 550 | size_t QtChatWindow::getCount() { |
| 551 | return unreadCount_; | 551 | return unreadCount_; |
| 552 | } | 552 | } |
| 553 | 553 | ||
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 8cc3283..b876d1e 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h | |||
| @@ -106,7 +106,7 @@ namespace Swift { | |||
| 106 | void show(); | 106 | void show(); |
| 107 | bool isVisible() const; | 107 | bool isVisible() const; |
| 108 | void activate(); | 108 | void activate(); |
| 109 | void setUnreadMessageCount(int count); | 109 | void setUnreadMessageCount(size_t count); |
| 110 | void convertToMUC(MUCType mucType); | 110 | void convertToMUC(MUCType mucType); |
| 111 | // TreeWidget *getTreeWidget(); | 111 | // TreeWidget *getTreeWidget(); |
| 112 | void setAvailableSecurityLabels(const std::vector<SecurityLabelsCatalog::Item>& labels); | 112 | void setAvailableSecurityLabels(const std::vector<SecurityLabelsCatalog::Item>& labels); |
| @@ -119,7 +119,7 @@ namespace Swift { | |||
| 119 | void setContactChatState(ChatState::ChatStateType state); | 119 | void setContactChatState(ChatState::ChatStateType state); |
| 120 | void setRosterModel(Roster* roster); | 120 | void setRosterModel(Roster* roster); |
| 121 | void setTabComplete(TabComplete* completer); | 121 | void setTabComplete(TabComplete* completer); |
| 122 | int getCount(); | 122 | size_t getCount(); |
| 123 | virtual void replaceSystemMessage(const ChatMessage& message, const std::string& id, const TimestampBehaviour timestampBehaviour); | 123 | virtual void replaceSystemMessage(const ChatMessage& message, const std::string& id, const TimestampBehaviour timestampBehaviour); |
| 124 | void replaceLastMessage(const ChatMessage& message, const TimestampBehaviour timestampBehaviour); | 124 | void replaceLastMessage(const ChatMessage& message, const TimestampBehaviour timestampBehaviour); |
| 125 | void setAckState(const std::string& id, AckState state); | 125 | void setAckState(const std::string& id, AckState state); |
| @@ -201,7 +201,7 @@ namespace Swift { | |||
| 201 | void handleFocusTimerTick(); | 201 | void handleFocusTimerTick(); |
| 202 | 202 | ||
| 203 | private: | 203 | private: |
| 204 | int unreadCount_; | 204 | size_t unreadCount_; |
| 205 | bool contactIsTyping_; | 205 | bool contactIsTyping_; |
| 206 | LastLineTracker lastLineTracker_; | 206 | LastLineTracker lastLineTracker_; |
| 207 | std::string id_; | 207 | std::string id_; |
diff --git a/Swift/QtUI/QtTabbable.h b/Swift/QtUI/QtTabbable.h index 5837702..63c60f4 100644 --- a/Swift/QtUI/QtTabbable.h +++ b/Swift/QtUI/QtTabbable.h | |||
| @@ -19,7 +19,7 @@ namespace Swift { | |||
| 19 | 19 | ||
| 20 | bool isWidgetSelected(); | 20 | bool isWidgetSelected(); |
| 21 | virtual AlertType getWidgetAlertState() {return NoActivity;} | 21 | virtual AlertType getWidgetAlertState() {return NoActivity;} |
| 22 | virtual int getCount() {return 0;} | 22 | virtual size_t getCount() {return 0;} |
| 23 | virtual std::string getID() const = 0; | 23 | virtual std::string getID() const = 0; |
| 24 | virtual void setEmphasiseFocus(bool /*emphasise*/) {} | 24 | virtual void setEmphasiseFocus(bool /*emphasise*/) {} |
| 25 | 25 | ||
Swift