Example #1
0
DccChatWindow::DccChatWindow(DccDescriptor * dcc, const char * name)
    : DccWindow(KviWindow::DccChat, name, dcc)
{
	m_pButtonBox = new KviTalHBox(this);

	m_pLabel = new KviThemedLabel(m_pButtonBox, this, "dcc_chat_label");
	m_pLabel->setText(name);
	m_pButtonBox->setStretchFactor(m_pLabel, 1);

	m_pButtonContainer = new KviTalHBox(m_pButtonBox);
	createTextEncodingButton(m_pButtonContainer);

#ifdef COMPILE_CRYPT_SUPPORT
	createCryptControllerButton(m_pButtonContainer);
#endif

	m_pSplitter = new KviTalSplitter(Qt::Horizontal, this);
	m_pSplitter->setObjectName("dcc_chat_splitter");
	m_pSplitter->setChildrenCollapsible(false);

	m_pIrcView = new KviIrcView(m_pSplitter, this);
	connect(m_pIrcView, SIGNAL(rightClicked()), this, SLOT(textViewRightClicked()));
	m_pInput = new KviInput(this);

	//setFocusHandler(m_pInput,this);

	m_pSlaveThread = nullptr;

	if(KVI_OPTION_BOOL(KviOption_boolAutoLogDccChat))
		m_pIrcView->startLogging();

	m_pMarshal = new DccMarshal(this);
	connect(m_pMarshal, SIGNAL(error(KviError::Code)), this, SLOT(handleMarshalError(KviError::Code)));
	connect(m_pMarshal, SIGNAL(connected()), this, SLOT(connected()));
	connect(m_pMarshal, SIGNAL(inProgress()), this, SLOT(connectionInProgress()));
#ifdef COMPILE_SSL_SUPPORT
	connect(m_pMarshal, SIGNAL(startingSSLHandshake()), this, SLOT(startingSSLHandshake()));
	connect(m_pMarshal, SIGNAL(sslError(const char *)), this, SLOT(sslError(const char *)));
#endif

	m_pSlaveThread = nullptr;

	startConnection();
}
Example #2
0
DccVoiceWindow::DccVoiceWindow(DccDescriptor * dcc,const char * name)
    : DccWindow(KviWindow::DccVoice,name,dcc)
{
    m_pDescriptor = dcc;
    m_pSlaveThread = 0;

    m_pSplitter = new KviTalSplitter(Qt::Horizontal,this);
    m_pSplitter->setObjectName("dcc_window_splitter");
    m_pIrcView = new KviIrcView(m_pSplitter,this);

    m_pHBox = new KviTalHBox(this);

    KviTalVBox * vbox = new KviTalVBox(m_pHBox);

    m_pInputLabel = new QLabel(__tr2qs_ctx("Input buffer","dcc"),vbox);
    m_pInputLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
    m_pOutputLabel = new QLabel(__tr2qs_ctx("Output buffer","dcc"),vbox);
    m_pOutputLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
    vbox->setSpacing(1);

    KviTalVBox * vbox2 = new KviTalVBox(m_pHBox);

    m_pRecordingLabel = new QLabel(vbox2);
    m_pRecordingLabel->setPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::Record)));
    m_pRecordingLabel->setEnabled(false);
    m_pRecordingLabel->setFrameStyle(QFrame::Raised | QFrame::Panel);

    m_pPlayingLabel = new QLabel(vbox2);
    m_pPlayingLabel->setPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::Play)));
    m_pPlayingLabel->setEnabled(false);
    m_pPlayingLabel->setFrameStyle(QFrame::Raised | QFrame::Panel);

    vbox2->setSpacing(1);

    //#warning "The volume slider should be enabled only when receiving data"
    //m_pVolumeSlider = new QSlider(-100, 0, 10, 0, Qt::Vertical, m_pHBox, "dcc_voice_volume_slider");
    m_pVolumeSlider = new QSlider(Qt::Vertical,m_pHBox);
    m_pVolumeSlider->setObjectName("dcc_voice_volume_slider");
    m_pVolumeSlider->setMinimum(-100);
    m_pVolumeSlider->setMaximum(0);
    m_pVolumeSlider->setPageStep(10);
    m_pVolumeSlider->setValue(0);

    m_pVolumeSlider->setValue(getMixerVolume());
    /* Update the tooltip */
    setMixerVolume(m_pVolumeSlider->value());
    m_pVolumeSlider->setMaximumWidth(16);
    m_pVolumeSlider->setMaximumHeight(2*m_pPlayingLabel->height());
    connect(m_pVolumeSlider, SIGNAL(valueChanged(int)), this, SLOT(setMixerVolume(int)));

    m_pTalkButton = new QToolButton(m_pHBox);
    m_pTalkButton->setEnabled(false);
    m_pTalkButton->setCheckable(true);
    QIcon iset;
    iset.addPixmap(*(g_pIconManager->getBigIcon(KVI_BIGICON_DISCONNECTED)),QIcon::Normal,QIcon::Off);
    iset.addPixmap(*(g_pIconManager->getBigIcon(KVI_BIGICON_CONNECTED)),QIcon::Normal,QIcon::On);
    m_pTalkButton->setIcon(iset);
    m_pTalkButton->setIconSize(QSize(32,32));
    connect(m_pTalkButton,SIGNAL(toggled(bool)),this,SLOT(startOrStopTalking(bool)));

    m_pHBox->setStretchFactor(vbox,1);
    m_pHBox->setMargin(2);
    m_pHBox->setSpacing(1);

    //setFocusHandler(m_pIrcView,this);

    m_pMarshal = new DccMarshal(this);
    connect(m_pMarshal,SIGNAL(error(KviError::Code)),this,SLOT(handleMarshalError(KviError::Code)));
    connect(m_pMarshal,SIGNAL(connected()),this,SLOT(connected()));
    connect(m_pMarshal,SIGNAL(inProgress()),this,SLOT(connectionInProgress()));

    m_pUpdateTimer = new QTimer();

    startConnection();
}