diff options
| author | Remko Tronçon <git@el-tramo.be> | 2013-03-04 13:23:10 (GMT) | 
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2013-03-04 16:03:53 (GMT) | 
| commit | ca7a45a25c2fe332fad1ee3f7a2822415c249206 (patch) | |
| tree | 268c6d37f087935a307061f9d5ef507ddd5162cf | |
| parent | 836925a5cdc7017da7fb84416c803e652b48e399 (diff) | |
| download | swift-ca7a45a25c2fe332fad1ee3f7a2822415c249206.zip swift-ca7a45a25c2fe332fad1ee3f7a2822415c249206.tar.bz2 | |
Qt5 support & warning fixes.
Change-Id: I62c7d5ca44c915e36c797c798294b7c34b465514
76 files changed, 180 insertions, 123 deletions
| diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot index 4f68b1b..a8b7446 100644 --- a/BuildTools/SCons/SConscript.boot +++ b/BuildTools/SCons/SConscript.boot @@ -54,6 +54,7 @@ vars.Add("sqlite_force_bundled", "Force use of the bundled SQLite", None)  vars.Add(PathVariable("avahi_includedir", "Avahi headers location", None, PathVariable.PathAccept))  vars.Add(PathVariable("avahi_libdir", "Avahi library location", None, PathVariable.PathAccept))  vars.Add(PathVariable("qt", "Qt location", "", PathVariable.PathAccept)) +vars.Add(BoolVariable("qt5", "Compile in Qt5 mode", "no")) # TODO: auto-detect this  vars.Add(PathVariable("docbook_xml", "DocBook XML", None, PathVariable.PathAccept))  vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccept))  vars.Add(BoolVariable("build_examples", "Build example programs", "yes")) @@ -117,7 +118,9 @@ if env["PLATFORM"] == "darwin" :  			env["CCFLAGS"] = ["-arch", "x86_64"]  	if "cxx" not in env :  		env["CXX"] = "clang++" -		env["CXXFLAGS"] = ["-std=c++11"] +		# Compiling Qt5 in C++0x mode includes headers that we don't have +		if not env["qt5"] : +			env["CXXFLAGS"] = ["-std=c++11"]  	if "link" not in env :  		env["LINK"] = "clang"  		if platform.machine() == "x86_64" : @@ -237,7 +240,7 @@ else :  			"-Wno-global-constructors", # We depend on this for e.g. string constants  			"-Wno-disabled-macro-expansion", # Caused due to system headers  			"-Wno-c++11-extensions", # We use C++11; turn this off when we use -std=c++11 -			"-Wno-pedantic", # Fix these when we have time +			"-Wno-long-long", # We use long long  			"-Wno-padded",  			])  	else : diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py index 671fd08..8e174c0 100644 --- a/BuildTools/SCons/Tools/qt4.py +++ b/BuildTools/SCons/Tools/qt4.py @@ -286,9 +286,9 @@ def generate(env):  		# Commands for the qt support ...  		QT4_UICCOM = '$QT4_UIC $QT4_UICFLAGS -o $TARGET $SOURCE', -    # FIXME: The -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED flag is a hack to work -    # around an issue in Qt -    # See https://bugreports.qt-project.org/browse/QTBUG-22829 +		# FIXME: The -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED flag is a hack to work +		# around an issue in Qt +		# See https://bugreports.qt-project.org/browse/QTBUG-22829  		QT4_MOCFROMHCOM = '$QT4_MOC -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED $QT4_MOCFROMHFLAGS $QT4_MOCINCFLAGS -o $TARGET $SOURCE',  		QT4_MOCFROMCXXCOM = [  			'$QT4_MOC -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED $QT4_MOCFROMCXXFLAGS $QT4_MOCINCFLAGS -o $TARGET $SOURCE', @@ -395,7 +395,7 @@ def generate(env):  	# TODO: Does dbusxml2cpp need an adapter  	env.AddMethod(enable_modules, "EnableQt4Modules") -def enable_modules(self, modules, debug=False, crosscompiling=False) : +def enable_modules(self, modules, debug=False, crosscompiling=False, version='4') :  	import sys  	validModules = [ @@ -420,6 +420,11 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :  		'QtWebKit',  		'QtHelp',  		'QtScript', + +		# Qt5 modules +		'QtWidgets', +		'QtMultimedia', +		'QtWebKitWidgets',  		]  	staticModules = [  		'QtUiTools', @@ -440,6 +445,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :  		'QtXml'			 : ['QT_XML_LIB'],  		'QtOpenGL'	 : ['QT_OPENGL_LIB'],  		'QtGui'			 : ['QT_GUI_LIB'], +		'QtWidgets'  : ['QT_WIDGETS_LIB'], +		'QtWebKitWidgets' : [],  		'QtNetwork'  : ['QT_NETWORK_LIB'],  		'QtCore'		 : ['QT_CORE_LIB'],  	} @@ -450,7 +457,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :  	if sys.platform.startswith("linux") and not crosscompiling :  		if debug : debugSuffix = '_debug' -		self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include", "phonon")]) +		if version == '4' : +			self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include", "phonon")])  		for module in modules :  			self.AppendUnique(LIBS=[module+debugSuffix])  			self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")]) @@ -472,8 +480,9 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :  			modules.remove("QtAssistant")  			modules.append("QtAssistantClient")  		# FIXME: Phonon Hack -		self.AppendUnique(LIBS=['phonon'+debugSuffix+'4']) -		self.AppendUnique(LIBS=[lib+debugSuffix+'4' for lib in modules if lib not in staticModules]) +		if version == '4' : +			self.AppendUnique(LIBS=['phonon'+debugSuffix+version]) +		self.AppendUnique(LIBS=[lib+debugSuffix+version for lib in modules if lib not in staticModules])  		self.PrependUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules])  		if 'QtOpenGL' in modules:  			self.AppendUnique(LIBS=['opengl32']) @@ -498,7 +507,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :  			self.AppendUnique(LINKFLAGS="-L$QTDIR/lib") #TODO clean!  		# FIXME: Phonon Hack -		self.Append(LINKFLAGS=['-framework', "phonon"]) +		if version == '4' : +			self.Append(LINKFLAGS=['-framework', "phonon"])  		for module in modules :  			if module in staticModules : @@ -506,9 +516,9 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :  				self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")])  			else :  				if len(self["QTDIR"]) > 0 : -					self.Append(CPPFLAGS = ["-I" + os.path.join("$QTDIR", "lib", module + ".framework", "Versions", "4", "Headers")]) +					self.Append(CPPFLAGS = ["-I" + os.path.join("$QTDIR", "lib", module + ".framework", "Versions", version, "Headers")])  				else : -					self.Append(CPPFLAGS = ["-I" + os.path.join("/Library/Frameworks", module + ".framework", "Versions", "4", "Headers")]) +					self.Append(CPPFLAGS = ["-I" + os.path.join("/Library/Frameworks", module + ".framework", "Versions", version, "Headers")])  				self.Append(LINKFLAGS=['-framework', module])  		if 'QtOpenGL' in modules:  			self.AppendUnique(LINKFLAGS="-F/System/Library/Frameworks") diff --git a/SwifTools/CrashReporter.cpp b/SwifTools/CrashReporter.cpp index 42a98d8..67377f2 100644 --- a/SwifTools/CrashReporter.cpp +++ b/SwifTools/CrashReporter.cpp @@ -73,6 +73,6 @@ CrashReporter::CrashReporter(const boost::filesystem::path& path) {  // Dummy implementation  namespace Swift {  	CrashReporter::CrashReporter(const boost::filesystem::path&) {} -}; +}  #endif diff --git a/SwifTools/Notifier/GrowlNotifierDelegate.mm b/SwifTools/Notifier/GrowlNotifierDelegate.mm index 6952cab..e184da6 100644 --- a/SwifTools/Notifier/GrowlNotifierDelegate.mm +++ b/SwifTools/Notifier/GrowlNotifierDelegate.mm @@ -8,7 +8,7 @@  #include <SwifTools/Notifier/GrowlNotifier.h> -@implementation GrowlNotifierDelegate; +@implementation GrowlNotifierDelegate  @synthesize registrationDictionary;  @synthesize name; diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h index 7a2100e..247c606 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.h +++ b/Swift/Controllers/Roster/ContactRosterItem.h @@ -26,7 +26,7 @@ class ContactRosterItem : public RosterItem {  	public:  		enum Feature {  			FileTransferFeature, -			WhiteboardFeature, +			WhiteboardFeature  		};  	public: diff --git a/Swift/QtUI/ChatSnippet.cpp b/Swift/QtUI/ChatSnippet.cpp index ab31d29..4a0560b 100644 --- a/Swift/QtUI/ChatSnippet.cpp +++ b/Swift/QtUI/ChatSnippet.cpp @@ -39,4 +39,4 @@ QString ChatSnippet::wrapResizable(const QString& text) {  	return "<span class='swift_resizable'>" + text + "</span>";  } -}; +} diff --git a/Swift/QtUI/EventViewer/QtEvent.cpp b/Swift/QtUI/EventViewer/QtEvent.cpp index 3c6f16c..c3ff944 100644 --- a/Swift/QtUI/EventViewer/QtEvent.cpp +++ b/Swift/QtUI/EventViewer/QtEvent.cpp @@ -7,6 +7,7 @@  #include "Swift/QtUI/EventViewer/QtEvent.h"  #include <QDateTime> +#include <QColor>  #include "Swift/Controllers/XMPPEvents/MessageEvent.h"  #include "Swift/Controllers/XMPPEvents/ErrorEvent.h" @@ -25,8 +26,8 @@ QVariant QtEvent::data(int role) {   	switch (role) {  		case Qt::ToolTipRole: return QVariant(text()).toString() + "\n" + B2QDATE(event_->getTime()).toString();  		case Qt::DisplayRole: return QVariant(text()); -		case Qt::TextColorRole: return active_ ? Qt::black : Qt::darkGray; -		case Qt::BackgroundColorRole: return active_ ? Qt::white : Qt::lightGray; +		case Qt::TextColorRole: return QColor(active_ ? Qt::black : Qt::darkGray); +		case Qt::BackgroundColorRole: return QColor(active_ ? Qt::white : Qt::lightGray);  		case SenderRole: return QVariant(sender());  			/*case StatusTextRole: return statusText_;  		case AvatarRole: return avatar_; diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp index 2fa24c2..7bd16e3 100644 --- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp +++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp @@ -23,7 +23,7 @@ namespace Swift {  QtMUCSearchWindow::QtMUCSearchWindow() {  	ui_.setupUi(this); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  	setWindowIcon(QIcon(":/logo-icon-16.png"));  #endif  	setModal(true); diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp index acdc61e..c00acf7 100644 --- a/Swift/QtUI/QtAboutWidget.cpp +++ b/Swift/QtUI/QtAboutWidget.cpp @@ -19,7 +19,7 @@  namespace Swift {  QtAboutWidget::QtAboutWidget() : QDialog() { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  	setWindowTitle(QString(tr("About %1")).arg("Swift"));  #endif  	setWindowIcon(QIcon(":/logo-icon-16.png")); diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 7d8f16e..e37803e 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -23,7 +23,7 @@  namespace Swift {  QtChatTabs::QtChatTabs() : QWidget() { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  	setWindowIcon(QIcon(":/logo-chat-16.png"));  #else  	setAttribute(Qt::WA_ShowWithoutActivating); @@ -270,7 +270,7 @@ void QtChatTabs::moveEvent(QMoveEvent*) {  void QtChatTabs::checkForFirstShow() {  	if (!isVisible()) { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  		showMinimized();  #else  		/* https://bugreports.qt-project.org/browse/QTBUG-19194  diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index 967ebec..ad3ba2a 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -41,7 +41,7 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent, bool disableAutoScro  	connect(webView_, SIGNAL(clearRequested()), SLOT(handleClearRequested()));  	connect(webView_, SIGNAL(fontGrowRequested()), SLOT(increaseFontSize()));  	connect(webView_, SIGNAL(fontShrinkRequested()), SLOT(decreaseFontSize())); -#ifdef Q_WS_X11 +#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)  	/* To give a border on Linux, where it looks bad without */  	QStackedWidget* stack = new QStackedWidget(this);  	stack->addWidget(webView_); diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index a53ca5d..7f27cb6 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -25,6 +25,7 @@  #include <Swift/Controllers/UIEvents/SendFileUIEvent.h>  #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h>  #include "QtChatWindowJSBridge.h" +#include "QtUtilities.h"  #include <boost/cstdint.hpp>  #include <boost/format.hpp> @@ -33,6 +34,7 @@  #include <QLabel>  #include <qdebug.h>  #include <QMessageBox> +#include <QMimeData>  #include <QInputDialog>  #include <QApplication>  #include <QBoxLayout> @@ -487,7 +489,7 @@ std::string QtChatWindow::addMessage(const std::string &message, const std::stri  QString QtChatWindow::linkimoticonify(const QString& message) const {  	QString messageHTML(message); -	messageHTML = Qt::escape(messageHTML); +	messageHTML = QtUtilities::htmlEscape(messageHTML);  	QMapIterator<QString, QString> it(emoticons_);  	QString textStyle = showEmoticons_ ? "style='display:none'" : "";  	QString imageStyle = showEmoticons_ ? "" : "style='display:none'"; @@ -504,8 +506,8 @@ QString QtChatWindow::linkimoticonify(const QString& message) const {  QString QtChatWindow::getHighlightSpanStart(const HighlightAction& highlight)  { -	QString color = Qt::escape(P2QSTRING(highlight.getTextColor())); -	QString background = Qt::escape(P2QSTRING(highlight.getTextBackground())); +	QString color = QtUtilities::htmlEscape(P2QSTRING(highlight.getTextColor())); +	QString background = QtUtilities::htmlEscape(P2QSTRING(highlight.getTextBackground()));  	if (color.isEmpty()) {  		color = "black";  	} @@ -524,8 +526,8 @@ std::string QtChatWindow::addMessage(const QString &message, const std::string &  	QString htmlString;  	if (label) { -		htmlString = QString("<span style=\"border: thin dashed grey; padding-left: .5em; padding-right: .5em; color: %1; background-color: %2; font-size: 90%; margin-right: .5em; \" class='swift_label'>").arg(Qt::escape(P2QSTRING(label->getForegroundColor()))).arg(Qt::escape(P2QSTRING(label->getBackgroundColor()))); -		htmlString += QString("%1</span> ").arg(Qt::escape(P2QSTRING(label->getDisplayMarking()))); +		htmlString = QString("<span style=\"border: thin dashed grey; padding-left: .5em; padding-right: .5em; color: %1; background-color: %2; font-size: 90%; margin-right: .5em; \" class='swift_label'>").arg(QtUtilities::htmlEscape(P2QSTRING(label->getForegroundColor()))).arg(QtUtilities::htmlEscape(P2QSTRING(label->getBackgroundColor()))); +		htmlString += QString("%1</span> ").arg(QtUtilities::htmlEscape(P2QSTRING(label->getDisplayMarking())));  	}  	QString messageHTML(message);  	QString styleSpanStart = style == "" ? "" : "<span style=\"" + style + "\">"; @@ -543,7 +545,7 @@ std::string QtChatWindow::addMessage(const QString &message, const std::string &  	}  	QString qAvatarPath =  scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded();  	std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); -	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, Qt::escape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); +	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id))));  	previousMessageWasSelf_ = senderIsSelf;  	previousSenderName_ = P2QSTRING(senderName); @@ -605,7 +607,7 @@ std::string formatSize(const boost::uintmax_t bytes) {  }  static QString encodeButtonArgument(const QString& str) { -	return Qt::escape(P2QSTRING(Base64::encode(createByteArray(Q2PSTRING(str))))); +	return QtUtilities::htmlEscape(P2QSTRING(Base64::encode(createByteArray(Q2PSTRING(str)))));  }  static QString decodeButtonArgument(const QString& str) { @@ -653,7 +655,7 @@ std::string QtChatWindow::addFileTransfer(const std::string& senderName, bool se  	}  	QString qAvatarPath = "qrc:/icons/avatar.png";  	std::string id = "ftmessage" + boost::lexical_cast<std::string>(idCounter_++); -	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, Qt::escape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::local_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); +	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::local_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id))));  	previousMessageWasSelf_ = senderIsSelf;  	previousSenderName_ = P2QSTRING(senderName); @@ -677,7 +679,7 @@ std::string QtChatWindow::addWhiteboardRequest(bool senderIsSelf) {  				buildChatWindowButton(tr("Cancel"), ButtonWhiteboardSessionCancel, wb_id) +  			"</div>";  	} else { -		htmlString = "<div id='" + wb_id + "'>" + tr("%1 would like to start a whiteboard chat").arg(Qt::escape(contact_)) + ": <br/>" + +		htmlString = "<div id='" + wb_id + "'>" + tr("%1 would like to start a whiteboard chat").arg(QtUtilities::htmlEscape(contact_)) + ": <br/>" +  				buildChatWindowButton(tr("Cancel"), ButtonWhiteboardSessionCancel, wb_id) +  				buildChatWindowButton(tr("Accept"), ButtonWhiteboardSessionAcceptRequest, wb_id) +  			"</div>"; @@ -691,7 +693,7 @@ std::string QtChatWindow::addWhiteboardRequest(bool senderIsSelf) {  	}  	QString qAvatarPath = "qrc:/icons/avatar.png";  	std::string id = "wbmessage" + boost::lexical_cast<std::string>(idCounter_++); -	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, Qt::escape(contact_), B2QDATE(boost::posix_time::second_clock::local_time()), qAvatarPath, false, false, theme_, P2QSTRING(id)))); +	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, QtUtilities::htmlEscape(contact_), B2QDATE(boost::posix_time::second_clock::local_time()), qAvatarPath, false, false, theme_, P2QSTRING(id))));  	previousMessageWasSelf_ = false;  	previousSenderName_ = contact_; @@ -766,7 +768,7 @@ void QtChatWindow::addErrorMessage(const std::string& errorMessage) {  		onAllMessagesRead();  	} -	QString errorMessageHTML(Qt::escape(P2QSTRING(errorMessage))); +	QString errorMessageHTML(QtUtilities::htmlEscape(P2QSTRING(errorMessage)));  	errorMessageHTML.replace("\n","<br/>");  	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet("<span class=\"error\">" + errorMessageHTML + "</span>", QDateTime::currentDateTime(), false, theme_))); @@ -1009,7 +1011,7 @@ void QtChatWindow::addMUCInvitation(const std::string& senderName, const JID& ji  	QString id = QString(ButtonMUCInvite + "%1").arg(P2QSTRING(boost::lexical_cast<std::string>(idCounter_++)));  	htmlString += "<div id='" + id + "'>" + -			buildChatWindowButton(tr("Accept Invite"), ButtonMUCInvite, Qt::escape(P2QSTRING(jid.toString())), Qt::escape(P2QSTRING(password)), id) + +			buildChatWindowButton(tr("Accept Invite"), ButtonMUCInvite, QtUtilities::htmlEscape(P2QSTRING(jid.toString())), QtUtilities::htmlEscape(P2QSTRING(password)), id) +  		"</div>";  	bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasMUCInvite, senderName, false); @@ -1021,7 +1023,7 @@ void QtChatWindow::addMUCInvitation(const std::string& senderName, const JID& ji  	}  	QString qAvatarPath = "qrc:/icons/avatar.png"; -	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, Qt::escape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::local_time()), qAvatarPath, false, appendToPrevious, theme_, id))); +	messageLog_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::local_time()), qAvatarPath, false, appendToPrevious, theme_, id)));  	previousMessageWasSelf_ = false;  	previousSenderName_ = P2QSTRING(senderName);  	previousMessageKind_ = PreviousMessageWasMUCInvite; diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp index 71961c2..fac0761 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.cpp +++ b/Swift/QtUI/QtFileTransferListItemModel.cpp @@ -105,7 +105,7 @@ int QtFileTransferListItemModel::rowCount(const QModelIndex& /* parent */) const  }  QModelIndex QtFileTransferListItemModel::index(int row, int column, const QModelIndex& /* parent */) const { -	return createIndex(row, column, 0); +	return createIndex(row, column, (void*) 0);  }  } diff --git a/Swift/QtUI/QtFileTransferListItemModel.h b/Swift/QtUI/QtFileTransferListItemModel.h index 1d892a5..28f13f8 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.h +++ b/Swift/QtUI/QtFileTransferListItemModel.h @@ -34,7 +34,7 @@ private:  		State,  		Progress,  		OverallSize, -		NoOfColumns, +		NoOfColumns  	};  private: diff --git a/Swift/QtUI/QtHighlightRulesItemModel.cpp b/Swift/QtUI/QtHighlightRulesItemModel.cpp index ff2f639..4efa712 100644 --- a/Swift/QtUI/QtHighlightRulesItemModel.cpp +++ b/Swift/QtUI/QtHighlightRulesItemModel.cpp @@ -206,7 +206,7 @@ bool QtHighlightRulesItemModel::setData(const QModelIndex &index, const QVariant  			highlightManager_->setRule(index.row(), r);  			emit dataChanged(index, index);  			foreach (int column, changedColumns) { -				QModelIndex i = createIndex(index.row(), column, 0); +				QModelIndex i = createIndex(index.row(), column, (void*) 0);  				emit dataChanged(i, i);  			}  		} @@ -227,7 +227,7 @@ int QtHighlightRulesItemModel::rowCount(const QModelIndex& /* parent */) const  QModelIndex QtHighlightRulesItemModel::index(int row, int column, const QModelIndex& /* parent */) const  { -	return createIndex(row, column, 0); +	return createIndex(row, column, (void*) 0);  }  bool QtHighlightRulesItemModel::insertRows(int row, int count, const QModelIndex& /* parent */) diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 875235d..23621c6 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -21,6 +21,7 @@  #include <QDateTime>  #include <Swift/QtUI/QtScaledAvatarCache.h>  #include <QLineEdit> +#include "QtUtilities.h"  #include <boost/smart_ptr/make_shared.hpp>  #include <boost/numeric/conversion/cast.hpp> @@ -108,7 +109,7 @@ void QtHistoryWindow::addMessage(const std::string &message, const std::string &  	QString scaledAvatarPath = QtScaledAvatarCache(32).getScaledAvatarPath(avatarPath.c_str());  	QString messageHTML(P2QSTRING(message)); -	messageHTML = Qt::escape(messageHTML); +	messageHTML = QtUtilities::htmlEscape(messageHTML);  	QString searchTerm = ui_.searchBox_->lineEdit()->text();  	if (searchTerm.length()) {  		messageHTML.replace(searchTerm, "<span style='background-color: yellow'>" + searchTerm + "</span>"); @@ -125,14 +126,14 @@ void QtHistoryWindow::addMessage(const std::string &message, const std::string &  	if (addAtTheTop) {  		bool appendToPrevious = ((senderIsSelf && previousTopMessageWasSelf_) || (!senderIsSelf && !previousTopMessageWasSelf_&& previousTopSenderName_ == P2QSTRING(senderName))); -		conversation_->addMessageTop(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, Qt::escape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); +		conversation_->addMessageTop(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id))));  		previousTopMessageWasSelf_ = senderIsSelf;  		previousTopSenderName_ = P2QSTRING(senderName);  	}  	else {  		bool appendToPrevious = ((senderIsSelf && previousBottomMessageWasSelf_) || (!senderIsSelf && !previousBottomMessageWasSelf_&& previousBottomSenderName_ == P2QSTRING(senderName))); -		conversation_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, Qt::escape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); +		conversation_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id))));  		previousBottomMessageWasSelf_ = senderIsSelf;  		previousBottomSenderName_ = P2QSTRING(senderName);  	} diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index cf22ad0..188e55f 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -55,7 +55,7 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* set  	uiEventStream_ = uiEventStream;  	setWindowTitle("Swift"); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  	setWindowIcon(QIcon(":/logo-icon-16.png"));  #endif  	QtUtilities::setX11Resource(this, "Main"); diff --git a/Swift/QtUI/QtNameWidget.h b/Swift/QtUI/QtNameWidget.h index 0f00c41..3225879 100644 --- a/Swift/QtUI/QtNameWidget.h +++ b/Swift/QtUI/QtNameWidget.h @@ -31,7 +31,7 @@ namespace Swift {  		private:  			enum Mode {  				ShowNick, -				ShowJID, +				ShowJID  			};  			SettingsProvider* settings; diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp index 26b160a..b1cdd19 100644 --- a/Swift/QtUI/QtProfileWindow.cpp +++ b/Swift/QtUI/QtProfileWindow.cpp @@ -19,6 +19,7 @@  #include <QTextDocument>  #include <Swift/QtUI/QtSwiftUtil.h> +#include <Swift/QtUI/QtUtilities.h>  namespace Swift { @@ -75,7 +76,7 @@ void QtProfileWindow::setProcessing(bool processing) {  void QtProfileWindow::setError(const std::string& error) {  	if (!error.empty()) { -		ui->errorLabel->setText("<font color='red'>" + Qt::escape(P2QSTRING(error)) + "</font>"); +		ui->errorLabel->setText("<font color='red'>" + QtUtilities::htmlEscape(P2QSTRING(error)) + "</font>");  	}  	else {  		ui->errorLabel->setText(""); diff --git a/Swift/QtUI/QtSettingsProvider.cpp b/Swift/QtUI/QtSettingsProvider.cpp index 64e88d4..a98cdf3 100644 --- a/Swift/QtUI/QtSettingsProvider.cpp +++ b/Swift/QtUI/QtSettingsProvider.cpp @@ -108,7 +108,7 @@ QSettings* QtSettingsProvider::getQSettings() {  }  void QtSettingsProvider::updatePermissions() { -#if !defined(Q_WS_WIN) && !defined(Q_WS_MAC) +#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)  	QFile file(settings_.fileName());  	if (file.exists()) {  		file.setPermissions(QFile::ReadOwner|QFile::WriteOwner); diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp index 2f45709..456a56f 100644 --- a/Swift/QtUI/QtSystemTray.cpp +++ b/Swift/QtUI/QtSystemTray.cpp @@ -9,7 +9,7 @@  #include "Swift/QtUI/QtSystemTray.h"  #include <QtDebug> -#ifdef Q_WS_X11 +#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)  #include <QDBusInterface>  #endif  #include <QIcon> @@ -24,7 +24,7 @@ QtSystemTray::QtSystemTray() : QObject(), trayMenu_(0), onlineIcon_(":icons/onli  	trayIcon_->setToolTip("Swift");  	connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason)));  	connect(&throbberMovie_, SIGNAL(frameChanged(int)), this, SLOT(handleThrobberFrameChanged(int))); -#ifdef Q_WS_X11 +#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)  	bool isUnity = QDBusInterface("com.canonical.Unity.Launcher", "/com/canonical/Unity/Launcher").isValid();  	if (isUnity) {  		// Add an activation menu, because this is the only way to get the application to the diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp index 3a62325..0497d01 100644 --- a/Swift/QtUI/QtTextEdit.cpp +++ b/Swift/QtUI/QtTextEdit.cpp @@ -14,7 +14,7 @@ namespace Swift {  QtTextEdit::QtTextEdit(QWidget* parent) : QTextEdit(parent){  	connect(this, SIGNAL(textChanged()), this, SLOT(handleTextChanged()));  	handleTextChanged(); -}; +}  void QtTextEdit::keyPressEvent(QKeyEvent* event) {  	int key = event->key(); diff --git a/Swift/QtUI/QtTranslator.h b/Swift/QtUI/QtTranslator.h index fdafaf0..a2129f0 100644 --- a/Swift/QtUI/QtTranslator.h +++ b/Swift/QtUI/QtTranslator.h @@ -16,6 +16,10 @@ class QtTranslator : public Swift::Translator {  		}  		virtual std::string translate(const std::string& text, const std::string& context) { +#if QT_VERSION >= 0x050000 +			return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), 0).toUtf8()); +#else  			return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), 0, QCoreApplication::UnicodeUTF8).toUtf8()); +#endif  		}  }; diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index 2ec2818..7ec25df 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -145,7 +145,7 @@ void QtUIFactory::handleChatWindowFontResized(int size) {  UserSearchWindow* QtUIFactory::createUserSearchWindow(UserSearchWindow::Type type, UIEventStream* eventStream, const std::set<std::string>& groups) {  	return new QtUserSearchWindow(eventStream, type, groups); -}; +}  JoinMUCWindow* QtUIFactory::createJoinMUCWindow(UIEventStream* uiEventStream) {  	return new QtJoinMUCWindow(uiEventStream); diff --git a/Swift/QtUI/QtUtilities.cpp b/Swift/QtUI/QtUtilities.cpp index be9d179..e9aa4a4 100644 --- a/Swift/QtUI/QtUtilities.cpp +++ b/Swift/QtUI/QtUtilities.cpp @@ -1,13 +1,14 @@  /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information.   */  #include "QtUtilities.h" +#include <QTextDocument>  #include <QWidget> -#ifdef Q_WS_X11 +#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)  #include <QX11Info>  #include <X11/Xlib.h>  #include <X11/Xutil.h> @@ -18,7 +19,7 @@  namespace QtUtilities {  void setX11Resource(QWidget* widget, const QString& c) { -#ifdef Q_WS_X11 +#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)  	char res_class[] = SWIFT_APPLICATION_NAME;  	XClassHint hint;  	hint.res_name = (QString(SWIFT_APPLICATION_NAME) + "-" + c).toUtf8().data(); @@ -30,4 +31,12 @@ void setX11Resource(QWidget* widget, const QString& c) {  #endif  } +QString htmlEscape(const QString& s) { +#if QT_VERSION >= 0x050000 +	return s.toHtmlEscaped(); +#else +	return Qt::escape(s); +#endif +} +  } diff --git a/Swift/QtUI/QtUtilities.h b/Swift/QtUI/QtUtilities.h index 6e64d6e..40c16bc 100644 --- a/Swift/QtUI/QtUtilities.h +++ b/Swift/QtUI/QtUtilities.h @@ -1,5 +1,5 @@  /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information.   */ @@ -11,4 +11,5 @@ class QString;  namespace QtUtilities {  	void setX11Resource(QWidget* widget, const QString& c); -}; +	QString htmlEscape(const QString& s); +} diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp index 4d34e53..d9bb4fe 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp @@ -156,7 +156,7 @@ void QtVCardAddressField::handleEditibleChanged(bool isEditable) {  	foreach (QWidget* widget, textFields) {  		QtResizableLineEdit* lineEdit;  		if ((lineEdit = dynamic_cast<QtResizableLineEdit*>(widget))) { -			lineEdit->setShown(isEditable ? true : !lineEdit->text().isEmpty()); +			lineEdit->setVisible(isEditable ? true : !lineEdit->text().isEmpty());  			lineEdit->setStyleSheet(isEditable ? "" : "QLineEdit { border: none; background: transparent; }");  		}  	} diff --git a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp index 46f253f..b946fc4 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp @@ -12,6 +12,7 @@  #include <Swiften/Base/Log.h>  #include <Swift/QtUI/QtSwiftUtil.h> +#include <Swift/QtUI/QtUtilities.h>  namespace Swift { @@ -71,7 +72,7 @@ void QtVCardInternetEMailField::handleEditibleChanged(bool isEditable) {  	} else {  		if (emailLineEdit) emailLineEdit->hide();  		if (emailLabel) { -			emailLabel->setText(QString("<a href=\"mailto:%1\">%1</a>").arg(Qt::escape(emailLineEdit->text()))); +			emailLabel->setText(QString("<a href=\"mailto:%1\">%1</a>").arg(QtUtilities::htmlEscape(emailLineEdit->text())));  			emailLabel->show();  		}  	} diff --git a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp index dbb4b7c..ecb5533 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp @@ -11,6 +11,7 @@  #include <boost/algorithm/string.hpp>  #include <Swift/QtUI/QtSwiftUtil.h> +#include <Swift/QtUI/QtUtilities.h>  namespace Swift { @@ -62,7 +63,7 @@ void QtVCardJIDField::handleEditibleChanged(bool isEditable) {  	} else {  		if (jidLineEdit) jidLineEdit->hide();  		if (jidLabel) { -			jidLabel->setText(QString("<a href=\"xmpp:%1\">%1</a>").arg(Qt::escape(jidLineEdit->text()))); +			jidLabel->setText(QString("<a href=\"xmpp:%1\">%1</a>").arg(QtUtilities::htmlEscape(jidLineEdit->text())));  			jidLabel->show();  		}  	} diff --git a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp index 5f231dc..e399885 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp @@ -41,7 +41,13 @@ void QtVCardOrganizationField::setupContentWidgets() {  	unitsTreeWidget->header()->setStretchLastSection(false);  	int closeIconWidth = unitsTreeWidget->fontMetrics().height();  	unitsTreeWidget->header()->resizeSection(1, closeIconWidth); + +#if QT_VERSION >= 0x050000 +	unitsTreeWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch); +#else  	unitsTreeWidget->header()->setResizeMode(0, QHeaderView::Stretch); +#endif +  	unitsTreeWidget->setHeaderHidden(true);  	unitsTreeWidget->setRootIsDecorated(false);  	unitsTreeWidget->setEditTriggers(QAbstractItemView::DoubleClicked); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp index 0b6f0c1..35cc4ce 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp @@ -12,6 +12,8 @@  #include <boost/algorithm/string.hpp>  #include <Swift/QtUI/QtSwiftUtil.h> +#include <Swift/QtUI/QtUtilities.h> +  namespace Swift { @@ -59,7 +61,7 @@ void QtVCardURLField::handleEditibleChanged(bool isEditable) {  	} else {  		if (urlLineEdit) urlLineEdit->hide();  		if (urlLabel) { -			urlLabel->setText(QString("<a href=\"%1\">%1</a>").arg(Qt::escape(urlLineEdit->text()))); +			urlLabel->setText(QString("<a href=\"%1\">%1</a>").arg(QtUtilities::htmlEscape(urlLineEdit->text())));  			urlLabel->show();  		}  	} diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 5fdf138..64d0fcf 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -10,6 +10,7 @@  #include <boost/bind.hpp>  #include <QUrl> +#include <QMimeData>  #include <Swiften/Base/Platform.h>  #include <Swift/Controllers/Roster/ContactRosterItem.h> diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index 885d04c..2909c05 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -40,7 +40,8 @@ void RosterModel::setRoster(Roster* roster) {  void RosterModel::reLayout() {  	//emit layoutChanged(); -	reset(); +	beginResetModel(); +	endResetModel(); // TODO: Not sure if this isn't too early?  	if (!roster_) {  		return;  	} @@ -53,7 +54,7 @@ void RosterModel::reLayout() {  void RosterModel::handleChildrenChanged(GroupRosterItem* /*group*/) {  	reLayout(); -}							   +}								  void RosterModel::handleDataChanged(RosterItem* item) {  	Q_ASSERT(item); @@ -163,12 +164,12 @@ QIcon RosterModel::getPresenceIcon(RosterItem* item) const {  	if (!contact) return QIcon();  	QString iconString;  	switch (contact->getStatusShow()) { -	 	case StatusShow::Online: iconString = "online";break; -	 	case StatusShow::Away: iconString = "away";break; -	 	case StatusShow::XA: iconString = "away";break; -	 	case StatusShow::FFC: iconString = "online";break; -	 	case StatusShow::DND: iconString = "dnd";break; -	 	case StatusShow::None: iconString = "offline";break; +		case StatusShow::Online: iconString = "online";break; +		case StatusShow::Away: iconString = "away";break; +		case StatusShow::XA: iconString = "away";break; +		case StatusShow::FFC: iconString = "online";break; +		case StatusShow::DND: iconString = "dnd";break; +		case StatusShow::None: iconString = "offline";break;  	}  	return QIcon(":/icons/" + iconString + ".png");  } diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 4ab6792..13d36fa 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -24,7 +24,7 @@ myenv = env.Clone()  # Disable warnings that affect Qt  myenv["CXXFLAGS"] = filter(lambda x : x != "-Wfloat-equal", myenv["CXXFLAGS"])  if "clang" in env["CC"] : -	myenv.Append(CXXFLAGS = ["-Wno-float-equal", "-Wno-shorten-64-to-32", "-Wno-missing-prototypes", "-Wno-unreachable-code", "-Wno-disabled-macro-expansion", "-Wno-unused-private-field", "-Wno-extra-semi", "-Wno-duplicate-enum", "-Wno-missing-variable-declarations", "-Wno-conversion"]) +	myenv.Append(CXXFLAGS = ["-Wno-float-equal", "-Wno-shorten-64-to-32", "-Wno-missing-prototypes", "-Wno-unreachable-code", "-Wno-disabled-macro-expansion", "-Wno-unused-private-field", "-Wno-extra-semi", "-Wno-duplicate-enum", "-Wno-missing-variable-declarations", "-Wno-conversion", "-Wno-undefined-reinterpret-cast"])  myenv.UseFlags(env["SWIFT_CONTROLLERS_FLAGS"])  myenv.UseFlags(env["SWIFTOOLS_FLAGS"]) @@ -53,13 +53,18 @@ myenv.Tool("qt4", toolpath = ["#/BuildTools/SCons/Tools"])  myenv.Tool("nsis", toolpath = ["#/BuildTools/SCons/Tools"])  myenv.Tool("wix", toolpath = ["#/BuildTools/SCons/Tools"])  myenv.Tool("textfile", toolpath = ["#/BuildTools/SCons/Tools"]) -qt4modules = ['QtCore', 'QtGui', 'QtWebKit'] +qt4modules = ['QtCore', 'QtWebKit', 'QtGui'] +if myenv["qt5"] : +  qt_version = '5' +  qt4modules += ['QtWidgets', 'QtWebKitWidgets', 'QtMultimedia'] +else : +  qt_version = '4'  if env["PLATFORM"] == "posix" :  	qt4modules += ["QtDBus"]  if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :  	qt4modules += ["QtNetwork"] -myenv.EnableQt4Modules(qt4modules, debug = False) +myenv.EnableQt4Modules(qt4modules, debug = False, version = qt_version)  myenv.Append(CPPPATH = ["."]) diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index d69c626..02b238e 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -29,7 +29,7 @@ namespace Swift {  QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type, const std::set<std::string>& groups) : eventStream_(eventStream), type_(type), model_(NULL) {  	setupUi(this); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  	setWindowIcon(QIcon(":/logo-icon-16.png"));  #endif  	QString title(type == UserSearchWindow::AddContact ? tr("Add Contact") : tr("Chat to User")); @@ -264,7 +264,11 @@ void QtUserSearchWindow::setResultsForm(Form::ref results) {  	resultsPage_->results_->setModel(newModel);  	resultsPage_->results_->setItemDelegate(new QItemDelegate());  	resultsPage_->results_->setHeaderHidden(false); +#if QT_VERSION >= 0x050000 +	resultsPage_->results_->header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#else  	resultsPage_->results_->header()->setResizeMode(QHeaderView::ResizeToContents); +#endif  	delete model_;  	model_ = newModel;  	resultsPage_->setNoResults(model_->rowCount() == 0); diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 414e590..89de95e 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -26,7 +26,7 @@  namespace Swift {  	QtWhiteboardWindow::QtWhiteboardWindow(WhiteboardSession::ref whiteboardSession) : QWidget() { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  		setWindowIcon(QIcon(":/logo-icon-16.png"));  #endif  		layout = new QVBoxLayout(this); diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp index d02cce6..70947f5 100644 --- a/Swift/QtUI/main.cpp +++ b/Swift/QtUI/main.cpp @@ -33,7 +33,9 @@ int main(int argc, char* argv[]) {  	Swift::CrashReporter crashReporter(applicationPathProvider.getDataDir() / "crashes"); +#if QT_VERSION < 0x050000  	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); +#endif  	// Parse program options  	boost::program_options::options_description desc = Swift::QtSwift::getOptionsDescription(); @@ -62,7 +64,9 @@ int main(int argc, char* argv[]) {  	}  	// Translation +#if QT_VERSION < 0x050000  	QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); +#endif  	boost::filesystem::path someTranslationPath = applicationPathProvider.getResourcePath("/translations/swift_en.qm");  	QTranslator qtTranslator; diff --git a/Swiften/Base/Error.h b/Swiften/Base/Error.h index 906c1d9..d9f3b91 100644 --- a/Swiften/Base/Error.h +++ b/Swiften/Base/Error.h @@ -13,4 +13,4 @@ namespace Swift {  		public:  			virtual ~Error();  	}; -}; +} diff --git a/Swiften/Base/SafeAllocator.h b/Swiften/Base/SafeAllocator.h index 9f9dd42..f59119e 100644 --- a/Swiften/Base/SafeAllocator.h +++ b/Swiften/Base/SafeAllocator.h @@ -27,4 +27,4 @@ namespace Swift {  				std::allocator<T>::deallocate(p, num);  			}  	}; -}; +} diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h index de181a1..5ce6c3d 100644 --- a/Swiften/Base/String.h +++ b/Swiften/Base/String.h @@ -32,7 +32,7 @@ namespace Swift {  			std::string convertIntToHexString(int h);  			int convertHexStringToInt(const std::string& s); -	}; +	}  	class SWIFTEN_API makeString {  		public: diff --git a/Swiften/Client/BlockList.h b/Swiften/Client/BlockList.h index 39a211d..d8cff60 100644 --- a/Swiften/Client/BlockList.h +++ b/Swiften/Client/BlockList.h @@ -17,7 +17,7 @@ namespace Swift {  			enum State {  				Requesting,  				Available, -				Error, +				Error  			};  			virtual ~BlockList(); diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index 2553546..c17ec9b 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -53,7 +53,7 @@ namespace Swift {  					SessionStartError,  					TLSClientCertificateError,  					TLSError, -					StreamError, +					StreamError  				} type;  				Error(Type type) : type(type) {}  			}; diff --git a/Swiften/Component/ComponentConnector.cpp b/Swiften/Component/ComponentConnector.cpp index b7bdd34..0dd8e82 100644 --- a/Swiften/Component/ComponentConnector.cpp +++ b/Swiften/Component/ComponentConnector.cpp @@ -104,4 +104,4 @@ void ComponentConnector::handleTimeout() {  	finish(boost::shared_ptr<Connection>());  } -}; +} diff --git a/Swiften/Component/ComponentConnector.h b/Swiften/Component/ComponentConnector.h index 549457b..0e35ab2 100644 --- a/Swiften/Component/ComponentConnector.h +++ b/Swiften/Component/ComponentConnector.h @@ -62,4 +62,4 @@ namespace Swift {  			std::deque<HostAddress> addressQueryResults;  			boost::shared_ptr<Connection> currentConnection;  	}; -}; +} diff --git a/Swiften/Component/ComponentError.h b/Swiften/Component/ComponentError.h index 928af2a..9c54b53 100644 --- a/Swiften/Component/ComponentError.h +++ b/Swiften/Component/ComponentError.h @@ -16,7 +16,7 @@ namespace Swift {  				ConnectionWriteError,  				XMLError,  				AuthenticationFailedError, -				UnexpectedElementError, +				UnexpectedElementError  			};  			ComponentError(Type type = UnknownError) : type_(type) {} diff --git a/Swiften/Component/ComponentSession.h b/Swiften/Component/ComponentSession.h index 073c3f4..bc1ea5f 100644 --- a/Swiften/Component/ComponentSession.h +++ b/Swiften/Component/ComponentSession.h @@ -35,7 +35,7 @@ namespace Swift {  			struct Error : public Swift::Error {  				enum Type {  					AuthenticationFailedError, -					UnexpectedElementError, +					UnexpectedElementError  				} type;  				Error(Type type) : type(type) {}  			}; diff --git a/Swiften/Elements/FormField.h b/Swiften/Elements/FormField.h index e8fe3a0..fbd1ebe 100644 --- a/Swiften/Elements/FormField.h +++ b/Swiften/Elements/FormField.h @@ -101,14 +101,14 @@ namespace Swift {  			name##FormField() : GenericFormField< valueType >() {} \  	}; -	SWIFTEN_DECLARE_FORM_FIELD(Boolean, bool); -	SWIFTEN_DECLARE_FORM_FIELD(Fixed, std::string); -	SWIFTEN_DECLARE_FORM_FIELD(Hidden, std::string); -	SWIFTEN_DECLARE_FORM_FIELD(ListSingle, std::string); -	SWIFTEN_DECLARE_FORM_FIELD(TextMulti, std::string); -	SWIFTEN_DECLARE_FORM_FIELD(TextPrivate, std::string); -	SWIFTEN_DECLARE_FORM_FIELD(TextSingle, std::string); -	SWIFTEN_DECLARE_FORM_FIELD(JIDSingle, JID); -	SWIFTEN_DECLARE_FORM_FIELD(JIDMulti, std::vector<JID>); -	SWIFTEN_DECLARE_FORM_FIELD(ListMulti, std::vector<std::string>); +	SWIFTEN_DECLARE_FORM_FIELD(Boolean, bool) +	SWIFTEN_DECLARE_FORM_FIELD(Fixed, std::string) +	SWIFTEN_DECLARE_FORM_FIELD(Hidden, std::string) +	SWIFTEN_DECLARE_FORM_FIELD(ListSingle, std::string) +	SWIFTEN_DECLARE_FORM_FIELD(TextMulti, std::string) +	SWIFTEN_DECLARE_FORM_FIELD(TextPrivate, std::string) +	SWIFTEN_DECLARE_FORM_FIELD(TextSingle, std::string) +	SWIFTEN_DECLARE_FORM_FIELD(JIDSingle, JID) +	SWIFTEN_DECLARE_FORM_FIELD(JIDMulti, std::vector<JID>) +	SWIFTEN_DECLARE_FORM_FIELD(ListMulti, std::vector<std::string>)  } diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h index 64c9f14..fb33eaf 100644 --- a/Swiften/Elements/IBB.h +++ b/Swiften/Elements/IBB.h @@ -21,11 +21,11 @@ namespace Swift {  			enum Action {  				Open,  				Close, -				Data, +				Data  			};  			enum StanzaType {  				IQStanza, -				MessageStanza, +				MessageStanza  			};  			IBB(Action action = Open, const std::string& streamID = "") : action(action), streamID(streamID), stanzaType(IQStanza), blockSize(-1), sequenceNumber(-1) { diff --git a/Swiften/Elements/JingleContentPayload.h b/Swiften/Elements/JingleContentPayload.h index 183b8eb..547fc70 100644 --- a/Swiften/Elements/JingleContentPayload.h +++ b/Swiften/Elements/JingleContentPayload.h @@ -23,7 +23,7 @@ namespace Swift {  			enum Creator {  				UnknownCreator,  				InitiatorCreator, -				ResponderCreator, +				ResponderCreator  			};  			/*enum Senders { diff --git a/Swiften/Elements/JingleIBBTransportPayload.h b/Swiften/Elements/JingleIBBTransportPayload.h index 7633f6b..3124f35 100644 --- a/Swiften/Elements/JingleIBBTransportPayload.h +++ b/Swiften/Elements/JingleIBBTransportPayload.h @@ -18,7 +18,7 @@ namespace Swift {  			enum StanzaType {  				IQStanza, -				MessageStanza, +				MessageStanza  			};  			void setStanzaType(StanzaType stanzaType) { diff --git a/Swiften/Elements/JingleS5BTransportPayload.h b/Swiften/Elements/JingleS5BTransportPayload.h index 995933c..41bf809 100644 --- a/Swiften/Elements/JingleS5BTransportPayload.h +++ b/Swiften/Elements/JingleS5BTransportPayload.h @@ -20,7 +20,7 @@ namespace Swift {  		public:  			enum Mode {  				TCPMode, // default case -				UDPMode, +				UDPMode  			};  			struct Candidate { @@ -28,7 +28,7 @@ namespace Swift {  					DirectType, // default case  					AssistedType,  					TunnelType, -					ProxyType, +					ProxyType  				};  				Candidate() : priority(0), type(DirectType) {} diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h index 0d0551c..a58d3ae 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -41,7 +41,7 @@ namespace Swift {  				UndefinedCondition,  				UnsupportedEncoding,  				UnsupportedStanzaType, -				UnsupportedVersion, +				UnsupportedVersion  			};  			StreamError(Type type = UndefinedCondition, const std::string& text = std::string()) : type_(type), text_(text) { } diff --git a/Swiften/FileTransfer/FileTransfer.h b/Swiften/FileTransfer/FileTransfer.h index 01c9449..29b4ebf 100644 --- a/Swiften/FileTransfer/FileTransfer.h +++ b/Swiften/FileTransfer/FileTransfer.h @@ -25,7 +25,7 @@ public:  			Negotiating,  			Transferring,  			WaitingForStart, -			WaitingForAccept, +			WaitingForAccept  		};  		FTState state; diff --git a/Swiften/FileTransfer/FileTransferError.h b/Swiften/FileTransfer/FileTransferError.h index 6a6b454..eb1e8f8 100644 --- a/Swiften/FileTransfer/FileTransferError.h +++ b/Swiften/FileTransfer/FileTransferError.h @@ -13,7 +13,7 @@ namespace Swift {  				UnknownError,  				PeerError,  				ReadError, -				ClosedError, +				ClosedError  			};  			FileTransferError(Type type = UnknownError) : type(type) {} diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h index a832796..61d0c0e 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h @@ -38,7 +38,7 @@ public:  		Ready,  		Writing,  		Reading, -		Finished, +		Finished  	};  public: diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h index 60a404b..7e13ddd 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h @@ -30,7 +30,7 @@ namespace Swift {  				ReadyForTransfer,  				ReadingData,  				WritingData, -				Finished, +				Finished  			};  			SOCKS5BytestreamServerSession(boost::shared_ptr<Connection> connection, SOCKS5BytestreamRegistry* registry); diff --git a/Swiften/IDN/StringPrep.cpp b/Swiften/IDN/StringPrep.cpp index 3ab7088..a0d067e 100644 --- a/Swiften/IDN/StringPrep.cpp +++ b/Swiften/IDN/StringPrep.cpp @@ -14,7 +14,7 @@  #elif defined(HAVE_LIBIDN)  extern "C" {  	#include <stringprep.h> -}; +}  #endif  #include <vector> diff --git a/Swiften/IDN/StringPrep.h b/Swiften/IDN/StringPrep.h index 688600c..35c4593 100644 --- a/Swiften/IDN/StringPrep.h +++ b/Swiften/IDN/StringPrep.h @@ -17,7 +17,7 @@ namespace Swift {  				NamePrep,  				XMPPNodePrep,  				XMPPResourcePrep, -				SASLPrep, +				SASLPrep  			};  			static std::string getPrepared(const std::string& s, Profile profile); diff --git a/Swiften/Network/ChainedConnector.h b/Swiften/Network/ChainedConnector.h index 4110522..03462bc 100644 --- a/Swiften/Network/ChainedConnector.h +++ b/Swiften/Network/ChainedConnector.h @@ -49,4 +49,4 @@ namespace Swift {  			boost::shared_ptr<Connector> currentConnector;  			boost::shared_ptr<Error> lastError;  	}; -}; +} diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp index 5ab3b92..a0155cf 100644 --- a/Swiften/Network/Connector.cpp +++ b/Swiften/Network/Connector.cpp @@ -183,4 +183,4 @@ void Connector::handleTimeout() {  	handleConnectionConnectFinished(true);  } -}; +} diff --git a/Swiften/Network/Connector.h b/Swiften/Network/Connector.h index 26a98b8..49ac271 100644 --- a/Swiften/Network/Connector.h +++ b/Swiften/Network/Connector.h @@ -71,4 +71,4 @@ namespace Swift {  			boost::shared_ptr<Connection> currentConnection;  			bool foundSomeDNS;  	}; -}; +} diff --git a/Swiften/Network/NATPortMapping.h b/Swiften/Network/NATPortMapping.h index db14500..a7982d6 100644 --- a/Swiften/Network/NATPortMapping.h +++ b/Swiften/Network/NATPortMapping.h @@ -13,7 +13,7 @@ namespace Swift {  	public:  		enum Protocol {  			TCP, -			UDP, +			UDP  		};  		NATPortMapping(int localPort, int publicPort, Protocol protocol = TCP, int leaseInSeconds = 60 * 60 * 24) : publicPort(publicPort), localPort(localPort), protocol(protocol), leaseInSeconds(leaseInSeconds) { diff --git a/Swiften/Network/NATTraversalRemovePortForwardingRequest.h b/Swiften/Network/NATTraversalRemovePortForwardingRequest.h index cf349b1..c82ae03 100644 --- a/Swiften/Network/NATTraversalRemovePortForwardingRequest.h +++ b/Swiften/Network/NATTraversalRemovePortForwardingRequest.h @@ -15,7 +15,7 @@ namespace Swift {  			struct PortMapping {  				enum Protocol {  					TCP, -					UDP, +					UDP  				};  				unsigned int publicPort; diff --git a/Swiften/Network/SOCKS5ProxiedConnection.h b/Swiften/Network/SOCKS5ProxiedConnection.h index 61092e0..7906879 100644 --- a/Swiften/Network/SOCKS5ProxiedConnection.h +++ b/Swiften/Network/SOCKS5ProxiedConnection.h @@ -30,7 +30,7 @@ namespace Swift {  		private:  			enum {  				ProxyAuthenticating = 0, -				ProxyConnecting, +				ProxyConnecting  			} proxyState_;  	};  } diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.h b/Swiften/Parser/PayloadParsers/BytestreamsParser.h index 4785913..5c151c2 100644 --- a/Swiften/Parser/PayloadParsers/BytestreamsParser.h +++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.h @@ -24,7 +24,7 @@ namespace Swift {  		private:  			enum Level {   				TopLevel = 0,  -				PayloadLevel = 1, +				PayloadLevel = 1  			};  			int level;  	}; diff --git a/Swiften/Parser/PayloadParsers/IBBParser.h b/Swiften/Parser/PayloadParsers/IBBParser.h index d899475..59011b4 100644 --- a/Swiften/Parser/PayloadParsers/IBBParser.h +++ b/Swiften/Parser/PayloadParsers/IBBParser.h @@ -23,7 +23,7 @@ namespace Swift {  		private:  			enum Level {  -				TopLevel = 0,  +				TopLevel = 0  			};  			int level;  			std::string currentText; diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h index ae8d36c..1f85c85 100644 --- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h @@ -27,7 +27,7 @@ namespace Swift {  		private:  			enum Level {   				TopLevel = 0,  -				PayloadLevel = 1, +				PayloadLevel = 1  			};  			int level;  			FormParserFactory* formParserFactory; diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h index 93560c6..7ea22b4 100644 --- a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h +++ b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h @@ -26,7 +26,7 @@ class JingleFileTransferDescriptionParser : public GenericPayloadParser<JingleFi  		enum CurrentParseElement {  			UnknownElement,  			RequestElement, -			OfferElement, +			OfferElement  		};  		PayloadParserFactoryCollection* factories; diff --git a/Swiften/Parser/PayloadParsers/JingleParser.h b/Swiften/Parser/PayloadParsers/JingleParser.h index 188ead9..c7bd58c 100644 --- a/Swiften/Parser/PayloadParsers/JingleParser.h +++ b/Swiften/Parser/PayloadParsers/JingleParser.h @@ -29,5 +29,5 @@ class JingleParser : public GenericPayloadParser<JinglePayload> {  			boost::shared_ptr<PayloadParser> currentPayloadParser;  }; -}; +} diff --git a/Swiften/Parser/PayloadParsers/SearchPayloadParser.h b/Swiften/Parser/PayloadParsers/SearchPayloadParser.h index 006e0d9..d456eb8 100644 --- a/Swiften/Parser/PayloadParsers/SearchPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/SearchPayloadParser.h @@ -28,7 +28,7 @@ namespace Swift {  			enum Level {   				TopLevel = 0,   				PayloadLevel = 1, -				ItemLevel = 2, +				ItemLevel = 2  			};  			int level;  			FormParserFactory* formParserFactory; diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.h b/Swiften/Parser/PayloadParsers/StreamInitiationParser.h index c2ffd07..f7350cd 100644 --- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.h +++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.h @@ -29,7 +29,7 @@ namespace Swift {  				TopLevel = 0,   				PayloadLevel = 1,  				FileOrFeatureLevel = 2, -				FormOrDescriptionLevel = 3, +				FormOrDescriptionLevel = 3  			};  			int level;  			FormParserFactory* formParserFactory; diff --git a/Swiften/SASL/DIGESTMD5ClientAuthenticator.h b/Swiften/SASL/DIGESTMD5ClientAuthenticator.h index 01cdde9..813ded2 100644 --- a/Swiften/SASL/DIGESTMD5ClientAuthenticator.h +++ b/Swiften/SASL/DIGESTMD5ClientAuthenticator.h @@ -28,7 +28,7 @@ namespace Swift {  			enum Step {  				Initial,  				Response, -				Final, +				Final  			} step;  			std::string host;  			std::string cnonce; diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp index 5dfff3c..62261d0 100644 --- a/Swiften/Session/BOSHSessionStream.cpp +++ b/Swiften/Session/BOSHSessionStream.cpp @@ -212,4 +212,4 @@ void BOSHSessionStream::handlePoolBOSHDataWritten(const SafeByteArray& data) {  	onDataWritten(data);  } -}; +} diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp index cd6d0e6..2bd8d66 100644 --- a/Swiften/Session/BasicSessionStream.cpp +++ b/Swiften/Session/BasicSessionStream.cpp @@ -207,4 +207,4 @@ void BasicSessionStream::handleDataWritten(const SafeByteArray& data) {  	onDataWritten(data);  } -}; +} diff --git a/Swiften/Session/SessionStream.cpp b/Swiften/Session/SessionStream.cpp index 0d73b63..7378680 100644 --- a/Swiften/Session/SessionStream.cpp +++ b/Swiften/Session/SessionStream.cpp @@ -11,4 +11,4 @@ namespace Swift {  SessionStream::~SessionStream() {  } -}; +} diff --git a/Swiften/StringCodecs/HMAC.h b/Swiften/StringCodecs/HMAC.h index 72d3bab..8b02d88 100644 --- a/Swiften/StringCodecs/HMAC.h +++ b/Swiften/StringCodecs/HMAC.h @@ -49,7 +49,7 @@ namespace Swift {  			return hash(y);  		} -	}; +	}  	template<typename Hash, int BlockSize>  	class HMAC { | 
 Swift
 Swift