1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/***************************************************************************
knutmessagemanager.h - description
-------------------
begin : So led 24 2004
copyright : (C) 2004 by Daniel Prynych
email : Daniel.Prynych@alo.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KNUTMESSAGEMANAGER_H
#define KNUTMESSAGEMANAGER_H
#include "knutmessage.h"
#include <tqobject.h>
/**
*@author Daniel Prynych
*/
namespace knc {
enum LevelOfMessage {
infoLevel, // status RB, TRIM, CAL, TRIM
lowWarningLevel, // OVER,
warningLevel, // OB ..
errorLevel, // connection error
criticalLevel // Status BL, OFF
};
}
class TQString;
/**
* Tato trida slouzi pro ovladani vyskakovacich oken (pop-up)
* Okno pracuji nezavisle na ostatnich oknech a NEPOZASTAVUJI jejich cinnost.
*
* @author Daniel Prynych
* @short window message manager
* @version 0.1
*/
class KNutMessageManager : public TQObject {
Q_OBJECT
public:
/**
* Konstruktor - vytvori instanci tridy.
*
* @since 0.1
*/
KNutMessageManager( TQObject *parent=0, const char *name=0);
/**
* Destruktor.
*
* @since 0.1.1
**/
~KNutMessageManager();
/**
* Pozada o zobrazeni okna. Pokud je zobrazeno okne s vyssi prioritou, neni funkce provedena.
*
* @param text Text of message, which will be showed in window
*
* @param text Text zpravy ktera se zobrazi v okne.
* @param messageLevel urcuje prioritu zpravy.
* @param useInfoIcon urcuje ktera icona se zobrazi. Pokud je nastaven na true, je vzdy zobrazena icona
* info, pokud je false je nastavena icona v zavislosti na priorite zpravy.
*
* @since 0.2
**/
void addMessage (TQString text, knc::LevelOfMessage messageLevel = knc::infoLevel, bool useInfoIcon = false, bool useShortTimeOfValidity = false);
/**
* Close window, when one is existed
* Zrusi okno, pokud existuje;
*
* @since 0.1.1
**/
void deleteMessage (void);
private slots:
/**
* @internal
* Je aktivovan, kdyz bylo pozadano o zruseni okna stisknutim praveho widgetu nebo vnejsimi udalostmi (KDE Logout).
*
* @since 0.1.2
**/
void slotFinishedMessage (void);
/**
* @internal
* Je aktivovan, kdyz bylo pozadano o zruseni okna stsknutim OK nebo vyprsenim casoveho terminu
*
* @since 0.1.2
**/
void slotEndMessage (void);
/**
* @internal
/ Is activated when window was moved
* Je aktivovan, kdyz bylo okno presunuto
*
* @since 0.1.2
**/
void slotMessageMoved (int x,int y);
private:
static const long int TimeOfValidity = 600; //600 sec or 10n min
static const long int ShortTimeOfValidity = 60; // 60 sec or one min
KNutMessage* m_myMess;
knc::LevelOfMessage m_myMessLevel;
int m_xPos;
int m_yPos;
};
#endif
|