diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-12-30 16:47:37 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-12-30 18:03:54 (GMT) |
commit | 96b31c598f5c229c3acc0579ddfe22dd503e2b9d (patch) | |
tree | d73db22e591e49f088f359b9876df232eb99c6a9 /Swift/QtUI | |
parent | b19210aa48e7cea40929593daed997668fe789be (diff) | |
download | swift-96b31c598f5c229c3acc0579ddfe22dd503e2b9d.zip swift-96b31c598f5c229c3acc0579ddfe22dd503e2b9d.tar.bz2 |
Enable & fix pedantic CLang warnings.
Change-Id: I70109624b4bd7aab9ba679a3eaabc225dd64a03a
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/EventViewer/EventDelegate.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtAffiliationEditor.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtAffiliationEditor.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtFileTransferListItemModel.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.cpp | 9 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtWebView.cpp | 3 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 5 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/ColorWidget.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/FreehandLineItem.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/GView.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp | 17 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/QtWhiteboardWindow.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/TextDialog.h | 4 |
18 files changed, 41 insertions, 31 deletions
diff --git a/Swift/QtUI/EventViewer/EventDelegate.cpp b/Swift/QtUI/EventViewer/EventDelegate.cpp index 9ecdd34..fdb1866 100644 --- a/Swift/QtUI/EventViewer/EventDelegate.cpp +++ b/Swift/QtUI/EventViewer/EventDelegate.cpp @@ -29,7 +29,6 @@ QSize EventDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIn case SubscriptionEventType: return subscriptionDelegate_.sizeHint(option, item); case ErrorEventType: return errorDelegate_.sizeHint(option, item); case MUCInviteEventType: return mucInviteDelegate_.sizeHint(option, item); - default: return QStyledItemDelegate::sizeHint(option, index); } } @@ -44,7 +43,6 @@ void EventDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, case SubscriptionEventType: subscriptionDelegate_.paint(painter, option, item);break; case ErrorEventType: errorDelegate_.paint(painter, option, item);break; case MUCInviteEventType: mucInviteDelegate_.paint(painter, option, item);break; - default: QStyledItemDelegate::paint(painter, option, index); } } diff --git a/Swift/QtUI/QtAffiliationEditor.cpp b/Swift/QtUI/QtAffiliationEditor.cpp index ed03c23..0896b92 100644 --- a/Swift/QtUI/QtAffiliationEditor.cpp +++ b/Swift/QtUI/QtAffiliationEditor.cpp @@ -76,4 +76,4 @@ MUCOccupant::Affiliation QtAffiliationEditor::affiliationFromIndex(int affiliati } } -}
\ No newline at end of file +} diff --git a/Swift/QtUI/QtAffiliationEditor.h b/Swift/QtUI/QtAffiliationEditor.h index 913b2cc..96536eb 100644 --- a/Swift/QtUI/QtAffiliationEditor.h +++ b/Swift/QtUI/QtAffiliationEditor.h @@ -34,4 +34,4 @@ namespace Swift { std::map<MUCOccupant::Affiliation, std::vector<JID> > affiliations_; std::vector<ChangePair> changes_; }; -}
\ No newline at end of file +} diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index d3a5676..7d8f16e 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -237,7 +237,7 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) { switch (tabbable->getWidgetAlertState()) { case QtTabbable::WaitingActivity : tabTextColor = QColor(217, 20, 43); break; case QtTabbable::ImpendingActivity : tabTextColor = QColor(27, 171, 32); break; - default : tabTextColor = QColor(); + case QtTabbable::NoActivity : tabTextColor = QColor(); break; } tabs_->tabBar()->setTabTextColor(index, tabTextColor); diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index 81820a3..967ebec 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -365,7 +365,7 @@ void QtChatView::resetView() { connect(webPage_->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(handleFrameSizeChanged()), Qt::UniqueConnection); } -QWebElement findElementWithID(QWebElement document, QString elementName, QString id) { +static QWebElement findElementWithID(QWebElement document, QString elementName, QString id) { QWebElementCollection elements = document.findAll(elementName); foreach(QWebElement element, elements) { if (element.attribute("id") == id) { diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 28549f8..5d57184 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -576,6 +576,7 @@ std::string QtChatWindow::addAction(const std::string &message, const std::strin return addMessage(" *" + linkimoticonify(P2QSTRING(message)) + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ", time); } +// FIXME: Move this to a different file std::string formatSize(const boost::uintmax_t bytes) { static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL}; int power = 0; @@ -587,11 +588,11 @@ std::string formatSize(const boost::uintmax_t bytes) { return str( boost::format("%.1lf %sB") % engBytes % (power > 0 ? siPrefix[power-1] : "") ); } -QString encodeButtonArgument(const QString& str) { +static QString encodeButtonArgument(const QString& str) { return Qt::escape(P2QSTRING(Base64::encode(createByteArray(Q2PSTRING(str))))); } -QString decodeButtonArgument(const QString& str) { +static QString decodeButtonArgument(const QString& str) { return P2QSTRING(byteArrayToString(Base64::decode(Q2PSTRING(str)))); } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 3416b42..c32ae83 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -37,6 +37,9 @@ namespace Swift { class QtChatWindowJSBridge; class SettingsProvider; + // FIXME: Move this to a different file + std::string formatSize(const boost::uintmax_t bytes); + class LabelModel : public QAbstractListModel { Q_OBJECT public: diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp index cf1de07..71961c2 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.cpp +++ b/Swift/QtUI/QtFileTransferListItemModel.cpp @@ -9,14 +9,14 @@ #include <boost/bind.hpp> #include <boost/cstdint.hpp> +#include "QtChatWindow.h" // for formatSize + #include <Swiften/Base/boost_bsignals.h> #include <Swift/Controllers/FileTransfer/FileTransferController.h> #include <Swift/Controllers/FileTransfer/FileTransferOverview.h> namespace Swift { -extern std::string formatSize(const boost::uintmax_t bytes); - QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) { } diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index e54bd51..875235d 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -23,6 +23,7 @@ #include <QLineEdit> #include <boost/smart_ptr/make_shared.hpp> +#include <boost/numeric/conversion/cast.hpp> #include <boost/date_time/gregorian/gregorian.hpp> namespace Swift { @@ -183,7 +184,7 @@ void QtHistoryWindow::handleScrollReachedTop() { int year, month, day; QDate firstDate = *dates_.begin(); firstDate.getDate(&year, &month, &day); - onScrollReachedTop(boost::gregorian::date(year, month, day)); + onScrollReachedTop(boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day))); } void QtHistoryWindow::handleScrollReachedBottom() { @@ -194,7 +195,7 @@ void QtHistoryWindow::handleScrollReachedBottom() { int year, month, day; QDate lastDate = *dates_.rbegin(); lastDate.getDate(&year, &month, &day); - onScrollReachedBottom(boost::gregorian::date(year, month, day)); + onScrollReachedBottom(boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day))); } void QtHistoryWindow::handleReturnPressed() { @@ -205,7 +206,7 @@ void QtHistoryWindow::handleCalendarClicked(const QDate& date) { int year, month, day; QDate tempDate = date; // getDate discards const qualifier tempDate.getDate(&year, &month, &day); - onCalendarClicked(boost::gregorian::date(year, month, day)); + onCalendarClicked(boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day))); } void QtHistoryWindow::setDate(const boost::gregorian::date& date) { @@ -242,7 +243,7 @@ boost::gregorian::date QtHistoryWindow::getLastVisibleDate() { int year, month, day; lastDate.getDate(&year, &month, &day); - return boost::gregorian::date(year, month, day); + return boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day)); } return boost::gregorian::date(boost::gregorian::not_a_date_time); } diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 96e08a3..4d10956 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -67,9 +67,9 @@ namespace Swift{ #if defined(SWIFTEN_PLATFORM_MACOSX) -#define SWIFT_APPCAST_URL "http://swift.im/appcast/swift-mac-dev.xml" +//#define SWIFT_APPCAST_URL "http://swift.im/appcast/swift-mac-dev.xml" #else -#define SWIFT_APPCAST_URL "" +//#define SWIFT_APPCAST_URL "" #endif po::options_description QtSwift::getOptionsDescription() { diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp index 388f06a..1222ee2 100644 --- a/Swift/QtUI/QtWebView.cpp +++ b/Swift/QtUI/QtWebView.cpp @@ -9,6 +9,7 @@ #include <QKeyEvent> #include <QFocusEvent> +#include <boost/numeric/conversion/cast.hpp> #include <QMenu> namespace Swift { @@ -30,7 +31,7 @@ void QtWebView::keyPressEvent(QKeyEvent* event) { modifiers, event->text(), event->isAutoRepeat(), - event->count()); + boost::numeric_cast<unsigned short>(event->count())); QWebView::keyPressEvent(translatedEvent); delete translatedEvent; } diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 54304d4..df7cc87 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -20,7 +20,12 @@ def generateDefaultTheme(dir) : Import("env") 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"]) + myenv.UseFlags(env["SWIFT_CONTROLLERS_FLAGS"]) myenv.UseFlags(env["SWIFTOOLS_FLAGS"]) if myenv["HAVE_XSS"] : diff --git a/Swift/QtUI/Whiteboard/ColorWidget.h b/Swift/QtUI/Whiteboard/ColorWidget.h index 6abdf00..ae1af0f 100644 --- a/Swift/QtUI/Whiteboard/ColorWidget.h +++ b/Swift/QtUI/Whiteboard/ColorWidget.h @@ -10,7 +10,7 @@ namespace Swift { class ColorWidget : public QWidget { - Q_OBJECT; + Q_OBJECT public: ColorWidget(QWidget* parent = 0); QSize sizeHint() const; diff --git a/Swift/QtUI/Whiteboard/FreehandLineItem.h b/Swift/QtUI/Whiteboard/FreehandLineItem.h index f3c6607..b1af3d1 100644 --- a/Swift/QtUI/Whiteboard/FreehandLineItem.h +++ b/Swift/QtUI/Whiteboard/FreehandLineItem.h @@ -10,8 +10,6 @@ #include <QPainter> #include <iostream> -using namespace std; - namespace Swift { class FreehandLineItem : public QGraphicsItem { public: diff --git a/Swift/QtUI/Whiteboard/GView.h b/Swift/QtUI/Whiteboard/GView.h index 88ea326..6a4fd2f 100644 --- a/Swift/QtUI/Whiteboard/GView.h +++ b/Swift/QtUI/Whiteboard/GView.h @@ -18,7 +18,7 @@ namespace Swift { class GView : public QGraphicsView { - Q_OBJECT; + Q_OBJECT public: enum Mode { Rubber, Line, Rect, Circle, HandLine, Text, Polygon, Select }; enum Type { New, Update, MoveUp, MoveDown }; diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 50d7f54..414e590 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -10,6 +10,7 @@ #include <boost/bind.hpp> #include <boost/smart_ptr/make_shared.hpp> +#include <boost/numeric/conversion/cast.hpp> #include <Swiften/Whiteboard/WhiteboardSession.h> #include <Swiften/Elements/WhiteboardPayload.h> @@ -264,7 +265,9 @@ namespace Swift { std::vector<std::pair<int, int> > points; QVector<QPointF>::const_iterator it = freehandLineItem->points().constBegin(); for ( ; it != freehandLineItem->points().constEnd(); ++it) { - points.push_back(std::pair<int, int>(it->x()+item->pos().x(), it->y()+item->pos().y())); + points.push_back(std::pair<int, int>( + boost::numeric_cast<int>(it->x()+item->pos().x()), + boost::numeric_cast<int>(it->y()+item->pos().y()))); } element->setColor(WhiteboardColor(color.red(), color.green(), color.blue(), color.alpha())); @@ -310,7 +313,9 @@ namespace Swift { std::vector<std::pair<int, int> > points; QVector<QPointF>::const_iterator it = polygon.begin(); for (; it != polygon.end(); ++it) { - points.push_back(std::pair<int, int>(it->x()+item->pos().x(), it->y()+item->pos().y())); + points.push_back(std::pair<int, int>( + boost::numeric_cast<int>(it->x()+item->pos().x()), + boost::numeric_cast<int>(it->y()+item->pos().y()))); } element->setPoints(points); @@ -328,10 +333,10 @@ namespace Swift { QGraphicsEllipseItem* ellipseItem = qgraphicsitem_cast<QGraphicsEllipseItem*>(item); if (ellipseItem) { QRectF rect = ellipseItem->rect(); - int cx = rect.x()+rect.width()/2 + item->pos().x(); - int cy = rect.y()+rect.height()/2 + item->pos().y(); - int rx = rect.width()/2; - int ry = rect.height()/2; + int cx = boost::numeric_cast<int>(rect.x()+rect.width()/2 + item->pos().x()); + int cy = boost::numeric_cast<int>(rect.y()+rect.height()/2 + item->pos().y()); + int rx = boost::numeric_cast<int>(rect.width()/2); + int ry = boost::numeric_cast<int>(rect.height()/2); WhiteboardEllipseElement::ref element = boost::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry); QColor penColor = ellipseItem->pen().color(); diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h index 4665ef0..3957bb7 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h @@ -30,7 +30,7 @@ namespace Swift { class QtWhiteboardWindow : public QWidget, public WhiteboardWindow { - Q_OBJECT; + Q_OBJECT public: QtWhiteboardWindow(WhiteboardSession::ref whiteboardSession); void show(); diff --git a/Swift/QtUI/Whiteboard/TextDialog.h b/Swift/QtUI/Whiteboard/TextDialog.h index f4d9a13..64a0fe2 100644 --- a/Swift/QtUI/Whiteboard/TextDialog.h +++ b/Swift/QtUI/Whiteboard/TextDialog.h @@ -16,12 +16,10 @@ #include <iostream> -using namespace std; - namespace Swift { class TextDialog : public QDialog { - Q_OBJECT; + Q_OBJECT public: TextDialog(QGraphicsTextItem* item, QWidget* parent = 0); |