X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=9432f2a0149117940d5e1e5aad09fa9a68837d8e;hp=6506061ff62b052b0e34d0f2281f259d7affddc7;hb=d04fd0d39884932c5b9656ad3a4a6e13c204b529;hpb=a49409f619ba884568a021ea2e0ec94bcc2491f3
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 6506061f..9432f2a0 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -52,12 +52,14 @@ void Core::destroy() {
Core::Core() : storage(0) {
_startTime = QDateTime::currentDateTime().toUTC(); // for uptime :)
+ loadTranslation(QLocale::system());
+
// Register storage backends here!
registerStorageBackend(new SqliteStorage(this));
if(!_storageBackends.count()) {
- quWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting..."));
- quWarning() << qPrintable(tr("Currently, Quassel only supports SQLite3. You need to build your\n"
+ qWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting..."));
+ qWarning() << qPrintable(tr("Currently, Quassel only supports SQLite3. You need to build your\n"
"Qt library with the sqlite plugin enabled in order for quasselcore\n"
"to work."));
exit(1); // TODO make this less brutal (especially for mono client -> popup)
@@ -72,7 +74,7 @@ void Core::init() {
CoreSettings cs;
if(!(configured = initStorage(cs.storageSettings().toMap()))) {
- quWarning() << "Core is currently not configured! Please connect with a Quassel Client for basic setup.";
+ qWarning() << "Core is currently not configured! Please connect with a Quassel Client for basic setup.";
// try to migrate old settings
QVariantMap old = cs.oldDbSettings().toMap();
@@ -80,7 +82,7 @@ void Core::init() {
QVariantMap newSettings;
newSettings["Backend"] = "SQLite";
if((configured = initStorage(newSettings))) {
- quWarning() << "...but thankfully I found some old settings to migrate!";
+ qWarning() << "...but thankfully I found some old settings to migrate!";
cs.setStorageSettings(newSettings);
}
}
@@ -117,7 +119,7 @@ void Core::restoreState() {
return;
}
if(instance()->sessions.count()) {
- quWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));
+ qWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));
return;
}
CoreSettings s;
@@ -202,12 +204,12 @@ bool Core::initStorage(QVariantMap dbSettings, bool setup) {
if(_storageBackends.contains(backend)) {
storage = _storageBackends[backend];
} else {
- quError() << "Selected storage backend is not available:" << backend;
+ qCritical() << "Selected storage backend is not available:" << backend;
return configured = false;
}
if(!storage->init(dbSettings)) {
if(!setup || !(storage->setup(dbSettings) && storage->init(dbSettings))) {
- quError() << "Could not init storage!";
+ qCritical() << "Could not init storage!";
storage = 0;
return configured = false;
}
@@ -359,23 +361,23 @@ bool Core::startListening() {
// in mono mode we only start a local port if a port is specified in the cli call
if(Quassel::runMode() == Quassel::Monolithic && !Quassel::isOptionSet("port"))
return true;
-
+
bool success = false;
uint port = Quassel::optionValue("port").toUInt();
if(_server.listen(QHostAddress::Any, port)) {
- quInfo() << "Listening for GUI clients on IPv6 port" << _server.serverPort()
+ quInfo() << "Listening for GUI clients on IPv4 port" << _server.serverPort()
<< "using protocol version" << Quassel::buildInfo().protocolVersion;
success = true;
}
if(_v6server.listen(QHostAddress::AnyIPv6, port)) {
- quInfo() << "Listening for GUI clients on IPv4 port" << _v6server.serverPort()
+ quInfo() << "Listening for GUI clients on IPv6 port" << _v6server.serverPort()
<< "using protocol version" << Quassel::buildInfo().protocolVersion;
success = true;
}
if(!success) {
- quError() << qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(_server.errorString()));
+ qCritical() << qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(_server.errorString()));
}
return success;
@@ -432,7 +434,7 @@ void Core::clientHasData() {
void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
if(!msg.contains("MsgType")) {
// Client is way too old, does not even use the current init format
- quWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
+ qWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
socket->close();
return;
}
@@ -448,7 +450,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
"This core needs at least client/core protocol version %1.
"
"Please consider upgrading your client.").arg(Quassel::buildInfo().coreNeedsProtocol);
SignalProxy::writeDataToDevice(socket, reply);
- quWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting."));
+ qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting."));
socket->close(); return;
}
@@ -508,7 +510,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
#ifdef HAVE_SSL
// after we told the client that we are ssl capable we switch to ssl mode
if(supportSsl && msg["UseSsl"].toBool()) {
- quDebug() << qPrintable(tr("Starting TLS for Client:")) << qPrintable(socket->peerAddress().toString());
+ qDebug() << qPrintable(tr("Starting TLS for Client:")) << qPrintable(socket->peerAddress().toString());
connect(sslSocket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &)));
sslSocket->startServerEncryption();
}
@@ -517,7 +519,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
#ifndef QT_NO_COMPRESS
if(supportsCompression && msg["UseCompression"].toBool()) {
socket->setProperty("UseCompression", true);
- quDebug() << "Using compression for Client:" << qPrintable(socket->peerAddress().toString());
+ qDebug() << "Using compression for Client:" << qPrintable(socket->peerAddress().toString());
}
#endif
@@ -528,7 +530,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
reply["MsgType"] = "ClientLoginReject";
reply["Error"] = tr("Client not initialized!
You need to send an init message before trying to login.");
SignalProxy::writeDataToDevice(socket, reply);
- quWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
+ qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
socket->close(); return;
}
if(msg["MsgType"] == "CoreSetupData") {
@@ -571,7 +573,7 @@ void Core::clientDisconnected() {
socket->deleteLater();
} else {
// we have to crawl through the hashes and see if we find a victim to remove
- quDebug() << qPrintable(tr("Non-authed client disconnected. (socket allready destroyed)"));
+ qDebug() << qPrintable(tr("Non-authed client disconnected. (socket allready destroyed)"));
// DO NOT CALL ANY METHODS ON socket!!
socket = static_cast(sender());
@@ -613,7 +615,7 @@ void Core::setupClientSession(QTcpSocket *socket, UserId uid) {
blocksizes.remove(socket);
clientInfo.remove(socket);
if(!sess) {
- quWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString());
+ qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString());
socket->close();
}
sess->addClient(socket);
@@ -640,7 +642,7 @@ void Core::setupInternalClientSession(SignalProxy *proxy) {
SessionThread *Core::createSession(UserId uid, bool restore) {
if(sessions.contains(uid)) {
- quWarning() << "Calling createSession() when a session for the user already exists!";
+ qWarning() << "Calling createSession() when a session for the user already exists!";
return 0;
}
SessionThread *sess = new SessionThread(uid, restore, this);
@@ -661,5 +663,5 @@ void Core::sslErrors(const QList &errors) {
void Core::socketError(QAbstractSocket::SocketError err) {
QAbstractSocket *socket = qobject_cast(sender());
if(socket && err != QAbstractSocket::RemoteHostClosedError)
- quWarning() << "Core::socketError()" << socket << err << socket->errorString();
+ qWarning() << "Core::socketError()" << socket << err << socket->errorString();
}