ChatDataWindow::ChatDataWindow(ChatConfigurationWidgetFactoryRepository *chatConfigurationWidgetFactoryRepository, const Chat &chat) : QWidget(0, Qt::Dialog), MyChatConfigurationWidgetFactoryRepository(chatConfigurationWidgetFactoryRepository), ValueStateNotifier(new CompositeConfigurationValueStateNotifier(this)), SimpleStateNotifier(new SimpleConfigurationValueStateNotifier(this)), MyChat(chat), EditWidget(0) { setWindowRole("kadu-chat-data"); setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Chat Properties - %1").arg(MyChat.display())); createGui(); new WindowGeometryManager(new ConfigFileVariantWrapper("General", "ChatDataWindowGeometry"), QRect(0, 50, 425, 500), this); connect(Core::instance()->chatManager(), SIGNAL(chatRemoved(Chat)), this, SLOT(chatRemoved(Chat))); SimpleStateNotifier->setState(StateNotChanged); ValueStateNotifier->addConfigurationValueStateNotifier(SimpleStateNotifier); connect(ValueStateNotifier, SIGNAL(stateChanged(ConfigurationValueState)), this, SLOT(stateChangedSlot(ConfigurationValueState))); stateChangedSlot(ValueStateNotifier->state()); if (MyChatConfigurationWidgetFactoryRepository) { connect(MyChatConfigurationWidgetFactoryRepository, SIGNAL(factoryRegistered(ChatConfigurationWidgetFactory*)), this, SLOT(factoryRegistered(ChatConfigurationWidgetFactory*))); connect(MyChatConfigurationWidgetFactoryRepository, SIGNAL(factoryUnregistered(ChatConfigurationWidgetFactory*)), this, SLOT(factoryUnregistered(ChatConfigurationWidgetFactory*))); foreach (ChatConfigurationWidgetFactory *factory, MyChatConfigurationWidgetFactoryRepository->factories()) factoryRegistered(factory); } }
AggregateChatManager::~AggregateChatManager() { disconnect(ChatManager::instance(), SIGNAL(chatAdded(Chat)), this, SLOT(chatAdded(Chat))); disconnect(ChatManager::instance(), SIGNAL(chatRemoved(Chat)), this, SLOT(chatRemoved(Chat))); foreach (const Chat &chat, ChatManager::instance()->allItems()) chatRemoved(chat); }
ChatManagerAdapter::ChatManagerAdapter(ChatManager *chatManager, ChatListModel *model) : QObject{model}, m_model{model} { m_model->setChats(chatManager->allItems().values().toVector()); connect(chatManager, SIGNAL(chatAdded(Chat)), this, SLOT(chatAdded(Chat)), Qt::DirectConnection); connect(chatManager, SIGNAL(chatRemoved(Chat)), this, SLOT(chatRemoved(Chat)), Qt::DirectConnection); }