Skip to content
This repository
Browse code

SysStat: license updated & unused files removed

  • Loading branch information...
commit b0b6a30c23a9d302dd3cc7a33997ac0447459f9a 1 parent 12f8ac0
Kuzma Shapran kuzmas authored
159 libraries/sysstat/cpufreqstat.cpp
... ... @@ -1,159 +0,0 @@
1   -/*************
2   -**
3   -** Project: Qt-based interface to system statistics (libsysstat)
4   -** Author: Copyright (C) 2009 - 2012 Kuzma Shapran <Kuzma.Shapran@gmail.com>
5   -** License: LGPLv3
6   -**
7   -** This file is part of SysStat library.
8   -**
9   -** This library is free software; you can redistribute it and/or modify it
10   -** under the terms of the GNU Lesser General Public License as published by
11   -** the Free Software Foundation; either version 3 of the License, or any
12   -** later version. This work is distributed in the hope that it will be
13   -** useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14   -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15   -** See the GNU Lesser General Public License for more details.
16   -**
17   -** You should have received a copy of the GNU Lesser General Public License
18   -** along with the library.
19   -** If not, see <http://www.gnu.org/licenses/lgpl.html>.
20   -**
21   -*************/
22   -
23   -
24   -#include "cpufreqstat.hpp"
25   -#include "cpufreqstat_p.hpp"
26   -
27   -
28   -namespace SysStat {
29   -
30   -CpuFreqStatPrivate::CpuFreqStatPrivate(CpuFreqStat *parent)
31   - : BaseStatPrivate(parent)
32   -{
33   - m_source = defaultSource();
34   -
35   - connect(m_timer, SIGNAL(timeout()), SLOT(timeout()));
36   -
37   - updateSources();
38   -}
39   -
40   -CpuFreqStatPrivate::~CpuFreqStatPrivate()
41   -{
42   -}
43   -
44   -void CpuFreqStatPrivate::addSource(const QString &source)
45   -{
46   - bool ok;
47   -
48   - uint min = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_max_freq").arg(source))).toUInt(&ok);
49   - if (ok)
50   - {
51   - uint max = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_max_freq").arg(source))).toUInt(&ok);
52   - if (ok)
53   - {
54   - m_sources.append(source);
55   - m_bounds[source] = qMakePair(min, max);
56   - }
57   - }
58   -}
59   -
60   -void CpuFreqStatPrivate::updateSources(void)
61   -{
62   - m_sources.clear();
63   - m_bounds.clear();
64   -
65   - bool ok;
66   -
67   - foreach (QString range, readAllFile("/sys/devices/system/cpu/online").split(QChar(','), QString::SkipEmptyParts))
68   - {
69   - int dash = range.indexOf('-');
70   - if (dash != -1)
71   - {
72   - uint min = range.left(dash).toUInt(&ok);
73   - if (ok)
74   - {
75   - uint max = range.mid(dash + 1).toUInt(&ok);
76   - if (ok)
77   - for (uint number = min; number <= max; ++number)
78   - addSource(QString("cpu%1").arg(number));
79   - }
80   - }
81   - else
82   - {
83   - uint number = range.toUInt(&ok);
84   - if (ok)
85   - addSource(QString("cpu%1").arg(number));
86   - }
87   - }
88   -}
89   -
90   -void CpuFreqStatPrivate::timeout(void)
91   -{
92   - bool ok;
93   -
94   - uint cur = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_cur_freq").arg(m_source))).toUInt(&ok);
95   -
96   - if (ok)
97   - emit update(cur);
98   -}
99   -
100   -QString CpuFreqStatPrivate::defaultSource(void)
101   -{
102   - if (m_sources.isEmpty())
103   - updateSources();
104   -
105   - if (!m_sources.isEmpty())
106   - return m_sources[0];
107   -
108   - return QString();
109   -}
110   -
111   -uint CpuFreqStatPrivate::minFreq(const QString &source) const
112   -{
113   - Bounds::ConstIterator I = m_bounds.constFind(source);
114   -
115   - if (I != m_bounds.constEnd())
116   - return I.value().first;
117   -
118   - return 0;
119   -}
120   -
121   -uint CpuFreqStatPrivate::maxFreq(const QString &source) const
122   -{
123   - Bounds::ConstIterator I = m_bounds.constFind(source);
124   -
125   - if (I != m_bounds.constEnd())
126   - return I.value().second;
127   -
128   - return 0;
129   -}
130   -
131   -CpuFreqStat::CpuFreqStat(QObject *parent)
132   - : BaseStat(parent)
133   -{
134   - impl = new CpuFreqStatPrivate(this);
135   - baseimpl = impl;
136   -
137   - connect(impl, SIGNAL(update(uint)), this, SIGNAL(update(uint)));
138   -}
139   -
140   -CpuFreqStat::~CpuFreqStat()
141   -{
142   -}
143   -
144   -void CpuFreqStat::updateSources(void)
145   -{
146   - dynamic_cast<CpuFreqStatPrivate*>(impl)->updateSources();
147   -}
148   -
149   -uint CpuFreqStat::minFreq(const QString &source) const
150   -{
151   - return dynamic_cast<CpuFreqStatPrivate*>(impl)->minFreq(source);
152   -}
153   -
154   -uint CpuFreqStat::maxFreq(const QString &source) const
155   -{
156   - return dynamic_cast<CpuFreqStatPrivate*>(impl)->maxFreq(source);
157   -}
158   -
159   -}
64 libraries/sysstat/cpufreqstat.hpp
... ... @@ -1,64 +0,0 @@
1   -/*************
2   -**
3   -** Project: Qt-based interface to system statistics (libsysstat)
4   -** Author: Copyright (C) 2009 - 2012 Kuzma Shapran <Kuzma.Shapran@gmail.com>
5   -** License: LGPLv3
6   -**
7   -** This file is part of SysStat library.
8   -**
9   -** This library is free software; you can redistribute it and/or modify it
10   -** under the terms of the GNU Lesser General Public License as published by
11   -** the Free Software Foundation; either version 3 of the License, or any
12   -** later version. This work is distributed in the hope that it will be
13   -** useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14   -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15   -** See the GNU Lesser General Public License for more details.
16   -**
17   -** You should have received a copy of the GNU Lesser General Public License
18   -** along with the library.
19   -** If not, see <http://www.gnu.org/licenses/lgpl.html>.
20   -**
21   -*************/
22   -
23   -
24   -#ifndef LIBSYSSTAT__CPU_FREQ_STAT__INCLUDED
25   -#define LIBSYSSTAT__CPU_FREQ_STAT__INCLUDED
26   -
27   -
28   -#include <QtCore/QObject>
29   -#include <QtCore/QtGlobal>
30   -#include <QtCore/QString>
31   -
32   -#include "sysstat_global.hpp"
33   -#include "basestat.hpp"
34   -
35   -
36   -namespace SysStat {
37   -
38   -class CpuFreqStatPrivate;
39   -
40   -class SYSSTATSHARED_EXPORT CpuFreqStat : public BaseStat
41   -{
42   - Q_OBJECT
43   -
44   -public:
45   - CpuFreqStat(QObject *parent = NULL);
46   - ~CpuFreqStat();
47   -
48   - QStringList sources(void) const;
49   -
50   - void updateSources(void);
51   -
52   - uint minFreq(const QString &source) const;
53   - uint maxFreq(const QString &source) const;
54   -
55   -signals:
56   - void update(uint freq);
57   -
58   -protected:
59   - CpuFreqStatPrivate* impl;
60   -};
61   -
62   -}
63   -
64   -#endif //LIBSYSSTAT__CPU_FREQ_STAT__INCLUDED
69 libraries/sysstat/cpufreqstat_p.hpp
... ... @@ -1,69 +0,0 @@
1   -/*************
2   -**
3   -** Project: Qt-based interface to system statistics (libsysstat)
4   -** Author: Copyright (C) 2009 - 2012 Kuzma Shapran <Kuzma.Shapran@gmail.com>
5   -** License: LGPLv3
6   -**
7   -** This file is part of SysStat library.
8   -**
9   -** This library is free software; you can redistribute it and/or modify it
10   -** under the terms of the GNU Lesser General Public License as published by
11   -** the Free Software Foundation; either version 3 of the License, or any
12   -** later version. This work is distributed in the hope that it will be
13   -** useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14   -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15   -** See the GNU Lesser General Public License for more details.
16   -**
17   -** You should have received a copy of the GNU Lesser General Public License
18   -** along with the library.
19   -** If not, see <http://www.gnu.org/licenses/lgpl.html>.
20   -**
21   -*************/
22   -
23   -
24   -#ifndef LIBSYSSTAT__CPU_FREQ_STAT__PRIVATE__INCLUDED
25   -#define LIBSYSSTAT__CPU_FREQ_STAT__PRIVATE__INCLUDED
26   -
27   -
28   -#include <QtCore/QObject>
29   -#include <QtCore/QtGlobal>
30   -#include <QtCore/QMap>
31   -#include <QtCore/QPair>
32   -
33   -#include "basestat_p.hpp"
34   -#include "cpufreqstat.hpp"
35   -
36   -
37   -namespace SysStat {
38   -
39   -class CpuFreqStatPrivate : public BaseStatPrivate
40   -{
41   - Q_OBJECT
42   -
43   -public:
44   - CpuFreqStatPrivate(CpuFreqStat *parent = NULL);
45   - ~CpuFreqStatPrivate();
46   -
47   - void updateSources(void);
48   -
49   - uint minFreq(const QString &source) const;
50   - uint maxFreq(const QString &source) const;
51   -
52   -signals:
53   - void update(uint freq);
54   -
55   -private slots:
56   - void timeout(void);
57   -
58   -private:
59   - QString defaultSource(void);
60   -
61   - typedef QMap<QString, QPair<uint, uint> > Bounds;
62   - Bounds m_bounds;
63   -
64   - void addSource(const QString &source);
65   -};
66   -
67   -}
68   -
69   -#endif //LIBSYSSTAT__CPU_FREQ_STAT__PRIVATE__INCLUDED
27 razorqt-panel/plugin-sysstat/razorsysstatutils.cpp
... ... @@ -1,3 +1,30 @@
  1 +/* BEGIN_COMMON_COPYRIGHT_HEADER
  2 + * (c)LGPL2+
  3 + *
  4 + * Razor - a lightweight, Qt based, desktop toolset
  5 + * http://razor-qt.org
  6 + *
  7 + * Copyright: 2012 Razor team
  8 + * Authors:
  9 + * Kuzma Shapran <kuzma.shapran@gmail.com>
  10 + *
  11 + * This program or library is free software; you can redistribute it
  12 + * and/or modify it under the terms of the GNU Lesser General Public
  13 + * License as published by the Free Software Foundation; either
  14 + * version 2.1 of the License, or (at your option) any later version.
  15 + *
  16 + * This library is distributed in the hope that it will be useful,
  17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19 + * Lesser General Public License for more details.
  20 +
  21 + * You should have received a copy of the GNU Lesser General
  22 + * Public License along with this library; if not, write to the
  23 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  24 + * Boston, MA 02110-1301 USA
  25 + *
  26 + * END_COMMON_COPYRIGHT_HEADER */
  27 +
1 28 #include <QtCore/QRegExp>
2 29 #include <QtCore/qmath.h>
3 30
33 razorqt-panel/plugin-sysstat/razorsysstatutils.h
... ... @@ -1,5 +1,32 @@
1   -#ifndef COLOURSELECTOR_H
2   -#define COLOURSELECTOR_H
  1 +/* BEGIN_COMMON_COPYRIGHT_HEADER
  2 + * (c)LGPL2+
  3 + *
  4 + * Razor - a lightweight, Qt based, desktop toolset
  5 + * http://razor-qt.org
  6 + *
  7 + * Copyright: 2012 Razor team
  8 + * Authors:
  9 + * Kuzma Shapran <kuzma.shapran@gmail.com>
  10 + *
  11 + * This program or library is free software; you can redistribute it
  12 + * and/or modify it under the terms of the GNU Lesser General Public
  13 + * License as published by the Free Software Foundation; either
  14 + * version 2.1 of the License, or (at your option) any later version.
  15 + *
  16 + * This library is distributed in the hope that it will be useful,
  17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19 + * Lesser General Public License for more details.
  20 +
  21 + * You should have received a copy of the GNU Lesser General
  22 + * Public License along with this library; if not, write to the
  23 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  24 + * Boston, MA 02110-1301 USA
  25 + *
  26 + * END_COMMON_COPYRIGHT_HEADER */
  27 +
  28 +#ifndef RAZORSYSSTATUTILS_HPP
  29 +#define RAZORSYSSTATUTILS_HPP
3 30
4 31 #include <QtCore/QString>
5 32
@@ -11,4 +38,4 @@ int netSpeedFromString(QString value);
11 38
12 39 }
13 40
14   -#endif // COLOURSELECTOR_H
  41 +#endif // RAZORSYSSTATUTILS_HPP

0 comments on commit b0b6a30

Please sign in to comment.
Something went wrong with that request. Please try again.