summaryrefslogtreecommitdiffstats
path: root/libk9copy/k9config.cpp
blob: 679de16bb1df9d41d24036084983e7e7c32ad63c (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//
// C++ Implementation: k9config
//
// Description: 
//
//
// Author: Jean-Michel PETIT <[email protected]>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "k9config.h"

k9Config::k9Config() {
    m_config=NULL;
    read();
}

void k9Config::read() {
  // if (! m_config->hasGroup( "options"))
  // 	readOldConfig();
  if (m_config!=NULL)
    delete m_config;
  m_config=new KSimpleConfig("K9Copy");


  m_config->setGroup( "dir");
  m_prefOutput=m_config->readEntry("output",locateLocal("tmp","k9copy/",true));
  
  m_config->setGroup("devices");
  m_InputDev=m_config->readNumEntry("input",0);
  m_OutputDev=m_config->readNumEntry("output",0);

  m_config->setGroup("options");
  m_prefK3b=m_config->readBoolEntry("usek3b",false);
  m_prefAutoBurn=m_config->readBoolEntry("autoburn",false);
  m_quickScan=m_config->readBoolEntry("quickscan",true);
  m_prefSize=m_config->readNumEntry("dvdsize",4400);
  m_useDvdAuthor=m_config->readBoolEntry("useDvdAuthor",true);
  m_keepMenus=m_config->readBoolEntry("keepMenus",true);
  m_prefDelTmpFiles=m_config->readBoolEntry("deltmpfiles",false);

  m_config->setGroup("mp4");
  m_prefMp4Codec=m_config->readNumEntry("codec",0);
  m_prefMp4Size=m_config->readNumEntry("size",700);
  m_prefMp4NumberCD=m_config->readNumEntry("numberCD",1);
  m_prefMp4Width=m_config->readEntry("width","640");
  m_prefMp4Height=m_config->readEntry("height","");
  m_prefMp4AspectRatio=m_config->readBoolEntry("aspectRatio",true);
  m_prefMp42Passes=m_config->readBoolEntry("2passes",false);
  m_prefMp4AudioBitrate=m_config->readEntry("audiobitrate","128");
  m_prefMp4VideoBitrate=m_config->readEntry("videobitrate" "");
  m_prefMp4AudioCodec=m_config->readNumEntry("audiocodec",0);
  m_prefMp4AudioGain=m_config->readNumEntry("audiogain",7);
  m_prefUseCellCache=m_config->readBoolEntry("usecellcache",true);

  m_config->setGroup("mencoder");
  m_prefVersion=m_config->readEntry("version","");
  m_codecAudio=m_config->readListEntry("audio");
  m_codecLabels=m_config->readListEntry("labels");
  m_codecLabelsAudio=m_config->readListEntry("audiolabels");
  

  m_codecVideo=m_config->readListEntry("video");
  
  m_config->setGroup("devices");
  m_devices=m_config->readListEntry("dev");
  m_devicesLabels=m_config->readListEntry("labels");
  m_devicesIO=m_config->readListEntry("IO");

  m_config->setGroup("preview");
  m_useMplayer=m_config->readBoolEntry("useMplayer",false);
  m_useGL=m_config->readBoolEntry("useGL",false);
  m_MplayerVout=m_config->readNumEntry("MplayerVout",0);
  m_MplayerAout=m_config->readNumEntry("MplayerAout",0);

  m_config->setGroup("authoring");
  m_prefAudioFormat=m_config->readEntry("audioFormat","AC3");
  m_prefAudioBitrate=m_config->readNumEntry("audioBitrate",192);
  m_prefButtonWidth=m_config->readNumEntry("buttonWidth",50);
  m_prefButtonHeight=m_config->readNumEntry("buttonHeight",40);
  m_prefButtonHiliteColor=m_config->readColorEntry("buttonHiliteColor",&TQColor(TQt::yellow));
  m_prefButtonTextColor=m_config->readColorEntry("buttonTextColor",&TQColor(TQt::yellow));

  m_prefButtonFont=m_config->readFontEntry("buttonFont");


}

void k9Config::save() {
  m_config->setGroup( "dir");
  m_config->writeEntry("output",m_prefOutput);
  
  m_config->setGroup("devices");
  m_config->writeEntry("input", m_InputDev);
  m_config->writeEntry("output",m_OutputDev);

  m_config->setGroup("options");
  m_config->writeEntry("usek3b",m_prefK3b);
  m_config->writeEntry("autoburn",m_prefAutoBurn);
  m_config->writeEntry("quickscan",m_quickScan);
  m_config->writeEntry("dvdsize",m_prefSize);
  m_config->writeEntry("useDvdAuthor",m_useDvdAuthor);
  m_config->writeEntry("keepMenus",m_keepMenus);
  m_config->writeEntry("deltmpfiles",m_prefDelTmpFiles);
  
  m_config->setGroup("mp4");
  m_config->writeEntry("codec",m_prefMp4Codec);
  m_config->writeEntry("size",m_prefMp4Size);
  m_config->writeEntry("numberCD",m_prefMp4NumberCD);
  m_config->writeEntry("width",m_prefMp4Width);
  m_config->writeEntry("height",m_prefMp4Height);
  m_config->writeEntry("audiobitrate",m_prefMp4AudioBitrate);
  m_config->writeEntry("videobitrate",m_prefMp4VideoBitrate);
  m_config->writeEntry("aspectRatio",m_prefMp4AspectRatio);
  m_config->writeEntry("2passes",m_prefMp42Passes);
  m_config->writeEntry("audiogain",m_prefMp4AudioGain);
  m_config->writeEntry("audiocodec", m_prefMp4AudioCodec);
  m_config->writeEntry("usecellcache",m_prefUseCellCache);


  m_config->setGroup("mencoder");
  m_config->writeEntry("version",m_prefVersion);
  m_config->writeEntry("audio",m_codecAudio);
  m_config->writeEntry("labels",m_codecLabels);
  m_config->writeEntry("audiolabels",m_codecLabelsAudio);
  m_config->writeEntry("video",m_codecVideo);

  m_config->setGroup("devices");
  m_config->writeEntry("dev",m_devices);
  m_config->writeEntry("labels",m_devicesLabels);
  m_config->writeEntry("IO",m_devicesIO);

  m_config->setGroup("preview");
  m_config->writeEntry("useMplayer",m_useMplayer);
  m_config->writeEntry("useGL",m_useGL);
  m_config->writeEntry("MplayerVout",m_MplayerVout);
  m_config->writeEntry("MplayerAout",m_MplayerAout);

  m_config->setGroup("authoring");
  m_config->writeEntry("audioFormat",m_prefAudioFormat);
  m_config->writeEntry("audioBitrate",m_prefAudioBitrate);
  m_config->writeEntry("buttonWidth",m_prefButtonWidth);
  m_config->writeEntry("buttonHeight",m_prefButtonHeight);
  m_config->writeEntry("buttonHiliteColor",m_prefButtonHiliteColor);
  m_config->writeEntry("buttonTextColor",m_prefButtonTextColor);
  m_config->writeEntry("buttonFont",m_prefButtonFont);

}


k9Config::~k9Config(){
   delete m_config;

}