Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / kinfocenter / base / info_hpux.cpp
blob9c3efd6c36ae51765270e832b38d7c24272e18fd
1 /*
2 !!!!! this file will be included by info.cpp !!!!!
4 Mostly written 1998-1999 by Helge Deller (deller@gmx.de),
5 with some pieces of code from Aubert Pierre.
7 Last modified: done:
8 1999-06-21 added more models to the lookup-table (deller)
9 1999-06-18 added support for 64-Bit HP-UX in CPU-detection(deller)
10 1999-05-04 added audio(alib)-support (deller)
11 1999-04-27 [tested with HP-UX 10.20 (HP9000/715/64-EISA)]
12 added support for nearly all categories
13 (means: not finished!)
14 1998-11-01 first, nearly empty version (deller)
15 with a little source for CPU from Aubert Pierre
18 #include <unistd.h>
19 #include <sys/types.h>
20 #include <sys/param.h>
21 #include <sys/pstat.h>
22 #include <sys/utsname.h>
23 #include <sys/statvfs.h>
24 #include <sys/vfs.h>
25 #include <fstab.h>
26 #include <stdlib.h>
27 #include <QFile>
28 #include <QFontMetrics>
29 #include <QTextStream>
31 # define INFO_CPU_MODEL "/bin/model" // as pipe !!
32 # define INFO_PCI "" // Please, who know it ????
33 # define INFO_PCI_EISA "/etc/eisa/system.sci" // File !
34 # define INFO_IOPORTS_1 "/etc/dmesg" // as pipe !
35 # define INFO_IOPORTS_2 "/usr/sbin/dmesg" // as pipe !
36 # define INFO_DEVICES "/etc/ioscan" // as pipe !!
37 # define INFO_PARTITIONS_1 FSTAB // = "/etc/fstab" (in fstab.h)
38 # define INFO_PARTITIONS_2 "/etc/checklist"
40 /* The following table is from an HP-UX 10.20 System
41 build out of the files
42 "/usr/lib/sched.models"
44 "/opt/langtools/lib/sched.models"
45 If you have more entries, then please add them or send them to me!
48 // entries for PA_REVISION[]
49 enum V_ENTRIES
50 { V_1x0,
51 V_1x1, V_1x1a, V_1x1b, V_1x1c, V_1x1d, V_1x1e,
52 V_2x0,
53 V_LAST};
55 static const char PA_REVISION[V_LAST][7] = { "1.0", "1.1", "1.1a", "1.1b", "1.1c", "1.1d", "1.1e", "2.0" };
57 // entries for PA_NAME[]
58 enum PA_ENTRIES
59 { PA7000,
60 PA7100, PA7100LC, PA7200, PA7300,
61 PA8000, PA8200, PA8500,
62 PARISC_PA_LAST};
64 static const char PA_NAME[PARISC_PA_LAST][11] = { "PA7000", "PA7100", "PA7100LC", "PA7200", "PA7300", "PA8000", "PA8200", "PA8500" };
66 struct _type_LOOKUPTABLE {
67 char Name[8];
68 unsigned short parisc_rev; // = enum V_ENTRIES
69 unsigned short parisc_name; // = enum PA_ENTRIES
72 static const struct _type_LOOKUPTABLE PA_LOOKUPTABLE[] = {
73 /* VERSION A.00.07
74 (there seems to exist several different files with same version-number !)*/
75 { "600", V_1x0, PA7000 }, { "635", V_1x0, PA7000 }, { "645", V_1x0, PA7000 }, { "700", V_1x1, PA7000 }, { "705", V_1x1a, PA7000 }, { "710", V_1x1a, PA7000 }, { "712", V_1x1c, PA7100LC }, { "715", V_1x1c, PA7100LC }, { "720", V_1x1a, PA7000 }, { "722", V_1x1c, PA7100LC },
76 { "725", V_1x1c, PA7100LC }, { "728", V_1x1d, PA7200 }, { "730", V_1x1a, PA7000 }, { "735", V_1x1b, PA7100 },
77 { "742", V_1x1b, PA7100 },
78 { "743", V_1x1b, PA7100 }, // or a 1.1c,PA7100LC !!
79 { "744", V_1x1e, PA7300 }, { "745", V_1x1b, PA7100 }, { "747", V_1x1b, PA7100 }, { "750", V_1x1a, PA7000 }, { "755", V_1x1b, PA7100 }, { "770", V_1x1d, PA7200 }, { "777", V_1x1d, PA7200 }, { "778", V_1x1e, PA7300 }, { "779", V_1x1e, PA7300 }, { "780", V_2x0, PA8000 },
80 { "781", V_2x0, PA8000 }, { "782", V_2x0, PA8200 }, { "783", V_2x0, PA8500 }, { "785", V_2x0, PA8500 },
81 { "800", V_1x0, PA7000 }, // and one with: 2.0 / PA8000
82 { "801", V_1x1c, PA7100LC }, { "802", V_2x0, PA8000 }, { "803", V_1x1e, PA7300 }, { "804", V_2x0, PA8000 }, { "806", V_1x1c, PA7100LC }, { "807", V_1x1a, PA7000 }, { "808", V_1x0, PA7000 }, { "809", V_1x1d, PA7200 }, { "810", V_2x0, PA8000 }, { "811", V_1x1c, PA7100LC }, { "813", V_1x1e,
83 PA7300 }, { "815", V_1x0, PA7000 }, { "816", V_1x1c, PA7100LC }, { "817", V_1x1a, PA7000 }, { "819", V_1x1d, PA7200 }, { "820", V_2x0, PA8000 }, { "821", V_1x1d, PA7200 }, { "822", V_1x0, PA7000 }, { "825", V_1x0, PA7000 }, { "826", V_1x1c, PA7100LC }, { "827", V_1x1a, PA7000 }, {
84 "829", V_1x1d, PA7200 }, { "831", V_1x1d, PA7200 }, { "832", V_1x0, PA7000 }, { "834", V_1x0, PA7000 }, { "835", V_1x0, PA7000 }, { "837", V_1x1a, PA7000 }, { "839", V_1x1d, PA7200 }, { "840", V_1x0, PA7000 }, { "841", V_1x1d, PA7200 }, { "842", V_1x0, PA7000 }, { "845", V_1x0,
85 PA7000 }, { "847", V_1x1a, PA7000 }, { "849", V_1x1d, PA7200 }, { "850", V_1x0, PA7000 }, { "851", V_1x1d, PA7200 }, { "852", V_1x0, PA7000 }, { "855", V_1x0, PA7000 }, { "856", V_1x1c, PA7100LC }, { "857", V_1x1a, PA7000 }, { "859", V_1x1d, PA7200 }, { "860", V_1x0, PA7000 }, {
86 "861", V_2x0, PA8000 }, { "865", V_1x0, PA7000 }, { "869", V_1x1d, PA7200 }, { "870", V_1x0, PA7000 }, { "871", V_2x0, PA8000 }, { "877", V_1x1a, PA7000 }, { "879", V_2x0, PA8000 }, { "887", V_1x1b, PA7100 }, { "889", V_2x0, PA8000 }, { "890", V_1x0, PA7000 }, { "891", V_1x1b,
87 PA7100 }, { "892", V_1x1b, PA7100 }, { "893", V_2x0, PA8000 }, { "895", V_2x0, PA8000 }, { "896", V_2x0, PA8000 }, { "897", V_1x1b, PA7100 }, { "898", V_2x0, PA8200 }, { "899", V_2x0, PA8200 }, { "900", V_1x0, PA7000 }, { "B115", V_1x1e, PA7300 }, { "B120", V_1x1e, PA7300 }, {
88 "B132L", V_1x1e, PA7300 }, { "B160L", V_1x1e, PA7300 }, { "B180L", V_1x1e, PA7300 }, { "C100", V_1x1d, PA7200 }, { "C110", V_1x1d, PA7200 }, { "C115", V_1x1e, PA7300 }, { "C120", V_1x1e, PA7300 }, { "C130", V_2x0, PA8000 }, { "C140", V_2x0, PA8000 }, { "C160L", V_1x1e, PA7300 }, {
89 "C160", V_2x0, PA8000 }, { "C180L", V_1x1e, PA7300 }, { "C180-XP", V_2x0, PA8000 }, { "C180", V_2x0, PA8000 }, { "C200+", V_2x0, PA8200 }, { "C230+", V_2x0, PA8200 }, { "C240+", V_2x0, PA8200 }, { "CB260", V_2x0, PA8200 },
90 { "D200", V_1x1d, PA7200 }, // or: 1.1c, PA7100LC
91 { "D210", V_1x1d, PA7200 }, // or: 1.1c, PA7100LC
92 { "D220", V_1x1e, PA7300 }, { "D230", V_1x1e, PA7300 }, { "D250", V_1x1d, PA7200 }, { "D260", V_1x1d, PA7200 }, { "D270", V_2x0, PA8000 }, { "D280", V_2x0, PA8000 }, { "D310", V_1x1c, PA7100LC }, { "D320", V_1x1e, PA7300 }, { "D330", V_1x1e, PA7300 }, { "D350", V_1x1d, PA7200 }, { "D360",
93 V_1x1d, PA7200 }, { "D370", V_2x0, PA8000 }, { "D380", V_2x0, PA8000 }, { "D400", V_1x1d, PA7200 }, { "D410", V_1x1d, PA7200 }, { "D650", V_2x0, PA8000 }, { "DX0", V_1x1c, PA7100LC }, { "DX5", V_1x1c, PA7100LC }, { "DXO", V_1x1c, PA7100LC }, { "E25", V_1x1c, PA7100LC }, { "E35",
94 V_1x1c, PA7100LC }, { "E45", V_1x1c, PA7100LC }, { "E55", V_1x1c, PA7100LC }, { "F10", V_1x1a, PA7000 }, { "F20", V_1x1a, PA7000 }, { "F30", V_1x1a, PA7000 }, { "G30", V_1x1a, PA7000 }, { "G40", V_1x1a, PA7000 }, { "G50", V_1x1b, PA7100 }, { "G60", V_1x1b, PA7100 }, { "G70", V_1x1b,
95 PA7100 }, { "H20", V_1x1a, PA7000 }, { "H30", V_1x1a, PA7000 }, { "H40", V_1x1a, PA7000 }, { "H50", V_1x1b, PA7100 }, { "H60", V_1x1b, PA7100 }, { "H70", V_1x1b, PA7100 }, { "I30", V_1x1a, PA7000 }, { "I40", V_1x1a, PA7000 }, { "I50", V_1x1b, PA7100 }, { "I60", V_1x1b, PA7100 }, {
96 "I70", V_1x1b, PA7100 }, { "J200", V_1x1d, PA7200 }, { "J210XC", V_1x1d, PA7200 }, { "J210", V_1x1d, PA7200 }, { "J220", V_2x0, PA8000 }, { "J2240", V_2x0, PA8200 }, { "J280", V_2x0, PA8000 }, { "J282", V_2x0, PA8000 }, { "J400", V_2x0, PA8000 }, { "J410", V_2x0, PA8000 }, { "K100",
97 V_1x1d, PA7200 }, { "K200", V_1x1d, PA7200 }, { "K210", V_1x1d, PA7200 }, { "K230", V_1x1d, PA7200 }, { "K250", V_2x0, PA8000 }, { "K260", V_2x0, PA8000 }, { "K370", V_2x0, PA8200 }, { "K380", V_2x0, PA8200 }, { "K400", V_1x1d, PA7200 }, { "K410", V_1x1d, PA7200 }, { "K420", V_1x1d,
98 PA7200 }, { "K430", V_1x1d, PA7200 }, { "K450", V_2x0, PA8000 }, { "K460", V_2x0, PA8000 }, { "K470", V_2x0, PA8200 }, { "K570", V_2x0, PA8200 }, { "K580", V_2x0, PA8200 }, { "S700i", V_1x1e, PA7300 }, { "S715", V_1x1e, PA7300 }, { "S744", V_1x1e, PA7300 },
99 { "S760", V_1x1e, PA7300 }, { "T500", V_1x1c, PA7100LC }, // or: 1.1b, PA7100
100 { "T520", V_1x1b, PA7100 }, { "T540", V_2x0, PA8000 }, { "T600", V_2x0, PA8000 }, { "V2000", V_2x0, PA8000 }, { "V2200", V_2x0, PA8200 }, { "V2250", V_2x0, PA8200 }, { "V2500", V_2x0, PA8500 },
102 { "", 0, 0 } /* Last Entry has to be empty. */
105 /* Helper-Functions */
107 // Value() is defined in info.cpp !!!
109 static bool Find_in_LOOKUPTABLE(QListView *lBox, char *machine) {
110 char *Machine;
111 int len;
112 const struct _type_LOOKUPTABLE *Entry = PA_LOOKUPTABLE;
113 QString str;
114 QListViewItem* olditem = 0;
116 Machine = machine; // machine is like: "9000/715/D"
117 while ((*Machine) && (*Machine!='/'))
118 ++Machine;
120 if (*Machine)
121 ++Machine;
122 else
123 Machine=machine;
125 len = strlen(Machine);
127 while (Entry->Name[0]) {
128 if (strncmp(Entry->Name, Machine, len)==0) {
129 olditem = new QListViewItem(lBox, olditem, i18n("PA-RISC Processor"),
130 QString(PA_NAME[Entry->parisc_name]));
131 olditem = new QListViewItem(lBox, olditem, i18n("PA-RISC Revision"),
132 QString("PA-RISC ") + QString(PA_REVISION[Entry->parisc_rev]));
133 return true;
134 } else
135 ++Entry; // next Entry !
138 return false;
141 /* all following functions should return true, when the Information
142 was filled into the lBox-Widget.
143 returning false indicates, that information was not available.
146 bool GetInfo_CPU(QListView *lBox) {
147 FILE *pipe;
148 QFile *model;
150 struct pst_dynamic psd;
151 struct pst_static pst;
152 struct pst_processor pro;
153 struct utsname info;
154 QString str, str2;
155 QListViewItem* olditem = 0;
156 int maxwidth, i;
158 if ((pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0) == -1) || (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0)== -1)) {
159 return false;
162 maxwidth = 0;
163 lBox->addColumn(i18n("Information") );
164 lBox->addColumn(i18n("Value") );
166 uname(&info);
168 olditem = new QListViewItem(lBox, olditem, i18n("Machine"), info.machine);
170 model = new QFile(INFO_CPU_MODEL);
171 if (model->exists()) {
172 if ((pipe = popen(INFO_CPU_MODEL, "r"))) {
173 QTextStream *t = new QTextStream(pipe, QIODevice::ReadOnly);
174 str = t->readLine();
175 olditem = new QListViewItem(lBox, olditem, i18n("Model"), str);
176 delete t;
178 delete pipe;
180 delete model;
182 olditem = new QListViewItem(lBox, olditem, i18n("Machine Identification Number"),
183 strlen(info.__idnumber) ? QString(info.__idnumber) : i18n("(none)") );
185 if (psd.psd_proc_cnt<=0)
186 psd.psd_proc_cnt=1; // Minimum one CPU !
188 olditem = new QListViewItem(lBox, olditem, i18n("Number of Active Processors"),
189 Value(psd.psd_proc_cnt));
191 pstat_getprocessor( &pro, sizeof(pro), 1, 0);
192 olditem = new QListViewItem(lBox, olditem, i18n("CPU Clock"),
193 Value(pro.psp_iticksperclktick/10000) + ' ' + i18n("MHz"));
195 switch (sysconf(_SC_CPU_VERSION)) {
196 case CPU_HP_MC68020:
197 str2 = "Motorola 68020";
198 break;
199 case CPU_HP_MC68030:
200 str2 = "Motorola 68030";
201 break;
202 case CPU_HP_MC68040:
203 str2 = "Motorola 68040";
204 break;
205 case CPU_PA_RISC1_0:
206 str2 = "PA-RISC 1.0";
207 break;
208 case CPU_PA_RISC1_1:
209 str2 = "PA-RISC 1.1";
210 break;
211 case CPU_PA_RISC1_2:
212 str2 = "PA-RISC 1.2";
213 break;
214 case CPU_PA_RISC2_0:
215 #if defined(_SC_KERNEL_BITS)
216 switch (sysconf(_SC_KERNEL_BITS)) {
217 case 64: str2 = "PA-RISC 2.0w (64 bit)"; break;
218 case 32: str2 = "PA-RISC 2.0n (32 bit)"; break;
219 default: str2 = "PA-RISC 2.0"; break;
220 }; break;
221 #else /* !defined(_SC_KERNEL_BITS) */
222 str2 = "PA-RISC 2.0";
223 break;
224 #endif
225 default:
226 str2 = i18n("(unknown)");
227 break;
230 olditem = new QListViewItem(lBox, olditem, i18n("CPU Architecture"), str2);
232 Find_in_LOOKUPTABLE(lBox, info.machine);// try to get extended Information.
234 for (i=PS_PA83_FPU; i<=PS_PA89_FPU; ++i) {
235 if ((1<<(i-1)) & pro.psp_coprocessor.psc_present) {
236 str = QString( (i==PS_PA83_FPU) ? "PS_PA83_FPU" : "PS_PA89_FPU") + QString(" (") + QString(((1<<(i-1))&pro.psp_coprocessor.psc_enabled) ? i18n("enabled") : i18n("disabled") ) + QString(")");
238 olditem = new QListViewItem(lBox, olditem, i18n("Numerical Coprocessor (FPU)"), str);
240 }// for(coprocessor..)
242 str = Value(((pst.physical_memory*pst.page_size)/1024/1024)) + QString(" ") + i18n("MB"); // Mega-Byte
243 olditem = new QListViewItem(lBox, olditem, i18n("Total Physical Memory"), str);
245 str = Value(pst.page_size) + QString(" ") + i18n("Bytes");
246 olditem = new QListViewItem(lBox, olditem, i18n("Size of One Page"), str);
248 return true;
251 bool GetInfo_ReadfromFile(QListView *lBox, const char *Name) {
252 char buf[2048];
254 QFile *file = new QFile(Name);
255 QListViewItem* olditem = 0;
257 if (!file->open(QIODevice::ReadOnly)) {
258 delete file;
259 return false;
262 while (file->readLine(buf, sizeof(buf)-1) >= 0) {
263 if (strlen(buf))
264 olditem = new QListViewItem(lBox, olditem, QString::fromLocal8Bit(buf));
267 file->close();
268 delete file;
269 return (lBox->childCount());
272 bool GetInfo_IRQ(QListView *) {
273 return false;
276 bool GetInfo_DMA(QListView *) {
277 return false;
280 bool GetInfo_PCI(QTreeWidget* tree) {
281 return (GetInfo_ReadfromFile(tree, INFO_PCI) + GetInfo_ReadfromFile(tree, INFO_PCI_EISA) );
284 bool GetInfo_IO_Ports(QListView *lBox) {
285 if (GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_1, false))
286 return true;
287 else
288 return GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_2, false);
291 bool GetInfo_Devices(QListView *lBox) {
292 return GetInfo_ReadfromPipe(lBox, INFO_DEVICES, false);
295 bool GetInfo_SCSI(QListView *lBox) {
296 return GetInfo_Devices(lBox);
298 /* Parts taken from fsusage.c from the Midnight Commander (mc)
300 Copyright (C) 1991, 1992 Free Software Foundation, In
302 Return the number of TOSIZE-byte blocks used by
303 BLOCKS FROMSIZE-byte blocks, rounding away from zero.
304 TOSIZE must be positive. Return -1 if FROMSIZE is not positive. */
306 static long fs_adjust_blocks(long blocks, int fromsize, int tosize) {
307 if (tosize <= 0)
308 abort();
309 if (fromsize <= 0)
310 return -1;
312 if (fromsize == tosize) /* E.g., from 512 to 512. */
313 return blocks;
314 else if (fromsize > tosize) /* E.g., from 2048 to 512. */
315 return blocks * (fromsize / tosize);
316 else
317 /* E.g., from 256 to 512. */
318 return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
321 /* Fill in the fields of FSP with information about space usage for
322 the filesystem on which PATH resides.
323 Return 0 if successful, -1 if not. */
325 #define CONVERT_BLOCKS(b) fs_adjust_blocks ((b), fsd.f_bsize, 512)
327 static int get_fs_usage(char *path, long *l_total, long *l_avail) {
328 struct statfs fsd; /* 4.3BSD, SunOS 4, HP-UX, AIX. */
329 unsigned long fsu_blocks, fsu_bfree, fsu_bavail;
331 *l_total = *l_avail = 0;
332 if (statfs(path, &fsd) < 0)
333 return -1;
335 fsu_blocks = CONVERT_BLOCKS (fsd.f_blocks);
336 fsu_bfree = CONVERT_BLOCKS (fsd.f_bfree);
337 fsu_bavail = CONVERT_BLOCKS (fsd.f_bavail);
339 *l_avail = getuid() ? fsu_bavail/2 : fsu_bfree/2;
340 *l_total = fsu_blocks/2;
342 return 0;
345 // Some Ideas taken from garbazo from his source in info_fbsd.cpp
347 bool GetInfo_Partitions(QListView *lbox) {
348 #define NUMCOLS 5
349 QString Title[NUMCOLS];
350 int n;
352 struct fstab *fstab_ent;
353 struct statvfs svfs;
354 long total, avail;
355 QString str;
356 QString MB(i18n("MB")+ " "); // International Text for MB=Mega-Byte
358 if (setfsent() != 1) // Try to open fstab
359 return false;
361 Title[0] = i18n("Device");
362 Title[1] = i18n("Mount Point");
363 Title[2] = i18n("FS Type");
364 Title[3] = i18n("Total Size");
365 Title[4] = i18n("Free Size");
367 for (n=0; n<NUMCOLS; ++n) {
368 lbox->addColumn(Title[n]);
371 while ((fstab_ent=getfsent())!=NULL) {
372 /* fstab_ent->fs_type holds only "rw","xx","ro"... */
373 memset(&svfs, 0, sizeof(svfs));
374 statvfs(fstab_ent->fs_file, &svfs);
375 get_fs_usage(fstab_ent->fs_file, &total, &avail);
377 if (!strcmp(fstab_ent->fs_type, FSTAB_XX)) // valid drive ?
378 svfs.f_basetype[0] = 0;
380 if (svfs.f_basetype[0]) {
381 new QListViewItem(lbox, QString(fstab_ent->fs_spec),
382 QString(fstab_ent->fs_file) + QString(" "),
383 (svfs.f_basetype[0] ? QString(svfs.f_basetype) : i18n("n/a")),
384 Value((total+512)/1024,6) + MB,
385 Value((avail+512)/1024,6) + MB);
386 } else {
387 new QListViewItem(lbox, QString(fstab_ent->fs_spec),
388 QString(fstab_ent->fs_file) + QString(" "),
389 (svfs.f_basetype[0] ? QString(svfs.f_basetype) : i18n("n/a")));
393 endfsent();
395 return true;
398 bool GetInfo_XServer_and_Video(QListView *lBox) {
399 lBox = lBox;
400 return GetInfo_XServer_Generic(lBox);
403 #ifndef HAVE_ALIB_H
405 bool GetInfo_Sound(QListView * /*lBox*/) {
406 return false;
409 #else // defined(HAVE_ALIB_H)
410 #include "Alib.h"
412 static const char formatNames[6][15] = {
413 "ADFUnknown", "ADFMuLaw", "ADFALaw",
414 "ADFLin16", "ADFLin8", "ADFLin8Offset"};
416 /* handle typo in 1st release of Alib.h */
417 #ifndef ARightOutputChMask
418 #define ARightOutputChMask ARighOutputChMask
419 #endif
421 bool GetInfo_Sound( QListView *lBox )
423 Audio *audio;
424 long status;
425 char server[80];
426 int i;
428 QString str,str2;
429 QListViewItem* olditem = 0;
431 // server = Hostname....
432 server[0] = 0;
433 audio = AOpenAudio( server, &status );
434 if( status ) {
435 return false;
438 lBox->addColumn(i18n("Information") );
439 lBox->addColumn(i18n("Value") );
441 olditem = new QListViewItem(lBox, olditem, i18n("Audio Name"), QString(audio->audio_name));
442 olditem = new QListViewItem(lBox, olditem, i18n("Vendor"), QString(audio->vendor));
443 olditem = new QListViewItem(lBox, olditem, i18n("Alib Version"),
444 Value(audio->alib_major_version) + QString(".") +
445 Value(audio->alib_minor_version));
447 olditem = new QListViewItem(lBox, olditem, i18n("Protocol Revision"),
448 Value(audio->proto_major_version) + QString(".") +
449 Value(audio->proto_minor_version));
451 olditem = new QListViewItem(lBox, olditem, i18n("Vendor Number"),
452 Value(audio->vnumber));
454 olditem = new QListViewItem(lBox, olditem, i18n("Release"),
455 Value(audio->release));
457 olditem = new QListViewItem(lBox, olditem, i18n("Byte Order"),
458 QString((audio->byte_order==ALSBFirst)? i18n("ALSBFirst (LSB)"):
459 ((audio->byte_order==AMSBFirst)? i18n("AMSBFirst (MSB)"):
460 i18n("Invalid Byteorder.")) ));
462 olditem = new QListViewItem(lBox, olditem, i18n("Bit Order"),
463 QString((audio->sound_bit_order==ALeastSignificant)?
464 i18n("ALeastSignificant (LSB)") :
465 ((audio->sound_bit_order==AMostSignificant) ?
466 i18n("AMostSignificant (MSB)"):i18n("Invalid Bitorder.")) ));
468 olditem = new QListViewItem(lBox, olditem, i18n("Data Formats"));
469 for ( i = 0; i < audio->n_data_format; i++ ) {
470 if (audio->data_format_list[i] <= ADFLin8Offset)
471 new QListViewItem(olditem, QString(formatNames[audio->data_format_list[i]]));
473 olditem->setExpanded(true);
475 olditem = new QListViewItem(lBox, olditem, i18n("Sampling Rates"));
476 for ( i = 0; i < audio->n_sampling_rate; i++ ) {
477 new QListViewItem(olditem, Value(audio->sampling_rate_list[i]));
479 olditem->setExpanded(true);
481 olditem = new QListViewItem(lBox, olditem, i18n("Input Sources"));
482 if ( audio->input_sources & AMonoMicrophoneMask )
483 new QListViewItem(olditem, i18n("Mono-Microphone"));
484 if ( audio->input_sources & AMonoAuxiliaryMask )
485 new QListViewItem(olditem, i18n("Mono-Auxiliary"));
486 if ( audio->input_sources & ALeftMicrophoneMask )
487 new QListViewItem(olditem, i18n("Left-Microphone"));
488 if ( audio->input_sources & ARightMicrophoneMask )
489 new QListViewItem(olditem, i18n("Right-Microphone"));
490 if ( audio->input_sources & ALeftAuxiliaryMask )
491 new QListViewItem(olditem, i18n("Left-Auxiliary"));
492 if ( audio->input_sources & ARightAuxiliaryMask )
493 new QListViewItem(olditem, i18n("Right-Auxiliary"));
494 olditem->setExpanded(true);
496 olditem = new QListViewItem(lBox, olditem,i18n("Input Channels"));
497 if ( audio->input_channels & AMonoInputChMask )
498 new QListViewItem(olditem, i18n("Mono-Channel"));
499 if ( audio->input_channels & ALeftInputChMask )
500 new QListViewItem(olditem, i18n("Left-Channel"));
501 if ( audio->input_channels & ARightInputChMask )
502 new QListViewItem(olditem, i18n("Right-Channel"));
503 olditem->setExpanded(true);
505 olditem = new QListViewItem(lBox, olditem, i18n("Output Destinations"));
506 if ( audio->output_destinations & AMonoIntSpeakerMask )
507 new QListViewItem(olditem, i18n("Mono-InternalSpeaker"));
508 if ( audio->output_destinations & AMonoJackMask )
509 new QListViewItem(olditem, i18n("Mono-Jack"));
510 if ( audio->output_destinations & ALeftIntSpeakerMask )
511 new QListViewItem(olditem, i18n("Left-InternalSpeaker"));
512 if ( audio->output_destinations & ARightIntSpeakerMask )
513 new QListViewItem(olditem, i18n("Right-InternalSpeaker"));
514 if ( audio->output_destinations & ALeftJackMask )
515 new QListViewItem(olditem, i18n("Left-Jack"));
516 if ( audio->output_destinations & ARightJackMask )
517 new QListViewItem(olditem, i18n("Right-Jack"));
518 olditem->setExpanded(true);
520 olditem = new QListViewItem(lBox, olditem, i18n("Output Channels"));
521 if ( audio->output_channels & AMonoOutputChMask )
522 new QListViewItem(olditem, i18n("Mono-Channel"));
523 if ( audio->output_channels & ALeftOutputChMask )
524 new QListViewItem(olditem, i18n("Left-Channel"));
525 if ( audio->output_channels & ARightOutputChMask )
526 new QListViewItem(olditem, i18n("Right-Channel"));
527 olditem->setExpanded(true);
529 olditem = new QListViewItem(lBox, olditem, i18n("Gain"));
530 new QListViewItem(olditem, i18n("Input Gain Limits"),
531 Value(audio->max_input_gain));
532 new QListViewItem(olditem,i18n("Output Gain Limits"),
533 Value(audio->min_output_gain) + QString(" ")
534 + Value(audio->max_output_gain));
535 new QListViewItem(olditem, i18n("Monitor Gain Limits"),
536 Value(audio->min_monitor_gain) + QString(" ")
537 + Value(audio->max_monitor_gain));
538 new QListViewItem(olditem, i18n("Gain Restricted"),
539 Value(audio->gm_gain_restricted));
540 olditem->setExpanded(true);
542 olditem = new QListViewItem(lBox, olditem,i18n("Lock"),
543 Value(audio->lock));
544 olditem = new QListViewItem(lBox, olditem, i18n("Queue Length"),
545 Value(audio->qlen));
546 olditem = new QListViewItem(lBox, olditem, i18n("Block Size"),
547 Value(audio->block_size));
548 olditem = new QListViewItem(lBox, olditem, i18n("Stream Port (decimal)"),
549 Value(audio->stream_port));
550 olditem = new QListViewItem(lBox, olditem, i18n("Ev Buffer Size"),
551 Value(audio->ev_buf_size));
552 olditem = new QListViewItem(lBox, olditem, i18n("Ext Number"),
553 Value(audio->ext_number));
555 ACloseAudio( audio, &status );
557 return true;
560 #endif // defined(HAVE_ALIB_H)