blob: be4169a342ff04d3aac78465d453e230e39c4f5d (
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
|
/***************************************************************************
* Copyright (C) 2005-2006 Nicolas Hadacek <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "device_info.h"
#include "devices/base/generic_device.h"
#include "progs/list/prog_list.h"
#include "tool_list.h"
TQString Device::webpageHtml(const Device::Data &data)
{
const Device::Documents &documents = data.documents();
TQString url = "http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=";
if ( documents.webpage.isEmpty() ) url += "2044&AllWords=" + data.name();
else url += "1335&dDocName=en" + documents.webpage;
return "<a href=\"" + url + "\">" + i18n("Device Page") + "</a> ";
}
TQString documentHtml(const TQString &document, const TQString &label)
{
if ( document.isEmpty() ) return TQString();
return ", <a href=\"document://" + document + "\">" + label + "</a>";
}
TQString Device::documentHtml(const Device::Data &data)
{
TQString s = webpageHtml(data);
s += documentHtml(data.documents().datasheet, i18n("Datasheet"));
s += documentHtml(data.documents().progsheet, i18n("Programming Specifications"));
return htmlTableRow(i18n("Documents"), s);
}
TQString Device::supportedHtmlInfo(const Device::Data &data)
{
TQString doc;
doc += "<hr />\n";
doc += "<table>\n";
TQString tools;
Tool::Lister::ConstIterator tit;
for (tit=Tool::lister().begin(); tit!=Tool::lister().end(); ++tit) {
if ( !tit.data()->isSupported(data.name()) ) continue;
if ( tit.data()->isCustom() ) continue;
if ( !tools.isEmpty() ) tools += ", ";
tools += tit.data()->label();
}
doc += htmlTableRow(i18n("Tools"), tools) + "\n";
TQString progs;
Programmer::Lister::ConstIterator pit;
for (pit=Programmer::lister().begin(); pit!=Programmer::lister().end(); ++pit) {
if ( !pit.data()->isSupported(data.name()) ) continue;
if ( !progs.isEmpty() ) progs += ", ";
progs += pit.data()->label();
}
doc += htmlTableRow(i18n("Programmers"), progs) + "\n";
doc += "</table>\n";
return doc;
}
|