# -DWANT_(CORE|QTCLIENT|MONO)=(ON|OFF)
# : select binaries to build
# -DQT=/path/to/qt : Choose a Qt4 installation to use instead of the system Qt4
-# -DSTATIC=1 : Enable static building of Quassel, most useful with a static Qt.
-# -DSTATICWIN=1 : Enable static building for Windows.
+# -DSTATIC : Enable static building of Quassel. Use with care.
# -DSPUTDEV : Do not use.
#
# NOTE: You need to remove CMakeCache.txt if you plan to change any of these values!
# with 2.4, so... DUH!
# cmake_policy(SET CMP0003 OLD) # suppress linker warnings
+# Temporary
if(STATICWIN)
- set(CMAKE_BUILD_TYPE Release)
+ set(STATIC 1)
endif(STATICWIN)
+if(STATIC)
+ set(CMAKE_BUILD_TYPE Release)
+endif(STATIC)
+
# Enable various flags on gcc
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wall Wall)
qt4_add_resources(RC_SQL src/core/sql.qrc)
# Set global buildflags
-if(DEFINED STATIC)
- set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc ${CMAKE_EXE_LINKER_FLAGS}")
- link_directories(${CMAKE_BINARY_DIR}/staticlibs)
-endif(DEFINED STATIC)
-
-if(STATICWIN AND WIN32)
+# This is very much non-portable, so don't use -DSTATICGCC until you know what
+# you do.
+if(STATIC AND CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_CXX_FLAGS "-static-libgcc ${CMAKE_CXX_FLAGS}")
+ link_directories(${CMAKE_BINARY_DIR}/staticlibs) # override dynamic libs
+ if(OPENSSL_FOUND)
+ set(QUASSEL_SSL_LIBRARIES ssl crypto) # these miss in static builds
+ endif(OPENSSL_FOUND)
+endif(STATIC AND CMAKE_COMPILER_IS_GNUCXX)
+
+if(STATIC AND WIN32)
link_libraries(imm32 winmm) # missing by default :/
if(OPENSSL_FOUND)
link_libraries(${OPENSSL_LIBRARIES} libeay32MD)
endif(OPENSSL_FOUND)
-endif(STATICWIN AND WIN32)
+endif(STATIC AND WIN32)
if(WIN32)
set(WIN32_RC src/icons/win32.rc) # for app icons on windows
# This macro sets variables for additional Qt modules.
macro(setup_qt4_variables)
set(QUASSEL_QT_LIBRARIES )
- foreach(qtmod CORE ${ARGV})
+ IF(WIN32)
+ set(MAIN MAIN)
+ ENDIF(WIN32)
+ foreach(qtmod CORE ${ARGV} ${MAIN})
set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_QT${qtmod}_LIBRARY} ${QT_${qtmod}_LIB_DEPENDENCIES})
endforeach(qtmod ${ARGV})
set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_LIBRARIES})
${RC_SQL} ${RC_I18N} ${WIN32_RC})
set_target_properties(quasselcore PROPERTIES
COMPILE_FLAGS "-DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_CORE")
- target_link_libraries(quasselcore mod_core mod_common ${QUASSEL_QT_LIBRARIES})
+ target_link_libraries(quasselcore mod_core mod_common
+ ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
endif(WANT_CORE)
if(WANT_QTCLIENT)
- setup_qt4_variables(GUI NETWORK MAIN)
+ setup_qt4_variables(GUI NETWORK)
add_executable(quasselclient WIN32 ${CMAKE_SOURCE_DIR}/src/common/main.cpp
- ${RC_ICONS} ${RC_QUASSEL_ICONS} ${RC_I18N} ${WIN32_RC})
+ ${RC_ICONS} ${RC_QUASSEL_ICONS} ${RC_I18N} ${WIN32_RC})
set_target_properties(quasselclient PROPERTIES
COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DBUILD_QTUI")
- target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common ${QUASSEL_QT_LIBRARIES})
+ target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common
+ ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
endif(WANT_QTCLIENT)
if(WANT_MONO)
- setup_qt4_variables(GUI NETWORK SCRIPT SQL MAIN)
+ setup_qt4_variables(GUI NETWORK SCRIPT SQL)
add_executable(quassel WIN32 ${CMAKE_SOURCE_DIR}/src/common/main.cpp
- ${RC_ICONS} ${RC_QUASSEL_ICONS} ${RC_SQL} ${RC_I18N} ${WIN32_RC})
+ ${RC_ICONS} ${RC_QUASSEL_ICONS} ${RC_SQL} ${RC_I18N} ${WIN32_RC})
set_target_properties(quassel PROPERTIES
COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_MONO")
- target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${QUASSEL_QT_LIBRARIES})
+ target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common
+ ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
endif(WANT_MONO)
# Build bundles for MacOSX
Quassel recognizes the following options:
--DBUILD=<string>
- Specify which Quassel binaries to build. <string> may contain any combination of
- "core", "client", "mono" or "all".
+-DWANT_(CORE|QTCLIENT|MONO)=(ON|OFF)
+ Allow to choose which Quassel binaries to build.
-DQT=/path/to/qt
Use a non-system Qt installation. This is for example useful if you have a static
for(dep, DEPMOD) {
INCLUDEPATH *= $$SRCPATH/$$dep
}
-INCLUDEPATH *= $$MODPATH # and don't forget our own dir
+INCLUDEPATH *= $$MODPATH ../../ # and don't forget our own dir
# Now prefix all filenames with the correct dirname
--- /dev/null
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=Quassel IRC
+GenericName=IRC Client
+Comment=Distributed IRC client with central core component
+Icon=quassel
+TryExec=quasselclient
+Exec=quasselclient
+Categories=Qt;Network;Chat;IRCClient;
--- /dev/null
+#!/usr/bin/python
+# -*- coding: iso-8859-1 -*-
+
+# ==============================
+# Imports
+# ==============================
+import os
+import sha
+import sys
+
+try:
+ import sqlite3
+except ImportError:
+ print >> sys.stderr, "ERROR: sqlite3 module not available!"
+ print >> sys.stderr, "This script needs sqlite3 support which is part of Python 2.5"
+ print >> sys.stderr, "You probably need to upgrade your Python installation first."
+ sys.exit(3)
+
+class UserManager(object):
+ def __init__(self):
+ self.db = sqlite3.connect(os.environ['HOME'] + '/.quassel/quassel-storage.sqlite')
+
+ def __del__(self):
+ self.db.commit()
+ self.db.close();
+
+ def shaCrypt(self, password):
+ shaPass = sha.new(password)
+ return shaPass.hexdigest()
+
+ def addUser(self, username, password):
+ cursor = self.db.cursor()
+ cursor.execute('INSERT INTO quasseluser (username, password) VALUES (:username, :password)',
+ {'username':username, 'password':self.shaCrypt(password)})
+
+ def changePass(self, username, password):
+ cursor = self.db.cursor()
+ cursor.execute('UPDATE quasseluser SET password = :password WHERE username = :username',
+ {'username':username, 'password':self.shaCrypt(password)})
+
+if __name__ == "__main__":
+ generalError = "ERROR: Wrong arugment count (Syntax: %s add|changepass <username> <password>)" % sys.argv[0]
+ if len(sys.argv) < 3:
+ print generalError
+ sys.exit(1)
+
+ if sys.argv[1].lower() not in ['add', 'changepass']:
+ print generalError
+ sys.exit(2)
+
+ userManager = UserManager()
+ actions = {'add':userManager.addUser,
+ 'changepass':userManager.changePass}
+
+ actions[sys.argv[1]](sys.argv[2], sys.argv[3])
+
void Buffer::setLastSeenMsg(const MsgId &msgId) {
// qDebug() << "want to set lastSeen:" << bufferInfo() << seen << lastSeen();
const MsgId oldLastSeen = lastSeenMsg();
- if(!oldLastSeen.isValid() || msgId.isValid() && msgId > oldLastSeen) {
+ if(!oldLastSeen.isValid() || (msgId.isValid() && msgId > oldLastSeen)) {
//qDebug() << "setting:" << bufferInfo().bufferName() << seen;
_lastSeenMsg = msgId;
Client::setBufferLastSeenMsg(bufferInfo().bufferId(), msgId);
void ClientSyncer::clientInitAck(const QVariantMap &msg) {
// Core has accepted our version info and sent its own. Let's see if we accept it as well...
- if(msg.contains("CoreBuild") && msg["CoreBuild"].toUInt() < 732 // legacy!
- || !msg.contains("CoreBuild") && msg["ProtocolVersion"].toUInt() < Global::clientNeedsProtocol) {
+ if((msg.contains("CoreBuild") && msg["CoreBuild"].toUInt() < 732) // legacy!
+ || (!msg.contains("CoreBuild") && msg["ProtocolVersion"].toUInt() < Global::clientNeedsProtocol)) {
emit connectionError(tr("<b>The Quassel Core you are trying to connect to is too old!</b><br>"
"Need at least core/client protocol v%1 to connect.").arg(Global::clientNeedsProtocol));
disconnectFromCore();
UserCategoryItem *categoryItem = 0;
for(int i = 0; i < childCount(); i++) {
categoryItem = qobject_cast<UserCategoryItem *>(child(i));
- if(success = categoryItem->removeUser(ircUser)) {
+ if((success = categoryItem->removeUser(ircUser))) {
if(categoryItem->childCount() == 0)
removeChild(i);
break;
toolTip.append(tr("<b>Topic:</b> %1").arg(_topic));
}
}
+ if(_ircChannel) {
+ QString channelMode = _ircChannel->channelModeString(); // channelModeString is compiled on the fly -> thus cache the result
+ if(!channelMode.isEmpty())
+ toolTip.append(tr("<b>Mode:</b> %1").arg(channelMode));
+ }
} else {
toolTip.append(tr("Not active <br /> Double-click to join"));
}
// ok, create our version.gen now
QFile gen(target);
if(!gen.open(QIODevice::WriteOnly | QIODevice::Text)) {
- qFatal(QString("Could not write %1!").arg(target).toAscii());
+ qFatal("%s", qPrintable(QString("Could not write %1!").arg(target)));
return 255;
}
gen.write(QString("quasselGeneratedVersion = \"%1\";\n"
#include "ircchannel.h"
#include "network.h"
-//#include "nicktreemodel.h"
-#include "signalproxy.h"
#include "ircuser.h"
#include "util.h"
#include <QDebug>
-IrcChannel::IrcChannel(const QString &channelname, Network *network) : SyncableObject(network),
+IrcChannel::IrcChannel(const QString &channelname, Network *network)
+ : SyncableObject(network),
_initialized(false),
_name(channelname),
_topic(QString()),
setObjectName(QString::number(network->networkId().toInt()) + "/" + channelname);
}
-IrcChannel::~IrcChannel() {
-}
-
// ====================
// PUBLIC:
// ====================
emit userModeRemoved(ircuser->nick(), mode);
emit ircUserModeRemoved(ircuser, mode);
}
-
}
void IrcChannel::removeUserMode(const QString &nick, const QString &mode) {
joinIrcUsers(users, modes);
}
+QVariantMap IrcChannel::initChanModes() const {
+ QVariantMap channelModes;
+
+ QVariantMap A_modes;
+ QHash<QChar, QStringList>::const_iterator A_iter = _A_channelModes.constBegin();
+ while(A_iter != _A_channelModes.constEnd()) {
+ A_modes[A_iter.key()] = A_iter.value();
+ A_iter++;
+ }
+ channelModes["A"] = A_modes;
+
+ QVariantMap B_modes;
+ QHash<QChar, QString>::const_iterator B_iter = _B_channelModes.constBegin();
+ while(B_iter != _B_channelModes.constEnd()) {
+ B_modes[B_iter.key()] = B_iter.value();
+ B_iter++;
+ }
+ channelModes["B"] = B_modes;
+
+ QVariantMap C_modes;
+ QHash<QChar, QString>::const_iterator C_iter = _C_channelModes.constBegin();
+ while(C_iter != _C_channelModes.constEnd()) {
+ C_modes[C_iter.key()] = C_iter.value();
+ C_iter++;
+ }
+ channelModes["C"] = C_modes;
+
+ QString D_modes;
+ QSet<QChar>::const_iterator D_iter = _D_channelModes.constBegin();
+ while(D_iter != _D_channelModes.constEnd()) {
+ D_modes += *D_iter;
+ D_iter++;
+ }
+ channelModes["D"] = D_modes;
+
+ return channelModes;
+}
+
+void IrcChannel::initSetChanModes(const QVariantMap &channelModes) {
+ QVariantMap::const_iterator iter = channelModes["A"].toMap().constBegin();
+ QVariantMap::const_iterator iterEnd = channelModes["A"].toMap().constEnd();
+ while(iter != iterEnd) {
+ _A_channelModes[iter.key()[0]] = iter.value().toStringList();
+ iter++;
+ }
+
+ iter = channelModes["B"].toMap().constBegin();
+ iterEnd = channelModes["B"].toMap().constEnd();
+ while(iter != iterEnd) {
+ _B_channelModes[iter.key()[0]] = iter.value().toString();
+ iter++;
+ }
+
+ iter = channelModes["C"].toMap().constBegin();
+ iterEnd = channelModes["C"].toMap().constEnd();
+ while(iter != iterEnd) {
+ _C_channelModes[iter.key()[0]] = iter.value().toString();
+ iter++;
+ }
+
+ QString D_modes = channelModes["D"].toString();
+ for(int i = 0; i < D_modes.count(); i++) {
+ _D_channelModes << D_modes[i];
+ }
+
+}
+
void IrcChannel::ircUserDestroyed() {
IrcUser *ircUser = static_cast<IrcUser *>(sender());
Q_ASSERT(ircUser);
emit ircUserNickSet(ircUser, nick);
}
+/*******************************************************************************
+ *
+ * 3.3 CHANMODES
+ *
+ * o CHANMODES=A,B,C,D
+ *
+ * The CHANMODES token specifies the modes that may be set on a channel.
+ * These modes are split into four categories, as follows:
+ *
+ * o Type A: Modes that add or remove an address to or from a list.
+ * These modes always take a parameter when sent by the server to a
+ * client; when sent by a client, they may be specified without a
+ * parameter, which requests the server to display the current
+ * contents of the corresponding list on the channel to the client.
+ * o Type B: Modes that change a setting on the channel. These modes
+ * always take a parameter.
+ * o Type C: Modes that change a setting on the channel. These modes
+ * take a parameter only when set; the parameter is absent when the
+ * mode is removed both in the client's and server's MODE command.
+ * o Type D: Modes that change a setting on the channel. These modes
+ * never take a parameter.
+ *
+ * If the server sends any additional types after these 4, the client
+ * MUST ignore them; this is intended to allow future extension of this
+ * token.
+ *
+ * The IRC server MUST NOT list modes in CHANMODES which are also
+ * present in the PREFIX parameter; however, for completeness, modes
+ * described in PREFIX may be treated as type B modes.
+ *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Short Version:
+ * A --> add/remove from List
+ * B --> set value or remove
+ * C --> set value or remove
+ * D --> on/off
+ *
+ * B and C behave very similar... we store the data in different datastructes
+ * for future compatibility
+ ******************************************************************************/
+
+// NOTE: the behavior of addChannelMode and removeChannelMode depends on the type of mode
+// see list above for chanmode types
+void IrcChannel::addChannelMode(const QChar &mode, const QString &value) {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::NOT_A_CHANMODE:
+ return;
+ case Network::A_CHANMODE:
+ if(!_A_channelModes.contains(mode))
+ _A_channelModes[mode] = QStringList(value);
+ else if(!_A_channelModes[mode].contains(value))
+ _A_channelModes[mode] << value;
+ break;
+
+ case Network::B_CHANMODE:
+ _B_channelModes[mode] = value;
+ break;
+
+ case Network::C_CHANMODE:
+ _C_channelModes[mode] = value;
+ break;
+
+ case Network::D_CHANMODE:
+ _D_channelModes << mode;
+ break;
+ }
+ emit channelModeAdded(mode, value);
+}
+
+void IrcChannel::removeChannelMode(const QChar &mode, const QString &value) {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::NOT_A_CHANMODE:
+ return;
+ case Network::A_CHANMODE:
+ if(_A_channelModes.contains(mode))
+ _A_channelModes[mode].removeAll(value);
+ break;
+
+ case Network::B_CHANMODE:
+ _B_channelModes.remove(mode);
+ break;
+
+ case Network::C_CHANMODE:
+ _C_channelModes.remove(mode);
+ break;
+
+ case Network::D_CHANMODE:
+ _D_channelModes.remove(mode);
+ break;
+ }
+ emit channelModeRemoved(mode, value);
+}
+
+bool IrcChannel::hasMode(const QChar &mode) const {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::NOT_A_CHANMODE:
+ return false;
+ case Network::A_CHANMODE:
+ return _A_channelModes.contains(mode);
+ case Network::B_CHANMODE:
+ return _B_channelModes.contains(mode);
+ case Network::C_CHANMODE:
+ return _C_channelModes.contains(mode);
+ case Network::D_CHANMODE:
+ return _D_channelModes.contains(mode);
+ default:
+ return false;
+ }
+}
+
+QString IrcChannel::modeValue(const QChar &mode) const {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::B_CHANMODE:
+ if(_B_channelModes.contains(mode))
+ return _B_channelModes[mode];
+ else
+ return QString();
+ case Network::C_CHANMODE:
+ if(_C_channelModes.contains(mode))
+ return _C_channelModes[mode];
+ else
+ return QString();
+ default:
+ return QString();
+ }
+
+}
+
+QStringList IrcChannel::modeValueList(const QChar &mode) const {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::A_CHANMODE:
+ if(_A_channelModes.contains(mode))
+ return _A_channelModes[mode];
+ default:
+ return QStringList();
+ }
+}
+
+QString IrcChannel::channelModeString() const {
+ QStringList params;
+ QString modeString;
+
+ QSet<QChar>::const_iterator D_iter = _D_channelModes.constBegin();
+ while(D_iter != _D_channelModes.constEnd()) {
+ modeString += *D_iter;
+ D_iter++;
+ }
+
+ QHash<QChar, QString>::const_iterator BC_iter = _C_channelModes.constBegin();
+ while(BC_iter != _C_channelModes.constEnd()) {
+ modeString += BC_iter.key();
+ params << BC_iter.value();
+ BC_iter++;
+ }
+
+ BC_iter = _B_channelModes.constBegin();
+ while(BC_iter != _B_channelModes.constEnd()) {
+ modeString += BC_iter.key();
+ params << BC_iter.value();
+ BC_iter++;
+ }
+ if(modeString.isEmpty())
+ return modeString;
+ else
+ return QString("+%1 %2").arg(modeString).arg(params.join(" "));
+}
#define _IRCCHANNEL_H_
#include <QHash>
+#include <QSet>
#include <QString>
#include <QStringList>
#include <QVariantMap>
class IrcUser;
class Network;
-class SignalProxy;
class IrcChannel : public SyncableObject {
Q_OBJECT
public:
IrcChannel(const QString &channelname, Network *network);
- ~IrcChannel();
bool isKnownUser(IrcUser *ircuser) const;
bool isValidChannelUserMode(const QString &mode) const;
QString userModes(IrcUser *ircuser) const;
QString userModes(const QString &nick) const;
+ bool hasMode(const QChar &mode) const;
+ QString modeValue(const QChar &mode) const;
+ QStringList modeValueList(const QChar &mode) const;
+ QString channelModeString() const;
+
inline QTextCodec *codecForEncoding() const { return _codecForEncoding; }
inline QTextCodec *codecForDecoding() const { return _codecForDecoding; }
void setCodecForEncoding(const QString &codecName);
void removeUserMode(IrcUser *ircuser, const QString &mode);
void removeUserMode(const QString &nick, const QString &mode);
+ void addChannelMode(const QChar &mode, const QString &value);
+ void removeChannelMode(const QChar &mode, const QString &value);
+
// init geters
QVariantMap initUserModes() const;
+ QVariantMap initChanModes() const;
// init seters
void initSetUserModes(const QVariantMap &usermodes);
+ void initSetChanModes(const QVariantMap &chanModes);
signals:
void topicSet(const QString &topic);
void passwordSet(const QString &password);
void userModesSet(QString nick, QString modes);
- //void userModesSet(IrcUser *ircuser, QString modes);
void userModeAdded(QString nick, QString mode);
- //void userModeAdded(IrcUser *ircuser, QString mode);
void userModeRemoved(QString nick, QString mode);
- //void userModeRemoved(IrcUser *ircuser, QString mode);
-
+ void channelModeAdded(const QChar &mode, const QString &value);
+ void channelModeRemoved(const QChar &mode, const QString &value);
+
void ircUsersJoined(QList<IrcUser *> ircusers);
void ircUsersJoined(QStringList nicks, QStringList modes);
void ircUserParted(IrcUser *ircuser);
QTextCodec *_codecForEncoding;
QTextCodec *_codecForDecoding;
+
+ QHash<QChar, QStringList> _A_channelModes;
+ QHash<QChar, QString> _B_channelModes;
+ QHash<QChar, QString> _C_channelModes;
+ QSet<QChar> _D_channelModes;
+
};
#endif
//! Signal handler for graceful shutdown.
void handle_signal(int sig) {
- qWarning(QString("Caught signal %1 - exiting.").arg(sig).toAscii());
+ qWarning("%s", qPrintable(QString("Caught signal %1 - exiting.").arg(sig)));
QCoreApplication::quit();
}
***************************************************************************/
#include "network.h"
-#include "signalproxy.h"
-#include "ircuser.h"
-#include "ircchannel.h"
-
#include <QDebug>
#include <QTextCodec>
QTextCodec *Network::_defaultCodecForServer = 0;
QTextCodec *Network::_defaultCodecForEncoding = 0;
QTextCodec *Network::_defaultCodecForDecoding = 0;
-
// ====================
// Public:
// ====================
-Network::Network(const NetworkId &networkid, QObject *parent) : SyncableObject(parent),
+Network::Network(const NetworkId &networkid, QObject *parent)
+ : SyncableObject(parent),
_proxy(0),
_networkId(networkid),
_identity(0),
setObjectName(QString::number(networkid.toInt()));
}
-// I think this is unnecessary since IrcUsers have us as their daddy :)
-
Network::~Network() {
emit aboutToBeDestroyed();
-// QHashIterator<QString, IrcUser *> ircuser(_ircUsers);
-// while (ircuser.hasNext()) {
-// ircuser.next();
-// delete ircuser.value();
-// }
-// qDebug() << "Destroying net" << networkName() << networkId();
-}
-
-
-NetworkId Network::networkId() const {
- return _networkId;
-}
-
-SignalProxy *Network::proxy() const {
- return _proxy;
-}
-
-void Network::setProxy(SignalProxy *proxy) {
- _proxy = proxy;
- //proxy->synchronize(this); // we should to this explicitly from the outside!
-}
-
-bool Network::isMyNick(const QString &nick) const {
- return (myNick().toLower() == nick.toLower());
-}
-
-bool Network::isMe(IrcUser *ircuser) const {
- return (ircuser->nick().toLower() == myNick().toLower());
}
bool Network::isChannelName(const QString &channelname) const {
return QString("#&!+").contains(channelname[0]);
}
-bool Network::isConnected() const {
- return _connected;
-}
-
-//Network::ConnectionState Network::connectionState() const {
-int Network::connectionState() const {
- return _connectionState;
-}
-
NetworkInfo Network::networkInfo() const {
NetworkInfo info;
info.networkName = networkName();
return QString();
}
-QString Network::prefixToMode(const QCharRef &prefix) {
- return prefixToMode(QString(prefix));
-}
-
QString Network::modeToPrefix(const QString &mode) {
if(prefixModes().contains(mode))
return QString(prefixes()[prefixModes().indexOf(mode)]);
return QString();
}
-QString Network::modeToPrefix(const QCharRef &mode) {
- return modeToPrefix(QString(mode));
-}
-
-QString Network::networkName() const {
- return _networkName;
-}
-
-QString Network::currentServer() const {
- return _currentServer;
-}
-
-QString Network::myNick() const {
- return _myNick;
-}
-
-IdentityId Network::identity() const {
- return _identity;
-}
-
QStringList Network::nicks() const {
// we don't use _ircUsers.keys() since the keys may be
// not up to date after a nick change
return nicks;
}
-QStringList Network::channels() const {
- return _ircChannels.keys();
-}
-
-QVariantList Network::serverList() const {
- return _serverList;
-}
-
-bool Network::useRandomServer() const {
- return _useRandomServer;
-}
-
-QStringList Network::perform() const {
- return _perform;
-}
-
-bool Network::useAutoIdentify() const {
- return _useAutoIdentify;
-}
-
-QString Network::autoIdentifyService() const {
- return _autoIdentifyService;
-}
-
-QString Network::autoIdentifyPassword() const {
- return _autoIdentifyPassword;
-}
-
-bool Network::useAutoReconnect() const {
- return _useAutoReconnect;
-}
-
-quint32 Network::autoReconnectInterval() const {
- return _autoReconnectInterval;
-}
-
-quint16 Network::autoReconnectRetries() const {
- return _autoReconnectRetries;
-}
-
-bool Network::unlimitedReconnectRetries() const {
- return _unlimitedReconnectRetries;
-}
-
-bool Network::rejoinChannels() const {
- return _rejoinChannels;
-}
-
QString Network::prefixes() {
if(_prefixes.isNull())
determinePrefixes();
return _prefixModes;
}
-bool Network::supports(const QString ¶m) const {
- return _supports.contains(param);
+// example Unreal IRCD: CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMTG
+Network::ChannelModeType Network::channelModeType(const QString &mode) {
+ if(mode.isEmpty())
+ return NOT_A_CHANMODE;
+
+ QString chanmodes = support("CHANMODES");
+ if(chanmodes.isEmpty())
+ return NOT_A_CHANMODE;
+
+ ChannelModeType modeType = A_CHANMODE;
+ for(int i = 0; i < chanmodes.count(); i++) {
+ if(chanmodes[i] == mode[0])
+ break;
+ else if(chanmodes[i] == ',')
+ modeType = (ChannelModeType)(modeType << 1);
+ }
+ if(modeType > D_CHANMODE) {
+ qWarning() << "Network" << networkId() << "supplied invalid CHANMODES:" << chanmodes;
+ modeType = NOT_A_CHANMODE;
+ }
+ return modeType;
}
QString Network::support(const QString ¶m) const {
return _ircUsers[nick];
}
-IrcUser *Network::newIrcUser(const QByteArray &hostmask) {
- return newIrcUser(decodeServerString(hostmask));
-}
-
void Network::ircUserDestroyed() {
IrcUser *ircUser = static_cast<IrcUser *>(sender());
if(!ircUser)
return 0;
}
-IrcUser *Network::ircUser(const QByteArray &nickname) const {
- return ircUser(decodeServerString(nickname));
-}
-
-QList<IrcUser *> Network::ircUsers() const {
- return _ircUsers.values();
-}
-
-quint32 Network::ircUserCount() const {
- return _ircUsers.count();
-}
-
IrcChannel *Network::newIrcChannel(const QString &channelname) {
if(!_ircChannels.contains(channelname.toLower())) {
IrcChannel *channel = new IrcChannel(channelname, this);
return _ircChannels[channelname.toLower()];
}
-IrcChannel *Network::newIrcChannel(const QByteArray &channelname) {
- return newIrcChannel(decodeServerString(channelname));
-}
-
IrcChannel *Network::ircChannel(QString channelname) const {
channelname = channelname.toLower();
if(_ircChannels.contains(channelname))
return 0;
}
-IrcChannel *Network::ircChannel(const QByteArray &channelname) const {
- return ircChannel(decodeServerString(channelname));
-}
-
-
-QList<IrcChannel *> Network::ircChannels() const {
- return _ircChannels.values();
-}
-
-quint32 Network::ircChannelCount() const {
- return _ircChannels.count();
-}
-
QByteArray Network::defaultCodecForServer() {
- if(_defaultCodecForServer) return _defaultCodecForServer->name();
+ if(_defaultCodecForServer)
+ return _defaultCodecForServer->name();
return QByteArray();
}
}
QByteArray Network::defaultCodecForEncoding() {
- if(_defaultCodecForEncoding) return _defaultCodecForEncoding->name();
+ if(_defaultCodecForEncoding)
+ return _defaultCodecForEncoding->name();
return QByteArray();
}
}
QByteArray Network::defaultCodecForDecoding() {
- if(_defaultCodecForDecoding) return _defaultCodecForDecoding->name();
+ if(_defaultCodecForDecoding)
+ return _defaultCodecForDecoding->name();
return QByteArray();
}
}
QByteArray Network::codecForServer() const {
- if(_codecForServer) return _codecForServer->name();
+ if(_codecForServer)
+ return _codecForServer->name();
return QByteArray();
}
}
QByteArray Network::codecForEncoding() const {
- if(_codecForEncoding) return _codecForEncoding->name();
+ if(_codecForEncoding)
+ return _codecForEncoding->name();
return QByteArray();
}
}
QByteArray Network::codecForDecoding() const {
- if(_codecForDecoding) return _codecForDecoding->name();
+ if(_codecForDecoding)
+ return _codecForDecoding->name();
else return QByteArray();
}
// FIXME use server encoding if appropriate
QString Network::decodeString(const QByteArray &text) const {
- if(_codecForDecoding) return ::decodeString(text, _codecForDecoding);
+ if(_codecForDecoding)
+ return ::decodeString(text, _codecForDecoding);
else return ::decodeString(text, _defaultCodecForDecoding);
}
}
QString Network::decodeServerString(const QByteArray &text) const {
- if(_codecForServer) return ::decodeString(text, _codecForServer);
- else return ::decodeString(text, _defaultCodecForServer);
+ if(_codecForServer)
+ return ::decodeString(text, _codecForServer);
+ else
+ return ::decodeString(text, _defaultCodecForServer);
}
QByteArray Network::encodeServerString(const QString &string) const {
}
void Network::setConnected(bool connected) {
+ if(_connected == connected)
+ return;
+
_connected = connected;
if(!connected) {
removeChansAndUsers();
return supports;
}
-QVariantList Network::initServerList() const {
- return serverList();
-}
-
QStringList Network::initIrcUsers() const {
QStringList hostmasks;
foreach(IrcUser *ircuser, ircUsers()) {
}
}
-void Network::initSetServerList(const QVariantList & serverList) {
- setServerList(serverList);
-}
-
void Network::initSetIrcUsers(const QStringList &hostmasks) {
if(!_ircUsers.empty())
return;
emit ircChannelRemoved(channel);
}
-void Network::requestConnect() const {
- if(!proxy()) return;
- if(proxy()->proxyMode() == SignalProxy::Client) emit connectRequested(); // on the client this triggers calling this slot on the core
- else {
- if(connectionState() != Disconnected) {
- qWarning() << "Requesting connect while already being connected!";
- return;
- }
- emit connectRequested(networkId()); // and this is for CoreSession :)
- }
-}
-
-void Network::requestDisconnect() const {
- if(!proxy()) return;
- if(proxy()->proxyMode() == SignalProxy::Client) emit disconnectRequested(); // on the client this triggers calling this slot on the core
- else {
- if(connectionState() == Disconnected) {
- qWarning() << "Requesting disconnect while not being connected!";
- return;
- }
- emit disconnectRequested(networkId()); // and this is for CoreSession :)
- }
-}
-
void Network::emitConnectionError(const QString &errorMsg) {
emit connectionError(errorMsg);
}
<< " rejoinChannels = " << i.rejoinChannels << ")";
return dbg.space();
}
-
-
-
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#ifndef _NETWORK_H_
-#define _NETWORK_H_
+#ifndef NETWORK_H_
+#define NETWORK_H_
-#include <QDebug>
#include <QString>
#include <QStringList>
#include <QList>
#include "types.h"
#include "syncableobject.h"
-class SignalProxy;
-class IrcUser;
-class IrcChannel;
+#include "signalproxy.h"
+#include "ircuser.h"
+#include "ircchannel.h"
// defined below!
struct NetworkInfo;
Q_PROPERTY(bool rejoinChannels READ rejoinChannels WRITE setRejoinChannels STORED false)
public:
- enum ConnectionState { Disconnected, Connecting, Initializing, Initialized, Reconnecting, Disconnecting };
+ enum ConnectionState {
+ Disconnected,
+ Connecting,
+ Initializing,
+ Initialized,
+ Reconnecting,
+ Disconnecting
+ };
+
+ // see:
+ // http://www.irc.org/tech_docs/005.html
+ // http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
+ enum ChannelModeType {
+ NOT_A_CHANMODE = 0x00,
+ A_CHANMODE = 0x01,
+ B_CHANMODE = 0x02,
+ C_CHANMODE = 0x04,
+ D_CHANMODE = 0x08
+ };
+
Network(const NetworkId &networkid, QObject *parent = 0);
~Network();
- NetworkId networkId() const;
+ inline NetworkId networkId() const { return _networkId; }
- SignalProxy *proxy() const;
- void setProxy(SignalProxy *proxy);
+ inline SignalProxy *proxy() const { return _proxy; }
+ inline void setProxy(SignalProxy *proxy) { _proxy = proxy; }
- bool isMyNick(const QString &nick) const;
- bool isMe(IrcUser *ircuser) const;
+ inline bool isMyNick(const QString &nick) const { return (myNick().toLower() == nick.toLower()); }
+ inline bool isMe(IrcUser *ircuser) const { return (ircuser->nick().toLower() == myNick().toLower()); }
bool isChannelName(const QString &channelname) const;
- bool isConnected() const;
+ inline bool isConnected() const { return _connected; }
//Network::ConnectionState connectionState() const;
- int connectionState() const;
+ inline int connectionState() const { return _connectionState; }
QString prefixToMode(const QString &prefix);
- QString prefixToMode(const QCharRef &prefix);
+ inline QString prefixToMode(const QCharRef &prefix) { return prefixToMode(QString(prefix)); }
QString modeToPrefix(const QString &mode);
- QString modeToPrefix(const QCharRef &mode);
+ inline QString modeToPrefix(const QCharRef &mode) { return modeToPrefix(QString(mode)); }
- QString networkName() const;
- QString currentServer() const;
- QString myNick() const;
+ ChannelModeType channelModeType(const QString &mode);
+ inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); }
+
+ inline const QString &networkName() const { return _networkName; }
+ inline const QString ¤tServer() const { return _currentServer; }
+ inline const QString &myNick() const { return _myNick; }
inline IrcUser *me() const { return ircUser(myNick()); }
- IdentityId identity() const;
+ inline IdentityId identity() const { return _identity; }
QStringList nicks() const;
- QStringList channels() const;
- QVariantList serverList() const;
- bool useRandomServer() const;
- QStringList perform() const;
- bool useAutoIdentify() const;
- QString autoIdentifyService() const;
- QString autoIdentifyPassword() const;
- bool useAutoReconnect() const;
- quint32 autoReconnectInterval() const;
- quint16 autoReconnectRetries() const;
- bool unlimitedReconnectRetries() const;
- bool rejoinChannels() const;
+ inline QStringList channels() const { return _ircChannels.keys(); }
+ inline const QVariantList &serverList() const { return _serverList; }
+ inline bool useRandomServer() const { return _useRandomServer; }
+ inline const QStringList &perform() const { return _perform; }
+ inline bool useAutoIdentify() const { return _useAutoIdentify; }
+ inline const QString &autoIdentifyService() const { return _autoIdentifyService; }
+ inline const QString &autoIdentifyPassword() const { return _autoIdentifyPassword; }
+ inline bool useAutoReconnect() const { return _useAutoReconnect; }
+ inline quint32 autoReconnectInterval() const { return _autoReconnectInterval; }
+ inline quint16 autoReconnectRetries() const { return _autoReconnectRetries; }
+ inline bool unlimitedReconnectRetries() const { return _unlimitedReconnectRetries; }
+ inline bool rejoinChannels() const { return _rejoinChannels; }
NetworkInfo networkInfo() const;
void setNetworkInfo(const NetworkInfo &);
QString prefixes();
QString prefixModes();
- bool supports(const QString ¶m) const;
+ bool supports(const QString ¶m) const { return _supports.contains(param); }
QString support(const QString ¶m) const;
IrcUser *newIrcUser(const QString &hostmask);
- IrcUser *newIrcUser(const QByteArray &hostmask);
+ inline IrcUser *newIrcUser(const QByteArray &hostmask) { return newIrcUser(decodeServerString(hostmask)); }
IrcUser *ircUser(QString nickname) const;
- IrcUser *ircUser(const QByteArray &nickname) const;
- QList<IrcUser *> ircUsers() const;
- quint32 ircUserCount() const;
+ inline IrcUser *ircUser(const QByteArray &nickname) const { return ircUser(decodeServerString(nickname)); }
+ inline QList<IrcUser *> ircUsers() const { return _ircUsers.values(); }
+ inline quint32 ircUserCount() const { return _ircUsers.count(); }
IrcChannel *newIrcChannel(const QString &channelname);
- IrcChannel *newIrcChannel(const QByteArray &channelname);
+ inline IrcChannel *newIrcChannel(const QByteArray &channelname) { return newIrcChannel(decodeServerString(channelname)); }
IrcChannel *ircChannel(QString channelname) const;
- IrcChannel *ircChannel(const QByteArray &channelname) const;
- QList<IrcChannel *> ircChannels() const;
- quint32 ircChannelCount() const;
+ inline IrcChannel *ircChannel(const QByteArray &channelname) const { return ircChannel(decodeServerString(channelname)); }
+ inline QList<IrcChannel *> ircChannels() const { return _ircChannels.values(); }
+ inline quint32 ircChannelCount() const { return _ircChannels.count(); }
QByteArray codecForServer() const;
QByteArray codecForEncoding() const;
//init geters
QVariantMap initSupports() const;
- QVariantList initServerList() const;
+ inline QVariantList initServerList() const { return serverList(); }
QStringList initIrcUsers() const;
QStringList initIrcChannels() const;
//init seters
void initSetSupports(const QVariantMap &supports);
- void initSetServerList(const QVariantList &serverList);
+ inline void initSetServerList(const QVariantList &serverList) { setServerList(serverList); }
void initSetIrcUsers(const QStringList &hostmasks);
void initSetIrcChannels(const QStringList &channels);
// channel lists up to date
void ircUserNickChanged(QString newnick);
- void requestConnect() const;
- void requestDisconnect() const;
+ virtual inline void requestConnect() const { emit connectRequested(); }
+ virtual inline void requestDisconnect() const { emit disconnectRequested(); }
void emitConnectionError(const QString &);
corebacklogmanager.cpp
corebufferviewconfig.cpp
corebufferviewmanager.cpp
+ corenetwork.cpp
coresession.cpp
coresettings.cpp
coreusersettings.cpp
corebacklogmanager.h
corebufferviewconfig.h
corebufferviewmanager.h
+ corenetwork.h
coresession.h
ctcphandler.h
ircserverhandler.h
bool Core::startListening(uint port) {
if(!server.listen(QHostAddress::Any, port)) {
- qWarning(qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(server.errorString())));
+ qWarning("%s", qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(server.errorString())));
return false;
}
qDebug() << "Listening for GUI clients on port" << server.serverPort();
QVariantMap reply;
// Just version information -- check it!
- if(msg.contains("ClientBuild") && msg["ClientBuild"].toUInt() < 732
- || !msg.contains("ClientBuild") && msg["ProtocolVersion"].toUInt() < Global::coreNeedsProtocol) {
+ if((msg.contains("ClientBuild") && msg["ClientBuild"].toUInt() < 732)
+ || (!msg.contains("ClientBuild") && msg["ProtocolVersion"].toUInt() < Global::coreNeedsProtocol)) {
reply["MsgType"] = "ClientInitReject";
reply["Error"] = tr("<b>Your Quassel Client is too old!</b><br>"
"This core needs at least client/core protocol version %1.<br>"
DEPMOD = common
QT_MOD = core network sql script
-SRCS = core.cpp corebacklogmanager.cpp corebufferviewconfig.cpp corebufferviewmanager.cpp coresession.cpp coresettings.cpp networkconnection.cpp sqlitestorage.cpp abstractsqlstorage.cpp storage.cpp basichandler.cpp \
+SRCS = core.cpp corebacklogmanager.cpp corebufferviewconfig.cpp corebufferviewmanager.cpp corenetwork.cpp coresession.cpp coresettings.cpp networkconnection.cpp sqlitestorage.cpp abstractsqlstorage.cpp storage.cpp basichandler.cpp \
ircserverhandler.cpp userinputhandler.cpp ctcphandler.cpp coreusersettings.cpp sessionthread.cpp
-HDRS = core.h corebacklogmanager.h corebufferviewconfig.h corebufferviewmanager.h coresession.h coresettings.h networkconnection.h sqlitestorage.h abstractsqlstorage.h storage.h basichandler.h \
+HDRS = core.h corebacklogmanager.h corebufferviewconfig.h corebufferviewmanager.h corenetwork.h coresession.h coresettings.h networkconnection.h sqlitestorage.h abstractsqlstorage.h storage.h basichandler.h \
ircserverhandler.h userinputhandler.h ctcphandler.h coreusersettings.h sessionthread.h
contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "corenetwork.h"
+#include "coresession.h"
+
+CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session)
+ : Network(networkid, session),
+ _coreSession(session)
+{
+}
+
+void CoreNetwork::requestConnect() const {
+ if(connectionState() != Disconnected) {
+ qWarning() << "Requesting connect while already being connected!";
+ return;
+ }
+ emit connectRequested(networkId());
+}
+
+void CoreNetwork::requestDisconnect() const {
+ if(connectionState() == Disconnected) {
+ qWarning() << "Requesting disconnect while not being connected!";
+ return;
+ }
+ emit disconnectRequested(networkId());
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef CORENETWORK_H
+#define CORENETWORK_H
+
+#include "network.h"
+
+class CoreSession;
+
+class CoreNetwork : public Network {
+ Q_OBJECT
+
+public:
+ CoreNetwork(const NetworkId &networkid, CoreSession *session);
+
+ virtual const QMetaObject *syncMetaObject() const { return &Network::staticMetaObject; }
+
+ inline CoreSession *coreSession() const { return _coreSession; }
+
+public slots:
+ virtual void requestConnect() const;
+ virtual void requestDisconnect() const;
+
+private:
+ CoreSession *_coreSession;
+};
+
+#endif //CORENETWORK_H
#include "corebufferviewmanager.h"
#include "storage.h"
-#include "network.h"
+#include "corenetwork.h"
#include "ircuser.h"
#include "ircchannel.h"
#include "identity.h"
foreach(NetworkConnection *conn, _connections.values()) {
delete conn;
}
- foreach(Network *net, _networks.values()) {
+ foreach(CoreNetwork *net, _networks.values()) {
delete net;
}
}
return _user;
}
-Network *CoreSession::network(NetworkId id) const {
+CoreNetwork *CoreSession::network(NetworkId id) const {
if(_networks.contains(id)) return _networks[id];
return 0;
}
}
void CoreSession::connectToNetwork(NetworkId id) {
- Network *net = network(id);
+ CoreNetwork *net = network(id);
if(!net) {
qWarning() << "Connect to unknown network requested! net:" << id << "user:" << user();
return;
id = info.networkId.toInt();
if(!_networks.contains(id)) {
- Network *net = new Network(id, this);
+ CoreNetwork *net = new CoreNetwork(id, this);
connect(net, SIGNAL(connectRequested(NetworkId)), this, SLOT(connectToNetwork(NetworkId)));
connect(net, SIGNAL(disconnectRequested(NetworkId)), this, SLOT(disconnectFromNetwork(NetworkId)));
net->setNetworkInfo(info);
}
}
+// FIXME: move to CoreNetwork
void CoreSession::updateNetwork(const NetworkInfo &info) {
if(!_networks.contains(info.networkId)) {
qWarning() << "Update request for unknown network received!";
}
if(bufferInfo.type() == BufferInfo::ChannelBuffer) {
- Network *net = network(bufferInfo.networkId());
+ CoreNetwork *net = network(bufferInfo.networkId());
if(!net) {
qWarning() << "CoreSession::removeBufferRequested(): Received BufferInfo with unknown networkId!";
return;
class CoreBufferViewManager;
class Identity;
class NetworkConnection;
-class Network;
+class CoreNetwork;
struct NetworkInfo;
class SignalProxy;
QList<BufferInfo> buffers() const;
UserId user() const;
- Network *network(NetworkId) const;
+ CoreNetwork *network(NetworkId) const;
NetworkConnection *networkConnection(NetworkId) const;
Identity *identity(IdentityId) const;
SignalProxy *_signalProxy;
QHash<NetworkId, NetworkConnection *> _connections;
- QHash<NetworkId, Network *> _networks;
- QHash<NetworkId, Network *> _networksToRemove;
+ QHash<NetworkId, CoreNetwork *> _networks;
+ // QHash<NetworkId, CoreNetwork *> _networksToRemove;
QHash<IdentityId, Identity *> _identities;
BufferSyncer *_bufferSyncer;
emit displayMsg(Message::Join, BufferInfo::ChannelBuffer, channel, channel, prefix);
//qDebug() << "IrcServerHandler::handleJoin()" << prefix << params;
ircuser->joinChannel(channel);
- if(network()->isMe(ircuser)) networkConnection()->setChannelJoined(channel);
+ if(network()->isMe(ircuser)) {
+ networkConnection()->setChannelJoined(channel);
+ putCmd("MODE", params[0]); // we want to know the modes of the channel we just joined, so we ask politely
+ }
}
void IrcServerHandler::handleKick(const QString &prefix, const QList<QByteArray> ¶ms) {
emit displayMsg(Message::Mode, BufferInfo::ChannelBuffer, serverDecode(params[0]), serverDecode(params).join(" "), prefix);
IrcChannel *channel = network()->ircChannel(params[0]);
- // FIXME: currently the IrcChannels only support PREFIX-Modes for users
- // This cannot be fixed unless the SignalProxy() doesn't rely on methodIds anymore
QString modes = params[1];
bool add = true;
- int modeIndex = 2;
+ int paramOffset = 2;
for(int c = 0; c < modes.length(); c++) {
if(modes[c] == '+') {
add = true;
continue;
}
- // this is the part where we restrict the mode changes to PREFIXES:
- if(network()->prefixModes().contains(modes[c]) && modeIndex < params.count()) {
- IrcUser *ircUser = network()->ircUser(params[modeIndex]);
+ if(network()->prefixModes().contains(modes[c])) {
+ // user channel modes (op, voice, etc...)
+ if(paramOffset < params.count()) {
+ IrcUser *ircUser = network()->ircUser(params[paramOffset]);
+ if(add)
+ channel->addUserMode(ircUser, QString(modes[c]));
+ else
+ channel->removeUserMode(ircUser, QString(modes[c]));
+ } else {
+ qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
+ }
+ paramOffset++;
+ } else {
+ // regular channel modes
+ QString value;
+ Network::ChannelModeType modeType = network()->channelModeType(modes[c]);
+ if(modeType == Network::A_CHANMODE || modeType == Network::B_CHANMODE || (modeType == Network::C_CHANMODE && add)) {
+ if(paramOffset < params.count()) {
+ value = params[paramOffset];
+ } else {
+ qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
+ }
+ paramOffset++;
+ }
+
if(add)
- channel->addUserMode(ircUser, QString(modes[c]));
+ channel->addChannelMode(modes[c], value);
else
- channel->removeUserMode(ircUser, QString(modes[c]));
+ channel->removeChannelMode(modes[c], value);
}
- modeIndex++;
}
} else {
emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(serverDecode(params).join(" ")));
}
+/* RPL_CHANNELMODEIS - "<channel> <mode> <mode params>" */
+void IrcServerHandler::handle324(const QString &prefix, const QList<QByteArray> ¶ms) {
+ Q_UNUSED(prefix);
+ handleMode(prefix, params);
+}
+
+/* RPL_??? - "<channel> <creation time (unix)>" */
+void IrcServerHandler::handle329(const QString &prefix, const QList<QByteArray> ¶ms) {
+ Q_UNUSED(prefix);
+ // FIXME implement this...
+}
+
/* RPL_NOTOPIC */
void IrcServerHandler::handle331(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
void handle318(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_ENDOFWHOIS
void handle319(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISCHANNELS
void handle320(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISVIRT (is identified to services)
+ void handle324(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_CHANNELMODEIS
+ void handle329(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_??? (channel creation time)
void handle331(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_NOTOPIC
void handle332(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_TOPIC
void handle333(const QString &prefix, const QList<QByteArray> ¶ms); // Topic set by...
void UserInputHandler::handleAway(const BufferInfo &bufferInfo, const QString &msg) {
Q_UNUSED(bufferInfo)
- QString awayMsg;
+ QString awayMsg = msg;
// if there is no message supplied we have to check if we are already away or not
if(msg.isEmpty()) {
IrcUser *me = network()->me();
bufferwidget.cpp
coreconfigwizard.cpp
coreconnectdlg.cpp
- configwizard.cpp
debugconsole.cpp
inputwidget.cpp
jumpkeyhandler.cpp
if(buffer->contents().isEmpty())
return;
MsgId msgId = buffer->contents().first()->msgId();
- if(!lastBacklogOffset.isValid() || msgId < lastBacklogOffset && lastBacklogSize + REQUEST_COUNT <= buffer->contents().count()) {
+ if(!lastBacklogOffset.isValid() || (msgId < lastBacklogOffset && lastBacklogSize + REQUEST_COUNT <= buffer->contents().count())) {
Client::backlogManager()->requestBacklog(bufferId, REQUEST_COUNT, msgId.toInt());
lastBacklogOffset = msgId;
lastBacklogSize = buffer->contents().size();
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
- * devel@quassel-irc.org *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) version 3. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-
-#include <QtGui>
-
-#include "configwizard.h"
-
-ConfigWizard::ConfigWizard(const QStringList &storageProviders, QWidget *parent) : QWizard(parent) {
- setPage(Page_Intro, new IntroPage());
- setPage(Page_AdminUser, new AdminUserPage());
- setPage(Page_StorageSelection, new StorageSelectionPage(storageProviders));
- setPage(Page_StorageDetails, new StorageDetailsPage());
- setPage(Page_Conclusion, new ConclusionPage(storageProviders));
-
- setStartId(Page_Intro);
-
-#ifndef Q_WS_MAC
- setWizardStyle(ModernStyle);
-#endif
-
- setOption(HaveHelpButton, false);
- setOption(NoBackButtonOnStartPage, true);
- setOption(HaveNextButtonOnLastPage, false);
- setOption(HaveFinishButtonOnEarlyPages, false);
- setOption(NoCancelButton, true);
-
- setWindowTitle(tr("Core Configuration Wizard"));
-}
-
-
-IntroPage::IntroPage(QWidget *parent) : QWizardPage(parent) {
- setTitle(tr("Introduction"));
-
- label = new QLabel(tr("This wizard will guide you through the setup process for your shiny new Quassel IRC Client."));
- label->setWordWrap(true);
-
- QVBoxLayout *layout = new QVBoxLayout();
- layout->addWidget(label);
- setLayout(layout);
-}
-
-int IntroPage::nextId() const {
- return ConfigWizard::Page_AdminUser;
-}
-
-
-AdminUserPage::AdminUserPage(QWidget *parent) : QWizardPage(parent) {
- setTitle(tr("Setup Admin User"));
- setSubTitle(tr("Please enter credentials for the admin user."));
-
- nameLabel = new QLabel(tr("Name:"));
- nameEdit = new QLineEdit();
- nameLabel->setBuddy(nameEdit);
-
- passwordLabel = new QLabel(tr("Password:"));
- passwordEdit = new QLineEdit();
- passwordEdit->setEchoMode(QLineEdit::Password);
- passwordLabel->setBuddy(passwordLabel);
-
- registerField("adminuser.name*", nameEdit);
- registerField("adminuser.password*", passwordEdit);
-
- QGridLayout *layout = new QGridLayout();
- layout->addWidget(nameLabel, 0, 0);
- layout->addWidget(nameEdit, 0, 1);
- layout->addWidget(passwordLabel, 1, 0);
- layout->addWidget(passwordEdit, 1, 1);
- setLayout(layout);
-}
-
-int AdminUserPage::nextId() const {
- return ConfigWizard::Page_StorageSelection;
-}
-
-
-StorageSelectionPage::StorageSelectionPage(const QStringList &storageProviders, QWidget *parent) : QWizardPage(parent) {
- setTitle(tr("Select Storage Provider"));
- setSubTitle(tr("Please select the storage provider you want to use."));
-
- storageSelection = new QComboBox();
- storageSelection->addItems(storageProviders);
-
- registerField("storage.provider", storageSelection);
-
- QVBoxLayout *layout = new QVBoxLayout();
- layout->addWidget(storageSelection);
- setLayout(layout);
-}
-
-int StorageSelectionPage::nextId() const {
- QString selection = storageSelection->currentText();
- if (!selection.compare("Sqlite", Qt::CaseInsensitive)) {
- return ConfigWizard::Page_Conclusion;
- } else {
- return ConfigWizard::Page_StorageDetails;
- }
-}
-
-
-StorageDetailsPage::StorageDetailsPage(QWidget *parent) : QWizardPage(parent) {
- setTitle(tr("Setup Storage Provider"));
- setSubTitle(tr("Please enter credentials for the selected storage provider."));
-
- hostLabel = new QLabel(tr("Host:"));
- hostEdit = new QLineEdit();
- hostLabel->setBuddy(hostEdit);
-
- portLabel = new QLabel(tr("Port:"));
- portEdit = new QLineEdit();
- QIntValidator *portValidator = new QIntValidator(0, 65535, this);
- portEdit->setValidator(portValidator);
- portLabel->setBuddy(portEdit);
-
- databaseLabel = new QLabel(tr("Database:"));
- databaseEdit = new QLineEdit();
- databaseLabel->setBuddy(databaseEdit);
-
- userLabel = new QLabel(tr("User:"));
- userEdit = new QLineEdit();
- userLabel->setBuddy(userEdit);
-
- passwordLabel = new QLabel(tr("Password:"));
- passwordEdit = new QLineEdit();
- passwordEdit->setEchoMode(QLineEdit::Password);
- passwordLabel->setBuddy(passwordLabel);
-
- registerField("storage.host*", hostEdit);
- registerField("storage.port*", portEdit);
- registerField("storage.database*", databaseEdit);
- registerField("storage.user*", userEdit);
- registerField("storage.password*", passwordEdit);
-
- QGridLayout *layout = new QGridLayout();
- layout->addWidget(hostLabel, 0, 0);
- layout->addWidget(hostEdit, 0, 1);
- layout->addWidget(portLabel, 1, 0);
- layout->addWidget(portEdit, 1, 1);
- layout->addWidget(databaseLabel, 2, 0);
- layout->addWidget(databaseEdit, 2, 1);
- layout->addWidget(userLabel, 3, 0);
- layout->addWidget(userEdit, 3, 1);
- layout->addWidget(passwordLabel, 4, 0);
- layout->addWidget(passwordEdit, 4, 1);
- setLayout(layout);
-}
-
-int StorageDetailsPage::nextId() const {
- return ConfigWizard::Page_Conclusion;
-}
-
-
-ConclusionPage::ConclusionPage(const QStringList &storageProviders, QWidget *parent) : QWizardPage(parent) {
- setTitle(tr("Conclusion"));
- setSubTitle(tr("You chose the following configuration:"));
-
- this->storageProviders = storageProviders;
-
- adminuser = new QLabel();
- storage = new QLabel();
- storage->setWordWrap(true);
-
- QVBoxLayout *layout = new QVBoxLayout();
- layout->addWidget(adminuser);
- layout->addWidget(storage);
- setLayout(layout);
-}
-
-int ConclusionPage::nextId() const {
- return -1;
-}
-
-void ConclusionPage::initializePage() {
- QString adminuserText = "Admin User: " + field("adminuser.name").toString();
- adminuser->setText(adminuserText);
-
- QString storageText = "Selected Storage Provider: ";
- QString sp = storageProviders.value(field("storage.provider").toInt());
- if (!sp.compare("Sqlite", Qt::CaseInsensitive)) {
- storageText.append(sp);
- } else {
- storageText += sp + "\nHost: " + field("storage.host").toString() + "\nPort: " + field("storage.port").toString() + "\nDatabase: " + field("storage.database").toString() + "\nUser: " + field("storage.user").toString();
- }
- storage->setText(storageText);
-}
-
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
- * devel@quassel-irc.org *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) version 3. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-
-#ifndef CONFIGWIZARD_H_
-#define CONFIGWIZARD_H_
-
-#include <QWizard>
-
-class QLabel;
-class QLineEdit;
-class QComboBox;
-
-class ConfigWizard : public QWizard {
- Q_OBJECT
-
- public:
- enum {
- Page_Intro,
- Page_AdminUser,
- Page_StorageSelection,
- Page_StorageDetails,
- Page_Conclusion
- };
-
- ConfigWizard(const QStringList &storageProviders, QWidget *parent = NULL);
-};
-
-class IntroPage : public QWizardPage {
- Q_OBJECT
-
- public:
- IntroPage(QWidget *parent = NULL);
-
- int nextId() const;
-
- private:
- QLabel *label;
-};
-
-class AdminUserPage : public QWizardPage {
- Q_OBJECT
-
- public:
- AdminUserPage(QWidget *parent = NULL);
-
- int nextId() const;
-
- private:
- QLabel *nameLabel;
- QLineEdit *nameEdit;
- QLabel *passwordLabel;
- QLineEdit *passwordEdit;
-};
-
-class StorageSelectionPage : public QWizardPage {
- Q_OBJECT
-
- public:
- StorageSelectionPage(const QStringList &storageProviders, QWidget *parent = NULL);
-
- int nextId() const;
-
- private:
- QComboBox *storageSelection;
-};
-
-class StorageDetailsPage : public QWizardPage {
- Q_OBJECT
-
- public:
- StorageDetailsPage(QWidget *parent = NULL);
-
- int nextId() const;
-
- private:
- QLabel *hostLabel;
- QLineEdit *hostEdit;
- QLabel *portLabel;
- QLineEdit *portEdit;
- QLabel *databaseLabel;
- QLineEdit *databaseEdit;
- QLabel *userLabel;
- QLineEdit *userEdit;
- QLabel *passwordLabel;
- QLineEdit *passwordEdit;
-};
-
-class ConclusionPage : public QWizardPage {
- Q_OBJECT
-
- public:
- ConclusionPage(const QStringList &storageProviders, QWidget *parent = NULL);
-
- void initializePage();
- int nextId() const;
-
- private:
- QLabel *adminuser;
- QLabel *storage;
- QStringList storageProviders;
-};
-
-#endif /*CONFIGWIZARD_H_*/
AdminUserPage::AdminUserPage(QWidget *parent) : QWizardPage(parent) {
ui.setupUi(this);
- setTitle(tr("Create User Account"));
- setSubTitle(tr("First, we will create a user account on the core. This first user will have administrator privileges."));
+ setTitle(tr("Create Admin User"));
+ setSubTitle(tr("First, we will create a user on the core. This first user will have administrator privileges."));
registerField("adminUser.user*", ui.user);
registerField("adminUser.password*", ui.password);
QT_MOD = core gui network
SRCS += aboutdlg.cpp bufferwidget.cpp chatline-old.cpp chatwidget.cpp \
- coreconfigwizard.cpp coreconnectdlg.cpp configwizard.cpp debugconsole.cpp inputwidget.cpp \
+ coreconfigwizard.cpp coreconnectdlg.cpp debugconsole.cpp inputwidget.cpp \
mainwin.cpp nicklistwidget.cpp qtui.cpp qtuisettings.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \
titlesetter.cpp topicbutton.cpp topicwidget.cpp verticaldock.cpp jumpkeyhandler.cpp
HDRS += aboutdlg.h bufferwidget.h chatline-old.h chatwidget.h \
- coreconfigwizard.h configwizard.h debugconsole.h inputwidget.h \
+ coreconfigwizard.h debugconsole.h inputwidget.h \
coreconnectdlg.h mainwin.h nicklistwidget.h qtui.h qtuisettings.h qtuistyle.h settingsdlg.h settingspagedlg.h \
titlesetter.h topicbutton.h topicwidget.h verticaldock.h jumpkeyhandler.h
#include "settingsdlg.h"
-SettingsDlg::SettingsDlg(QWidget *parent) : QDialog(parent) {
+SettingsDlg::SettingsDlg(QWidget *parent)
+ : QDialog(parent),
+ _currentPage(0)
+{
ui.setupUi(this);
- _currentPage = 0;
-
- //recommendedSize = layout()->minimumSize();
-
- // make the scrollarea behave sanely
- ui.settingsFrame->setWidgetResizable(true);
- ui.settingsFrame->setWidget(ui.settingsStack);
updateGeometry();
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
}
-/*
-QSize SettingsDlg::sizeHint() const {
- return recommendedSize;
-}
-*/
-
-SettingsPage *SettingsDlg::currentPage() const {
- return _currentPage;
-}
-
void SettingsDlg::registerSettingsPage(SettingsPage *sp) {
sp->setParent(ui.settingsStack);
ui.settingsStack->addWidget(sp);
- //recommendedSize = recommendedSize.expandedTo(sp->sizeHint());
- //updateGeometry();
+
connect(sp, SIGNAL(changed(bool)), this, SLOT(setButtonStates()));
QTreeWidgetItem *cat;
cat = new QTreeWidgetItem(ui.settingsTree, QStringList(sp->category()));
cat->setExpanded(true);
cat->setFlags(Qt::ItemIsEnabled);
- } else cat = cats[0];
+ } else {
+ cat = cats[0];
+ }
QTreeWidgetItem *item = new QTreeWidgetItem(cat, QStringList(sp->title()));
- treeItems[sp] = item;
- pages[QString("%1$%2").arg(sp->category(), sp->title())] = sp;
+ item->setData(0, SettingsPageRole, qVariantFromValue<QObject *>(sp));
pageIsLoaded[sp] = false;
- // TESTING
- // selectPage(sp->category(), sp->title());
}
-void SettingsDlg::selectPage(const QString &cat, const QString &title) {
- SettingsPage *sp = pages[QString("%1$%2").arg(cat, title)];
+void SettingsDlg::selectPage(SettingsPage *sp) {
if(!sp) {
_currentPage = 0;
ui.settingsStack->setCurrentIndex(0);
- ui.settingsTree->setCurrentItem(0);
+ ui.pageTitle->setText(tr("Settings"));
return;
}
+
if(!pageIsLoaded[sp]) {
sp->load();
pageIsLoaded[sp] = true;
}
+
if(sp != currentPage() && currentPage() != 0 && currentPage()->hasChanged()) {
int ret = QMessageBox::warning(this, tr("Save changes"),
tr("There are unsaved changes on the current configuration page. Would you like to apply your changes now?"),
undoChanges();
} else sp = currentPage();
}
+
if(sp != currentPage()) {
ui.pageTitle->setText(sp->title());
ui.settingsStack->setCurrentWidget(sp);
- ui.settingsStack->setMinimumSize(sp->minimumSizeHint()); // we don't want our page shrinked, use scrollbars instead...
_currentPage = sp;
}
- ui.settingsTree->setCurrentItem(treeItems[sp]);
setButtonStates();
}
void SettingsDlg::itemSelected() {
QList<QTreeWidgetItem *> items = ui.settingsTree->selectedItems();
- if(!items.count()) {
- return;
- } else {
- QTreeWidgetItem *parent = items[0]->parent();
- if(!parent) return;
- QString cat = parent->text(0);
- QString title = items[0]->text(0);
- selectPage(cat, title);
+ SettingsPage *sp = 0;
+ if(!items.isEmpty()) {
+ sp = qobject_cast<SettingsPage *>(items[0]->data(0, SettingsPageRole).value<QObject *>());
}
+ selectPage(sp);
}
void SettingsDlg::setButtonStates() {
class SettingsDlg : public QDialog {
Q_OBJECT
- public:
- SettingsDlg(QWidget *parent = 0);
- void registerSettingsPage(SettingsPage *);
- void unregisterSettingsPage(SettingsPage *);
- SettingsPage *currentPage() const;
-
- //QSize sizeHint() const;
-
- public slots:
- void selectPage(const QString &category, const QString &title);
-
- private slots:
- void itemSelected();
- void buttonClicked(QAbstractButton *);
- bool applyChanges();
- void undoChanges();
- void reload();
- void loadDefaults();
- void setButtonStates();
-
- private:
- Ui::SettingsDlg ui;
-
- SettingsPage *_currentPage;
- QHash<QString, SettingsPage *> pages;
- QHash<SettingsPage *, QTreeWidgetItem *> treeItems;
- QHash<SettingsPage *, bool> pageIsLoaded;
-
- //QSize recommendedSize;
+public:
+ SettingsDlg(QWidget *parent = 0);
+ void registerSettingsPage(SettingsPage *);
+ void unregisterSettingsPage(SettingsPage *);
+
+ inline SettingsPage *currentPage() const { return _currentPage; }
+
+public slots:
+ void selectPage(SettingsPage *sp); // const QString &category, const QString &title);
+
+private slots:
+ void itemSelected();
+ void buttonClicked(QAbstractButton *);
+ bool applyChanges();
+ void undoChanges();
+ void reload();
+ void loadDefaults();
+ void setButtonStates();
+
+private:
+ Ui::SettingsDlg ui;
+
+ SettingsPage *_currentPage;
+ QHash<SettingsPage *, bool> pageIsLoaded;
+
+ enum {
+ SettingsPageRole = Qt::UserRole
+ };
};
<rect>
<x>0</x>
<y>0</y>
- <width>415</width>
+ <width>429</width>
<height>273</height>
</rect>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
- <string><em>Note: Adding more users and changing your username/password has not been implemented yet.</string>
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: Adding more users and changing your username/password is not possible via Quassel's interface yet.</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-style:italic;">If you need to do these things have a look at the manageusers.py script which is located in the /scripts directory.</p></body></html></string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>405</width>
<height>51</height>
<rect>
<x>0</x>
<y>0</y>
- <width>828</width>
- <height>587</height>
+ <width>725</width>
+ <height>575</height>
</rect>
</property>
<property name="windowTitle" >
<string>Configure Quassel</string>
</property>
- <layout class="QVBoxLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
- <layout class="QVBoxLayout" >
- <item>
- <widget class="QSplitter" name="splitter" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
+ <widget class="QSplitter" name="splitter" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QTreeWidget" name="settingsTree" >
+ <property name="maximumSize" >
+ <size>
+ <width>200</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Settings</string>
</property>
- <widget class="QTreeWidget" name="settingsTree" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize" >
- <size>
- <width>200</width>
- <height>16777215</height>
- </size>
- </property>
- <column>
+ </column>
+ </widget>
+ <widget class="QWidget" name="" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QLabel" name="pageTitle" >
+ <property name="font" >
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
<property name="text" >
<string>Settings</string>
</property>
- </column>
- </widget>
- <widget class="QWidget" name="layoutWidget" >
- <layout class="QVBoxLayout" >
- <item>
- <widget class="QLabel" name="pageTitle" >
- <property name="font" >
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text" >
- <string>Settings</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QScrollArea" name="settingsFrame" >
- <property name="frameShape" >
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow" >
- <enum>QFrame::Sunken</enum>
- </property>
- <layout class="QVBoxLayout" >
- <item>
- <widget class="QStackedWidget" name="settingsStack" >
- <property name="minimumSize" >
- <size>
- <width>16</width>
- <height>16</height>
- </size>
- </property>
- <property name="currentIndex" >
- <number>0</number>
- </property>
- <widget class="QWidget" name="page_3" />
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
- </property>
- </widget>
- </item>
- </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QStackedWidget" name="settingsStack" >
+ <widget class="QWidget" name="page" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>492</width>
+ <height>466</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
+ </property>
+ </widget>
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>QScrollArea</class>
- <extends>QFrame</extends>
- <header>QScrollArea</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources/>
<connections/>
</ui>
Qt::ItemFlags BufferViewFilter::flags(const QModelIndex &index) const {
Qt::ItemFlags flags = mapToSource(index).flags();
- if(_config && index == QModelIndex() || index.parent() == QModelIndex())
+ if(_config && (index == QModelIndex() || index.parent() == QModelIndex()))
flags |= Qt::ItemIsDropEnabled;
return flags;
}
if(s[pos+1] == 'D') code += s[pos+2];
FormatType ftype = formatType(code);
if(ftype == Invalid) {
- qWarning(qPrintable(QString("Invalid format code in string: %1").arg(s)));
+ qWarning("%s", qPrintable(QString("Invalid format code in string: %1").arg(s)));
continue;
}
//Q_ASSERT(ftype != Invalid);