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:
@@ -127,6 +127,7 @@ public:
|
|||||||
void AddCopyrightEntry(const char* name,
|
void AddCopyrightEntry(const char* name,
|
||||||
const char* text,
|
const char* text,
|
||||||
const StringVector& licenses,
|
const StringVector& licenses,
|
||||||
|
const StringVector& sources,
|
||||||
const char* url);
|
const char* url);
|
||||||
void AddCopyrightEntry(const char* name,
|
void AddCopyrightEntry(const char* name,
|
||||||
const char* text, const char* url = NULL);
|
const char* text, const char* url = NULL);
|
||||||
@@ -536,13 +537,13 @@ void
|
|||||||
AboutView::AddCopyrightEntry(const char* name, const char* text,
|
AboutView::AddCopyrightEntry(const char* name, const char* text,
|
||||||
const char* url)
|
const char* url)
|
||||||
{
|
{
|
||||||
AddCopyrightEntry(name, text, StringVector(), url);
|
AddCopyrightEntry(name, text, StringVector(), StringVector(), url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AboutView::AddCopyrightEntry(const char* name, const char* text,
|
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);
|
BFont font(be_bold_font);
|
||||||
//font.SetSize(be_bold_font->Size());
|
//font.SetSize(be_bold_font->Size());
|
||||||
@@ -582,6 +583,27 @@ AboutView::AddCopyrightEntry(const char* name, const char* text,
|
|||||||
fCreditsView->Insert("\n");
|
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) {
|
if (url) {
|
||||||
BString urlName;
|
BString urlName;
|
||||||
BString urlAddress;
|
BString urlAddress;
|
||||||
@@ -996,6 +1018,7 @@ AboutView::_CreateCreditsView()
|
|||||||
"Bourne Again Shell.\n"
|
"Bourne Again Shell.\n"
|
||||||
COPYRIGHT_STRING "The Free Software Foundation.",
|
COPYRIGHT_STRING "The Free Software Foundation.",
|
||||||
StringVector("GNU LGPL v2.1", "GNU GPL v2", "GNU GPL v3", NULL),
|
StringVector("GNU LGPL v2.1", "GNU GPL v2", "GNU GPL v3", NULL),
|
||||||
|
StringVector(),
|
||||||
"http://www.gnu.org");
|
"http://www.gnu.org");
|
||||||
|
|
||||||
// FreeBSD copyrights
|
// FreeBSD copyrights
|
||||||
@@ -1394,7 +1417,7 @@ AboutView::_AddPackageCreditEntries()
|
|||||||
text << "\n" << package->CopyrightAt(i);
|
text << "\n" << package->CopyrightAt(i);
|
||||||
|
|
||||||
AddCopyrightEntry(package->PackageName(), text.String(),
|
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;
|
fPackageName = package;
|
||||||
fCopyrights.SetTo(packageDescription, "Copyright", COPYRIGHT_STRING);
|
fCopyrights.SetTo(packageDescription, "Copyright", COPYRIGHT_STRING);
|
||||||
fLicenses.SetTo(packageDescription, "License");
|
fLicenses.SetTo(packageDescription, "License");
|
||||||
|
fSources.SetTo(packageDescription, "SourceURL");
|
||||||
fURL = url;
|
fURL = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,6 +243,7 @@ PackageCredit::PackageCredit(const PackageCredit& other)
|
|||||||
fPackageName(other.fPackageName),
|
fPackageName(other.fPackageName),
|
||||||
fCopyrights(other.fCopyrights),
|
fCopyrights(other.fCopyrights),
|
||||||
fLicenses(other.fLicenses),
|
fLicenses(other.fLicenses),
|
||||||
|
fSources(other.fSources),
|
||||||
fURL(other.fURL)
|
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&
|
||||||
PackageCredit::SetURL(const char* url)
|
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*
|
const char*
|
||||||
PackageCredit::URL() const
|
PackageCredit::URL() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ public:
|
|||||||
PackageCredit& SetCopyright(const char* copyright);
|
PackageCredit& SetCopyright(const char* copyright);
|
||||||
PackageCredit& SetLicenses(const char* license,...);
|
PackageCredit& SetLicenses(const char* license,...);
|
||||||
PackageCredit& SetLicense(const char* license);
|
PackageCredit& SetLicense(const char* license);
|
||||||
|
PackageCredit& SetSources(const char* source,...);
|
||||||
|
PackageCredit& SetSource(const char* source);
|
||||||
PackageCredit& SetURL(const char* url);
|
PackageCredit& SetURL(const char* url);
|
||||||
|
|
||||||
const char* PackageName() const;
|
const char* PackageName() const;
|
||||||
@@ -81,6 +83,10 @@ public:
|
|||||||
int32 CountLicenses() const;
|
int32 CountLicenses() const;
|
||||||
const char* LicenseAt(int32 index) const;
|
const char* LicenseAt(int32 index) const;
|
||||||
|
|
||||||
|
const StringVector& Sources() const;
|
||||||
|
int32 CountSources() const;
|
||||||
|
const char* SourceAt(int32 index) const;
|
||||||
|
|
||||||
const char* URL() const;
|
const char* URL() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -90,6 +96,7 @@ private:
|
|||||||
BString fPackageName;
|
BString fPackageName;
|
||||||
StringVector fCopyrights;
|
StringVector fCopyrights;
|
||||||
StringVector fLicenses;
|
StringVector fLicenses;
|
||||||
|
StringVector fSources;
|
||||||
BString fURL;
|
BString fURL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user