4 * Copyright (C) 2002 Felix Domke <tmbinc@tuxbox.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * $Id: enigma_info.cpp,v 1.33 2006/07/15 13:22:48 ghostrider Exp $
23 #include <enigma_info.h>
26 #include <streaminfo.h>
28 #include <lib/base/i18n.h>
29 #include <lib/dvb/service.h>
30 #include <lib/dvb/frontend.h>
31 #include <lib/gui/ewindow.h>
32 #include <lib/gui/eskin.h>
33 #include <lib/gui/elabel.h>
34 #include <lib/gui/ebutton.h>
35 #include <lib/system/info.h>
36 #include <lib/system/dmfp.h>
39 :eListBoxWindow
<eListBoxEntryMenu
>(_("Infos"), 7, 320)
41 move(ePoint(150, 166));
42 CONNECT((new eListBoxEntryMenu(&list
, _("Streaminfo"), _("open the Streaminfo")))->selected
, eZapInfo::sel_streaminfo
);
43 CONNECT((new eListBoxEntryMenu(&list
, _("About..."), _("open the about dialog")))->selected
, eZapInfo::sel_about
);
50 void eZapInfo::sel_streaminfo()
53 eStreaminfo
si(0, eServiceInterface::getInstance()->service
);
55 si
.setLCD(LCDTitle
, LCDElement
);
63 static eString
getVersionInfo(const char *info
)
65 FILE *f
=fopen("/.version", "rt");
67 f
= fopen("/etc/image-version", "rt");
74 if (!fgets(buffer
, 128, f
))
77 buffer
[strlen(buffer
)-1]=0;
78 if ((!strncmp(buffer
, info
, strlen(info
)) && (buffer
[strlen(info
)]=='=')))
80 int i
= strlen(info
)+1;
81 result
= eString(buffer
).mid(i
, strlen(buffer
)-i
);
89 class eAboutScreen
: public eWindow
91 eLabel
*machine
, *processor
, *frontend
, *harddisks
, *vendor
, *logo
, *version
, *dreamlogo
, *triaxlogo
, *fpversion
;
99 machine
=new eLabel(this);
100 machine
->setName("machine");
102 vendor
=new eLabel(this);
103 vendor
->setName("vendor");
105 processor
=new eLabel(this);
106 processor
->setName("processor");
108 frontend
=new eLabel(this);
109 frontend
->setName("frontend");
111 harddisks
=new eLabel(this);
112 harddisks
->setName("harddisks");
114 okButton
=new eButton(this);
115 okButton
->setName("okButton");
117 dreamlogo
=new eLabel(this);
118 dreamlogo
->setName("dreamlogo");
120 triaxlogo
=new eLabel(this);
121 triaxlogo
->setName("triaxlogo");
123 version
=new eLabel(this);
124 version
->setName("version");
126 fpversion
=new eLabel(this);
127 fpversion
->setName("fp_version");
129 if (eSkin::getActive()->build(this, "eAboutScreen"))
130 eFatal("skin load of \"eAboutScreen\" failed");
135 if ( !eSystemInfo::getInstance()->hasHDD() )
138 eWidget
*h
=search("harddisk_label");
143 machine
->setText(eSystemInfo::getInstance()->getModel());
144 vendor
->setText(eSystemInfo::getInstance()->getManufacturer());
145 processor
->setText(eString().sprintf("Processor: %s", eSystemInfo::getInstance()->getCPUInfo()));
147 switch (eSystemInfo::getInstance()->getFEType())
149 case eSystemInfo::feSatellite
:
150 frontend
->setText(_("Frontend: Satellite"));
152 case eSystemInfo::feCable
:
153 frontend
->setText(_("Frontend: Cable"));
155 case eSystemInfo::feTerrestrial
:
156 frontend
->setText(_("Frontend: Terrestrial"));
159 frontend
->setText(_("Frontend: Unknown"));
164 if ( eSystemInfo::getInstance()->hasHDD() )
166 for (int c
='a'; c
<'h'; c
++)
170 FILE *f
=fopen(eString().sprintf("/proc/ide/hd%c/media", c
).c_str(), "r");
173 if ((!fgets(line
, 1024, f
)) || strcmp(line
, "disk\n"))
178 FILE *f
=fopen(eString().sprintf("/proc/ide/hd%c/model", c
).c_str(), "r");
182 fgets(line
, 1024, f
);
186 line
[strlen(line
)-1]=0;
188 f
=fopen(eString().sprintf("/proc/ide/hd%c/capacity", c
).c_str(), "r");
192 fscanf(f
, "%d", &capacity
);
196 sharddisks
+="master";
200 sharddisks
+=eString().sprintf(", %d MB", capacity
/2048);
205 #endif //DISABLE_FILE
206 if (sharddisks
== "")
207 sharddisks
=_("none");
208 harddisks
->setText(sharddisks
);
211 eString verid
=getVersionInfo("version");
213 version
->setText(_("unknown"));
216 int type
=atoi(verid
.left(1).c_str());
218 typea
[0]=_("release");
220 typea
[2]=_("internal");
221 eString ver
=verid
.mid(1, 3);
222 eString date
=verid
.mid(4, 8);
223 // eString time=verid.mid(12, 4);
224 if ( eSystemInfo::getInstance()->getHwType() >= eSystemInfo::DM7000
)
226 eString(typea
[type
%3]) + eString(" ") + ver
[0] + "." + ver
[1] + "." + ver
[2]
227 + ", " + date
.mid(6, 2) + "." + date
.mid(4,2) + "." + date
.left(4));
231 ("%s %c.%d. %s", typea
[type
%3], ver
[0],
232 atoi( eString().sprintf("%c%c",ver
[1],ver
[2]).c_str() ),
233 (date
.mid(6, 2) + "." + date
.mid(4,2) + "." + date
.left(4)).c_str()
239 if ( !strcmp(eSystemInfo::getInstance()->getManufacturer(),"Triax") )
241 else if ( !strcmp(eSystemInfo::getInstance()->getManufacturer(),"Dream-Multimedia-TV") )
244 if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7000
245 || eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7020
)
247 eString fp_version
= fpversion
->getText();
248 fp_version
+= eString().sprintf(" 1.%02d", eDreamboxFP::getFPVersion());
249 eDebug("%s", fp_version
.c_str());
250 fpversion
->setText(fp_version
);
255 CONNECT(okButton
->selected
, eWidget::accept
);
259 void eZapInfo::sel_about()