diff options
Diffstat (limited to 'cui/source/dialogs/about.cxx')
-rw-r--r-- | cui/source/dialogs/about.cxx | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index dd5df31db6ae..ce82e418cf9e 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -17,13 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cassert> + #include <about.hxx> #include <osl/process.h> //osl_getProcessLocale +#include <rtl/bootstrap.hxx> #include <sal/log.hxx> //SAL_WARN +#include <vcl/graph.hxx> //Graphic #include <vcl/settings.hxx> //GetSettings #include <vcl/svapp.hxx> //Application:: -#include <vcl/virdev.hxx> //VirtualDevice #include <vcl/weld.hxx> #include <unotools/resmgr.hxx> //Translate @@ -100,20 +105,20 @@ AboutDialog::AboutDialog(weld::Window *pParent) ? "shell/logo_inverted" : "shell/logo", aBackgroundBitmap, nWidth * 0.8)) { - ScopedVclPtr<VirtualDevice> m_pVirDev = - m_pBrandImage->create_virtual_device(); - m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel()); - m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap); - m_pBrandImage->set_image(m_pVirDev.get()); - m_pVirDev.disposeAndClear(); + // Eliminate white background when Skia is disabled by not drawing the + // background bitmap to a VirtualDevice. On most platforms, non-Skia + // VirtualDevices will be filled with a solid color when drawing + // the bitmap. + Graphic aGraphic(aBackgroundBitmap); + m_pBrandImage->set_image(aGraphic.GetXGraphic()); } if (SfxApplication::loadBrandSvg("shell/about", aBackgroundBitmap, nWidth * 0.9)) { - ScopedVclPtr<VirtualDevice> m_pVirDev = - m_pAboutImage->create_virtual_device(); - m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel()); - m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap); - m_pAboutImage->set_image(m_pVirDev.get()); - m_pVirDev.disposeAndClear(); + // Eliminate white background when Skia is disabled by not drawing the + // background bitmap to a VirtualDevice. On most platforms, non-Skia + // VirtualDevices will be filled with a solid color when drawing + // the bitmap. + Graphic aGraphic(aBackgroundBitmap); + m_pAboutImage->set_image(aGraphic.GetXGraphic()); } // Links @@ -136,23 +141,16 @@ AboutDialog::AboutDialog(weld::Window *pParent) AboutDialog::~AboutDialog() {} -bool AboutDialog::IsStringValidGitHash(const OUString &hash) { - for (int i = 0; i < hash.getLength(); i++) { - if (!std::isxdigit(hash[i])) { - return false; - } - } - return true; +bool AboutDialog::IsStringValidGitHash(std::u16string_view hash) { + return std::all_of(hash.begin(), hash.end(), + [](auto &rSymbol) { return std::isxdigit(rSymbol); }); } OUString AboutDialog::GetVersionString() { - OUString sVersion = CuiResId(TranslateId(nullptr, "%ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX")); - -#ifdef _WIN64 - sVersion += " (x64)"; -#elif defined(_WIN32) - sVersion += " (x86)"; -#endif + OUString arch; + auto const ok = rtl::Bootstrap::get("_ARCH", arch); + assert(ok); (void) ok; + OUString sVersion = CuiResId(TranslateId(nullptr, "%ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX")) + " (" + arch + ")"; #if HAVE_FEATURE_COMMUNITY_FLAVOR sVersion += " / LibreOffice Community"; @@ -216,14 +214,11 @@ OUString AboutDialog::GetMiscString() { sMisc = EXTRA_BUILDID "\n"; } - OUString aCalcMode = "Calc: "; // Calc calculation mode + OUString aCalcMode; // Calc calculation mode #if HAVE_FEATURE_OPENCL - bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled(); - if (bOpenCL) - aCalcMode += "CL"; -#else - const bool bOpenCL = false; + if (openclwrapper::GPUEnv::isOpenCLEnabled()) + aCalcMode += " CL"; #endif static const bool bThreadingProhibited = @@ -231,19 +226,18 @@ OUString AboutDialog::GetMiscString() { bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation:: UseThreadedCalculationForFormulaGroups::get(); - if (!bThreadingProhibited && !bOpenCL && bThreadedCalc) { - if (!aCalcMode.endsWith(" ")) - aCalcMode += " "; - aCalcMode += "threaded"; + if (!bThreadingProhibited && bThreadedCalc) { + aCalcMode += " threaded"; } if (officecfg::Office::Calc::Defaults::Sheet::JumboSheets::get()) { - if (!aCalcMode.endsWith(" ")) - aCalcMode += " "; - aCalcMode += "Jumbo"; + aCalcMode += " Jumbo"; } - sMisc += aCalcMode; + + if (aCalcMode.isEmpty()) + aCalcMode = " default"; + sMisc += "Calc:" + aCalcMode; return sMisc; } |