Beispiel #1
0
void WidgetIrcMain::connectToImpl(const ConnectionInfo& connection)
{
	Session* session = Session::fromConnection(connection, this);
    session->setEncoding(Application::encoding());
    if (session->userName().isEmpty())
        session->setUserName("quazaa");
	if (!session->hasQuit() && session->ensureNetwork())
		session->open();
    tabWidget->addSession(session);

	connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateSession()));
	connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateSession()));
	updateSession(session);

    SessionTabWidget* tab = tabWidget->sessionWidget(session);
    connect(tab, SIGNAL(viewAdded(WidgetIrcMessageView*)), this, SLOT(viewAdded(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(viewRemoved(WidgetIrcMessageView*)), this, SLOT(viewRemoved(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(viewRenamed(WidgetIrcMessageView*)), this, SLOT(viewRenamed(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(viewActivated(WidgetIrcMessageView*)), this, SLOT(viewActivated(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(editSession(Session*)), this, SLOT(editSession(Session*)));

    if (WidgetIrcMessageView* view = tab->viewAt(0)) {
        treeWidget->addView(view);
        treeWidget->setCurrentView(view);
        treeWidget->parentWidget()->show();
        view->applySettings();
    }

    if (!quazaaSettings.WinMain.ChatUserListSplitter.isEmpty())
        tab->restoreSplitter(quazaaSettings.WinMain.ChatUserListSplitter);
}
Beispiel #2
0
void MainWindow::connectToImpl(const ConnectionInfo& connection)
{
    Session* session = Session::fromConnection(connection, this);
    session->setEncoding(Application::encoding());
    session->setUserName("communi");
    if (!session->hasQuit() && session->ensureNetwork())
        session->open();
    tabWidget->addSession(session);
    if (treeWidget)
        treeWidget->setCurrentView(session);

    connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateSession()));
    connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateSession()));
    updateSession(session);

    SessionTabWidget* tab = tabWidget->sessionWidget(session);
    connect(tab, SIGNAL(viewAdded(MessageView*)), this, SLOT(viewAdded(MessageView*)));
    connect(tab, SIGNAL(viewRemoved(MessageView*)), this, SLOT(viewRemoved(MessageView*)));
    connect(tab, SIGNAL(viewRenamed(QString,QString)), this, SLOT(viewRenamed(QString,QString)));
    connect(tab, SIGNAL(viewActivated(MessageView*)), this, SLOT(viewActivated(MessageView*)));
    connect(tab, SIGNAL(editSession(Session*)), this, SLOT(editSession(Session*)));

    QSettings settings;
    if (settings.contains("list"))
        tab->restoreSplitter(settings.value("list").toByteArray());
}