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,
78 ID_GENERATE_REGISTRATION
79 };
80
83
84 /*Show Gui Dialog for Registration Licence*/
86
87 /*Hide Gui Dialog for Registration Licence*/
89
90 /*Show Gui Dialog for Generation Licence */
92
94 virtual void OnEvent(albaEventBase *alba_event);
95
97 bool albaLicenceManager::GetExpireDate(wxDateTime &dateExpire);
98
101
103 void SetListener(albaObserver *Listener) { m_Listener = Listener; };
104
106 void SetCryptKey(wxString cryptKey) { m_CryptKey = cryptKey; }
107
108 /*Set mail to send the registration key. This is showed in RegistrationDialog*/
109 void SetRegistrationMail(wxString mail) { m_RegMail = mail; };
110
111 /*Set the image path. This is showed in RegistrationDialog*/
112 void SetImagePath(wxString path) { m_RegImagePath = path; };
113
114
117
119 void SetLicModality(albaLicenceManager::licenceModalities licModality) { m_LicModality = licModality; }
120
122
124 void SetReadUserData(bool val) { m_ReadUserData = val; }
125protected:
126
128 wxString EncryptStr(wxString plainStr);
129
131 wxString DecryptStr(wxString plainStr);
132
133
134
136 CreateNewLicenceStatuses CreateNewTimeLicence(wxString RegCode, wxDateTime expirationDate, wxString &newLicence);
137
139 CreateNewLicenceStatuses CreateNewBinaryLicence(wxString RegCode, wxString &newLicence);
140
142 addLicenceStatuses CheckCreateLicence(wxString registrationString);
143
145 unsigned long SecondsInThisMillennium();
146
148 void AddTimeLicence(wxDateTime expireDate);
149
152
154 void OnTextFieldChanged(wxEvent &event);
155
156 wxString m_AppName;
157 wxString m_CryptKey;
159 wxString m_RegMail;
161
163
164 //GUI
165
167
168 /*Copy string to clipboard*/
169 void ToClipboard(HWND hwnd, const std::string &s);
170
171 wxString m_FirstKey;
172 wxString m_SecondKey;
173
175
178
180
182 wxTextCtrl *m_Result_textCtrl;
183 wxCalendarCtrl *m_CalendarCtrl;
184
185 // Member variables (add to private section)
186 wxTextCtrl *m_Name_textCtrl;
192
194};
195#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
wxTextCtrl * m_InstitutionalEmail_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