Thought it might be a good idea to enable gcc warnings (-Wall -Wextra -ansi), so I did. While fixing
most of the resulting warnings, I also found a couple of bugs. So this was a Good Thing[tm], obviously.
Don't even think of enabling -pedantic as well - this fails horribly somewhere in Qt.
src/common/logger.h
src/common/main_core.cpp
src/common/main_gui.cpp
-src/common/main_mono.cpp
src/common/message.cpp
src/common/message.h
src/common/proxy_common.h
src/common/build_mono.cpp
src/common/build_qtgui.cpp
src/common/build_core.cpp
+src/common/main.cpp
SET(QT_USE_QTXML true)
SET(QT_USE_QTSQL true)
SET(QT_USE_QTNETWORK true)
+SET(QT_USE_QTUITOOLS true)
SET(QT_DONT_USE_QTGUI true) # This is added later if GUI is requested
INCLUDE(${QT_USE_FILE})
QT4_ADD_RESOURCES(_RCCS ${quassel_RCCS})
+ADD_DEFINITIONS(-Wall -Wextra -ansi) # may not be portable!
+
SET(TARGET_LIST )
IF(BUILD_CORE)
b->appendMsg(msg);
}
-void Client::recvStatusMsg(QString net, QString msg) {
+void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) {
//recvMessage(net, Message::server("", QString("[STATUS] %1").arg(msg)));
}
-void Client::recvBacklogData(BufferId id, const QList<QVariant> &msgs, bool done) {
+void Client::recvBacklogData(BufferId id, const QList<QVariant> &msgs, bool /*done*/) {
Buffer *b = buffer(id);
foreach(QVariant v, msgs) {
Message msg = v.value<Message>();
***************************************************************************/
#define BUILD_MONO
-#include "main_mono.cpp"
+#include "main.cpp"
struct Exception {
Exception(QString msg = "Unknown Exception") : _msg(msg) {};
+ virtual ~Exception() {}; // make gcc happy
virtual inline QString msg() { return _msg; }
protected:
QCoreApplication::setOrganizationName("Quassel IRC Development Team");
Global::quasselDir = QDir::homePath() + "/.quassel";
-
+ Core::instance();
#ifdef BUILD_MONO
QObject::connect(Core::localSession(), SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant)), ClientProxy::instance(), SLOT(recv(CoreSignal, QVariant, QVariant, QVariant)));
QObject::connect(ClientProxy::instance(), SIGNAL(send(ClientSignal, QVariant, QVariant, QVariant)), Core::localSession(), SLOT(processSignal(ClientSignal, QVariant, QVariant, QVariant)));
#endif
Settings::init();
- Style::init();
+#ifndef BUILD_CORE
+ Style::init();
MainWin *mainWin = new MainWin();
Client::init(mainWin);
mainWin->init();
+#else
+ Core::instance(); // create and init the core object
+#endif
+
int exitCode = app.exec();
+
+#ifndef BUILD_CORE
// the mainWin has to be deleted before the Core
// if not Quassel will crash on exit under certain conditions since the gui
// still wants to access clientdata
delete mainWin;
Client::destroy();
+#endif
+#ifndef BUILD_QTGUI
Core::destroy();
+#endif
+
return exitCode;
}
+#ifndef BUILD_CORE
void Client::syncToCore() {
//Q_ASSERT(Global::data("CoreReady").toBool());
coreBuffers = Core::localSession()->buffers();
// NOTE: We don't need to request server states, because in the monolithic version there can't be
// any servers connected at this stage...
}
-
+#endif
/***************************************************************************
- * Copyright (C) 2005/06 by The Quassel Team *
+ * Copyright (C) 2005-07 by The Quassel IRC Development Team *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
enum Flags { None = 0, Self = 1, PrivMsg = 2, Highlight = 4 };
uint msgId;
- Type type;
- quint8 flags;
+ BufferId buffer;
QString target;
- QString sender;
QString text;
+ QString sender;
+ Type type;
+ quint8 flags;
QDateTime timeStamp;
- BufferId buffer;
Message(QString _target, Type _type = Plain, QString _text = "", QString _sender = "", quint8 _flags = None)
: target(_target), text(_text), sender(_sender), type(_type), flags(_flags) { timeStamp = QDateTime::currentDateTime().toUTC(); }
: buffer(_buffer), text(_text), sender(_sender), type(_type), flags(_flags) { timeStamp = QDateTime::currentDateTime().toUTC(); }
Message(QDateTime _ts, BufferId _buffer = BufferId(), Type _type = Plain, QString _text = "", QString _sender = "", quint8 _flags = None)
- : timeStamp(_ts), buffer(_buffer), text(_text), sender(_sender), type(_type), flags(_flags) {}
-
-/*
- static Message plain(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message notice(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message action(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message nick(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message mode(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message join(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message part(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message quit(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message kick(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message kill(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message server(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message info(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
- static Message error(QString _target, QString _text, QString _sender = "", quint8 _flags = None);
-*/
+ : buffer(_buffer), text(_text), sender(_sender), type(_type), flags(_flags), timeStamp(_ts) {}
+
};
QDataStream &operator<<(QDataStream &out, const Message &msg);
class AbstractUiMsg {
public:
-
+ virtual ~AbstractUiMsg() {};
virtual QString sender() const = 0;
virtual QString text() const = 0;
virtual MsgId msgId() const = 0;
class AbstractUi {
public:
+ virtual ~AbstractUi() {};
virtual AbstractUiMsg *layoutMsg(const Message &) = 0;
}
Core::Core() {
-
+ qDebug() << "core";
}
void Core::init() {
*/
class SettingsInterface {
public:
+ virtual ~SettingsInterface() {};
virtual QString category() = 0;
virtual QString title() = 0;
virtual QWidget *settingsWidget() = 0;
return line.start;
}
}
+ qWarning() << "Should we ever reach this point?";
+ return 0;
}
void ChatLine::precomputeLine() {
for(int j = url.start; j < url.end; j++) charUrlIdx[j] = i;
}
if(!textFormat.count()) return;
- int idx = 0; int cnt = 0; int w = 0; int h = 0;
+ int idx = 0; int cnt = 0; int w = 0;
QFontMetrics metrics(textFormat[0].format.font());
Word wr;
wr.start = -1; wr.trailing = -1;
//}
}
-void ChatWidget::scrollBarValChanged(int val) {
- return;
+void ChatWidget::scrollBarValChanged(int /*val*/) {
+ /*
if(val >= verticalScrollBar()->maximum()) bottomLine = -1;
else {
int bot = val + viewport()->height();
int line = yToLineIdx(bot);
//bottomLine = line;
}
+ */
}
void ChatWidget::scrollBarAction(int action) {
void ChatWidget::layout() {
// TODO fix scrollbars
//int botLine = yToLineIdx(verticalScrollBar()->value() +
- qreal y = 0;
for(int i = 0; i < lines.count(); i++) {
qreal h = lines[i]->layout(tsWidth, senderWidth, textWidth);
ycoords[i+1] = h + ycoords[i];
}
int ChatWidget::yToLineIdx(qreal y) {
- if(y >= ycoords[ycoords.count()-1]) ycoords.count()-1;
+ if(y >= ycoords[ycoords.count()-1]) return ycoords.count()-1;
if(ycoords.count() <= 1) return 0;
int uidx = 0;
int oidx = ycoords.count() - 1;
}
mouseMode = Pressed;
break;
+ default:
+ break;
}
}
}
-void ChatWidget::mouseDoubleClickEvent(QMouseEvent *event) {
+void ChatWidget::mouseDoubleClickEvent(QMouseEvent * /*event*/) {
QPoint pos = _pos + QPoint(0, verticalScrollBar()->value());
int x = pos.x();
int y = pos.y();
- MousePos oldpos = mousePos;
+ //MousePos oldpos = mousePos;
if(x >= tsGrabPos - 3 && x <= tsGrabPos + 3) mousePos = OverTsSep;
else if(x >= senderGrabPos - 3 && x <= senderGrabPos + 3) mousePos = OverTextSep;
else mousePos = None;
break;
case DragTextSep:
break;
+ default:
+ break;
}
// Pass 2: Some mouse modes need work after being set...
if(mouseMode == DragTsSep && x < size().width() - Style::sepSenderText() - senderWidth - 10) {
return lines[selectionLine]->text().mid(selectionStart, selectionEnd - selectionStart);
}
-/************************************************************************************/
-
-
-/******************************************************************************************************************/
-
public:
MainWin();
- ~MainWin();
+ virtual ~MainWin();
void init();
void registerBufferViewDock(BufferViewDock *);
/***************************************************************************/
-ServerEditDlg::ServerEditDlg(QWidget *parent, VarMap server) {
+ServerEditDlg::ServerEditDlg(QWidget *parent, VarMap server) : QDialog(parent) {
ui.setupUi(this);
if(!server.isEmpty()) {