Patch level : 10.0

Files correlati     : ba1.exe
Ricompilazione Demo : [ ]
Commento            :
Migliorata finestra di attesa collegamento a sito patch


git-svn-id: svn://10.65.10.50/trunk@18945 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-05-27 13:23:41 +00:00
parent 118cff0593
commit cbc9e2528e
5 changed files with 99 additions and 57 deletions

View File

@ -28,7 +28,7 @@ public:
static const char* default_name() { return "install.ini"; } static const char* default_name() { return "install.ini"; }
TInstall_ini() : TConfig("install.ini", "Main") { } TInstall_ini() : TConfig(CONFIG_GENERAL, "Main") { }
TInstall_ini(const char* path) : TConfig(path, "Main") { } TInstall_ini(const char* path) : TConfig(path, "Main") { }
TInstall_ini(const char* path, const char * paragraph) : TConfig(path, paragraph) { } TInstall_ini(const char* path, const char * paragraph) : TConfig(path, paragraph) { }
virtual ~TInstall_ini() { } virtual ~TInstall_ini() { }

View File

@ -1,6 +1,5 @@
#include <agasys.h> #include <agasys.h>
#include <applicat.h> #include <applicat.h>
#include <dongle.h>
#include <execp.h> #include <execp.h>
#include <isamrpc.h> #include <isamrpc.h>
#include <modaut.h> #include <modaut.h>
@ -159,6 +158,7 @@ protected:
bool get_patches_path(TFilename& path) const; bool get_patches_path(TFilename& path) const;
void parse_internet_path(TString& http_server, TFilename& http_path) const; void parse_internet_path(TString& http_server, TFilename& http_path) const;
bool is_program_dir(const TFilename& path); bool is_program_dir(const TFilename& path);
bool is_visible_patch(TConfig& ini) const;
public: public:
bool installed() const { return _installed;} bool installed() const { return _installed;}
@ -178,6 +178,42 @@ public:
TInstaller_mask* TInstaller_mask::_curr_mask = NULL; TInstaller_mask* TInstaller_mask::_curr_mask = NULL;
bool TInstaller_mask::is_visible_patch(TConfig& ini) const
{
bool yes = true;
const TString& module = ini.get_paragraph();
CHECKS(module.len() == 2, "Invalid module ", (const char*)module);
const int mod = dongle().module_name2code(module);
if (mod > BAAUT && mod < ENDAUT)
{
TAuto_token_string oem = ini.get("OEM");
if (oem.blank())
{
// Pezza temporanea: assegno OEM noti
switch (mod)
{
case LVAUT: oem = "2,4"; break;
case PEAUT: oem = "3"; break;
case COAUT: oem = "5"; break;
default: break;
};
}
if (oem.full())
yes = oem.get_pos(dongle().oem()) >= 0;
else
{
// Pezza temporanea: Ee significava AGA only
const bool ee = ini.get_bool("Ee");
if (ee && dongle().oem() != 0)
yes = false;
}
}
return yes;
}
// Copia nello sheet i dati di un modulo prendendoli da un .ini // Copia nello sheet i dati di un modulo prendendoli da un .ini
bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch, int pos) bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch, int pos)
{ {
@ -186,18 +222,8 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch
return false; return false;
// Nasconde i moduli riservati da occhi indiscreti // Nasconde i moduli riservati da occhi indiscreti
TAuto_token_string oem = ini.get("OEM"); if (!is_visible_patch(ini))
if (oem.full())
{
if (oem.get_pos(dongle().oem() < 0))
return false; return false;
}
else
{
const bool ee = ini.get_bool("Ee");
if (ee && dongle().oem() != 0)
return false;
}
const int numpatch = ini.get_int("Patch"); const int numpatch = ini.get_int("Patch");
TString4 strpatch; TString4 strpatch;
@ -391,7 +417,7 @@ bool TInstaller_mask::autoload()
TFilename remote_ini = http_path; TFilename remote_ini = http_path;
remote_ini << TInstall_ini::default_name(); remote_ini << TInstall_ini::default_name();
{ {
TIndwin contacting(60,TR("Connessione al server HTTP..."), false, false); TTimerind contacting(30*1000, TR("Connessione al server HTTP..."), false, false);
http_get(http_server, remote_ini, ininame); http_get(http_server, remote_ini, ininame);
} }
} }
@ -534,9 +560,14 @@ bool TInstaller_mask::autoload()
ini.write_protect(); ini.write_protect();
int r; int r;
for (r = int(items()-1); r >= 0; r--) for (r = int(items()-1); r >= 0; r--)
{
if (module == row(r).get(C_CODE)) if (module == row(r).get(C_CODE))
break; break;
}
if (r >= 0) if (r >= 0)
{
if (is_visible_patch(ini))
{ {
const TString16 patchversion = ini.get("Versione"); const TString16 patchversion = ini.get("Versione");
const int patchlevel = ini.get_int("Patch"); const int patchlevel = ini.get_int("Patch");
@ -557,6 +588,9 @@ bool TInstaller_mask::autoload()
row.add(patchversion, C_RELEASE); row.add(patchversion, C_RELEASE);
} }
} }
else
destroy(r); // Elimina patch di altri OEM erroneamente inserite
}
else else
add_module(ini, module, true); add_module(ini, module, true);
} }
@ -576,7 +610,7 @@ bool TInstaller_mask::do_process(TToken_string& commands) const
for (const char* c = commands.get(0); c && ok; c = commands.get()) for (const char* c = commands.get(0); c && ok; c = commands.get())
{ {
cmd = c; cmd = c;
if (!cmd.blank()) if (cmd.full())
{ {
TWait_cursor hourglass; TWait_cursor hourglass;
TExternal_app app(cmd); TExternal_app app(cmd);
@ -601,6 +635,10 @@ bool TInstaller_mask::post_process(TInstall_ini& ini, const char* module) const
bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini) bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini)
{ {
ini.set_paragraph(module);
if (!is_visible_patch(ini))
return false;
TInstall_ini curini; TInstall_ini curini;
if (curini.demo() != ini.demo()) if (curini.demo() != ini.demo())
{ {
@ -614,7 +652,7 @@ bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini)
const TString& version = ini.version(module); const TString& version = ini.version(module);
const word year = version2year(version); const word year = version2year(version);
if (year < 2007) if (year < 2009)
return error_box(FR("Il modulo '%s' non ha una versione valida."), module); return error_box(FR("Il modulo '%s' non ha una versione valida."), module);
#ifndef _DEMO_ #ifndef _DEMO_
@ -688,6 +726,7 @@ return yes;
void TInstaller_mask::create_dirs(const char* path) const void TInstaller_mask::create_dirs(const char* path) const
{ {
/*
TToken_string dirs(path, SLASH); TToken_string dirs(path, SLASH);
if (SLASH == '\\') if (SLASH == '\\')
dirs.replace('/', SLASH); dirs.replace('/', SLASH);
@ -705,6 +744,8 @@ void TInstaller_mask::create_dirs(const char* path) const
// build destination directory // build destination directory
make_dir(subdir); make_dir(subdir);
} }
*/
xvt_fsys_mkdir(path); // La nuova versione crea l'albero autonomamente
} }
// sposta il file dal direttorio temporaneo a quello passato come destinazione // sposta il file dal direttorio temporaneo a quello passato come destinazione
@ -763,7 +804,7 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
ok = update = false; ok = update = false;
} }
if (!update) if (!update)
::remove(src); src.fremove();
} }
return ok; return ok;
@ -913,15 +954,16 @@ void TInstaller_mask::kill_files()
list_files (filetokill, filelist); list_files (filetokill, filelist);
FOR_EACH_ARRAY_ROW(filelist, r, file) FOR_EACH_ARRAY_ROW(filelist, r, file)
{ {
if (fexist(*file)) filetokill = *file;
::remove_file(*file); if (filetokill.exist())
killed.add(*file); filetokill.fremove();
killed.add(filetokill);
} }
} }
else else
{ {
if (fexist(filetokill)) if (filetokill.exist())
::remove_file(filetokill); filetokill.fremove();
killed.add(filetokill); killed.add(filetokill);
} }
} //for(int k=0... } //for(int k=0...
@ -1722,7 +1764,7 @@ TInstaller_mask::TInstaller_mask()
enable(F_PATH, ko); enable(F_PATH, ko);
} }
add_string(F_CURPATH, 0, PR("Installa in "), 1, 3, 80, "D", 58); add_string(F_CURPATH, 0, PR("Installa in "), 1, 3, 80, "D", 56);
set_handler(F_PATH, path_handler); set_handler(F_PATH, path_handler);
set_handler(F_WEB, web_handler); set_handler(F_WEB, web_handler);

View File

@ -277,15 +277,13 @@ bool TProgind::setstatus(long l)
// TTimerind ------------------------------------------------------------ // TTimerind ------------------------------------------------------------
long TTimerind::_timer_id = 0L;
void TTimerind::handler(WINDOW w, EVENT* e) void TTimerind::handler(WINDOW w, EVENT* e)
{ {
switch(e->type) switch(e->type)
{ {
case E_CREATE: case E_CREATE:
case E_UPDATE: case E_UPDATE:
if (_status == 0L) if (_timer_id == 0L && _interval > 0)
_timer_id = xvt_timer_create(w, _interval); _timer_id = xvt_timer_create(w, _interval);
break; break;
case E_TIMER: case E_TIMER:
@ -293,7 +291,6 @@ void TTimerind::handler(WINDOW w, EVENT* e)
{ {
_status += _interval; _status += _interval;
force_update(); force_update();
xvt_timer_create(w, _interval);
} }
break; break;
default: default:
@ -302,17 +299,13 @@ void TTimerind::handler(WINDOW w, EVENT* e)
TIndwin::handler(w,e); TIndwin::handler(w,e);
} }
TTimerind::TTimerind(long msec, const char* txt, TTimerind::TTimerind(long msec, const char* txt, bool cancel, bool bar, int div, int i)
bool cancel, bool bar, int div, int i) : : TIndwin(msec, txt, cancel, bar, div), _timer_id(0), _interval(i)
TIndwin(msec, txt, cancel, bar, div) { }
{
_interval = i;
_timer_id = 0L;
}
TTimerind::~TTimerind() TTimerind::~TTimerind()
{ {
if (_timer_id != 0L) if (_timer_id)
xvt_timer_destroy(_timer_id); xvt_timer_destroy(_timer_id);
} }

View File

@ -52,9 +52,9 @@ protected:
word measure_text(TToken_string& t, word& len) const; word measure_text(TToken_string& t, word& len) const;
// @cmember Calcola il rettangolo della barra di attesa // @cmember Calcola il rettangolo della barra di attesa
void get_bar_rct(RCT& r) const; virtual void get_bar_rct(RCT& r) const;
// @cmember Calcola il rettangolo del testo // @cmember Calcola il rettangolo del testo
void get_txt_rct(RCT& r) const; virtual void get_txt_rct(RCT& r) const;
// @cmember converte secondi in una stringa nel formato hh:mm:ss // @cmember converte secondi in una stringa nel formato hh:mm:ss
void sec2str(unsigned long ss, TString& str) const; void sec2str(unsigned long ss, TString& str) const;
@ -140,7 +140,7 @@ class TTimerind : public TIndwin
// @cmember:(INTERNAL) Intervallo di tempo // @cmember:(INTERNAL) Intervallo di tempo
int _interval; int _interval;
// @cmember:(INTERNAL) Indice di tempo // @cmember:(INTERNAL) Indice di tempo
static long _timer_id; long _timer_id;
// @access Protected Member // @access Protected Member
protected: protected:

View File

@ -2116,11 +2116,18 @@ class TPrintind : public TProgind
protected: protected:
virtual void update_bar(); virtual void update_bar();
virtual void get_txt_rct(RCT& r) const;
public: public:
TPrintind(long n, const char* msg); TPrintind(long n, const char* msg);
}; };
void TPrintind::get_txt_rct(RCT& r) const
{
TProgind::get_txt_rct(r);
r.right -= 48; // Lascia posto all'animazione
}
void TPrintind::update_bar() void TPrintind::update_bar()
{ {
TProgind::update_bar(); TProgind::update_bar();
@ -2131,7 +2138,7 @@ void TPrintind::update_bar()
const int n = _status * 100 / _max; const int n = _status * 100 / _max;
const TImage& img = (const TImage&)_modules[n%m]; const TImage& img = (const TImage&)_modules[n%m];
RCT r; get_bar_rct(r); RCT r; get_bar_rct(r);
img.draw(win(), r.right - img.width(), r.bottom + 2); img.draw(win(), r.right - img.width(), r.top - img.height() - 2);
} }
} }