Browse Source

random manager

old
Robin Thoni 9 years ago
parent
commit
c6518dd4ed
2 changed files with 39 additions and 0 deletions
  1. 19
    0
      server/randommanager.cpp
  2. 20
    0
      server/randommanager.h

+ 19
- 0
server/randommanager.cpp View File

@@ -0,0 +1,19 @@
1
+#include <time.h>
2
+#include "randommanager.h"
3
+
4
+RandomManager::RandomManager(QObject *parent) : InputManager(parent)
5
+{
6
+
7
+}
8
+
9
+bool RandomManager::init(const QVariant &)
10
+{
11
+    srand(time(nullptr));
12
+    return true;
13
+}
14
+
15
+QVariant RandomManager::read(const QVariant&)
16
+{
17
+    return rand();
18
+}
19
+

+ 20
- 0
server/randommanager.h View File

@@ -0,0 +1,20 @@
1
+#ifndef RANDOMMANAGER_H
2
+#define RANDOMMANAGER_H
3
+
4
+#include "inputmanager.h"
5
+
6
+class RandomManager : public InputManager
7
+{
8
+    Q_OBJECT
9
+public:
10
+    explicit RandomManager(QObject *parent = 0);
11
+
12
+signals:
13
+
14
+public slots:
15
+    bool init(const QVariant &) override;
16
+
17
+    QVariant read(const QVariant &) override;
18
+};
19
+
20
+#endif // RANDOMMANAGER_H

Loading…
Cancel
Save