source: src-qt4/pc-controlpanel/deinfo.h @ 1620346

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since 1620346 was 1620346, checked in by Kris Moore <kris@…>, 18 months ago

Initial import of PC-BSD /current/ SVN repo

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/**************************************************************************
2*   Copyright (C) 2011 by Yuri Momotyuk                                   *
3*   yurkis@gmail.com                                                      *
4*                                                                         *
5*   Permission is hereby granted, free of charge, to any person obtaining *
6*   a copy of this software and associated documentation files (the       *
7*   "Software"), to deal in the Software without restriction, including   *
8*   without limitation the rights to use, copy, modify, merge, publish,   *
9*   distribute, sublicense, and/or sell copies of the Software, and to    *
10*   permit persons to whom the Software is furnished to do so, subject to *
11*   the following conditions:                                             *
12*                                                                         *
13*   The above copyright notice and this permission notice shall be        *
14*   included in all copies or substantial portions of the Software.       *
15*                                                                         *
16*   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
17*   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
18*   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
19*   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
20*   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
21*   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
22*   OTHER DEALINGS IN THE SOFTWARE.                                       *
23***************************************************************************/
24
25#ifndef DEINFO_F
26#define DEINFO_F
27
28#include <QString>
29#include <QVector>
30
31//! Class that holds info about DE
32struct CDEInfo
33{
34public:
35    QString mName;          ///< De name 'Gnome', 'KDE', etc
36    QString mSudoCommand;   ///< native sudo command 'gtksu %s' for example
37    bool    misInstalled;   ///< True if DE installed
38    bool    misActive;      ///< True if DE is active now
39    bool    misXDG;         ///< True if DE is XDG compatible
40
41    CDEInfo(){
42        misInstalled=false;
43        misActive=false;
44        misXDG=false;
45    }
46};
47
48//! Class that holds list of desktop environments
49class CDEList
50{
51public:
52    /**
53      Refresh list
54
55      @param isAll- true if we want to fill list by all supported DEs outwice
56                     it fills by installed DEs
57    */
58    int refresh(bool isAll=false);
59
60    /**
61      Returns count of DE's descriptions in list
62    */
63    int size()
64        {
65            return mvDE.size();
66        }
67
68    CDEInfo& operator[](int idx)
69        {
70            return mvDE[idx];
71        }
72
73    /**
74      Returns pointer to description of active DE
75
76      @return Pointer to description of active DE or NULL if active DE unknown
77    */
78    CDEInfo* active();
79
80    /**
81      Returns DE description bu DE name
82
83      @param Name - Name to search (case insensative)
84
85      @return Pointer to DE description. NULL if not found
86    */
87    CDEInfo* byName(QString Name);
88
89protected:
90    QVector <CDEInfo> mvDE;
91};
92
93///////////////////////////////////////////////////////
94// Singleton object for DE list
95class CSingleDEList:public CDEList
96{
97public:
98    static CSingleDEList& getRef();
99};
100
101static CSingleDEList& InstalledDEList = CSingleDEList::getRef();
102
103#endif // DEINFO_F
Note: See TracBrowser for help on using the repository browser.