diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-14 18:57:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-14 21:36:32 (GMT) |
commit | cb05f5a908e20006c954ce38755c2e422ecc2388 (patch) | |
tree | a793551a5fe279a57d4330119560e8542f745484 /Swift/QtUI | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Swift/QtUI')
41 files changed, 140 insertions, 140 deletions
diff --git a/Swift/QtUI/ApplicationTest/main.cpp b/Swift/QtUI/ApplicationTest/main.cpp index 4e93452..a5f3820 100644 --- a/Swift/QtUI/ApplicationTest/main.cpp +++ b/Swift/QtUI/ApplicationTest/main.cpp @@ -9,7 +9,7 @@ #include <QVBoxLayout> #include <QLineEdit> #include "../QtSwiftUtil.h" -#include "Swiften/Base/String.h" +#include <string> #include "SwifTools/Application/Platform/PlatformApplication.h" using namespace Swift; diff --git a/Swift/QtUI/EventViewer/QtEvent.cpp b/Swift/QtUI/EventViewer/QtEvent.cpp index 21d713f..f0bc276 100644 --- a/Swift/QtUI/EventViewer/QtEvent.cpp +++ b/Swift/QtUI/EventViewer/QtEvent.cpp @@ -57,8 +57,8 @@ QString QtEvent::text() { } boost::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); if (subscriptionRequestEvent) { - String reason = subscriptionRequestEvent->getReason(); - String message = subscriptionRequestEvent->getJID().toBare().toString() + " would like to add you to their roster" + (reason.isEmpty() ? "." : ", saying '" + reason + "'."); + std::string reason = subscriptionRequestEvent->getReason(); + std::string message = subscriptionRequestEvent->getJID().toBare().toString() + " would like to add you to their roster" + (reason.empty() ? "." : ", saying '" + reason + "'."); return P2QSTRING(message); } boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); diff --git a/Swift/QtUI/FreeDesktopNotifier.cpp b/Swift/QtUI/FreeDesktopNotifier.cpp index 1edf19c..037f67b 100644 --- a/Swift/QtUI/FreeDesktopNotifier.cpp +++ b/Swift/QtUI/FreeDesktopNotifier.cpp @@ -18,10 +18,10 @@ namespace Swift { -FreeDesktopNotifier::FreeDesktopNotifier(const String& name) : applicationName(name) { +FreeDesktopNotifier::FreeDesktopNotifier(const std::string& name) : applicationName(name) { } -void FreeDesktopNotifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()>) { +void FreeDesktopNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()>) { QDBusConnection bus = QDBusConnection::sessionBus(); if (!bus.isConnected()) { return; diff --git a/Swift/QtUI/FreeDesktopNotifier.h b/Swift/QtUI/FreeDesktopNotifier.h index 0bbf6bb..2214a1a 100644 --- a/Swift/QtUI/FreeDesktopNotifier.h +++ b/Swift/QtUI/FreeDesktopNotifier.h @@ -12,12 +12,12 @@ namespace Swift { class FreeDesktopNotifier : public Notifier { public: - FreeDesktopNotifier(const String& name); + FreeDesktopNotifier(const std::string& name); - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback); + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback); private: - String applicationName; + std::string applicationName; QtCachedImageScaler imageScaler; }; } diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp index bdc121c..1e624b3 100644 --- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp +++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp @@ -185,7 +185,7 @@ MUCSearchRoomItem* QtMUCSearchWindow::getSelectedRoom() const { } } } - if (lstIndex.empty()) { + if (lstIndex.isEmpty()) { return NULL; } else { diff --git a/Swift/QtUI/NotifierTest/NotifierTest.cpp b/Swift/QtUI/NotifierTest/NotifierTest.cpp index 65641b0..e165993 100644 --- a/Swift/QtUI/NotifierTest/NotifierTest.cpp +++ b/Swift/QtUI/NotifierTest/NotifierTest.cpp @@ -7,14 +7,14 @@ #include <iostream> #include <boost/bind.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/Notifier/GrowlNotifier.h" #include <QApplication> using namespace Swift; -void notificationClicked(const String& message) { +void notificationClicked(const std::string& message) { std::cout << "Notification clicked: " << message << std::endl; } diff --git a/Swift/QtUI/QtAvatarWidget.cpp b/Swift/QtUI/QtAvatarWidget.cpp index 941e20e..0879d46 100644 --- a/Swift/QtUI/QtAvatarWidget.cpp +++ b/Swift/QtUI/QtAvatarWidget.cpp @@ -42,7 +42,7 @@ QtAvatarWidget::QtAvatarWidget(QWidget* parent) : QWidget(parent) { layout->addWidget(label); } -void QtAvatarWidget::setAvatar(const ByteArray& data, const String& type) { +void QtAvatarWidget::setAvatar(const ByteArray& data, const std::string& type) { this->data = data; this->type = type; diff --git a/Swift/QtUI/QtAvatarWidget.h b/Swift/QtUI/QtAvatarWidget.h index ce4d192..8830d82 100644 --- a/Swift/QtUI/QtAvatarWidget.h +++ b/Swift/QtUI/QtAvatarWidget.h @@ -18,13 +18,13 @@ namespace Swift { public: QtAvatarWidget(QWidget* parent); - void setAvatar(const ByteArray& data, const String& type); + void setAvatar(const ByteArray& data, const std::string& type); const ByteArray& getAvatarData() const { return data; } - const String& getAvatarType() const { + const std::string& getAvatarType() const { return type; } @@ -32,7 +32,7 @@ namespace Swift { private: ByteArray data; - String type; + std::string type; QLabel* label; }; } diff --git a/Swift/QtUI/QtBookmarkDetailWindow.cpp b/Swift/QtUI/QtBookmarkDetailWindow.cpp index d83e2eb..c0f04e2 100644 --- a/Swift/QtUI/QtBookmarkDetailWindow.cpp +++ b/Swift/QtUI/QtBookmarkDetailWindow.cpp @@ -27,23 +27,23 @@ boost::optional<MUCBookmark> QtBookmarkDetailWindow::createBookmarkFromForm() { //check room //check bookmarkName JID room(Q2PSTRING(room_->text())); - if (!room.isValid() || room.getNode().isEmpty() || !room.getResource().isEmpty()) { + if (!room.isValid() || room.getNode().empty() || !room.getResource().empty()) { QMessageBox::warning(this, "Bookmark not valid", "You must specify a valid room address (e.g. myroom@chats.example.com)."); return boost::optional<MUCBookmark>(); } - String name(Q2PSTRING(name_->text())); - if (name.isEmpty()) { + std::string name(Q2PSTRING(name_->text())); + if (name.empty()) { name = room.toString(); } MUCBookmark bookmark(room, name); - String nick(Q2PSTRING(nick_->text())); - String password(Q2PSTRING(password_->text())); + std::string nick(Q2PSTRING(nick_->text())); + std::string password(Q2PSTRING(password_->text())); bookmark.setAutojoin(autojoin_->isChecked()); - if (!nick.isEmpty()) { + if (!nick.empty()) { bookmark.setNick(nick); } - if (!password.isEmpty()) { + if (!password.empty()) { bookmark.setPassword(password); } return bookmark; diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 62a696e..dac9e93 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -233,7 +233,7 @@ QtTabbable::AlertType QtChatWindow::getWidgetAlertState() { return NoActivity; } -void QtChatWindow::setName(const String& name) { +void QtChatWindow::setName(const std::string& name) { contact_ = P2QSTRING(name); updateTitleWithUnreadCount(); } @@ -247,11 +247,11 @@ void QtChatWindow::updateTitleWithUnreadCount() { emit titleUpdated(); } -String QtChatWindow::addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(message, senderName, senderIsSelf, label, avatarPath, "", time); } -String QtChatWindow::addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const QString& style, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -269,8 +269,8 @@ String QtChatWindow::addMessage(const String &message, const String &senderName, htmlString += styleSpanStart + messageHTML + styleSpanEnd; bool appendToPrevious = !previousMessageWasSystem_ && !previousMessageWasPresence_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName))); - QString qAvatarPath = avatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(P2QSTRING(avatarPath)).toEncoded(); - String id = id_.generateID(); + QString qAvatarPath = avatarPath.empty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(P2QSTRING(avatarPath)).toEncoded(); + std::string id = id_.generateID(); messageLog_->addMessage(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, Qt::escape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); previousMessageWasSelf_ = senderIsSelf; @@ -284,7 +284,7 @@ void QtChatWindow::flash() { emit requestFlash(); } -void QtChatWindow::setAckState(String const& id, ChatWindow::AckState state) { +void QtChatWindow::setAckState(std::string const& id, ChatWindow::AckState state) { QString xml; switch (state) { case ChatWindow::Pending: xml = "<img src='qrc:/icons/throbber.gif' alt='This message has not been received by your server yet.'/>"; break; @@ -298,11 +298,11 @@ int QtChatWindow::getCount() { return unreadCount_; } -String QtChatWindow::addAction(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addAction(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(" *" + message + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ", time); } -void QtChatWindow::addErrorMessage(const String& errorMessage) { +void QtChatWindow::addErrorMessage(const std::string& errorMessage) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -316,7 +316,7 @@ void QtChatWindow::addErrorMessage(const String& errorMessage) { previousMessageWasPresence_ = false; } -void QtChatWindow::addSystemMessage(const String& message) { +void QtChatWindow::addSystemMessage(const std::string& message) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -331,7 +331,7 @@ void QtChatWindow::addSystemMessage(const String& message) { previousMessageWasPresence_ = false; } -void QtChatWindow::addPresenceMessage(const String& message) { +void QtChatWindow::addPresenceMessage(const std::string& message) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -390,7 +390,7 @@ void QtChatWindow::moveEvent(QMoveEvent*) { emit geometryChanged(); } -void QtChatWindow::replaceLastMessage(const String& message) { +void QtChatWindow::replaceLastMessage(const std::string& message) { messageLog_->replaceLastMessage(P2QSTRING(Linkify::linkify(message))); } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 20c8685..dbcfe9c 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -30,11 +30,11 @@ namespace Swift { public: QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventStream* eventStream); ~QtChatWindow(); - String addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time); - String addAction(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time); - void addSystemMessage(const String& message); - void addPresenceMessage(const String& message); - void addErrorMessage(const String& errorMessage); + std::string addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time); + std::string addAction(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time); + void addSystemMessage(const std::string& message); + void addPresenceMessage(const std::string& message); + void addErrorMessage(const std::string& errorMessage); void show(); void activate(); void setUnreadMessageCount(int count); @@ -44,15 +44,15 @@ namespace Swift { void setSecurityLabelsEnabled(bool enabled); void setSecurityLabelsError(); SecurityLabel getSelectedSecurityLabel(); - void setName(const String& name); + void setName(const std::string& name); void setInputEnabled(bool enabled); QtTabbable::AlertType getWidgetAlertState(); void setContactChatState(ChatState::ChatStateType state); void setRosterModel(Roster* roster); void setTabComplete(TabComplete* completer); int getCount(); - void replaceLastMessage(const String& message); - void setAckState(const String& id, AckState state); + void replaceLastMessage(const std::string& message); + void setAckState(const std::string& id, AckState state); void flash(); signals: @@ -75,7 +75,7 @@ namespace Swift { private: void updateTitleWithUnreadCount(); void tabComplete(); - String addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const QString& style, const boost::posix_time::ptime& time); + std::string addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time); int unreadCount_; bool contactIsTyping_; diff --git a/Swift/QtUI/QtContactEditWidget.cpp b/Swift/QtUI/QtContactEditWidget.cpp index 1f97a37..e8fe24a 100644 --- a/Swift/QtUI/QtContactEditWidget.cpp +++ b/Swift/QtUI/QtContactEditWidget.cpp @@ -18,7 +18,7 @@ namespace Swift { -QtContactEditWidget::QtContactEditWidget(const std::set<String>& allGroups, QWidget* parent) : QWidget(parent), groups_(NULL) { +QtContactEditWidget::QtContactEditWidget(const std::set<std::string>& allGroups, QWidget* parent) : QWidget(parent), groups_(NULL) { QBoxLayout* layout = new QVBoxLayout(this); setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0); @@ -43,7 +43,7 @@ QtContactEditWidget::QtContactEditWidget(const std::set<String>& allGroups, QWid groupsArea->setWidget(groups); QVBoxLayout* scrollLayout = new QVBoxLayout(groups); - foreach (String group, allGroups) { + foreach (std::string group, allGroups) { QCheckBox* check = new QCheckBox(groups); check->setText(P2QSTRING(group)); check->setCheckState(Qt::Unchecked); @@ -63,22 +63,22 @@ QtContactEditWidget::QtContactEditWidget(const std::set<String>& allGroups, QWid scrollLayout->addItem(new QSpacerItem(20, 73, QSizePolicy::Minimum, QSizePolicy::Expanding)); } -void QtContactEditWidget::setName(const String& name) { +void QtContactEditWidget::setName(const std::string& name) { name_->setText(P2QSTRING(name)); } -String QtContactEditWidget::getName() const { +std::string QtContactEditWidget::getName() const { return Q2PSTRING(name_->text()); } -void QtContactEditWidget::setSelectedGroups(const std::vector<String>& groups) { - foreach (String group, groups) { +void QtContactEditWidget::setSelectedGroups(const std::vector<std::string>& groups) { + foreach (std::string group, groups) { checkBoxes_[group]->setCheckState(Qt::Checked); } } -std::set<String> QtContactEditWidget::getSelectedGroups() const { - std::set<String> groups; +std::set<std::string> QtContactEditWidget::getSelectedGroups() const { + std::set<std::string> groups; foreach(const CheckBoxMap::value_type& group, checkBoxes_) { if (group.second->checkState() == Qt::Checked) { groups.insert(group.first); diff --git a/Swift/QtUI/QtContactEditWidget.h b/Swift/QtUI/QtContactEditWidget.h index b855b6c..26a9968 100644 --- a/Swift/QtUI/QtContactEditWidget.h +++ b/Swift/QtUI/QtContactEditWidget.h @@ -12,7 +12,7 @@ #include <QWidget> -#include <Swiften/Base/String.h> +#include <string> class QLineEdit; class QCheckBox; @@ -22,16 +22,16 @@ namespace Swift { Q_OBJECT public: - QtContactEditWidget(const std::set<String>& allGroups, QWidget* parent); + QtContactEditWidget(const std::set<std::string>& allGroups, QWidget* parent); - void setName(const String&); - String getName() const; + void setName(const std::string&); + std::string getName() const; - void setSelectedGroups(const std::vector<String>& groups); - std::set<String> getSelectedGroups() const; + void setSelectedGroups(const std::vector<std::string>& groups); + std::set<std::string> getSelectedGroups() const; private: - typedef std::map<String, QCheckBox*> CheckBoxMap; + typedef std::map<std::string, QCheckBox*> CheckBoxMap; CheckBoxMap checkBoxes_; QLineEdit* name_; QWidget* groups_; diff --git a/Swift/QtUI/QtContactEditWindow.cpp b/Swift/QtUI/QtContactEditWindow.cpp index 0781f64..97b8f95 100644 --- a/Swift/QtUI/QtContactEditWindow.cpp +++ b/Swift/QtUI/QtContactEditWindow.cpp @@ -47,7 +47,7 @@ QtContactEditWindow::QtContactEditWindow() : contactEditWidget_(NULL) { buttonLayout->addWidget(okButton); } -void QtContactEditWindow::setContact(const JID& jid, const String& name, const std::vector<String>& groups, const std::set<String>& allGroups) { +void QtContactEditWindow::setContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const std::set<std::string>& allGroups) { delete contactEditWidget_; jid_ = jid; jidLabel_->setText("<b>" + P2QSTRING(jid.toString()) + "</b>"); diff --git a/Swift/QtUI/QtContactEditWindow.h b/Swift/QtUI/QtContactEditWindow.h index 25ea9b7..2d283de 100644 --- a/Swift/QtUI/QtContactEditWindow.h +++ b/Swift/QtUI/QtContactEditWindow.h @@ -9,7 +9,7 @@ #include <QWidget> #include <Swift/Controllers/UIInterfaces/ContactEditWindow.h> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/JID/JID.h> class QLabel; @@ -24,7 +24,7 @@ namespace Swift { public: QtContactEditWindow(); - virtual void setContact(const JID& jid, const String& name, const std::vector<String>& groups, const std::set<String>& allGroups); + virtual void setContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const std::set<std::string>& allGroups); void setEnabled(bool); void show(); diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp index 60558ad..5ffc34d 100644 --- a/Swift/QtUI/QtJoinMUCWindow.cpp +++ b/Swift/QtUI/QtJoinMUCWindow.cpp @@ -39,12 +39,12 @@ void QtJoinMUCWindow::handleSearch() { onSearchMUC(); } -void QtJoinMUCWindow::setNick(const String& nick) { +void QtJoinMUCWindow::setNick(const std::string& nick) { ui.nickName->setText(P2QSTRING(nick)); lastSetNick = nick; } -void QtJoinMUCWindow::setMUC(const String& nick) { +void QtJoinMUCWindow::setMUC(const std::string& nick) { ui.room->setText(P2QSTRING(nick)); } diff --git a/Swift/QtUI/QtJoinMUCWindow.h b/Swift/QtUI/QtJoinMUCWindow.h index 2d12319..6e8e846 100644 --- a/Swift/QtUI/QtJoinMUCWindow.h +++ b/Swift/QtUI/QtJoinMUCWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <Swiften/Base/String.h> +#include <string> #include <Swift/Controllers/UIInterfaces/JoinMUCWindow.h> #include <Swift/QtUI/ui_QtJoinMUCWindow.h> @@ -16,8 +16,8 @@ namespace Swift { public: QtJoinMUCWindow(); - virtual void setNick(const String& nick); - virtual void setMUC(const String& nick); + virtual void setNick(const std::string& nick); + virtual void setMUC(const std::string& nick); virtual void show(); @@ -27,6 +27,6 @@ namespace Swift { private: Ui::QtJoinMUCWindow ui; - String lastSetNick; + std::string lastSetNick; }; } diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index c3fdac2..aae11d1 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -215,7 +215,7 @@ void QtLoginWindow::handleUIEvent(boost::shared_ptr<UIEvent> event) { } } -void QtLoginWindow::selectUser(const String& username) { +void QtLoginWindow::selectUser(const std::string& username) { for (int i = 0; i < usernames_.count(); i++) { if (P2QSTRING(username) == usernames_[i]) { username_->setCurrentIndex(i); @@ -225,7 +225,7 @@ void QtLoginWindow::selectUser(const String& username) { } } -void QtLoginWindow::removeAvailableAccount(const String& jid) { +void QtLoginWindow::removeAvailableAccount(const std::string& jid) { QString username = P2QSTRING(jid); int index = -1; for (int i = 0; i < usernames_.count(); i++) { @@ -241,7 +241,7 @@ void QtLoginWindow::removeAvailableAccount(const String& jid) { } } -void QtLoginWindow::addAvailableAccount(const String& defaultJID, const String& defaultPassword, const String& defaultCertificate) { +void QtLoginWindow::addAvailableAccount(const std::string& defaultJID, const std::string& defaultPassword, const std::string& defaultCertificate) { QString username = P2QSTRING(defaultJID); int index = -1; for (int i = 0; i < usernames_.count(); i++) { @@ -371,8 +371,8 @@ void QtLoginWindow::morphInto(MainWindow *mainWindow) { } } -void QtLoginWindow::setMessage(const String& message) { - if (!message.isEmpty()) { +void QtLoginWindow::setMessage(const std::string& message) { + if (!message.empty()) { message_->setText("<center><font color=\"red\">" + P2QSTRING(message) + "</font></center>"); } else { @@ -406,7 +406,7 @@ void QtLoginWindow::moveEvent(QMoveEvent*) { emit geometryChanged(); } -bool QtLoginWindow::askUserToTrustCertificatePermanently(const String& message, Certificate::ref certificate) { +bool QtLoginWindow::askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref certificate) { QMessageBox dialog(this); dialog.setText("The certificate presented by the server is not valid."); diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index 6987906..3f3b5f8 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -32,13 +32,13 @@ namespace Swift { void morphInto(MainWindow *mainWindow); virtual void loggedOut(); - virtual void setMessage(const String& message); - virtual void addAvailableAccount(const String& defaultJID, const String& defaultPassword, const String& defaultCertificate); - virtual void removeAvailableAccount(const String& jid); + virtual void setMessage(const std::string& message); + virtual void addAvailableAccount(const std::string& defaultJID, const std::string& defaultPassword, const std::string& defaultCertificate); + virtual void removeAvailableAccount(const std::string& jid); virtual void setLoginAutomatically(bool loginAutomatically); virtual void setIsLoggingIn(bool loggingIn); - void selectUser(const String& user); - bool askUserToTrustCertificatePermanently(const String& message, Certificate::ref certificate); + void selectUser(const std::string& user); + bool askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref certificate); void hide(); virtual void quit(); diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index 2fd5700..6ebd8aa 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -175,7 +175,7 @@ void QtMainWindow::handleShowOfflineToggled(bool state) { } } -void QtMainWindow::setMyNick(const String& nick) { +void QtMainWindow::setMyNick(const std::string& nick) { meView_->setNick(P2QSTRING(nick)); } @@ -183,11 +183,11 @@ void QtMainWindow::setMyJID(const JID& jid) { meView_->setJID(P2QSTRING(jid.toBare().toString())); } -void QtMainWindow::setMyAvatarPath(const String& path) { +void QtMainWindow::setMyAvatarPath(const std::string& path) { meView_->setAvatar(P2QSTRING(path)); } -void QtMainWindow::setMyStatusText(const String& status) { +void QtMainWindow::setMyStatusText(const std::string& status) { meView_->setStatusText(P2QSTRING(status)); } diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index 66b0caf..0dc9d36 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -37,10 +37,10 @@ namespace Swift { QtMainWindow(QtSettingsProvider*, UIEventStream* eventStream); ~QtMainWindow(); std::vector<QMenu*> getMenus() {return menus_;} - void setMyNick(const String& name); + void setMyNick(const std::string& name); void setMyJID(const JID& jid); - void setMyAvatarPath(const String& path); - void setMyStatusText(const String& status); + void setMyAvatarPath(const std::string& path); + void setMyStatusText(const std::string& status); void setMyStatusType(StatusShow::Type type); void setConnecting(); QtEventWindow* getEventWindow(); diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp index 0a53f11..c4fe400 100644 --- a/Swift/QtUI/QtProfileWindow.cpp +++ b/Swift/QtUI/QtProfileWindow.cpp @@ -118,8 +118,8 @@ void QtProfileWindow::handleSave() { onVCardChangeRequest(vcard); } -void QtProfileWindow::setError(const String& error) { - if (!error.isEmpty()) { +void QtProfileWindow::setError(const std::string& error) { + if (!error.empty()) { errorLabel->setText("<font color='red'>" + P2QSTRING(error) + "</font>"); } else { diff --git a/Swift/QtUI/QtProfileWindow.h b/Swift/QtUI/QtProfileWindow.h index 1ad73e8..edb9cce 100644 --- a/Swift/QtUI/QtProfileWindow.h +++ b/Swift/QtUI/QtProfileWindow.h @@ -26,7 +26,7 @@ namespace Swift { void setVCard(Swift::VCard::ref); void setEnabled(bool); void setProcessing(bool); - virtual void setError(const String&); + virtual void setError(const std::string&); void show(); void hide(); diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 0dc611d..3380610 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -12,7 +12,7 @@ #include <QSize> #include <QToolBar> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/StatusShow.h" #include "QtTextEdit.h" diff --git a/Swift/QtUI/QtSettingsProvider.cpp b/Swift/QtUI/QtSettingsProvider.cpp index 4bddce3..4a8a868 100644 --- a/Swift/QtUI/QtSettingsProvider.cpp +++ b/Swift/QtUI/QtSettingsProvider.cpp @@ -18,35 +18,35 @@ QtSettingsProvider::~QtSettingsProvider() { } -String QtSettingsProvider::getStringSetting(const String &settingPath) { +std::string QtSettingsProvider::getStringSetting(const std::string &settingPath) { QVariant setting = settings_.value(P2QSTRING(settingPath)); return setting.isNull() ? "" : Q2PSTRING(setting.toString()); } -void QtSettingsProvider::storeString(const String &settingPath, const String &settingValue) { +void QtSettingsProvider::storeString(const std::string &settingPath, const std::string &settingValue) { settings_.setValue(P2QSTRING(settingPath), P2QSTRING(settingValue)); } -bool QtSettingsProvider::getBoolSetting(const String &settingPath, bool defaultValue) { +bool QtSettingsProvider::getBoolSetting(const std::string &settingPath, bool defaultValue) { QVariant setting = settings_.value(P2QSTRING(settingPath)); return setting.isNull() ? defaultValue : setting.toBool(); } -void QtSettingsProvider::storeBool(const String &settingPath, bool settingValue) { +void QtSettingsProvider::storeBool(const std::string &settingPath, bool settingValue) { settings_.setValue(P2QSTRING(settingPath), settingValue); } -int QtSettingsProvider::getIntSetting(const String &settingPath, int defaultValue) { +int QtSettingsProvider::getIntSetting(const std::string &settingPath, int defaultValue) { QVariant setting = settings_.value(P2QSTRING(settingPath)); return setting.isNull() ? defaultValue : setting.toInt(); } -void QtSettingsProvider::storeInt(const String &settingPath, int settingValue) { +void QtSettingsProvider::storeInt(const std::string &settingPath, int settingValue) { settings_.setValue(P2QSTRING(settingPath), settingValue); } -std::vector<String> QtSettingsProvider::getAvailableProfiles() { - std::vector<String> profiles; +std::vector<std::string> QtSettingsProvider::getAvailableProfiles() { + std::vector<std::string> profiles; QVariant profilesVariant = settings_.value("profileList"); foreach(QString profileQString, profilesVariant.toStringList()) { profiles.push_back(Q2PSTRING(profileQString)); @@ -54,13 +54,13 @@ std::vector<String> QtSettingsProvider::getAvailableProfiles() { return profiles; } -void QtSettingsProvider::createProfile(const String& profile) { +void QtSettingsProvider::createProfile(const std::string& profile) { QStringList stringList = settings_.value("profileList").toStringList(); stringList.append(P2QSTRING(profile)); settings_.setValue("profileList", stringList); } -void QtSettingsProvider::removeProfile(const String& profile) { +void QtSettingsProvider::removeProfile(const std::string& profile) { QString profileStart(P2QSTRING(profile) + ":"); foreach (QString key, settings_.allKeys()) { if (key.startsWith(profileStart)) { diff --git a/Swift/QtUI/QtSettingsProvider.h b/Swift/QtUI/QtSettingsProvider.h index d1dbc5e..ca05fe1 100644 --- a/Swift/QtUI/QtSettingsProvider.h +++ b/Swift/QtUI/QtSettingsProvider.h @@ -17,15 +17,15 @@ class QtSettingsProvider : public SettingsProvider { public: QtSettingsProvider(); virtual ~QtSettingsProvider(); - virtual String getStringSetting(const String &settingPath); - virtual void storeString(const String &settingPath, const String &settingValue); - virtual bool getBoolSetting(const String &settingPath, bool defaultValue); - virtual void storeBool(const String &settingPath, bool settingValue); - virtual int getIntSetting(const String &settingPath, int defaultValue); - virtual void storeInt(const String &settingPath, int settingValue); - virtual std::vector<String> getAvailableProfiles(); - virtual void createProfile(const String& profile); - virtual void removeProfile(const String& profile); + virtual std::string getStringSetting(const std::string &settingPath); + virtual void storeString(const std::string &settingPath, const std::string &settingValue); + virtual bool getBoolSetting(const std::string &settingPath, bool defaultValue); + virtual void storeBool(const std::string &settingPath, bool settingValue); + virtual int getIntSetting(const std::string &settingPath, int defaultValue); + virtual void storeInt(const std::string &settingPath, int settingValue); + virtual std::vector<std::string> getAvailableProfiles(); + virtual void createProfile(const std::string& profile); + virtual void removeProfile(const std::string& profile); QSettings* getQSettings(); private: QSettings settings_; diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp index b967cef..387c6f3 100644 --- a/Swift/QtUI/QtSoundPlayer.cpp +++ b/Swift/QtUI/QtSoundPlayer.cpp @@ -24,7 +24,7 @@ void QtSoundPlayer::playSound(SoundEffect sound) { } } -void QtSoundPlayer::playSound(const String& soundResource) { +void QtSoundPlayer::playSound(const std::string& soundResource) { boost::filesystem::path resourcePath = applicationPathProvider->getResourcePath(soundResource); if (boost::filesystem::exists(resourcePath)) { QSound::play(resourcePath.string().c_str()); diff --git a/Swift/QtUI/QtSoundPlayer.h b/Swift/QtUI/QtSoundPlayer.h index 21ad8bb..6945f45 100644 --- a/Swift/QtUI/QtSoundPlayer.h +++ b/Swift/QtUI/QtSoundPlayer.h @@ -12,7 +12,7 @@ namespace Swift { class ApplicationPathProvider; - class String; + class QtSoundPlayer : public QObject, public SoundPlayer { Q_OBJECT @@ -22,7 +22,7 @@ namespace Swift { void playSound(SoundEffect sound); private: - void playSound(const String& soundResource); + void playSound(const std::string& soundResource); private: ApplicationPathProvider* applicationPathProvider; diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 1c14dee..d4c306f 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -22,7 +22,7 @@ #include "SwifTools/Application/PlatformApplicationPathProvider.h" #include "Swiften/Avatars/AvatarFileStorage.h" #include "Swiften/Disco/CapsFileStorage.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/Platform.h" #include "Swift/Controllers/FileStoragesFactory.h" #include "Swiften/Elements/Presence.h" diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h index cc9eb38..978fa14 100644 --- a/Swift/QtUI/QtSwift.h +++ b/Swift/QtUI/QtSwift.h @@ -11,7 +11,7 @@ #include <Swiften/TLS/PlatformTLSFactories.h> #include <Swiften/Network/BoostNetworkFactories.h> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/Platform.h" #include "Swiften/EventLoop/Qt/QtEventLoop.h" #include "QtSettingsProvider.h" diff --git a/Swift/QtUI/QtSwiftUtil.h b/Swift/QtUI/QtSwiftUtil.h index 3f1ad3b..60a9f18 100644 --- a/Swift/QtUI/QtSwiftUtil.h +++ b/Swift/QtUI/QtSwiftUtil.h @@ -7,8 +7,8 @@ #ifndef SWIFT_QtSwiftUtil_H #define SWIFT_QtSwiftUtil_H -#define P2QSTRING(a) QString::fromUtf8(a.getUTF8Data()) -#define Q2PSTRING(a) Swift::String(a.toUtf8()) +#define P2QSTRING(a) QString::fromUtf8(a.c_str()) +#define Q2PSTRING(a) std::string(a.toUtf8()) #define B2QDATE(a) QDateTime::fromTime_t((a - boost::posix_time::from_time_t(0)).total_seconds()) diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp index 57e1278..42c8a8f 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.cpp +++ b/Swift/QtUI/QtXMLConsoleWidget.cpp @@ -14,7 +14,7 @@ #include <QCheckBox> #include "QtSwiftUtil.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { @@ -71,15 +71,15 @@ void QtXMLConsoleWidget::closeEvent(QCloseEvent* event) { event->accept(); } -void QtXMLConsoleWidget::handleDataRead(const String& data) { +void QtXMLConsoleWidget::handleDataRead(const std::string& data) { appendTextIfEnabled("<!-- IN -->\n" + data + "\n", QColor(33,98,33)); } -void QtXMLConsoleWidget::handleDataWritten(const String& data) { +void QtXMLConsoleWidget::handleDataWritten(const std::string& data) { appendTextIfEnabled("<!-- OUT -->\n" + data + "\n", QColor(155,1,0)); } -void QtXMLConsoleWidget::appendTextIfEnabled(const String& data, const QColor& color) { +void QtXMLConsoleWidget::appendTextIfEnabled(const std::string& data, const QColor& color) { if (enabled->isChecked()) { QScrollBar* scrollBar = textEdit->verticalScrollBar(); bool scrollToBottom = (!scrollBar || scrollBar->value() == scrollBar->maximum()); diff --git a/Swift/QtUI/QtXMLConsoleWidget.h b/Swift/QtUI/QtXMLConsoleWidget.h index 1cfe54f..a345495 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.h +++ b/Swift/QtUI/QtXMLConsoleWidget.h @@ -23,14 +23,14 @@ namespace Swift { void show(); void activate(); - virtual void handleDataRead(const String& data); - virtual void handleDataWritten(const String& data); + virtual void handleDataRead(const std::string& data); + virtual void handleDataWritten(const std::string& data); private: virtual void closeEvent(QCloseEvent* event); virtual void showEvent(QShowEvent* event); - void appendTextIfEnabled(const String& data, const QColor& color); + void appendTextIfEnabled(const std::string& data, const QColor& color); private: QTextEdit* textEdit; diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp index 97b2028..fcd8691 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp @@ -20,18 +20,18 @@ QtTreeWidgetItem::QtTreeWidgetItem(QtTreeWidgetItem* parentItem) : QObject(), te } -void QtTreeWidgetItem::setText(const String& text) { +void QtTreeWidgetItem::setText(const std::string& text) { displayName_ = P2QSTRING(text); displayNameLower_ = displayName_.toLower(); emit changed(this); } -void QtTreeWidgetItem::setStatusText(const String& text) { +void QtTreeWidgetItem::setStatusText(const std::string& text) { statusText_ = P2QSTRING(text); emit changed(this); } -void QtTreeWidgetItem::setAvatarPath(const String& path) { +void QtTreeWidgetItem::setAvatarPath(const std::string& path) { avatar_ = QIcon(P2QSTRING(path)); emit changed(this); } diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h index c042ae0..a2d0cdd 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.h +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h @@ -10,7 +10,7 @@ #include <QColor> #include <QVariant> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Roster/TreeWidgetFactory.h" #include "Swiften/Roster/TreeWidget.h" #include "Swiften/Roster/TreeWidgetItem.h" @@ -43,9 +43,9 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem { QVariant data(int role); QIcon getPresenceIcon(); QtTreeWidgetItem(QtTreeWidgetItem* parentItem); - void setText(const String& text); - void setAvatarPath(const String& path); - void setStatusText(const String& text); + void setText(const std::string& text); + void setAvatarPath(const std::string& path); + void setStatusText(const std::string& text); void setStatusShow(StatusShow::Type show); void setTextColor(unsigned long color); void setBackgroundColor(unsigned long color); diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index 95452c8..306b76f 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -137,9 +137,9 @@ QString RosterModel::getToolTip(RosterItem* item) const { QIcon RosterModel::getAvatar(RosterItem* item) const { ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item); if (!contact) return QIcon(); - String path = contact->getAvatarPath(); + std::string path = contact->getAvatarPath(); - return path.isEmpty() ? QIcon() : QIcon(P2QSTRING(path)); + return path.empty() ? QIcon() : QIcon(P2QSTRING(path)); } QString RosterModel::getStatusText(RosterItem* item) const { diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index ad06654..c6fb004 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -209,7 +209,7 @@ void QtUserSearchWindow::show() { // //void QtUserSearchWindow::handleOkClicked() { // JID contact = JID(Q2PSTRING(jid_->text())); -// String nick = Q2PSTRING(nickName_->text()); +// std::string nick = Q2PSTRING(nickName_->text()); // if (addToRoster_->isChecked()) { // boost::shared_ptr<UIEvent> event(new AddContactUIEvent(contact, nick)); // eventStream_->send(event); diff --git a/Swift/QtUI/UserSearch/UserSearchModel.cpp b/Swift/QtUI/UserSearch/UserSearchModel.cpp index 1187c29..aafd789 100644 --- a/Swift/QtUI/UserSearch/UserSearchModel.cpp +++ b/Swift/QtUI/UserSearch/UserSearchModel.cpp @@ -46,12 +46,12 @@ QVariant UserSearchModel::data(UserSearchResult* item, int role) { QString UserSearchModel::nameLine(UserSearchResult* item) { QString result; - const std::map<String, String> fields = item->getFields(); - std::map<String, String>::const_iterator first = fields.find("first"); + const std::map<std::string, std::string> fields = item->getFields(); + std::map<std::string, std::string>::const_iterator first = fields.find("first"); if (first != fields.end()) { result += P2QSTRING((*first).second); } - std::map<String, String>::const_iterator last = fields.find("last"); + std::map<std::string, std::string>::const_iterator last = fields.find("last"); if (last != fields.end()) { if (!result.isEmpty()) { result += " "; diff --git a/Swift/QtUI/WindowsNotifier.cpp b/Swift/QtUI/WindowsNotifier.cpp index 9646b90..49489a3 100644 --- a/Swift/QtUI/WindowsNotifier.cpp +++ b/Swift/QtUI/WindowsNotifier.cpp @@ -16,7 +16,7 @@ namespace Swift { -WindowsNotifier::WindowsNotifier(const String& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray) : tray(tray) { +WindowsNotifier::WindowsNotifier(const std::string& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray) : tray(tray) { notifierWindow = new QtWin32NotifierWindow(); snarlNotifier = new SnarlNotifier(name, notifierWindow, icon); connect(tray, SIGNAL(messageClicked()), SLOT(handleMessageClicked())); @@ -27,7 +27,7 @@ WindowsNotifier::~WindowsNotifier() { delete notifierWindow; } -void WindowsNotifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback) { +void WindowsNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) { if (snarlNotifier->isAvailable()) { snarlNotifier->showMessage(type, subject, description, picture, callback); return; diff --git a/Swift/QtUI/WindowsNotifier.h b/Swift/QtUI/WindowsNotifier.h index dbf86a2..062b76f 100644 --- a/Swift/QtUI/WindowsNotifier.h +++ b/Swift/QtUI/WindowsNotifier.h @@ -19,10 +19,10 @@ namespace Swift { Q_OBJECT public: - WindowsNotifier(const String& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray); + WindowsNotifier(const std::string& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray); ~WindowsNotifier(); - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback); + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback); private slots: void handleMessageClicked(); diff --git a/Swift/QtUI/tmp/QtRosterContextMenu.cpp b/Swift/QtUI/tmp/QtRosterContextMenu.cpp index a59a2f7..c8375ba 100644 --- a/Swift/QtUI/tmp/QtRosterContextMenu.cpp +++ b/Swift/QtUI/tmp/QtRosterContextMenu.cpp @@ -18,7 +18,7 @@ #include "Swiften/Roster/ContactRosterItem.h" #include "Swiften/Roster/GroupRosterItem.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Roster/Roster.h" #include "Swift/Controllers/UIEvents/UIEvent.h" #include "Swift/Controllers/UIEvents/RemoveRosterItemUIEvent.h" @@ -92,8 +92,8 @@ void QtRosterContextMenu::handleRenameGroup() { bool ok; QString newName = QInputDialog::getText(NULL, "Rename group", "New name for " + P2QSTRING(item_->getDisplayName()), QLineEdit::Normal, P2QSTRING(item_->getDisplayName()), &ok); if (ok) { - std::vector<String> addedGroups; - std::vector<String> removedGroups; + std::vector<std::string> addedGroups; + std::vector<std::string> removedGroups; addedGroups.push_back(Q2PSTRING(newName)); removedGroups.push_back(group->getDisplayName()); foreach (RosterItem* child, group->getChildren()) { |