~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kinfocenter/Modules/samba/kcmsambastatistics.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * kcmsambastatistics.h
 
3
 *
 
4
 * Copyright (c) 2000 Alexander Neundorf <alexander.neundorf@rz.tu-ilmenau.de>
 
5
 *
 
6
 * Requires the Qt widget libraries, available at no cost at
 
7
 * http://www.troll.no/
 
8
 *
 
9
 *  This program is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2 of the License, or
 
12
 *  (at your option) any later version.
 
13
 *
 
14
 *  This program is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with this program; if not, write to the Free Software
 
21
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
22
 */
 
23
#ifndef kcmsambastatistics_h_included
 
24
#define kcmsambastatistics_h_included
 
25
 
 
26
#include <Qt3Support/Q3PtrList>
 
27
#include <QWidget>
 
28
 
 
29
class Q3ListView;
 
30
class QLabel;
 
31
class QComboBox;
 
32
class QCheckBox;
 
33
class QLineEdit;
 
34
class QPushButton;
 
35
 
 
36
class KConfig;
 
37
 
 
38
class SmallLogItem {
 
39
public:
 
40
        SmallLogItem() :
 
41
                name(""), count(0) {
 
42
        }
 
43
        SmallLogItem(const QString &n) :
 
44
                name(n), count(1) {
 
45
        }
 
46
        QString name;
 
47
        int count;
 
48
};
 
49
 
 
50
class LogItem {
 
51
public:
 
52
        LogItem() :
 
53
                name(""), accessed(), count(0) {
 
54
        }
 
55
        LogItem(const QString &n, const QString &a) :
 
56
                name(n), accessed(), count(1) {
 
57
                accessed.setAutoDelete(true);
 
58
                accessed.append(new SmallLogItem(a));
 
59
        }
 
60
        QString name;
 
61
        //QStrList accessedBy;
 
62
        Q3PtrList<SmallLogItem> accessed;
 
63
        int count;
 
64
        SmallLogItem* itemInList(const QString &name);
 
65
        void addItem(const QString &host);
 
66
};
 
67
 
 
68
class SambaLog {
 
69
public:
 
70
        SambaLog() {
 
71
                items.setAutoDelete(true);
 
72
        }
 
73
        Q3PtrList<LogItem> items;
 
74
        void addItem(const QString &share, const QString &host);
 
75
        void printItems();
 
76
private:
 
77
        LogItem* itemInList(const QString &name);
 
78
};
 
79
 
 
80
class StatisticsView : public QWidget {
 
81
Q_OBJECT
 
82
public:
 
83
        explicit StatisticsView(QWidget *parent=0, KConfig *config=0);
 
84
        virtual ~StatisticsView() {
 
85
        }
 
86
        void saveSettings() {
 
87
        }
 
88
        void loadSettings() {
 
89
        }
 
90
public Q_SLOTS:
 
91
        void setListInfo(Q3ListView *list, int nrOfFiles, int nrOfConnections);
 
92
private:
 
93
        KConfig *configFile;
 
94
        Q3ListView *dataList;
 
95
        Q3ListView* viewStatistics;
 
96
        QLabel* connectionsL, *filesL;
 
97
        QComboBox* eventCb;
 
98
        QLabel* eventL;
 
99
        QLineEdit* serviceLe;
 
100
        QLabel* serviceL;
 
101
        QLineEdit* hostLe;
 
102
        QLabel* hostL;
 
103
        QPushButton* calcButton, *clearButton;
 
104
        QCheckBox* expandedInfoCb, *expandedUserCb;
 
105
        int connectionsCount, filesCount, calcCount;
 
106
private Q_SLOTS:
 
107
        void clearStatistics();
 
108
        void calculate();
 
109
};
 
110
#endif // main_included