LCOV - code coverage report
Current view: top level - include/vcl - IconThemeSelector.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #ifndef INCLUDED_VCL_ICONTHEMESELECTOR_HXX
      11             : #define INCLUDED_VCL_ICONTHEMESELECTOR_HXX
      12             : 
      13             : #include <rtl/ustring.hxx>
      14             : 
      15             : #include <vcl/dllapi.h>
      16             : 
      17             : #include <vector>
      18             : 
      19             : // forward declaration of unit test class. Required for friend relationship.
      20             : class IconThemeSelectorTest;
      21             : 
      22             : namespace vcl {
      23             : class IconThemeInfo;
      24             : 
      25             : /** This class helps to choose an icon theme from a list of installed themes.
      26             :  *
      27             :  * The following factors influence the selection:
      28             :  * -# When high contrast mode is enabled, the high contrast icon theme is selected (if it is installed).
      29             :  * -# When a preferred theme has been set (e.g., in the gnome desktop settings), that theme is selected.
      30             :  */
      31       97202 : class VCL_DLLPUBLIC IconThemeSelector {
      32             : public:
      33             :     IconThemeSelector();
      34             : 
      35             :     /** Select an icon theme from the list of installed themes.
      36             :      *
      37             :      * If high contrast mode has been enabled, the highcontrast theme will be selected (if it is available).
      38             :      *
      39             :      * @pre
      40             :      * @p installedThemes must not be empty
      41             :      */
      42             :     OUString
      43             :     SelectIconTheme(
      44             :             const std::vector<IconThemeInfo>& installedThemes,
      45             :             const OUString& theme
      46             :             ) const;
      47             : 
      48             :     /** Select the standard icon theme for a desktop environment from a list of installed themes.
      49             :      *
      50             :      * If a preferred theme has been set, this one will take precedence.
      51             :      *
      52             :      * The same logic as in SelectIconTheme() will apply.
      53             :      *
      54             :      * @pre
      55             :      * @p installedThemes must not be empty
      56             :      */
      57             :     OUString
      58             :     SelectIconThemeForDesktopEnvironment(
      59             :             const std::vector<IconThemeInfo>& installedThemes,
      60             :             const OUString& desktopEnvironment) const;
      61             : 
      62             :     void
      63             :     SetUseHighContrastTheme(bool);
      64             : 
      65             :     void
      66             :     SetPreferredIconTheme(const OUString&);
      67             : 
      68             :     bool
      69             :     operator==(const vcl::IconThemeSelector&) const;
      70             : 
      71             :     bool
      72             :     operator!=(const vcl::IconThemeSelector&) const;
      73             : 
      74             : private:
      75             :     /** Return the first element of the themes, or the fallback if the vector is empty */
      76             :     static OUString
      77             :     ReturnFallback(const std::vector<IconThemeInfo>& installedThemes);
      78             : 
      79             :     /** The name of the icon theme which is used as fallback */
      80             :     static const OUString
      81             :     FALLBACK_ICON_THEME_ID;
      82             : 
      83             : 
      84             :     static OUString
      85             :     GetIconThemeForDesktopEnvironment(const OUString& desktopEnvironment);
      86             : 
      87             :     OUString mPreferredIconTheme;
      88             :     bool mUseHighContrastTheme;
      89             : 
      90             :     friend class ::IconThemeSelectorTest;
      91             : };
      92             : 
      93             : } /* namespace vcl */
      94             : 
      95             : #endif // INCLUDED_VCL_ICONTHEMESELECTOR_HXX
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11