Programmi dimostrativi
Per ottenere una versione demo dei programmi si devono ricompilare i programmi definendo il simbolo _DEMO_. I files modificati sono: applicat.cpp applicat.h isam.cpp maskfld.cpp stdtypes.cpp. Le limitazioni riguardano le date, il numero di record in archivio, una limitazione a due ore del tempo di utilizzo del programma e l'eliminazione del possibilita' di usare una ditta diversa dalla 1. git-svn-id: svn://10.65.10.50/trunk@5682 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2c508021b5
commit
56de750d9f
@ -159,6 +159,32 @@ long XVT_CALLCONV1 TApplication::task_eh(WINDOW win, EVENT *ep)
|
|||||||
case E_CREATE:
|
case E_CREATE:
|
||||||
if (_application->pre_create())
|
if (_application->pre_create())
|
||||||
{
|
{
|
||||||
|
#ifdef _DEMO_
|
||||||
|
{
|
||||||
|
const TString16 dname(encode("DATA"));
|
||||||
|
const TString16 hname(encode("ORA"));
|
||||||
|
TConfig c(CONFIG_STUDIO, "Main");
|
||||||
|
TDate data(decode(c.get(dname)));
|
||||||
|
TDate oggi(TODAY);
|
||||||
|
real remaining_time(decode(c.get(hname)));
|
||||||
|
main_app()._start_time = time(NULL);
|
||||||
|
|
||||||
|
if (data < oggi)
|
||||||
|
{
|
||||||
|
data = oggi;
|
||||||
|
c.set(dname, encode(data));
|
||||||
|
c.set(hname, encode("120.00"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (data == oggi)
|
||||||
|
{
|
||||||
|
if (remaining_time <= ZERO)
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
TTemp_window tw(win);
|
TTemp_window tw(win);
|
||||||
TString cap;
|
TString cap;
|
||||||
cap << prassi_spa() << " - " << main_app().get_module_name();
|
cap << prassi_spa() << " - " << main_app().get_module_name();
|
||||||
@ -285,6 +311,25 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
|||||||
void TApplication::stop_run()
|
void TApplication::stop_run()
|
||||||
{
|
{
|
||||||
if (_savefirm) prefix().set_codditta(_savefirm);
|
if (_savefirm) prefix().set_codditta(_savefirm);
|
||||||
|
#ifdef _DEMO_
|
||||||
|
{
|
||||||
|
const TString16 hname(encode("ORA"));
|
||||||
|
TConfig c(CONFIG_STUDIO, "Main");
|
||||||
|
real remaining_time(decode(c.get(hname)));
|
||||||
|
if (name() != "ba0100")
|
||||||
|
{
|
||||||
|
time_t wt = time(NULL);
|
||||||
|
int delay = (int) (wt - _start_time);
|
||||||
|
if (delay < 0)
|
||||||
|
remaining_time = ZERO;
|
||||||
|
else
|
||||||
|
remaining_time -= (delay / 60.0);
|
||||||
|
c.set(hname, encode(remaining_time.string()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
message_box("Questo e' un programma dimostrativo.\n Oggi ti rimangono %s minuti di utilizzo.", remaining_time.string(3, 0));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
terminate();
|
terminate();
|
||||||
xvt_app_destroy();
|
xvt_app_destroy();
|
||||||
}
|
}
|
||||||
@ -342,6 +387,7 @@ HIDDEN void wake_up_caller()
|
|||||||
|
|
||||||
void TApplication::terminate()
|
void TApplication::terminate()
|
||||||
{
|
{
|
||||||
|
|
||||||
wake_up_caller();
|
wake_up_caller();
|
||||||
|
|
||||||
close_all_dialogs();
|
close_all_dialogs();
|
||||||
@ -394,6 +440,7 @@ const char* TApplication::get_module_name() const
|
|||||||
|
|
||||||
void TApplication::set_perms()
|
void TApplication::set_perms()
|
||||||
{
|
{
|
||||||
|
#ifndef _DEMO_
|
||||||
_dongle_aut.set(0, TRUE);
|
_dongle_aut.set(0, TRUE);
|
||||||
for (int i = 1 ; i < ENDAUT; i++)
|
for (int i = 1 ; i < ENDAUT; i++)
|
||||||
{
|
{
|
||||||
@ -401,6 +448,7 @@ void TApplication::set_perms()
|
|||||||
const bool val = BITTEST(_int_tab0[af / 16], af % 16);
|
const bool val = BITTEST(_int_tab0[af / 16], af % 16);
|
||||||
_dongle_aut.set(i, val);
|
_dongle_aut.set(i, val);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
_user_aut.set(0, TRUE);
|
_user_aut.set(0, TRUE);
|
||||||
|
|
||||||
const TString& utente = user();
|
const TString& utente = user();
|
||||||
@ -587,8 +635,10 @@ void TApplication::end_wait()
|
|||||||
bool TApplication::has_module(int module, int checktype) const
|
bool TApplication::has_module(int module, int checktype) const
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
|
#ifndef _DEMO_
|
||||||
if (checktype == CHK_ALL || checktype == CHK_DONGLE)
|
if (checktype == CHK_ALL || checktype == CHK_DONGLE)
|
||||||
ok = _dongle_aut[module];
|
ok = _dongle_aut[module];
|
||||||
|
#endif
|
||||||
if (ok && checktype == CHK_ALL || checktype == CHK_USER)
|
if (ok && checktype == CHK_ALL || checktype == CHK_USER)
|
||||||
ok = _user_aut[module];
|
ok = _user_aut[module];
|
||||||
return ok;
|
return ok;
|
||||||
@ -610,6 +660,7 @@ bool TApplication::set_firm(long newfirm)
|
|||||||
{
|
{
|
||||||
const long oldfirm = get_firm();
|
const long oldfirm = get_firm();
|
||||||
|
|
||||||
|
#ifndef _DEMO_
|
||||||
if (newfirm < 1)
|
if (newfirm < 1)
|
||||||
{
|
{
|
||||||
TMask mask("bagn002");
|
TMask mask("bagn002");
|
||||||
@ -638,6 +689,7 @@ bool TApplication::set_firm(long newfirm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (newfirm == oldfirm || newfirm < 1)
|
if (newfirm == oldfirm || newfirm < 1)
|
||||||
return newfirm > 0;
|
return newfirm > 0;
|
||||||
@ -745,6 +797,9 @@ bool TApplication::firm_change_enabled() const
|
|||||||
|
|
||||||
// @comm Praticamente controlla se e' stato lanciato da ba0 o dal program manager
|
// @comm Praticamente controlla se e' stato lanciato da ba0 o dal program manager
|
||||||
{
|
{
|
||||||
|
#ifdef _DEMO_
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||||
static bool can = 2;
|
static bool can = 2;
|
||||||
if (can == 2)
|
if (can == 2)
|
||||||
@ -769,6 +824,7 @@ bool TApplication::firm_change_enabled() const
|
|||||||
#else
|
#else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TApplication::on_firm_change()
|
void TApplication::on_firm_change()
|
||||||
|
@ -33,8 +33,12 @@ class TApplication
|
|||||||
int __argc;
|
int __argc;
|
||||||
// @cmember:(INTERNAL) Array di argomenti passati all'applicazione
|
// @cmember:(INTERNAL) Array di argomenti passati all'applicazione
|
||||||
const char** __argv;
|
const char** __argv;
|
||||||
|
#ifdef _DEMO_
|
||||||
|
time_t _start_time;
|
||||||
|
#else
|
||||||
// @cmember:(INTERNAL) Array di autorizzazione concessa della chiavi
|
// @cmember:(INTERNAL) Array di autorizzazione concessa della chiavi
|
||||||
TBit_array _dongle_aut;
|
TBit_array _dongle_aut;
|
||||||
|
#endif
|
||||||
// @cmember:(INTERNAL) Array di autorizzazione concessa all'utente
|
// @cmember:(INTERNAL) Array di autorizzazione concessa all'utente
|
||||||
TBit_array _user_aut;
|
TBit_array _user_aut;
|
||||||
|
|
||||||
|
@ -3301,7 +3301,26 @@ bool TDate_field::on_key(KEY key)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
#ifdef _DEMO_
|
||||||
|
TDate d(data);
|
||||||
|
int y = d.year();
|
||||||
|
|
||||||
|
if (y & 0x0001) y--;
|
||||||
|
y >>= 3;
|
||||||
|
y++;
|
||||||
|
y /= 10;
|
||||||
|
if (y >= 25)
|
||||||
|
{
|
||||||
|
int m = d.month();
|
||||||
|
if (m > 3)
|
||||||
|
d.set_month(rand() % 3 + 1);
|
||||||
|
}
|
||||||
|
set_window_data(d.string());
|
||||||
|
#else
|
||||||
set_window_data(data);
|
set_window_data(data);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3322,6 +3341,23 @@ bool TDate_field::autosave(TRelation& r)
|
|||||||
if (field())
|
if (field())
|
||||||
{
|
{
|
||||||
const char* td = get();
|
const char* td = get();
|
||||||
|
#ifdef _DEMO_
|
||||||
|
{
|
||||||
|
TDate d(td);
|
||||||
|
int y = d.year();
|
||||||
|
|
||||||
|
y += 8;
|
||||||
|
y /= 25;
|
||||||
|
y >>= 3;
|
||||||
|
if (y >= 10)
|
||||||
|
{
|
||||||
|
int m = d.month() >> 2;
|
||||||
|
if (m > 0)
|
||||||
|
d.set_month(rand() % 3 + 1);
|
||||||
|
}
|
||||||
|
td = d.string();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (right_justified())
|
if (right_justified())
|
||||||
{
|
{
|
||||||
TDate d(td);
|
TDate d(td);
|
||||||
|
@ -41,6 +41,9 @@ static int _login_status = 0;
|
|||||||
// @rdesc Numero di serie della chiave
|
// @rdesc Numero di serie della chiave
|
||||||
int get_serial_number(const char* appname)
|
int get_serial_number(const char* appname)
|
||||||
{
|
{
|
||||||
|
#ifdef _DEMO_
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
if (_login_status == 0)
|
if (_login_status == 0)
|
||||||
{
|
{
|
||||||
if (HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
|
if (HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
|
||||||
@ -79,6 +82,7 @@ int get_serial_number(const char* appname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SerNo;
|
return SerNo;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// @doc INTERNAL
|
// @doc INTERNAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user