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

releng/10.0.1releng/10.0.2
Last change on this file since 11d9290 was 11d9290, checked in by Ken Moore <ken@…>, 6 months ago

Enable a bit of debugging within the control panel.

  • 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#include <QDebug>
31
32//! Class that holds info about DE
33struct CDEInfo
34{
35public:
36    QString mName;          ///< De name 'Gnome', 'KDE', etc
37    QString mSudoCommand;   ///< native sudo command 'gtksu %s' for example
38    bool    misInstalled;   ///< True if DE installed
39    bool    misActive;      ///< True if DE is active now
40    bool    misXDG;         ///< True if DE is XDG compatible
41
42    CDEInfo(){
43        misInstalled=false;
44        misActive=false;
45        misXDG=false;
46    }
47};
48
49//! Class that holds list of desktop environments
50class CDEList
51{
52public:
53    /**
54      Refresh list
55
56      @param isAll- true if we want to fill list by all supported DEs outwice
57                     it fills by installed DEs
58    */
59    int refresh(bool isAll=false);
60
61    /**
62      Returns count of DE's descriptions in list
63    */
64    int size()
65        {
66            return mvDE.size();
67        }
68
69    CDEInfo& operator[](int idx)
70        {
71            return mvDE[idx];
72        }
73
74    /**
75      Returns pointer to description of active DE
76
77      @return Pointer to description of active DE or NULL if active DE unknown
78    */
79    CDEInfo* active();
80
81    /**
82      Returns DE description bu DE name
83
84      @param Name - Name to search (case insensative)
85
86      @return Pointer to DE description. NULL if not found
87    */
88    CDEInfo* byName(QString Name);
89
90protected:
91    QVector <CDEInfo> mvDE;
92};
93
94///////////////////////////////////////////////////////
95// Singleton object for DE list
96class CSingleDEList:public CDEList
97{
98public:
99    static CSingleDEList& getRef();
100};
101
102static CSingleDEList& InstalledDEList = CSingleDEList::getRef();
103
104#endif // DEINFO_F
Note: See TracBrowser for help on using the repository browser.