_backlogManager(new ClientBacklogManager(this)),
_bufferViewManager(0),
_bufferViewOverlay(new BufferViewOverlay(this)),
+ _coreInfo(new CoreInfo(this)),
_dccConfig(0),
_ircListHelper(new ClientIrcListHelper(this)),
_inputHandler(0),
_messageProcessor(0),
_coreAccountModel(new CoreAccountModel(this)),
_coreConnection(new CoreConnection(this)),
- _connected(false),
- _debugLog(&_debugLogBuffer)
+ _connected(false)
{
_signalProxy->synchronize(_ircListHelper);
}
connect(this, SIGNAL(connected()), mainUi(), SLOT(connectedToCore()));
connect(this, SIGNAL(disconnected()), mainUi(), SLOT(disconnectedFromCore()));
+ // Listen to network removed events
+ connect(this, SIGNAL(networkRemoved(NetworkId)),
+ _messageProcessor, SLOT(networkRemoved(NetworkId)));
+
// attach backlog manager
p->synchronize(backlogManager());
connect(backlogManager(), SIGNAL(messagesReceived(BufferId, int)), _messageModel, SLOT(messagesReceived(BufferId, int)));
coreAccountModel()->load();
+ // Attach CoreInfo
+ p->synchronize(coreInfo());
+
connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState)));
coreConnection()->init();
}
}
+void Client::onDbUpgradeInProgress(bool inProgress)
+{
+ emit dbUpgradeInProgress(inProgress);
+}
+
+
+void Client::onExitRequested(int exitCode, const QString &reason)
+{
+ if (!reason.isEmpty()) {
+ qCritical() << reason;
+ emit exitRequested(reason);
+ }
+ QCoreApplication::exit(exitCode);
+}
+
+
/*** Network handling ***/
QList<NetworkId> Client::networkIds()
connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), _messageModel, SLOT(buffersPermanentlyMerged(BufferId, BufferId)));
connect(bufferSyncer(), SIGNAL(bufferMarkedAsRead(BufferId)), SIGNAL(bufferMarkedAsRead(BufferId)));
connect(bufferSyncer(), SIGNAL(bufferActivityChanged(BufferId, const Message::Types)), _networkModel, SLOT(bufferActivityChanged(BufferId, const Message::Types)));
+ connect(bufferSyncer(), SIGNAL(highlightCountChanged(BufferId, int)), _networkModel, SLOT(highlightCountChanged(BufferId, int)));
connect(networkModel(), SIGNAL(requestSetLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &)));
SignalProxy *p = signalProxy();
Q_ASSERT(!_highlightRuleManager);
_highlightRuleManager = new HighlightRuleManager(this);
p->synchronize(highlightRuleManager());
+ // Listen to network removed events
+ connect(this, SIGNAL(networkRemoved(NetworkId)),
+ _highlightRuleManager, SLOT(networkRemoved(NetworkId)));
/* not ready yet
// create TransferManager and DccConfig if core supports them
disconnect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization()));
requestInitialBacklog();
- if (isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync))
+ if (isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync)) {
bufferSyncer()->markActivitiesChanged();
+ bufferSyncer()->markHighlightCountsChanged();
+ }
}
}
+void Client::requestLegacyCoreInfo()
+{
+ // On older cores, the CoreInfo object was only synchronized on demand. Synchronize now if
+ // needed.
+ if (isConnected() && !isCoreFeatureEnabled(Quassel::Feature::SyncedCoreInfo)) {
+ // Delete the existing core info object (it will always exist as client is single-threaded)
+ _coreInfo->deleteLater();
+ // No need to set to null when creating new one immediately after
+
+ // Create a fresh, unsynchronized CoreInfo object, emulating legacy behavior of CoreInfo not
+ // persisting
+ _coreInfo = new CoreInfo(this);
+ // Synchronize the new object
+ signalProxy()->synchronize(_coreInfo);
+
+ // Let others know signal handlers have been reset
+ emit coreInfoResynchronized();
+ }
+}
+
+
void Client::disconnectFromCore()
{
if (!coreConnection()->isConnected())
_bufferSyncer = 0;
}
+ _coreInfo->reset();
+
if (_bufferViewManager) {
_bufferViewManager->deleteLater();
_bufferViewManager = 0;
}
+void Client::refreshLegacyCoreInfo()
+{
+ instance()->requestLegacyCoreInfo();
+}
+
+
void Client::changePassword(const QString &oldPassword, const QString &newPassword) {
CoreAccount account = currentCoreAccount();
account.setPassword(newPassword);
coreAccountModel()->save();
emit passwordChanged(success);
}
-
-
-#if QT_VERSION < 0x050000
-void Client::logMessage(QtMsgType type, const char *msg)
-{
- fprintf(stderr, "%s\n", msg);
- fflush(stderr);
- if (type == QtFatalMsg) {
- Quassel::logFatalMessage(msg);
- }
- else {
- QString msgString = QString("%1\n").arg(msg);
-
- //Check to see if there is an instance around, else we risk recursions
- //when calling instance() and creating new ones.
- if (!instanceExists())
- return;
-
- instance()->_debugLog << msgString;
- emit instance()->logUpdated(msgString);
- }
-}
-#else
-void Client::logMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
-{
- Q_UNUSED(context);
-
- fprintf(stderr, "%s\n", msg.toLocal8Bit().constData());
- fflush(stderr);
- if (type == QtFatalMsg) {
- Quassel::logFatalMessage(msg.toLocal8Bit().constData());
- }
- else {
- QString msgString = QString("%1\n").arg(msg);
-
- //Check to see if there is an instance around, else we risk recursions
- //when calling instance() and creating new ones.
- if (!instanceExists())
- return;
-
- instance()->_debugLog << msgString;
- emit instance()->logUpdated(msgString);
- }
-}
-#endif