Ticket #4679: sourceURL-aboutsystem.patch
File sourceURL-aboutsystem.patch, 5.0 KB (added by , 15 years ago) |
---|
-
src/apps/aboutsystem/AboutSystem.cpp
126 126 void AddCopyrightEntry(const char* name, 127 127 const char* text, 128 128 const StringVector& licenses, 129 const StringVector& sources, 129 130 const char* url); 130 131 void AddCopyrightEntry(const char* name, 131 132 const char* text, const char* url = NULL); … … 532 533 533 534 534 535 void 535 AboutView::AddCopyrightEntry(const char *name, const char *text, 536 AboutView::AddCopyrightEntry(const char *name, const char *text, 536 537 const char *url) 537 538 { 538 AddCopyrightEntry(name, text, StringVector(), url);539 AddCopyrightEntry(name, text, StringVector(), StringVector(), url); 539 540 } 540 541 541 542 542 543 void 543 544 AboutView::AddCopyrightEntry(const char *name, const char *text, 544 const StringVector& licenses, const char *url)545 const StringVector& licenses, const StringVector& sources, const char *url) 545 546 { 546 547 BFont font(be_bold_font); 547 548 //font.SetSize(be_bold_font->Size()); … … 577 578 fCreditsView->Insert("\n"); 578 579 } 579 580 581 if (sources.CountStrings() > 0) { 582 if (sources.CountStrings() > 1) 583 fCreditsView->Insert("Source Code: "); 584 else 585 fCreditsView->Insert("Source Code: "); 586 587 for (int32 i = 0; i < sources.CountStrings(); i++) { 588 const char* source = sources.StringAt(i); 589 590 if (i > 0) 591 fCreditsView->Insert(", "); 592 593 // TODO : what to do here? 594 fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue); 595 fCreditsView->InsertHyperText(source, new URLAction(source)); 596 } 597 598 fCreditsView->Insert("\n"); 599 } 600 580 601 if (url) { 581 602 fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue); 582 603 fCreditsView->InsertHyperText(url, new URLAction(url)); … … 911 932 "Bourne Again Shell.\n" 912 933 COPYRIGHT_STRING "The Free Software Foundation.", 913 934 StringVector("GNU LGPL v2.1", "GNU GPL v2", "GNU GPL v3", NULL), 935 StringVector(), 914 936 "http://www.gnu.org"); 915 937 916 938 // FreeBSD copyrights … … 1303 1325 text << "\n" << package->CopyrightAt(i); 1304 1326 1305 1327 AddCopyrightEntry(package->PackageName(), text.String(), 1306 package->Licenses(), package-> URL());1328 package->Licenses(), package->Sources(), package->URL()); 1307 1329 } 1308 1330 } 1309 1331 -
src/apps/aboutsystem/Utilities.h
67 67 PackageCredit& SetCopyright(const char* copyright); 68 68 PackageCredit& SetLicenses(const char* license,...); 69 69 PackageCredit& SetLicense(const char* license); 70 PackageCredit& SetSources(const char* source,...); 71 PackageCredit& SetSource(const char* source); 70 72 PackageCredit& SetURL(const char* url); 71 73 72 74 const char* PackageName() const; … … 79 81 int32 CountLicenses() const; 80 82 const char* LicenseAt(int32 index) const; 81 83 84 const StringVector& Sources() const; 85 int32 CountSources() const; 86 const char* SourceAt(int32 index) const; 87 82 88 const char* URL() const; 83 89 84 90 private: … … 88 94 BString fPackageName; 89 95 StringVector fCopyrights; 90 96 StringVector fLicenses; 97 StringVector fSources; 91 98 BString fURL; 92 99 }; 93 100 -
src/apps/aboutsystem/Utilities.cpp
198 198 { 199 199 const char* package; 200 200 const char* copyright; 201 const char* source; 201 202 const char* url; 202 203 203 204 // package and copyright are mandatory … … 213 214 fPackageName = package; 214 215 fCopyrights.SetTo(packageDescription, "Copyright", COPYRIGHT_STRING); 215 216 fLicenses.SetTo(packageDescription, "License"); 217 fSources.SetTo(packageDescription, "SourceURL"); 216 218 fURL = url; 217 219 } 218 220 … … 222 224 fPackageName(other.fPackageName), 223 225 fCopyrights(other.fCopyrights), 224 226 fLicenses(other.fLicenses), 227 fSources(other.fSources), 225 228 fURL(other.fURL) 226 229 { 227 230 } … … 249 252 250 253 // Scan the copyrights for year numbers and let the greater one win. 251 254 return _MaxCopyrightYear() > other._MaxCopyrightYear(); 255 256 // TODO: Do we prefer credits that provide source code? 252 257 } 253 258 254 259 … … 291 296 292 297 293 298 PackageCredit& 299 PackageCredit::SetSources(const char* source,...) 300 { 301 va_list list; 302 va_start(list, source); 303 fSources.SetTo(source, list); 304 va_end(list); 305 306 return *this; 307 } 308 309 310 PackageCredit& 311 PackageCredit::SetSource(const char* source) 312 { 313 return SetSources(source, NULL); 314 } 315 316 317 PackageCredit& 294 318 PackageCredit::SetURL(const char* url) 295 319 { 296 320 fURL = url; … … 348 372 } 349 373 350 374 375 const StringVector& 376 PackageCredit::Sources() const 377 { 378 return fSources; 379 } 380 381 382 int32 383 PackageCredit::CountSources() const 384 { 385 return fSources.CountStrings(); 386 } 387 388 351 389 const char* 390 PackageCredit::SourceAt(int32 index) const 391 { 392 return fSources.StringAt(index); 393 } 394 395 396 const char* 352 397 PackageCredit::URL() const 353 398 { 354 399 return fURL.Length() > 0 ? fURL.String() : NULL;