Communi  3.0.0
A cross-platform IRC framework written with Qt
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Macros Groups Pages
irclagtimer.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2008-2013 The Communi Project
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 * License for more details.
13 */
14 
15 #ifndef IRCLAGTIMER_H
16 #define IRCLAGTIMER_H
17 
18 #include <IrcGlobal>
19 #include <QtCore/qobject.h>
20 #include <QtCore/qmetatype.h>
21 #include <QtCore/qscopedpointer.h>
22 
23 IRC_BEGIN_NAMESPACE
24 
25 class IrcConnection;
26 class IrcLagTimerPrivate;
27 
28 class IRC_UTIL_EXPORT IrcLagTimer : public QObject
29 {
30  Q_OBJECT
31  Q_PROPERTY(qint64 lag READ lag NOTIFY lagChanged)
32  Q_PROPERTY(int interval READ interval WRITE setInterval)
33  Q_PROPERTY(IrcConnection* connection READ connection WRITE setConnection)
34 
35 public:
36  explicit IrcLagTimer(QObject* parent = 0);
37  virtual ~IrcLagTimer();
38 
39  IrcConnection* connection() const;
40  void setConnection(IrcConnection* connection);
41 
42  qint64 lag() const;
43 
44  int interval() const;
45  void setInterval(int seconds);
46 
47 Q_SIGNALS:
48  void lagChanged(qint64 lag);
49 
50 private:
51  QScopedPointer<IrcLagTimerPrivate> d_ptr;
52  Q_DECLARE_PRIVATE(IrcLagTimer)
53  Q_DISABLE_COPY(IrcLagTimer)
54 
55  Q_PRIVATE_SLOT(d_func(), void _irc_connected())
56  Q_PRIVATE_SLOT(d_func(), void _irc_pingServer())
57  Q_PRIVATE_SLOT(d_func(), void _irc_disconnected())
58 };
59 
60 IRC_END_NAMESPACE
61 
62 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcLagTimer*))
63 
64 #endif // IRCLAGTIMER_H
Provides means to establish a connection to an IRC server.
Definition: ircconnection.h:32
Provides a timer for measuring lag.
Definition: irclagtimer.h:28