X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=41ceb1edb1c5e927b7e33df1e588664f2de5a105;hp=ffecf7faf0a3b47626df87c8e9333f83c2ceefe6;hb=1b113021e8d82f93f46e02cf66428aebfb7d0357;hpb=9bb1e377323247ce65e70f2506f096098969d19e diff --git a/src/client/client.cpp b/src/client/client.cpp index ffecf7fa..41ceb1ed 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -25,6 +25,7 @@ #include "buffermodel.h" #include "buffersettings.h" #include "buffersyncer.h" +#include "bufferviewconfig.h" #include "bufferviewmanager.h" #include "clientbacklogmanager.h" #include "clientirclisthelper.h" @@ -116,7 +117,7 @@ void Client::init() { p->attachSlot(SIGNAL(identityCreated(const Identity &)), this, SLOT(coreIdentityCreated(const Identity &))); p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId))); - p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &)), SIGNAL(createNetwork(const NetworkInfo &))); + p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &, const QStringList &)), SIGNAL(createNetwork(const NetworkInfo &, const QStringList &))); p->attachSignal(this, SIGNAL(requestRemoveNetwork(NetworkId)), SIGNAL(removeNetwork(NetworkId))); p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId))); p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId))); @@ -166,8 +167,8 @@ const Network * Client::network(NetworkId networkid) { else return 0; } -void Client::createNetwork(const NetworkInfo &info) { - emit instance()->requestCreateNetwork(info); +void Client::createNetwork(const NetworkInfo &info, const QStringList &persistentChannels) { + emit instance()->requestCreateNetwork(info, persistentChannels); } void Client::removeNetwork(NetworkId id) { @@ -298,6 +299,10 @@ void Client::setSyncedToCore() { Q_ASSERT(!_bufferViewManager); _bufferViewManager = new BufferViewManager(signalProxy(), this); connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog())); + connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(createDefaultBufferView())); + + createDefaultIdentity(); + createDefaultNetworks(); _syncedToCore = true; emit connected(); @@ -309,6 +314,37 @@ void Client::requestInitialBacklog() { Client::backlogManager()->requestInitialBacklog(); } +void Client::createDefaultBufferView() { + if(bufferViewManager()->bufferViewConfigs().isEmpty()) { + BufferViewConfig config(-1); + config.setBufferViewName(tr("All Buffers")); + config.initSetBufferList(networkModel()->allBufferIdsSorted()); + bufferViewManager()->requestCreateBufferView(config.toVariantMap()); + } +} + +void Client::createDefaultIdentity() { + if(_identities.isEmpty()) { + Identity identity; + identity.setToDefaults(); + identity.setIdentityName(tr("Default Identity")); + createIdentity(identity); + } +} + +void Client::createDefaultNetworks() { + if(_networks.isEmpty()) { + QStringList defaultNets = Network::presetNetworks(true); + foreach(QString net, defaultNets) { + NetworkInfo info = Network::networkInfoFromPreset(net); + if(info.networkName.isEmpty()) + continue; + QStringList defaultChans = Network::presetDefaultChannels(net); + createNetwork(info, defaultChans); + } + } +} + void Client::setSecuredConnection() { emit securedConnection(); }