Add help text for attribute S/R.
[qpwmc.git] / pwmdClientInfo.cpp
blob9eb234fd758d4fd20eb8eb89766643f4deb50856
1 /*
2 Copyright (C) 2015-2024 Ben Kibbey <bjk@luxsci.net>
4 This file is part of qpwmc.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 USA
21 #include <QStringList>
22 #include "pwmdClientInfo.h"
24 ClientInfo::ClientInfo (QString id, QString name, QString filename,
25 QString host, bool lock, bool self, unsigned state,
26 QString userId, QString username, time_t connected)
28 _id = id;
29 _name = name;
30 _filename = filename.at(0) == '/' ? "-" : filename;
31 _host = host;
32 _lock = lock;
33 _self = self;
34 _state = state;
35 _userId = userId;
36 _username = username;
37 _connectedAt = connected;
38 _stale = 0;
41 ClientInfo::~ClientInfo ()
45 ClientInfo *
46 ClientInfo::parseLine (const QString &line)
48 QStringList fields = line.split (" ");
49 ClientInfo *ci = new ClientInfo (fields.at(0), fields.at(1), fields.at(2),
50 fields.at(3), fields.at(4).toInt() == 1,
51 fields.at(5).toInt() == 1,
52 fields.at(6).toUInt(), fields.at(7),
53 fields.at(8), fields.at(9).toUInt());
54 return ci;
57 QString
58 ClientInfo::id ()
60 return _id;
63 QString
64 ClientInfo::name ()
66 return _name;
69 QString
70 ClientInfo::filename ()
72 return _filename;
75 QString
76 ClientInfo::host ()
78 return _host;
81 bool
82 ClientInfo::locked ()
84 return _lock;
87 void
88 ClientInfo::setLocked (bool b)
90 _lock = b;
93 bool
94 ClientInfo::self ()
96 return _self;
99 unsigned
100 ClientInfo::state ()
102 return _state;
105 void
106 ClientInfo::setState (unsigned s)
108 _state = s;
111 QString
112 ClientInfo::userId ()
114 return _userId;
117 QString
118 ClientInfo::username ()
120 return _username;
123 time_t
124 ClientInfo::connectedAt ()
126 return _connectedAt;
129 void
130 ClientInfo::setStale (time_t t)
132 _stale = t;
135 time_t
136 ClientInfo::stale ()
138 return _stale;