Patch by Matt Madia with small modifications by myself: Read and display the
"SourceURL" fields in optional package descriptions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34725 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3212667705
commit
1e9ba7f26c
@ -127,6 +127,7 @@ public:
|
||||
void AddCopyrightEntry(const char* name,
|
||||
const char* text,
|
||||
const StringVector& licenses,
|
||||
const StringVector& sources,
|
||||
const char* url);
|
||||
void AddCopyrightEntry(const char* name,
|
||||
const char* text, const char* url = NULL);
|
||||
@ -536,13 +537,13 @@ void
|
||||
AboutView::AddCopyrightEntry(const char* name, const char* text,
|
||||
const char* url)
|
||||
{
|
||||
AddCopyrightEntry(name, text, StringVector(), url);
|
||||
AddCopyrightEntry(name, text, StringVector(), StringVector(), url);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AboutView::AddCopyrightEntry(const char* name, const char* text,
|
||||
const StringVector& licenses, const char* url)
|
||||
const StringVector& licenses, const StringVector& sources, const char* url)
|
||||
{
|
||||
BFont font(be_bold_font);
|
||||
//font.SetSize(be_bold_font->Size());
|
||||
@ -582,6 +583,27 @@ AboutView::AddCopyrightEntry(const char* name, const char* text,
|
||||
fCreditsView->Insert("\n");
|
||||
}
|
||||
|
||||
if (sources.CountStrings() > 0) {
|
||||
fCreditsView->Insert("Source Code: ");
|
||||
|
||||
for (int32 i = 0; i < sources.CountStrings(); i++) {
|
||||
const char* source = sources.StringAt(i);
|
||||
|
||||
if (i > 0)
|
||||
fCreditsView->Insert(", ");
|
||||
|
||||
BString urlName;
|
||||
BString urlAddress;
|
||||
parse_named_url(source, urlName, urlAddress);
|
||||
|
||||
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL,
|
||||
&kLinkBlue);
|
||||
fCreditsView->InsertHyperText(urlName, new URLAction(urlAddress));
|
||||
}
|
||||
|
||||
fCreditsView->Insert("\n");
|
||||
}
|
||||
|
||||
if (url) {
|
||||
BString urlName;
|
||||
BString urlAddress;
|
||||
@ -996,6 +1018,7 @@ AboutView::_CreateCreditsView()
|
||||
"Bourne Again Shell.\n"
|
||||
COPYRIGHT_STRING "The Free Software Foundation.",
|
||||
StringVector("GNU LGPL v2.1", "GNU GPL v2", "GNU GPL v3", NULL),
|
||||
StringVector(),
|
||||
"http://www.gnu.org");
|
||||
|
||||
// FreeBSD copyrights
|
||||
@ -1394,7 +1417,7 @@ AboutView::_AddPackageCreditEntries()
|
||||
text << "\n" << package->CopyrightAt(i);
|
||||
|
||||
AddCopyrightEntry(package->PackageName(), text.String(),
|
||||
package->Licenses(), package->URL());
|
||||
package->Licenses(), package->Sources(), package->URL());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,6 +233,7 @@ PackageCredit::PackageCredit(const BMessage& packageDescription)
|
||||
fPackageName = package;
|
||||
fCopyrights.SetTo(packageDescription, "Copyright", COPYRIGHT_STRING);
|
||||
fLicenses.SetTo(packageDescription, "License");
|
||||
fSources.SetTo(packageDescription, "SourceURL");
|
||||
fURL = url;
|
||||
}
|
||||
|
||||
@ -242,6 +243,7 @@ PackageCredit::PackageCredit(const PackageCredit& other)
|
||||
fPackageName(other.fPackageName),
|
||||
fCopyrights(other.fCopyrights),
|
||||
fLicenses(other.fLicenses),
|
||||
fSources(other.fSources),
|
||||
fURL(other.fURL)
|
||||
{
|
||||
}
|
||||
@ -310,6 +312,25 @@ PackageCredit::SetLicense(const char* license)
|
||||
}
|
||||
|
||||
|
||||
PackageCredit&
|
||||
PackageCredit::SetSources(const char* source,...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, source);
|
||||
fSources.SetTo(source, list);
|
||||
va_end(list);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
PackageCredit&
|
||||
PackageCredit::SetSource(const char* source)
|
||||
{
|
||||
return SetSources(source, NULL);
|
||||
}
|
||||
|
||||
|
||||
PackageCredit&
|
||||
PackageCredit::SetURL(const char* url)
|
||||
{
|
||||
@ -368,6 +389,27 @@ PackageCredit::LicenseAt(int32 index) const
|
||||
}
|
||||
|
||||
|
||||
const StringVector&
|
||||
PackageCredit::Sources() const
|
||||
{
|
||||
return fSources;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
PackageCredit::CountSources() const
|
||||
{
|
||||
return fSources.CountStrings();
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PackageCredit::SourceAt(int32 index) const
|
||||
{
|
||||
return fSources.StringAt(index);
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PackageCredit::URL() const
|
||||
{
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
PackageCredit& SetCopyright(const char* copyright);
|
||||
PackageCredit& SetLicenses(const char* license,...);
|
||||
PackageCredit& SetLicense(const char* license);
|
||||
PackageCredit& SetSources(const char* source,...);
|
||||
PackageCredit& SetSource(const char* source);
|
||||
PackageCredit& SetURL(const char* url);
|
||||
|
||||
const char* PackageName() const;
|
||||
@ -81,6 +83,10 @@ public:
|
||||
int32 CountLicenses() const;
|
||||
const char* LicenseAt(int32 index) const;
|
||||
|
||||
const StringVector& Sources() const;
|
||||
int32 CountSources() const;
|
||||
const char* SourceAt(int32 index) const;
|
||||
|
||||
const char* URL() const;
|
||||
|
||||
private:
|
||||
@ -90,6 +96,7 @@ private:
|
||||
BString fPackageName;
|
||||
StringVector fCopyrights;
|
||||
StringVector fLicenses;
|
||||
StringVector fSources;
|
||||
BString fURL;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user