コード例 #1
0
        public ChannelDlg(TeamTalk tt, ChannelDlgType dlgtype, int channelid, int parentid)
        {
            ttclient     = tt;
            this.dlgtype = dlgtype;

            InitializeComponent();

            if (channelid > 0 && ttclient.GetChannel(channelid, ref chan))
            {
                string path = "";
                ttclient.GetChannelPath(channelid, ref path);
                chanpathTextBox.Text         = path;
                channameTextBox.Text         = chan.szName;
                topicTextBox.Text            = chan.szTopic;
                passwdTextBox.Text           = chan.szPassword;
                maxusersNumericUpDown.Value  = chan.nMaxUsers;
                diskquotaNumericUpDown.Value = chan.nDiskQuota / 1024;
                permchannelCheckBox.Checked  = chan.uChannelType.HasFlag(ChannelType.CHANNEL_PERMANENT);
                singletxCheckBox.Checked     = chan.uChannelType.HasFlag(ChannelType.CHANNEL_SOLO_TRANSMIT);
                classroomCheckBox.Checked    = chan.uChannelType.HasFlag(ChannelType.CHANNEL_CLASSROOM);
                oprecvonlyCheckBox.Checked   = chan.uChannelType.HasFlag(ChannelType.CHANNEL_OPERATOR_RECVONLY);
                novoiceactCheckBox.Checked   = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_VOICEACTIVATION);
                norecordCheckBox.Checked     = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_RECORDING);

                switch (chan.audiocodec.nCodec)
                {
                case Codec.SPEEX_CODEC:
                    tabControl1.SelectedIndex   = (int)CodecTabs.SPEEX_CBR_TAB;
                    speexnbRadioButton.Checked  = chan.audiocodec.speex.nBandmode == 0;
                    speexwbRadioButton.Checked  = chan.audiocodec.speex.nBandmode == 1;
                    speexuwbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 2;
                    speexqualityTrackBar.Value  = chan.audiocodec.speex.nQuality;
                    speexTxInterval.Value       = chan.audiocodec.speex.nTxIntervalMSec;
                    speexstereoCheckBox.Checked = chan.audiocodec.speex.bStereoPlayback;
                    break;

                case Codec.SPEEX_VBR_CODEC:
                    tabControl1.SelectedIndex          = (int)CodecTabs.SPEEX_VBR_TAB;
                    speexvbrnbRadioButton.Checked      = chan.audiocodec.speex_vbr.nBandmode == 0;
                    speexvbrwbRadioButton.Checked      = chan.audiocodec.speex_vbr.nBandmode == 1;
                    speexvbruwbRadioButton.Checked     = chan.audiocodec.speex_vbr.nBandmode == 2;
                    speexvbrqualityTrackBar.Value      = chan.audiocodec.speex_vbr.nQuality;
                    speexvbrbitrateNumericUpDown.Value = chan.audiocodec.speex_vbr.nBitRate;
                    speexvbrmaxbrNumericUpDown.Value   = chan.audiocodec.speex_vbr.nMaxBitRate;
                    speexvbrTxInterval.Value           = chan.audiocodec.speex_vbr.nTxIntervalMSec;
                    speexvbrdtxCheckBox.Checked        = chan.audiocodec.speex_vbr.bDTX;
                    speexvbrstereoCheckBox.Checked     = chan.audiocodec.speex_vbr.bStereoPlayback;
                    break;

                case Codec.OPUS_CODEC:
                    tabControl1.SelectedIndex = (int)CodecTabs.OPUS_TAB;
                    int i = opussamplerateComboBox.FindString(chan.audiocodec.opus.nSampleRate.ToString());
                    if (i < 0)
                    {
                        i = 0;
                    }
                    opussamplerateComboBox.SelectedIndex = i;
                    opuschannelsComboBox.SelectedIndex   = chan.audiocodec.opus.nChannels - 1;
                    switch (chan.audiocodec.opus.nApplication)
                    {
                    case OpusConstants.OPUS_APPLICATION_AUDIO:
                        opusaudioRadioButton.Checked = true;
                        break;

                    case OpusConstants.OPUS_APPLICATION_VOIP:
                        opusvoipRadioButton.Checked = true;
                        break;

                    default:
                        opusvoipRadioButton.Checked = true;
                        break;
                    }
                    opuscomplexityNumericUpDown.Value = chan.audiocodec.opus.nComplexity;
                    opusfecCheckBox.Checked           = chan.audiocodec.opus.bFEC;
                    opusdtxCheckBox.Checked           = chan.audiocodec.opus.bDTX;
                    opusvbrCheckBox.Checked           = chan.audiocodec.opus.bVBR;
                    opusvbrconstraintCheckBox.Checked = chan.audiocodec.opus.bVBRConstraint;
                    opusbitrateNumericUpDown.Value    = chan.audiocodec.opus.nBitRate / 1000;
                    opusTxIntervalNumericUpDown.Value = chan.audiocodec.opus.nTxIntervalMSec;
                    break;
                }

                agcCheckBox.Checked     = chan.audiocfg.bEnableAGC;
                gainlevelTrackBar.Value = chan.audiocfg.nGainLevel;
            }
            else
            {
                string path = "";
                ttclient.GetChannelPath(parentid, ref path);
                chanpathTextBox.Text = path;
                chan.nParentID       = parentid;
            }

            UserType usertype = ttclient.GetMyUserType();

            switch (dlgtype)
            {
            case ChannelDlgType.JOIN_CHANNEL:
                //when joining a channel 'disk quota' and 'max users' are set to server's default values
                diskquotaNumericUpDown.ReadOnly = true;
                maxusersNumericUpDown.ReadOnly  = true;
                goto case ChannelDlgType.CREATE_CHANNEL;

            case ChannelDlgType.CREATE_CHANNEL:
                opussamplerateComboBox.SelectedIndex = 0;
                opuschannelsComboBox.SelectedIndex   = 0;
                opuschannelsComboBox.SelectedIndex   = 0;
                //only admins can change static channel property
                permchannelCheckBox.Enabled     = ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS);
                diskquotaNumericUpDown.ReadOnly = !ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS);
                agcCheckBox.Checked             = true;
                gainlevelTrackBar.Value         = 8000;
                break;

            case ChannelDlgType.UPDATE_CHANNEL:
                break;

            case ChannelDlgType.VIEW_CHANNEL:
                channameTextBox.ReadOnly        = true;
                topicTextBox.ReadOnly           = true;
                passwdTextBox.ReadOnly          = true;
                oppasswdTextBox.ReadOnly        = true;
                maxusersNumericUpDown.ReadOnly  = true;
                diskquotaNumericUpDown.ReadOnly = true;
                permchannelCheckBox.Enabled     = false;
                singletxCheckBox.Enabled        = false;
                classroomCheckBox.Enabled       = false;
                oprecvonlyCheckBox.Enabled      = false;
                novoiceactCheckBox.Enabled      = false;
                norecordCheckBox.Enabled        = false;
                agcCheckBox.Enabled             = false;
                gainlevelTrackBar.Enabled       = false;
                tabControl1.Enabled             = false;
                break;
            }
        }
コード例 #2
0
ファイル: ChannelDlg.cs プロジェクト: sayi21cn/TeamTalk5
        public ChannelDlg(TeamTalk tt, ChannelDlgType dlgtype, int channelid, int parentid)
        {
            ttclient = tt;
            this.dlgtype = dlgtype;

            InitializeComponent();

            if (channelid > 0 && ttclient.GetChannel(channelid, ref chan))
            {
                string path = "";
                ttclient.GetChannelPath(channelid, ref path);
                chanpathTextBox.Text = path;
                channameTextBox.Text = chan.szName;
                topicTextBox.Text = chan.szTopic;
                passwdTextBox.Text = chan.szPassword;
                maxusersNumericUpDown.Value = chan.nMaxUsers;
                diskquotaNumericUpDown.Value = chan.nDiskQuota / 1024;
                permchannelCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_PERMANENT);
                singletxCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_SOLO_TRANSMIT);
                classroomCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_CLASSROOM);
                oprecvonlyCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_OPERATOR_RECVONLY);
                novoiceactCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_VOICEACTIVATION);
                norecordCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_RECORDING);

                switch (chan.audiocodec.nCodec)
                {
                    case Codec.SPEEX_CODEC:
                        tabControl1.SelectedIndex = (int)CodecTabs.SPEEX_CBR_TAB;
                        speexnbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 0;
                        speexwbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 1;
                        speexuwbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 2;
                        speexqualityTrackBar.Value = chan.audiocodec.speex.nQuality;
                        speexTxInterval.Value = chan.audiocodec.speex.nTxIntervalMSec;
                        speexstereoCheckBox.Checked = chan.audiocodec.speex.bStereoPlayback;
                        break;
                    case Codec.SPEEX_VBR_CODEC :
                        tabControl1.SelectedIndex = (int)CodecTabs.SPEEX_VBR_TAB;
                        speexvbrnbRadioButton.Checked = chan.audiocodec.speex_vbr.nBandmode == 0;
                        speexvbrwbRadioButton.Checked = chan.audiocodec.speex_vbr.nBandmode == 1;
                        speexvbruwbRadioButton.Checked = chan.audiocodec.speex_vbr.nBandmode == 2;
                        speexvbrqualityTrackBar.Value = chan.audiocodec.speex_vbr.nQuality;
                        speexvbrbitrateNumericUpDown.Value = chan.audiocodec.speex_vbr.nBitRate;
                        speexvbrmaxbrNumericUpDown.Value = chan.audiocodec.speex_vbr.nMaxBitRate;
                        speexvbrTxInterval.Value = chan.audiocodec.speex_vbr.nTxIntervalMSec;
                        speexvbrdtxCheckBox.Checked = chan.audiocodec.speex_vbr.bDTX;
                        speexvbrstereoCheckBox.Checked = chan.audiocodec.speex_vbr.bStereoPlayback;
                        break;
                    case Codec.OPUS_CODEC:
                        tabControl1.SelectedIndex = (int)CodecTabs.OPUS_TAB;
                        int i = opussamplerateComboBox.FindString(chan.audiocodec.opus.nSampleRate.ToString());
                        if (i < 0)
                            i = 0;
                        opussamplerateComboBox.SelectedIndex = i;
                        opuschannelsComboBox.SelectedIndex = chan.audiocodec.opus.nChannels - 1;
                        switch (chan.audiocodec.opus.nApplication)
                        {
                            case OpusConstants.OPUS_APPLICATION_AUDIO :
                                opusaudioRadioButton.Checked = true;
                                break;
                            case OpusConstants.OPUS_APPLICATION_VOIP :
                                opusvoipRadioButton.Checked = true;
                                break;
                            default:
                                opusvoipRadioButton.Checked = true;
                                break;
                        }
                        opuscomplexityNumericUpDown.Value = chan.audiocodec.opus.nComplexity;
                        opusfecCheckBox.Checked = chan.audiocodec.opus.bFEC;
                        opusdtxCheckBox.Checked = chan.audiocodec.opus.bDTX;
                        opusvbrCheckBox.Checked = chan.audiocodec.opus.bVBR;
                        opusvbrconstraintCheckBox.Checked = chan.audiocodec.opus.bVBRConstraint;
                        opusbitrateNumericUpDown.Value = chan.audiocodec.opus.nBitRate / 1000;
                        opusTxIntervalNumericUpDown.Value = chan.audiocodec.opus.nTxIntervalMSec;
                        break;
                }

                agcCheckBox.Checked = chan.audiocfg.bEnableAGC;
                gainlevelTrackBar.Value = chan.audiocfg.nGainLevel;
            }
            else
            {
                string path = "";
                ttclient.GetChannelPath(parentid, ref path);
                chanpathTextBox.Text = path;
                chan.nParentID = parentid;
            }

            UserType usertype = ttclient.GetMyUserType();
            switch (dlgtype)
            {
                case ChannelDlgType.JOIN_CHANNEL :
                    //when joining a channel 'disk quota' and 'max users' are set to server's default values
                    diskquotaNumericUpDown.ReadOnly = true;
                    maxusersNumericUpDown.ReadOnly = true;
                    goto case ChannelDlgType.CREATE_CHANNEL;
                case ChannelDlgType.CREATE_CHANNEL :
                    opussamplerateComboBox.SelectedIndex = 0;
                    opuschannelsComboBox.SelectedIndex = 0;
                    opuschannelsComboBox.SelectedIndex = 0;
                    //only admins can change static channel property
                    permchannelCheckBox.Enabled = ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS);
                    diskquotaNumericUpDown.ReadOnly = !ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS);
                    agcCheckBox.Checked = true;
                    gainlevelTrackBar.Value = 8000;
                    break;
                case ChannelDlgType.UPDATE_CHANNEL :
                    break;
                case ChannelDlgType.VIEW_CHANNEL :
                    channameTextBox.ReadOnly = true;
                    topicTextBox.ReadOnly = true;
                    passwdTextBox.ReadOnly = true;
                    oppasswdTextBox.ReadOnly = true;
                    maxusersNumericUpDown.ReadOnly = true;
                    diskquotaNumericUpDown.ReadOnly = true;
                    permchannelCheckBox.Enabled = false;
                    singletxCheckBox.Enabled = false;
                    classroomCheckBox.Enabled = false;
                    oprecvonlyCheckBox.Enabled = false;
                    novoiceactCheckBox.Enabled = false;
                    norecordCheckBox.Enabled = false;
                    agcCheckBox.Enabled = false;
                    gainlevelTrackBar.Enabled = false;
                    tabControl1.Enabled = false;
                    break;
            }
        }