summaryrefslogtreecommitdiff
path: root/noncore/net/linphone/linphoneconfig.cpp
blob: ee02e1a24bc968c1ebfea535a121c70cf7bed725 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <qspinbox.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qslider.h>

#include <qpe/config.h>

#include "linphoneconfig.h"


LinPhoneConfig::LinPhoneConfig( QWidget* parent , const char* name , bool modal, WFlags fl ) : SettingsDialog( parent, name, modal,  fl ) {
    loadConfig();
}

LinPhoneConfig::~LinPhoneConfig() {
}

void LinPhoneConfig::loadConfig() {
    Config cfg("opie-phone");
    cfg.setGroup( "net" );
    cfg.setGroup( "sip" );
    PortSpin->setValue( cfg.readNumEntry( "sip_port", 5060 ) );
    UserPartLine->setText( cfg.readEntry( "username", "" ) );
    HostPartLine->setText( cfg.readEntry( "hostname", "" ) );
    CheckBoxReg->setChecked( cfg.readBoolEntry( "use_registrar", 0 ) );
    ServerAddressLine->setText(  cfg.readEntry( "registrar", "" ) );
      // cannot use crypt due to gnome stuff in linephone
    PasswordLine->setText(  cfg.readEntry( "reg_password",  "" ) );
    RecordLine->setText(  cfg.readEntry( "addr_of_rec", "" ) );
    CheckBoxProxy->setChecked( cfg.readBoolEntry( "as_proxy",  0 ) );
    cfg.setGroup( "rtp" );
    RTPPort->setText( cfg.readEntry( "audio_rtp_port", "" ) );
    SliderJitter->setValue( cfg.readNumEntry( "jitt_comp",  60 ) );
    cfg.setGroup( "audio" );
    // source
    cfg.setGroup( "video" );
    cfg.setGroup( "codecs" );
    cfg.setGroup( "address_book" );
}

void LinPhoneConfig::writeConfig() {
    Config cfg("opie-phone");
    cfg.setGroup( "net" );
    cfg.setGroup( "sip" );
    cfg.writeEntry( "sip_port", PortSpin->value() );
    cfg.writeEntry( "username", UserPartLine->text() );
    cfg.writeEntry( "hostname", HostPartLine->text() );
    cfg.writeEntry( "use_registrar", CheckBoxReg->isChecked() );
    cfg.writeEntry( "registrar", ServerAddressLine->text() );
    cfg.writeEntry( "reg_password",  PasswordLine->text() );
    cfg.writeEntry( "addr_of_rec", RecordLine->text() );
    cfg.writeEntry(  "as_proxy",  CheckBoxProxy->isChecked() );
    cfg.setGroup( "rtp" );
    cfg.writeEntry(  "audio_rtp_port",  RTPPort->text() );
    cfg.writeEntry(  "jitt_comp", SliderJitter->value() );
    cfg.setGroup( "audio" );
    cfg.setGroup( "video" );
    cfg.setGroup( "codecs" );
    cfg.setGroup( "address_book" );
}

void LinPhoneConfig::accept() {
    writeConfig();
    QDialog::accept();
}