diff --git a/ba/ba1600.h b/ba/ba1600.h index d8c7dabf7..2a2650581 100755 --- a/ba/ba1600.h +++ b/ba/ba1600.h @@ -28,7 +28,7 @@ public: 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, const char * paragraph) : TConfig(path, paragraph) { } virtual ~TInstall_ini() { } diff --git a/ba/ba1700.cpp b/ba/ba1700.cpp index d31df70c8..0cdd7b610 100755 --- a/ba/ba1700.cpp +++ b/ba/ba1700.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -159,6 +158,7 @@ protected: bool get_patches_path(TFilename& path) const; void parse_internet_path(TString& http_server, TFilename& http_path) const; bool is_program_dir(const TFilename& path); + bool is_visible_patch(TConfig& ini) const; public: bool installed() const { return _installed;} @@ -178,6 +178,42 @@ public: 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 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; // Nasconde i moduli riservati da occhi indiscreti - TAuto_token_string oem = ini.get("OEM"); - if (oem.full()) - { - if (oem.get_pos(dongle().oem() < 0)) - return false; - } - else - { - const bool ee = ini.get_bool("Ee"); - if (ee && dongle().oem() != 0) - return false; - } + if (!is_visible_patch(ini)) + return false; const int numpatch = ini.get_int("Patch"); TString4 strpatch; @@ -391,7 +417,7 @@ bool TInstaller_mask::autoload() TFilename remote_ini = http_path; 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); } } @@ -533,29 +559,37 @@ bool TInstaller_mask::autoload() TConfig ini(ininame, module); ini.write_protect(); 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)) break; + } + if (r >= 0) { - const TString16 patchversion = ini.get("Versione"); - const int patchlevel = ini.get_int("Patch"); - TToken_string& row = mask_rows.row(r); - const TString16 release(row.get(C_RELEASE)); - if (patchversion.mid(4) == release.mid(4) // se le versioni corrispondono ... - && patchlevel > row.get_int(C_PATCH)) // ..e il patchlevel è superiore - { - TString4 patch; patch.format("%04d", patchlevel); //aggiunge zeri per avere 3 cifre sempre - row.add(patch, C_PATCH); // aggiorna il patchlevel mostrato per il modulo - row.add(ini.get("Data"), C_DATAREL); // aggiorna data di rilascio - if (row.get_char(C_ISPATCH)<=' ') // se era un modulo ... - { - row.add("+", C_ISPATCH); // .....setta la presenza di patches - row.add(row.get(C_PATCH), C_BASEPATCH); // memorizza patch del modulo + if (is_visible_patch(ini)) + { + const TString16 patchversion = ini.get("Versione"); + const int patchlevel = ini.get_int("Patch"); + TToken_string& row = mask_rows.row(r); + const TString16 release(row.get(C_RELEASE)); + if (patchversion.mid(4) == release.mid(4) // se le versioni corrispondono ... + && patchlevel > row.get_int(C_PATCH)) // ..e il patchlevel è superiore + { + TString4 patch; patch.format("%04d", patchlevel); //aggiunge zeri per avere 3 cifre sempre + row.add(patch, C_PATCH); // aggiorna il patchlevel mostrato per il modulo + row.add(ini.get("Data"), C_DATAREL); // aggiorna data di rilascio + if (row.get_char(C_ISPATCH)<=' ') // se era un modulo ... + { + row.add("+", C_ISPATCH); // .....setta la presenza di patches + row.add(row.get(C_PATCH), C_BASEPATCH); // memorizza patch del modulo + } + if (release < patchversion) + row.add(patchversion, C_RELEASE); } - if (release < patchversion) - row.add(patchversion, C_RELEASE); } + else + destroy(r); // Elimina patch di altri OEM erroneamente inserite } else 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()) { cmd = c; - if (!cmd.blank()) + if (cmd.full()) { TWait_cursor hourglass; 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) { + ini.set_paragraph(module); + if (!is_visible_patch(ini)) + return false; + TInstall_ini curini; 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 word year = version2year(version); - if (year < 2007) + if (year < 2009) return error_box(FR("Il modulo '%s' non ha una versione valida."), module); #ifndef _DEMO_ @@ -688,6 +726,7 @@ return yes; void TInstaller_mask::create_dirs(const char* path) const { + /* TToken_string dirs(path, SLASH); if (SLASH == '\\') dirs.replace('/', SLASH); @@ -705,6 +744,8 @@ void TInstaller_mask::create_dirs(const char* path) const // build destination directory 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 @@ -763,7 +804,7 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool ok = update = false; } if (!update) - ::remove(src); + src.fremove(); } return ok; @@ -913,15 +954,16 @@ void TInstaller_mask::kill_files() list_files (filetokill, filelist); FOR_EACH_ARRAY_ROW(filelist, r, file) { - if (fexist(*file)) - ::remove_file(*file); - killed.add(*file); + filetokill = *file; + if (filetokill.exist()) + filetokill.fremove(); + killed.add(filetokill); } } else { - if (fexist(filetokill)) - ::remove_file(filetokill); + if (filetokill.exist()) + filetokill.fremove(); killed.add(filetokill); } } //for(int k=0... @@ -1722,7 +1764,7 @@ TInstaller_mask::TInstaller_mask() 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_WEB, web_handler); diff --git a/include/progind.cpp b/include/progind.cpp index be797dcd9..dd8d1afbe 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -277,15 +277,13 @@ bool TProgind::setstatus(long l) // TTimerind ------------------------------------------------------------ -long TTimerind::_timer_id = 0L; - void TTimerind::handler(WINDOW w, EVENT* e) { switch(e->type) { case E_CREATE: case E_UPDATE: - if (_status == 0L) + if (_timer_id == 0L && _interval > 0) _timer_id = xvt_timer_create(w, _interval); break; case E_TIMER: @@ -293,7 +291,6 @@ void TTimerind::handler(WINDOW w, EVENT* e) { _status += _interval; force_update(); - xvt_timer_create(w, _interval); } break; default: @@ -302,17 +299,13 @@ void TTimerind::handler(WINDOW w, EVENT* e) TIndwin::handler(w,e); } -TTimerind::TTimerind(long msec, const char* txt, - bool cancel, bool bar, int div, int i) : - TIndwin(msec, txt, cancel, bar, div) -{ - _interval = i; - _timer_id = 0L; -} +TTimerind::TTimerind(long msec, const char* txt, bool cancel, bool bar, int div, int i) + : TIndwin(msec, txt, cancel, bar, div), _timer_id(0), _interval(i) +{ } TTimerind::~TTimerind() { - if (_timer_id != 0L) + if (_timer_id) xvt_timer_destroy(_timer_id); } diff --git a/include/progind.h b/include/progind.h index 2774ae7dc..ee3d7d21f 100755 --- a/include/progind.h +++ b/include/progind.h @@ -52,9 +52,9 @@ protected: word measure_text(TToken_string& t, word& len) const; // @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 - 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 void sec2str(unsigned long ss, TString& str) const; @@ -140,7 +140,7 @@ class TTimerind : public TIndwin // @cmember:(INTERNAL) Intervallo di tempo int _interval; // @cmember:(INTERNAL) Indice di tempo - static long _timer_id; + long _timer_id; // @access Protected Member protected: diff --git a/include/reprint.cpp b/include/reprint.cpp index cfc563120..5a1e51934 100755 --- a/include/reprint.cpp +++ b/include/reprint.cpp @@ -2116,11 +2116,18 @@ class TPrintind : public TProgind protected: virtual void update_bar(); + virtual void get_txt_rct(RCT& r) const; public: 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() { TProgind::update_bar(); @@ -2131,7 +2138,7 @@ void TPrintind::update_bar() const int n = _status * 100 / _max; const TImage& img = (const TImage&)_modules[n%m]; 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); } }