|
85 | 85 |
|
86 | 86 | #include <iostream> |
87 | 87 | #include <boost/algorithm/string/case_conv.hpp> // for to_lower() |
| 88 | +#include <boost/algorithm/string/join.hpp> |
88 | 89 | #include "boinc.h" |
89 | 90 | #include "util.h" |
90 | 91 |
|
@@ -1452,70 +1453,51 @@ void BitcoinGUI::updateScraperIcon(int scraperEventtype, int status) |
1452 | 1453 |
|
1453 | 1454 | int64_t nConvergenceTime = ConvergedScraperStatsCache.nTime; |
1454 | 1455 |
|
1455 | | - std::string sExcludedProjects; |
1456 | | - std::string sIncludedScrapers; |
1457 | | - std::string sExcludedScrapers; |
1458 | | - std::string sScrapersNotPublishing; |
| 1456 | + QString qsExcludedProjects; |
| 1457 | + QString qsIncludedScrapers; |
| 1458 | + QString qsExcludedScrapers; |
| 1459 | + QString qsScrapersNotPublishing; |
1459 | 1460 |
|
1460 | 1461 | bool bDisplayScrapers = false; |
1461 | 1462 |
|
| 1463 | + // Note that the translation macro tr is applied in the setToolTip call below. |
1462 | 1464 | // If the convergence cache has excluded projects... |
1463 | 1465 | if (!ConvergedScraperStatsCache.Convergence.vExcludedProjects.empty()) |
1464 | 1466 | { |
1465 | | - for (const auto& iter : ConvergedScraperStatsCache.Convergence.vExcludedProjects) |
1466 | | - { |
1467 | | - if (sExcludedProjects.empty()) |
1468 | | - sExcludedProjects += iter.first; |
1469 | | - else |
1470 | | - sExcludedProjects += ", " + iter.first; |
1471 | | - } |
| 1467 | + qsExcludedProjects = QString(((std::string)boost::algorithm::join(ConvergedScraperStatsCache.Convergence.vExcludedProjects, ", ")).c_str()); |
1472 | 1468 | } |
1473 | 1469 | else |
1474 | 1470 | { |
1475 | | - sExcludedProjects = "none"; |
| 1471 | + qsExcludedProjects = "none"; |
1476 | 1472 | } |
1477 | 1473 |
|
1478 | 1474 | // If fDebug3 then show scrapers in tooltip... |
1479 | 1475 | if (fDebug3) |
1480 | 1476 | { |
1481 | 1477 | bDisplayScrapers = true; |
1482 | 1478 |
|
1483 | | - for (const auto& iter : ConvergedScraperStatsCache.Convergence.vIncludedScrapers) |
1484 | | - { |
1485 | | - if (sIncludedScrapers.empty()) |
1486 | | - sIncludedScrapers += iter; |
1487 | | - else |
1488 | | - sIncludedScrapers += ", " + iter; |
1489 | | - } // Don't need the else for empty here. |
| 1479 | + // No need to include "none" for included scrapers, because if no scrapers there will not be a convergence. |
| 1480 | + //sIncludedScrapers = boost::algorithm::join(ConvergedScraperStatsCache.Convergence.vIncludedScrapers, ", "); |
| 1481 | + // qsIncludedScrapers = sIncludedScrapers.c_str(); |
| 1482 | + //sIncludedScrapers = boost::algorithm::join(ConvergedScraperStatsCache.Convergence.vIncludedScrapers, ", "); |
| 1483 | + qsIncludedScrapers = QString(((std::string)boost::algorithm::join(ConvergedScraperStatsCache.Convergence.vIncludedScrapers, ", ")).c_str()); |
1490 | 1484 |
|
1491 | 1485 | if (!ConvergedScraperStatsCache.Convergence.vExcludedScrapers.empty()) |
1492 | 1486 | { |
1493 | | - for (const auto& iter : ConvergedScraperStatsCache.Convergence.vExcludedScrapers) |
1494 | | - { |
1495 | | - if (sExcludedScrapers.empty()) |
1496 | | - sExcludedScrapers += iter; |
1497 | | - else |
1498 | | - sExcludedScrapers += ", " + iter; |
1499 | | - } |
| 1487 | + qsExcludedScrapers = QString(((std::string)boost::algorithm::join(ConvergedScraperStatsCache.Convergence.vExcludedScrapers, ", ")).c_str()); |
1500 | 1488 | } |
1501 | 1489 | else |
1502 | 1490 | { |
1503 | | - sExcludedScrapers = "none"; |
| 1491 | + qsExcludedScrapers = "none"; |
1504 | 1492 | } |
1505 | 1493 |
|
1506 | 1494 | if (ConvergedScraperStatsCache.Convergence.vScrapersNotPublishing.empty()) |
1507 | 1495 | { |
1508 | | - for (const auto& iter : ConvergedScraperStatsCache.Convergence.vScrapersNotPublishing) |
1509 | | - { |
1510 | | - if (sScrapersNotPublishing.empty()) |
1511 | | - sScrapersNotPublishing += iter; |
1512 | | - else |
1513 | | - sScrapersNotPublishing += ", " + iter; |
1514 | | - } |
| 1496 | + qsScrapersNotPublishing = QString(((std::string)boost::algorithm::join(ConvergedScraperStatsCache.Convergence.vScrapersNotPublishing, ", ")).c_str()); |
1515 | 1497 | } |
1516 | 1498 | else |
1517 | 1499 | { |
1518 | | - sScrapersNotPublishing = "none"; |
| 1500 | + qsScrapersNotPublishing = "none"; |
1519 | 1501 | } |
1520 | 1502 | } |
1521 | 1503 |
|
@@ -1547,17 +1529,17 @@ void BitcoinGUI::updateScraperIcon(int scraperEventtype, int status) |
1547 | 1529 | "Scraper(s) excluded: %4. \n" |
1548 | 1530 | "Scraper(s) not publishing: %5.") |
1549 | 1531 | .arg(QString(DateTimeStrFormat("%x %H:%M:%S", nConvergenceTime).c_str())) |
1550 | | - .arg(QString(sExcludedProjects.c_str())) |
1551 | | - .arg(QString(sIncludedScrapers.c_str())) |
1552 | | - .arg(QString(sExcludedScrapers.c_str())) |
1553 | | - .arg(QString(sScrapersNotPublishing.c_str()))); |
| 1532 | + .arg(qsExcludedProjects) |
| 1533 | + .arg(qsIncludedScrapers) |
| 1534 | + .arg(qsExcludedScrapers) |
| 1535 | + .arg(qsScrapersNotPublishing)); |
1554 | 1536 | } |
1555 | 1537 | else |
1556 | 1538 | { |
1557 | 1539 | labelScraperIcon->setToolTip(tr("Scraper: Convergence achieved, date/time %1 UTC. \n" |
1558 | 1540 | " Project(s) excluded: %2.") |
1559 | 1541 | .arg(QString(DateTimeStrFormat("%x %H:%M:%S", nConvergenceTime).c_str())) |
1560 | | - .arg(QString(sExcludedProjects.c_str()))); |
| 1542 | + .arg(qsExcludedProjects)); |
1561 | 1543 | } |
1562 | 1544 | } |
1563 | 1545 | else if ((scraperEventtype == (int)scrapereventtypes::Convergence || scraperEventtype == (int)scrapereventtypes::SBContract) |
|
0 commit comments