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,
77 ID_GENERATE_REGISTRATION
78 };
79
82
83 /*Show Gui Dialog for Registration Licence*/
85
86 /*Hide Gui Dialog for Registration Licence*/
88
89 /*Show Gui Dialog for Generation Licence */
91
93 virtual void OnEvent(albaEventBase *alba_event);
94
96 bool albaLicenceManager::GetExpireDate(wxDateTime &dateExpire);
97
100
102 void SetListener(albaObserver *Listener) { m_Listener = Listener; };
103
105 void SetCryptKey(wxString cryptKey) { m_CryptKey = cryptKey; }
106
107 /*Set mail to send the registration key. This is showed in RegistrationDialog*/
108 void SetRegistrationMail(wxString mail) { m_RegMail = mail; };
109
110 /*Set the image path. This is showed in RegistrationDialog*/
111 void SetImagePath(wxString path) { m_RegImagePath = path; };
112
113
116
118 void SetLicModality(albaLicenceManager::licenceModalities licModality) { m_LicModality = licModality; }
119
121
123 void SetReadUserData(bool val) { m_ReadUserData = val; }
124protected:
125
127 wxString EncryptStr(wxString plainStr);
128
130 wxString DecryptStr(wxString plainStr);
131
132
133
135 CreateNewLicenceStatuses CreateNewTimeLicence(wxString RegCode, wxDateTime expirationDate, wxString &newLicence);
136
138 CreateNewLicenceStatuses CreateNewBinaryLicence(wxString RegCode, wxString &newLicence);
139
141 addLicenceStatuses CheckCreateLicence(wxString registrationString);
142
144 unsigned long SecondsInThisMillennium();
145
147 void AddTimeLicence(wxDateTime expireDate);
148
151
153 void OnTextFieldChanged(wxEvent &event);
154
155 wxString m_AppName;
156 wxString m_CryptKey;
158 wxString m_RegMail;
160
162
163 //GUI
164
166
167 /*Copy string to clipboard*/
168 void ToClipboard(HWND hwnd, const std::string &s);
169
170 wxString m_FirstKey;
171 wxString m_SecondKey;
172
174
177
179
181 wxTextCtrl *m_Result_textCtrl;
182 wxCalendarCtrl *m_CalendarCtrl;
183
184 // Member variables (add to private section)
185 wxTextCtrl *m_Name_textCtrl;
190
192};
193#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()
wxTextCtrl * m_Name_textCtrl
bool IsRegistred()
set expire date to the argument, return false if there is no expire date
wxTextCtrl * m_Surname_textCtrl
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
wxTextCtrl * m_IntendedUse_textCtrl
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.
albaGUIButton * m_GenerateRegistration_Button
albaObserver * m_Listener
void SetReadUserData(bool val)
Sets Read User Data, if true a.
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 OnTextFieldChanged(wxEvent &event)
handle text field changes
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
wxTextCtrl * m_Affiliation_textCtrl
wxString EncryptStr(wxString plainStr)
encrypts the input string
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36