ALBA
albaLicenceManager.h
Go to the documentation of this file.
1/*=========================================================================
2Program: Multimod Application Framework
3Module: $RCSfile: albaLicenceManager.h,v $
4Language: C++
5Date: $Date: 2009-05-19 14:29:52 $
6Version: $Revision: 1.1 $
7Authors: Gianluigi Crimi, Nicola Vanella
8==========================================================================
9Copyright (c) 2001/2005
10CINECA - Interuniversity Consortium (www.cineca.it)
11=========================================================================*/
12
13#include "albaDefines.h"
14#include "albaObserver.h"
15
16#ifndef __albaLicenceManager_H__
17#define __albaLicenceManager_H__
18
19class albaGUIButton;
20class albaGUIDialog;
23class wxDateTime;
24class wxImage;
25class wxCalendarCtrl;
26
27class ALBA_EXPORT albaLicenceManager : public albaObserver
28{
29public:
30
31 albaLicenceManager(wxString appName);
33
38 };
39
43 };
44
46 {
49 };
50
56 };
57
59 {
64 };
65
66 //----------------------------------------------------------------------------
67 // Widgets ID's
69 {
70 ID_COPY_KEY = MINID,
73 };
74
77
78 /*Show Gui Dialog for Registration Licence*/
80
81 /*Hide Gui Dialog for Registration Licence*/
83
84 /*Show Gui Dialog for Generation Licence */
86
88 virtual void OnEvent(albaEventBase *alba_event);
89
91 bool albaLicenceManager::GetExpireDate(wxDateTime &dateExpire);
92
95
97 void SetListener(albaObserver *Listener) { m_Listener = Listener; };
98
100 void SetCryptKey(wxString cryptKey) { m_CryptKey = cryptKey; }
101
102 /*Set mail to send the registration key. This is showed in RegistrationDialog*/
103 void SetRegistrationMail(wxString mail) { m_RegMail = mail; };
104
105 /*Set the image path. This is showed in RegistrationDialog*/
106 void SetImagePath(wxString path) { m_RegImagePath = path; };
107
108
111
113 void SetLicModality(albaLicenceManager::licenceModalities licModality) { m_LicModality = licModality; }
114
116
117protected:
118
120 wxString EncryptStr(wxString plainStr);
121
123 wxString DecryptStr(wxString plainStr);
124
125
126
128 CreateNewLicenceStatuses CreateNewTimeLicence(wxString RegCode, wxDateTime expirationDate, wxString &newLicence);
129
131 CreateNewLicenceStatuses CreateNewBinaryLicence(wxString RegCode, wxString &newLicence);
132
134 addLicenceStatuses CheckCreateLicence(wxString registrationString);
135
137 unsigned long SecondsInThisMillennium();
138
140 void AddTimeLicence(wxDateTime expireDate);
141
144
145 wxString m_AppName;
146 wxString m_CryptKey;
148 wxString m_RegMail;
150
152
153 //GUI
154
156
157 /*Copy string to clipboard*/
158 void ToClipboard(HWND hwnd, const std::string &s);
159
160 wxString m_FirstKey;
161 wxString m_SecondKey;
162
165
167
169 wxTextCtrl *m_Result_textCtrl;
170 wxCalendarCtrl *m_CalendarCtrl;
171
173};
174#endif
MINID
Definition: albaDecl.h:420
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
albaGUIButton inherit from wxButton.
Definition: albaGUIButton.h:35
albaGUIDialog is the base class for albaDialogs.
Definition: albaGUIDialog.h:76
albaGUIPicButton inherit from wxBitmapButton.
void SetRegistrationMail(wxString mail)
albaGUIDialog * m_RegistrationDialog
void ShowGenerateLicenceDialog()
bool IsRegistred()
set expire date to the argument, return false if there is no expire date
void AddBinaryLicence()
license the software to expireDate
virtual void OnEvent(albaEventBase *alba_event)
on event function
wxCalendarCtrl * m_CalendarCtrl
CreateNewLicenceStatuses CreateNewTimeLicence(wxString RegCode, wxDateTime expirationDate, wxString &newLicence)
creates a new licence string
void SetImagePath(wxString path)
wxTextCtrl * m_Result_textCtrl
bool GetExpireDate(wxDateTime &dateExpire)
set expire date to the argument, return false if there is no expire date
void HideRegistrationDialog()
void ShowRegistrationDialog()
albaGUIDialog * m_GenerateLicenceDialog
void SetListener(albaObserver *Listener)
sets the listener
unsigned long SecondsInThisMillennium()
returns the number of seconds from 1/1/2000 00:00 to now
albaLicenceManager(wxString appName)
void AddTimeLicence(wxDateTime expireDate)
license the software to expireDate
albaLicenceManager::licenceModalities GetLicModality() const
Returns LicModality.
albaObserver * m_Listener
licenceStatuses GetCurrentMode()
returns current registration status
void SetLicScope(albaLicenceManager::licenceScope scope)
addLicenceStatuses CheckCreateLicence(wxString registrationString)
check a new licence and add is to the current user
wxTextCtrl * m_FirstKey_textCtrl
void ToClipboard(HWND hwnd, const std::string &s)
CreateNewLicenceStatuses CreateNewBinaryLicence(wxString RegCode, wxString &newLicence)
creates a new licence string
wxString DecryptStr(wxString plainStr)
decrypts the input string, return empty string if the input is not correctly encrypted
void SetCryptKey(wxString cryptKey)
Sets CryptKey, if not set the alba default key will be used for enc/decryption.
void SetLicModality(albaLicenceManager::licenceModalities licModality)
Sets LicModality.
licenceModalities m_LicModality
wxString EncryptStr(wxString plainStr)
encrypts the input string
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36