diff --git a/checker/TODO.md b/checker/TODO.md index a8af4a1..2321826 100644 --- a/checker/TODO.md +++ b/checker/TODO.md @@ -89,12 +89,21 @@ DONE -> Check the first time installer DONE -> Improved updater progress ## 1.01 -- Updater: Create a "updating" file at start then delete it at the end. The launcher should check if the file is present, and then relaunch the updater again. +DONE -> Updater: Create a "updating" file at start then delete it at the end. The launcher should check if the file is present, and then relaunch the updater again. + +## 1.02 +DONE -> Force installer to make a folder named "Rise of Mankind - A New Dawn" and to decompress into "Mods/" folder + Check the folder name at start +DONE -> Possibility to use the default color (!?) +DONE -> GUI to exclude files +DONE -> Drop support for Sinhala (unmaintened and less than 1% translated) +DONE -> Add a function to reset the mod in the default state + +## Pending +? - Fix the weird updating loop !? ## 1.1 -- GUI to exclude files +- Add support for exclusions for mods files - Reimplement addon installer -- Calculate a mean remaining time / speed during the update # Notes ## Dev tools diff --git a/checker/and2_checker.pro b/checker/and2_checker.pro index 48b9a38..557bdd3 100644 --- a/checker/and2_checker.pro +++ b/checker/and2_checker.pro @@ -19,7 +19,8 @@ SOURCES += \ w_main.cpp \ w_modules.cpp \ w_options.cpp \ - w_install.cpp + w_install.cpp \ + w_exclusion.cpp HEADERS += \ f_check.h \ @@ -27,14 +28,16 @@ HEADERS += \ w_main.h \ w_modules.h \ w_options.h \ - w_install.h + w_install.h \ + w_exclusion.h FORMS += \ updatebox.ui \ w_main.ui \ w_modules.ui \ w_options.ui \ - w_install.ui + w_install.ui \ + w_exclusion.ui RC_FILE = icon.rc diff --git a/checker/f_check.cpp b/checker/f_check.cpp index b9401f1..8419981 100644 --- a/checker/f_check.cpp +++ b/checker/f_check.cpp @@ -119,6 +119,22 @@ bool f_check::ActionUpdate() return 0; } +bool f_check::ActionReset() +{ + #ifdef _WIN32 + QProcess update; + update.startDetached("upd_proc.exe reset"); + QApplication::quit(); + #endif + #ifdef __linux + QProcess update; + update.startDetached("upd_proc reset"); + QApplication::quit(); + #endif + + return 0; +} + int f_check::GetLocalVersion() { //** Get version number from "Assets/Python/Contrib/CvModName.py" diff --git a/checker/f_check.h b/checker/f_check.h index 86bebe7..2893c80 100644 --- a/checker/f_check.h +++ b/checker/f_check.h @@ -28,6 +28,7 @@ class f_check : public QObject bool ActionLauncherUpdate(); bool PrepareUpdate(); bool ActionUpdate(); + bool ActionReset(); int GetLocalVersion(); int GetDistantVersion(); QString ExtractChangelog(QString filepath); diff --git a/checker/f_civ.cpp b/checker/f_civ.cpp index 5208cbc..d2a6f2b 100644 --- a/checker/f_civ.cpp +++ b/checker/f_civ.cpp @@ -112,7 +112,7 @@ int readColorsCounter() QDomElement value_el = read.firstChildElement("Civ4ModularLoadControls").firstChildElement("ConfigurationInfos").firstChildElement("ConfigurationInfo").firstChildElement("Modules").firstChildElement("Module").toElement(); // Loop - int counter = -1; + int counter = 0; for(;; value_el=value_el.nextSiblingElement() ) { QString bLoad = value_el.firstChildElement("bLoad").text(); @@ -152,18 +152,19 @@ bool setColors(QString color) // Reset all values for(color_element ; !color_element.isNull(); color_element=color_element.nextSiblingElement() ) { color_element.firstChildElement("bLoad").firstChild().setNodeValue("0"); - } + } - color_element = read.firstChildElement("Civ4ModularLoadControls").firstChildElement("ConfigurationInfos").firstChildElement("ConfigurationInfo").firstChildElement("Modules").firstChildElement("Module").toElement(); + if(color != "default"){ + color_element = read.firstChildElement("Civ4ModularLoadControls").firstChildElement("ConfigurationInfos").firstChildElement("ConfigurationInfo").firstChildElement("Modules").firstChildElement("Module").toElement(); - for(color_element ; !color_element.isNull(); color_element=color_element.nextSiblingElement() ) { - QString txtValue = color_element.firstChildElement("Directory").firstChild().nodeValue(); - if (txtValue == color) { - color_element.firstChildElement("bLoad").firstChild().setNodeValue("1"); + for(color_element ; !color_element.isNull(); color_element=color_element.nextSiblingElement() ) { + QString txtValue = color_element.firstChildElement("Directory").firstChild().nodeValue(); + if (txtValue == color) { + color_element.firstChildElement("bLoad").firstChild().setNodeValue("1"); + } } } - // Save content back to the file if (!file.open(QIODevice::Truncate | QIODevice::WriteOnly)) { return 0; diff --git a/checker/lang/installer_es.xml b/checker/lang/installer_es.xml index 6a3e90e..4200f38 100644 --- a/checker/lang/installer_es.xml +++ b/checker/lang/installer_es.xml @@ -2,6 +2,9 @@ Civilización IV: A New Dawn pack de expansión necesario + Versión del lanzador: ${VERSION}\n\nEste asistente le guiará a través de la instalación de Civilization IV: A New Dawn.\n\nEl mod se instalará en \'Mis documentos\My Games\Beyond the Sword\Mods\' de forma predeterminada.\nCreará un acceso directo (opcional) al lanzador mod, que se utilizará para descargar fácilmente, actualizar o configurar la mod instalación.\n\nADVERTENCIA: Cualquier instalación existente del mod es compatible. Sin embargo, si tienes archivos modificadas, puede sobrescribirse sobre actualización del mod. + Programa de instalación instalará el paquete de expansión en la siguiente carpeta. +Para instalarlo en una carpeta diferente, haga clic en \'Examinar...\' y seleccione otra carpeta.$\n$\nNOTA: se recomienda encarecidamente utilizar la carpeta predeterminada seleccionada por debajo. Sin embargo, puede instalar el mod directamente en la carpeta del juego (\'Sid Meier\'s Civilization IV Beyond the Sword\Beyond the Sword\Mods\'). El lanzador está instalado. En el primer lanzamiento, detectará si el mod está presente en el directorio. Si no es así, sólo sigue el procedimiento de instalación. Iniciar el lanzador mod Crear acceso directo del escritorio diff --git a/checker/lang/installer_fr.xml b/checker/lang/installer_fr.xml index 5a73db9..f7ff66b 100644 --- a/checker/lang/installer_fr.xml +++ b/checker/lang/installer_fr.xml @@ -2,6 +2,8 @@ Civilization IV: A New Dawn pack d\'expansion requis + Version du lanceur: ${VERSION}\n\nCet assistant d\'installation va vous guider pour l\'installation de Civilization IV: A New Dawn.\n\nLe mod sera installé dans \'My Documents\My Games\Beyond the Sword\Mods\' par défaut. \nIl va créer un raccourci (option) vers le lanceur, qui sera utilisé pour télécharger, mettre à jour ou configurer l\'installation du mod.\n\nATTENTION : Si le mod est déjà installé, le lanceur pourrait remplacer certains de vos fichiers pendant les mises à jour. + L\'installateur va installer le pack d\'expansion dans le dossier suivant.$\nPour l\'installer dans un dossier différent, cliquez sur \'Parcourir...\' et sélectionnez un autre dossier.$\n$\nNOTE: Il est hautement recommandé d\'utiliser le dossier par défaut sélectionné ci-dessous. Cependant, vous pouvez choisir d\'installer le mod directement dans le dossier du jeu (\'Sid Meier\'s Civilization IV Beyond the Sword\Beyond the Sword\Mods\'). Le lanceur est maintenant installé. Au premier lancement, il va essayer de détecter si le mod est présent dans le répertoire. Si ce n\'est pas le cas, il suffit de suivre la procédure d\'installation. Démarrer le lanceur Créer un raccourci sur le bureau diff --git a/checker/lang/launcher.ts b/checker/lang/launcher.ts index 08cfba1..6cd304b 100644 --- a/checker/lang/launcher.ts +++ b/checker/lang/launcher.ts @@ -9,7 +9,7 @@ - + There seems to be a problem with the previous update. Checking file again. @@ -50,6 +50,19 @@ + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install @@ -101,22 +114,22 @@ - + Community - + Addons - + Help us to improve the mod ! - + Language @@ -257,30 +270,50 @@ - + + Reset mod to default state + + + + Check for update - + Update available ! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) - + Cache - + The cache is now cleared. NOTE: It is already automatically cleared on update. + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + + w_modules @@ -329,81 +362,91 @@ - Black + Dark blue (default) - Coal + Black - Dark red + Coal - Forest + Dark red - Purple + Forest - Red + Purple - Silver + Red + Silver + + + + Cerulean - + Game path: - + Select game path - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> - + Close the launcher when game start - + Autostart the mod with the game - + + Exclude files from update + + + + No path specified - + The game path has been changed - + No game path specified. diff --git a/checker/lang/launcher_de.ts b/checker/lang/launcher_de.ts index eb1e053..d35ece5 100644 --- a/checker/lang/launcher_de.ts +++ b/checker/lang/launcher_de.ts @@ -7,7 +7,7 @@ Der Launcher ist nicht im richtigen Verzeichnis. Er sollte entweder in 'Dokumente/My Games/Beyond the sword/Mods/Rise of Mankind - A New Dawn' oder in 'Civilization IV (root game folder)/Beyond the sword/Mods/Rise of Mankind - A New Dawn' sein. - + There seems to be a problem with the previous update. Checking file again. @@ -48,6 +48,19 @@ Es ist ein Update verfügbar. Möchten Sie updaten? + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install @@ -99,22 +112,22 @@ Installation reparieren - + Community Community - + Addons - + Help us to improve the mod ! Hilf uns die Mod zu verbessern! - + Language Sprache @@ -255,30 +268,50 @@ SVN Kommando eingeben - + + Reset mod to default state + + + + Check for update Auf Update überprüfen - + Update available ! Update verfügbar! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) Um das Spiel über den Launcher zu starten muss der Pfad zum Spiel in den Optionen (Optionen > Pfad zum Spiel angeben) angegeben werden - + Cache Cache - + The cache is now cleared. NOTE: It is already automatically cleared on update. Der Cache wurde geleert. Achtung: Er wird mit jedem Update automatisch geleert. + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + + w_modules @@ -327,81 +360,91 @@ + Dark blue (default) + + + + Black Schwarz - + Coal Kohle - + Dark red Dunkelrot - + Forest Wald - + Purple Lila - + Red Rot - + Silver Silber - + Cerulean Himmelblau - + Game path: Spielpfad: - + Select game path Pfad zum Spiel angeben - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher Konfiguration :</span></p></body></html> - + Close the launcher when game start Den Launcher schließen wenn das Spiel startet - + Autostart the mod with the game Die Mod automatisch mit dem Spiel starten - + + Exclude files from update + + + + No path specified Kein Pfad angegeben - + The game path has been changed Der Spielpfad wurde geändert - + No game path specified. Kein Spielpfad angegeben. diff --git a/checker/lang/launcher_es.ts b/checker/lang/launcher_es.ts index 14eeb2b..51466c0 100644 --- a/checker/lang/launcher_es.ts +++ b/checker/lang/launcher_es.ts @@ -7,7 +7,7 @@ El lanzador no está en el correcto directorio. Debe ser en 'My Documents/My Games/Beyond the sword/Mods/Rise of Mankind - A New Dawn' o en ' Civilization IV (carpeta del juego)/Beyond the sword/Mods/Rise of Mankind - A New Dawn' - + There seems to be a problem with the previous update. Checking file again. Parece haber un problema con la actualización anterior. Revisando el archivo. @@ -32,7 +32,7 @@ files left. - + ficheros restante. @@ -48,6 +48,19 @@ Hay una actualización disponible. ¿Quieres actualizar? + + w_exclusion + + + Choose which files to exclude from update + Seleccione los archivos a excluir de la actualización + + + + File + Archivo + + w_install @@ -99,22 +112,22 @@ Reparar instalación - + Community Comunidad - + Addons Addons - + Help us to improve the mod ! Ayúdanos a mejorar el mod! - + Language Idioma @@ -255,30 +268,50 @@ Introduzca el comando SVN - + + Reset mod to default state + Restablecer mod al estado predeterminado + + + Check for update Verificación de actualización - + Update available ! Actualización disponible! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) Para ser capaz de lanzar el juego desde el lanzador, necesita establecer la ruta de juego en la ventana de opciones. (Opciones > seleccione ruta del juego) - + Cache Caché - + The cache is now cleared. NOTE: It is already automatically cleared on update. Ahora es la cache. Nota: Ya automáticamente está desactivada en actualización. + + + Reset mod + Reiniciar el mod + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + Esto reiniciará el mod para el estado por defecto. Se eliminará cualquier modificación o preferencias del lanzador. + + + + Are you sure to continue ? + ¿Está seguro de continuar? + w_modules @@ -328,82 +361,92 @@ Configuración mod :</span></p></body></html> + Dark blue (default) + Azul oscuro (defecto) + + + Black Negro - + Coal Carbón - + Dark red Rojo oscuro - + Forest Bosque - + Purple Púrpura - + Red Rojo - + Silver Plata - + Cerulean Cerúleo - + Game path: Ruta de juego: - + Select game path Seleccione ruta del juego - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> <html><head/><body><p><span style=" font-size:10pt; font-weight:600;"> Configuración del lanzador :</span></p></body></html> - + Close the launcher when game start Cierra el lanzador cuando empiezan a juego - + Autostart the mod with the game Iniciar el mod con el juego - + + Exclude files from update + Excluir archivos de actualización + + + No path specified No hay ruta de acceso especificada - + The game path has been changed Se ha cambiado el camino juego - + No game path specified. No hay juego ruta de acceso especificada. diff --git a/checker/lang/launcher_fi.ts b/checker/lang/launcher_fi.ts index 79e57b6..fff4eed 100644 --- a/checker/lang/launcher_fi.ts +++ b/checker/lang/launcher_fi.ts @@ -7,7 +7,7 @@ - + There seems to be a problem with the previous update. Checking file again. @@ -48,6 +48,19 @@ + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install @@ -99,22 +112,22 @@ - + Community - + Addons - + Help us to improve the mod ! - + Language @@ -255,30 +268,50 @@ - + + Reset mod to default state + + + + Check for update - + Update available ! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) - + Cache - + The cache is now cleared. NOTE: It is already automatically cleared on update. + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + + w_modules @@ -327,81 +360,91 @@ - Black + Dark blue (default) - Coal + Black - Dark red + Coal - Forest + Dark red - Purple + Forest - Red + Purple - Silver + Red + Silver + + + + Cerulean - + Game path: - + Select game path - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> - + Close the launcher when game start - + Autostart the mod with the game - + + Exclude files from update + + + + No path specified - + The game path has been changed - + No game path specified. diff --git a/checker/lang/launcher_fr.ts b/checker/lang/launcher_fr.ts index b322c93..32c44ac 100644 --- a/checker/lang/launcher_fr.ts +++ b/checker/lang/launcher_fr.ts @@ -7,7 +7,7 @@ Le lanceur n'est pas dans le bon répertoire. Il devrait se trouver dans "My Documents/My Games/Beyond the sword/Mods/Rise of Mankind - A New Dawn' ou dans ' Civilization IV (dossier racine du jeu)/Beyond the sword/Mods/Rise of Mankind - A New Dawn' - + There seems to be a problem with the previous update. Checking file again. Il semble qu'il y ait eu un problème avec la mise à jour précédente. Nouvelle vérification des fichiers. @@ -48,6 +48,19 @@ Il y a une mise à jour disponible. Vous voulez mettre à jour ? + + w_exclusion + + + Choose which files to exclude from update + Choisir les fichiers à exclure de la mise à jour + + + + File + Fichier + + w_install @@ -99,22 +112,22 @@ Réparer installation - + Community Communauté - + Addons Modules - + Help us to improve the mod ! Aidez-nous à améliorer le mod ! - + Language Langue @@ -255,30 +268,50 @@ Entrez la commande SVN - + + Reset mod to default state + Réinitialiser l'installation du mod + + + Check for update Vérifier mises à jours - + Update available ! Mise à jour disponible ! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) Pour être en mesure de lancer le jeu depuis le lanceur, vous devez définir le chemin d'accès de jeu dans la fenêtre options. (Options > Selectionner chemin du jeu) - + Cache Cache - + The cache is now cleared. NOTE: It is already automatically cleared on update. Le cache est maintenant effacé. Remarque : il est déjà automatiquement effacé lors d'une mise à jour. + + + Reset mod + Réinitialiser le mod + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + Cela réinitialisera le mod à son état par défaut. Toute modification ou préférence du lanceur sera supprimée. + + + + Are you sure to continue ? + Êtes-vous sûr de continuer ? + w_modules @@ -327,81 +360,91 @@ + Dark blue (default) + Bleu foncé (défaut) + + + Black Noir - + Coal Charbon - + Dark red Rouge foncé - + Forest Forêt - + Purple Violet - + Red Rouge - + Silver Argent - + Cerulean Bleu céruléen - + Game path: Chemin du jeu : - + Select game path Sélectionnez chemin du jeu - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Configuration du lanceur :</span></p></body></html> - + Close the launcher when game start Fermer le lanceur lorsque le jeu démarre - + Autostart the mod with the game Démarrer le mod avec le jeu - + + Exclude files from update + Exclure des fichiers de la mise à jour + + + No path specified Aucun chemin d'accès spécifié - + The game path has been changed Le chemin d'accès de jeu a été changé - + No game path specified. Aucun chemin d'accès du jeu spécifié diff --git a/checker/lang/launcher_hu.ts b/checker/lang/launcher_hu.ts index e286496..fc104dc 100644 --- a/checker/lang/launcher_hu.ts +++ b/checker/lang/launcher_hu.ts @@ -7,7 +7,7 @@ - + There seems to be a problem with the previous update. Checking file again. @@ -48,6 +48,19 @@ + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install @@ -99,22 +112,22 @@ - + Community - + Addons - + Help us to improve the mod ! - + Language @@ -255,30 +268,50 @@ - + + Reset mod to default state + + + + Check for update - + Update available ! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) - + Cache - + The cache is now cleared. NOTE: It is already automatically cleared on update. + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + + w_modules @@ -327,81 +360,91 @@ - Black + Dark blue (default) - Coal + Black - Dark red + Coal - Forest + Dark red - Purple + Forest - Red + Purple - Silver + Red + Silver + + + + Cerulean - + Game path: - + Select game path - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> - + Close the launcher when game start - + Autostart the mod with the game - + + Exclude files from update + + + + No path specified - + The game path has been changed - + No game path specified. diff --git a/checker/lang/launcher_it.ts b/checker/lang/launcher_it.ts index d120586..7a3c323 100644 --- a/checker/lang/launcher_it.ts +++ b/checker/lang/launcher_it.ts @@ -7,7 +7,7 @@ Il lanciatore non è nella giusta directory. Dovrebbe essere in ' My Documents / My Games/Beyond spada/Mods/aumento dell'umanità - nuova alba A' o in ' Civilization IV (cartella principale del gioco) / di là della spada/Mods/aumento dell'umanità - nuova alba A' - + There seems to be a problem with the previous update. Checking file again. @@ -48,6 +48,19 @@ C'è un aggiornamento disponibile. Vuoi aggiornare? + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install @@ -99,22 +112,22 @@ - + Community - + Addons - + Help us to improve the mod ! - + Language @@ -255,30 +268,50 @@ - + + Reset mod to default state + + + + Check for update - + Update available ! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) - + Cache - + The cache is now cleared. NOTE: It is already automatically cleared on update. + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + + w_modules @@ -327,81 +360,91 @@ - Black + Dark blue (default) - Coal + Black - Dark red + Coal - Forest + Dark red - Purple + Forest - Red + Purple - Silver + Red + Silver + + + + Cerulean - + Game path: - + Select game path - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> - + Close the launcher when game start - + Autostart the mod with the game - + + Exclude files from update + + + + No path specified - + The game path has been changed - + No game path specified. diff --git a/checker/lang/launcher_pl.ts b/checker/lang/launcher_pl.ts index 8fd63eb..9b22e22 100644 --- a/checker/lang/launcher_pl.ts +++ b/checker/lang/launcher_pl.ts @@ -7,7 +7,7 @@ Launcher nie jest w prawidłowym katalogu. Powinien znajdować się w: 'My Documents/My Games/Beyond the sword/Mods/Rise of Mankind - A New Dawn' lub w 'Civilization IV (root game folder)/Beyond the sword/Mods/Rise of Mankind - A New Dawn' - + There seems to be a problem with the previous update. Checking file again. @@ -48,6 +48,19 @@ Jest dostępna aktualizacja. Chcesz zaktualizować? + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install @@ -99,22 +112,22 @@ Napraw instalacje - + Community Społeczność - + Addons - + Help us to improve the mod ! Pomóż nam ulepszyć modyfikację! - + Language Język @@ -256,30 +269,50 @@ Wprowadź komendę SVN - + + Reset mod to default state + + + + Check for update Sprawdź aktualizacje - + Update available ! Aktualizacja dostępna! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) By uruchomić grę z launchera, należy podać w opcjach ścieżkę do gry (Opcje > Podaj ścieżkę gry) - + Cache Pamięć podręczna - + The cache is now cleared. NOTE: It is already automatically cleared on update. Pamięć podręczna została wyczyszczona. UWAGA: Będzie czyszczony automatycznie przy aktualizacji + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + + w_modules @@ -328,81 +361,91 @@ + Dark blue (default) + + + + Black Czarny - + Coal Węglowy - + Dark red Ciemny Czerwony - + Forest Las - + Purple Purpurowy - + Red Czerwony - + Silver Srebrny - + Cerulean Ceruleum - + Game path: Ścieżka gry: - + Select game path Podaj ścieżkę gry - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Konfiguracja launchera:</span></p></body></html> - + Close the launcher when game start Zamknij launcher przy starcie gry - + Autostart the mod with the game Automatyczny start modyfikacji wraz ze startem gry - + + Exclude files from update + + + + No path specified Brak podanej ścieżki - + The game path has been changed Ścieżka gry została zmieniona - + No game path specified. Brak podanej ścieżki do gry diff --git a/checker/lang/launcher_ru.ts b/checker/lang/launcher_ru.ts index 7555f35..54cff96 100644 --- a/checker/lang/launcher_ru.ts +++ b/checker/lang/launcher_ru.ts @@ -7,7 +7,7 @@ - + There seems to be a problem with the previous update. Checking file again. @@ -48,6 +48,19 @@ + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install @@ -99,22 +112,22 @@ - + Community - + Addons - + Help us to improve the mod ! - + Language @@ -255,30 +268,50 @@ - + + Reset mod to default state + + + + Check for update - + Update available ! - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) - + Cache - + The cache is now cleared. NOTE: It is already automatically cleared on update. + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + + w_modules @@ -327,81 +360,91 @@ - Black + Dark blue (default) - Coal + Black - Dark red + Coal - Forest + Dark red - Purple + Forest - Red + Purple - Silver + Red + Silver + + + + Cerulean - + Game path: - + Select game path - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> - + Close the launcher when game start - + Autostart the mod with the game - + + Exclude files from update + + + + No path specified - + The game path has been changed - + No game path specified. diff --git a/checker/lang/launcher_si.ts b/checker/lang/launcher_si.ts index 0c55194..b49f84a 100644 --- a/checker/lang/launcher_si.ts +++ b/checker/lang/launcher_si.ts @@ -1,4 +1,6 @@ - + + + QObject @@ -7,9 +9,9 @@ දියත්කිරීම නියමිත නාමාවලියෙහි නොමැත .එය 'මගේ ලියවිලි /මගේ ක්‍රීඩා /අසිපත් වලින් ඔබ්බට /මොඩ්ස්/මනුෂ්‍ය වර්ගය පිබිදීම -නව පිබිදීමක් හෝ 4 වන ශිෂ්ටාචාරය (මුල් ක්‍රීඩා ගොනුව )/අසිපත් වලින් ඔබ්බට /මොඩ්ස්/මනුෂ්‍ය වර්ගය පිබිදීම -නව පිබිදීමක් - + There seems to be a problem with the previous update. Checking file again. - + @@ -17,22 +19,22 @@ Module updater - + Updating the game. Please be patient. - + Checking and downloading data: - + files left. - + @@ -48,27 +50,40 @@ නවීකරණයක් පවතියි .ඔබට නවීකරණයක් අවශ්‍ය ද ? + + w_exclusion + + + Choose which files to exclude from update + + + + + File + + + w_install Mod installation - + <html><head/><body><p align="center"><span style=" font-size:10pt; font-weight:600;">A New Dawn : </span></p><p align="center"><span style=" font-size:9pt;">The mod is not installed.</span></p><p align="center"><span style=" font-size:9pt;">Do you want to download and install it ?</span></p></body></html> - + Ok - + Cancel - + @@ -76,208 +91,228 @@ Launch Civilization IV - + Manage modules - + Options - + Menu - + Fix installation - + - + Community - + - + Addons - + - + Help us to improve the mod ! - + - + Language - + Exit - + Forum - + Bugreport (forum) - + About AND Resurrection team (forum) - + "Mega Civ Pack" (forum) - + "More music / More handicaps / Dinosaurs" (forum) - + Open mod folder - + Git: Create binary pack - + Git: Create update binary pack - + Translate the mod - + Help for translation (forum) - + Translate the launcher - + English - + French - + Sinhala - + Hungarian - + Finnish - + Polish - + Italian - + Spanish - + German - + Russian - + Restore default state - + Revert to an older revision... - + Addon "Blue marble" - + Clear cache - + Enter SVN command - + + + + + Reset mod to default state + - + Check for update - + - + Update available ! - + - + To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path) - + - + Cache - + - + The cache is now cleared. NOTE: It is already automatically cleared on update. - + + + + + Reset mod + + + + + This will reset the mod to the default state. Any modification or launcher preferences will be removed. + + + + + Are you sure to continue ? + @@ -285,17 +320,17 @@ Modules - + Local - + Distant - + @@ -303,107 +338,117 @@ Options - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Mod configuration :</span></p></body></html> - + Enable formations (more graphical units) - + Enable Blue Marble (alternative terrain graphics) - + Interface color: - + - Black - + Dark blue (default) + - Coal - + Black + - Dark red - + Coal + - Forest - + Dark red + - Purple - + Forest + - Red - + Purple + - Silver - + Red + + Silver + + + + Cerulean - + - + Game path: - + - + Select game path - + - + <html><head/><body><p><span style=" font-size:10pt; font-weight:600;">Launcher configuration :</span></p></body></html> - + - + Close the launcher when game start - + - + Autostart the mod with the game - + + + + + Exclude files from update + - + No path specified - + - + The game path has been changed - + - + No game path specified. - + - \ No newline at end of file + diff --git a/checker/main.cpp b/checker/main.cpp index 6a886e4..ae8f1ed 100644 --- a/checker/main.cpp +++ b/checker/main.cpp @@ -84,20 +84,27 @@ int main(int argc, char *argv[]) // Check for existing installation QFile temp("updating"); - if(temp.exists()){ + QFile reset("reset"); + if(temp.exists() || reset.exists()){ f_check updater; updater.PrepareUpdate(); QMessageBox msgBox; msgBox.setText(QObject::tr("There seems to be a problem with the previous update. Checking file again.")); msgBox.exec(); - QFile::remove("updating"); #ifdef _WIN32 - system("taskkill /F rsync.exe"); + system("taskkill /IM rsync.exe"); #endif #ifdef __linux system("killall rsync"); #endif - updater.ActionUpdate(); + if(temp.exists()){ + QFile::remove("updating"); + updater.ActionUpdate(); + } + if(reset.exists()){ + QFile::remove("reset"); + updater.ActionReset(); + } return a.exec(); } diff --git a/checker/w_exclusion.cpp b/checker/w_exclusion.cpp new file mode 100644 index 0000000..b7b998e --- /dev/null +++ b/checker/w_exclusion.cpp @@ -0,0 +1,330 @@ +#include "w_exclusion.h" +#include "ui_w_exclusion.h" +#include "QtCore" +#include + +w_exclusion::w_exclusion(QWidget *parent) : + QDialog(parent), + ui(new Ui::w_exclusion) +{ + ui->setupUi(this); + + // List files in tree widget + ui->treeWidget->setColumnCount(1); + ui->treeWidget->setHeaderLabels(QStringList() << "File"); + + // Read XML exclusion + QStringList checked_list; + checked_list << ReadExcludedList("checker/exclusions.default.xml"); + checked_list << ReadExcludedList("checker/exclusions.custom.xml"); + + // Test + treeWidget = new QTreeWidget; + QStringList list = ListFiles(); + PopulateList(ui->treeWidget, list, checked_list); + + // Connect checkboxes + connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *,int)), this, SLOT(modeItemChecked(QTreeWidgetItem *,int))); + connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(GetOutputList())); +} + +void w_exclusion::AddItem(QTreeWidget *treeWidget, QTreeWidgetItem *itm, QString string) +{ + itm->setText(0,string); + itm->setFlags(itm->flags() | Qt::ItemIsUserCheckable); + itm->setCheckState(0,Qt::Checked); + ui->treeWidget->insertTopLevelItem(0,itm); + treeWidget->addTopLevelItem(itm); +} + +QStringList w_exclusion::ListFiles() +{ + // List all files + QStringList files; + + QDirIterator iterator(".", QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + do{ + QString path = iterator.filePath(); + path.remove(0,2); + if (!path.isEmpty()){ + files << path; + } + iterator.next(); + } while (iterator.hasNext()); + + files.sort(Qt::CaseInsensitive); + + return files; +} + +void w_exclusion::PopulateList(QTreeWidget *treeWidget, QStringList file_list, QStringList exclusion_list){ + // Code borrowed from https://stackoverflow.com/questions/10348801/populate-qtreewidget-with-hierarchic-structure-from-absolute-filepaths + foreach (QString fileName, file_list) + { + bool checked = 0; + QStringList splitFileName = fileName.split("/"); + foreach(QString path, exclusion_list){ + if(path == fileName){ + checked = 1; + //qDebug() << "File found"; + } + } + + // add root folder as top level item if treeWidget doesn't already have it + if (treeWidget->findItems(splitFileName[0], Qt::MatchFixedString).isEmpty()) + { + topLevelItem = new QTreeWidgetItem; + topLevelItem->setText(0,splitFileName[0]); + topLevelItem->setFlags(topLevelItem->flags() | Qt::ItemIsUserCheckable); + if(checked == 1){ + topLevelItem->setCheckState(0,Qt::Checked); + } + else{ + topLevelItem->setCheckState(0,Qt::Unchecked); + } + + treeWidget->addTopLevelItem(topLevelItem); + } + + QTreeWidgetItem *parentItem = topLevelItem; + + // iterate through non-root directories (file name comes after) + //qDebug() << splitFileName.size(); + for (int i = 1; i < (splitFileName.size() - 1); ++i) + { + //qDebug() << "here"; + // iterate through children of parentItem to see if this directory exists + bool thisDirectoryExists = false; + for (int j = 0; j < parentItem->childCount(); ++j) + { + if (splitFileName[i] == parentItem->child(j)->text(0)) + { + thisDirectoryExists = true; + parentItem = parentItem->child(j); + break; + } + } + + if (!thisDirectoryExists) + { + // Add directory + parentItem = new QTreeWidgetItem(parentItem); + parentItem->setFlags(parentItem->flags() | Qt::ItemIsUserCheckable); + if(checked == 1){ + parentItem->setCheckState(0,Qt::Checked); + } + else{ + parentItem->setCheckState(0,Qt::Unchecked); + } + parentItem->setText(0, splitFileName[i]); + } + + } + if(splitFileName.size() > 1){ + QTreeWidgetItem *childItem = new QTreeWidgetItem(parentItem); + childItem->setText(0, splitFileName.last()); + childItem->setFlags(childItem->flags() | Qt::ItemIsUserCheckable); + if(checked == 1){ + childItem->setCheckState(0,Qt::Checked); + } + else{ + childItem->setCheckState(0,Qt::Unchecked); + } + } + + } +} + +void w_exclusion::CheckChildState(QTreeWidgetItem* item, enum Qt::CheckState eCheckState){ + //qDebug("Check child state"); + if(item) + { + int nChildCount = item->childCount(); + for (int i = 0; i < nChildCount; i++) + { + item->child(i)->setCheckState(0,eCheckState); + } + } +} + +void w_exclusion::modeItemChecked(QTreeWidgetItem * item, int nColumn ) +{ + if (item != NULL && nColumn != -1) + { + enum Qt::CheckState eCheckState = item->checkState(0); + CheckChildState(item, eCheckState); // Check Items Children + } +} + +void w_exclusion::ValidateParentState(QTreeWidgetItem* item) +{ + QTreeWidgetItem* parentItem = NULL; + enum Qt::CheckState eCheckState = Qt::Unchecked; + + if (item != NULL) // Is a valid Item + { + parentItem = item->parent(); + if (parentItem != NULL) // Item was a child + { + int nChildCount = parentItem->childCount(); + for (int i = 0; i < nChildCount; i++) + { + // See if any siblings are checked + if (parentItem->child(i)->checkState(0) == Qt::Checked) + { + eCheckState = Qt::Checked; + break; + } + } + parentItem->setCheckState(0, eCheckState); // Set parent according to children status + } + } +} + +QStringList w_exclusion::ReadExcludedList(QString filepath){ + + // Open the XML file + QDomDocument read; + QFile file(filepath); + if(!file.open(QIODevice::ReadOnly)) + { + qDebug() << "Error opening file"; + QStringList error; + error << "Error opening file"; + return error; + } + read.setContent(&file); + file.close(); + + // Read every exclusions + QStringList exclusions; + QDomElement entity = read.firstChildElement("exclusions").firstChildElement(); + + while(!entity.isNull()){ + exclusions << entity.text(); + //qDebug() << entity.text(); + entity=entity.nextSiblingElement(); + } + + // Split string list into a formatted exclusion list + /*foreach(QString entry, exclusions){ + qDebug() << entry; + }*/ + //qDebug() << exclude_list; + + return exclusions; +} + +void w_exclusion::GetOutputList(){ + QStringList excluded_list; + excluded_list = GetCheckedList(); + QList excluded_values; + excluded_values << ReadExcludedList("checker/exclusions.default.xml"); + excluded_values << ReadExcludedList("checker/exclusions.custom.xml"); + foreach(QStringList string_list, excluded_values){ + foreach(QString entry1, excluded_list){ + foreach (QString entry2, string_list){ + if(entry1 == entry2){ + excluded_list.removeAll(entry2); + } + } + } + } + WriteToXML(excluded_list); +} + +QStringList w_exclusion::GetCheckedList(){ + QTreeWidgetItemIterator it(ui->treeWidget); + QStringList checked_list; + // Get file list + while (*it) { + if((*it)->checkState(0) == Qt::Checked){ + QStringList filepath; + filepath << (*it)->text(0); + + // Check if it have parents + QTreeWidgetItem* parentItem; + parentItem = (*it)->parent(); + while(parentItem != NULL){ + filepath << parentItem->text(0); + //qDebug() << parentItem->text(0); + parentItem = parentItem->parent(); + } + + // Reverse list + QListIterator itl(filepath); + QStringList reverse_list; + itl.toBack(); + while(itl.hasPrevious()){ + reverse_list << itl.previous(); + } + checked_list << reverse_list.join("/"); + + } + ++it; + } + + /*foreach(QString entry, checked_list){ + qDebug() << entry; + }*/ + return checked_list; +} + +void w_exclusion::WriteToXML(QStringList file_list){ + // Load the file + QDomDocument xml; + QFile file("checker/exclusions.custom.xml"); + if(!file.open(QIODevice::ReadOnly)) + { + qDebug() << "Error opening custom xml"; + return; + } + xml.setContent(&file); + file.close(); + + // Set the correct node + QDomElement root = xml.firstChildElement().toElement(); + QDomElement entity = xml.firstChildElement("exclusions").firstChildElement("entity").toElement(); + + // Check each entity for corresponding file + QList nodes_to_remove; + for(entity;!entity.isNull();entity=entity.nextSiblingElement()){ + QString value = entity.firstChild().nodeValue(); + qDebug() << value; + int counter = 0; + foreach(QString entry, file_list){ + if(value == entry){ + counter++; + file_list.removeAll(entry); + } + } + + // Add node in removal list + if(counter==0){ + nodes_to_remove << entity; + } + } + + // Remove unchecked nodes + foreach(QDomNode node, nodes_to_remove){ + node.parentNode().removeChild(node); + } + + // Add new nodes + foreach(QString entry, file_list){ + qDebug() << entry; + QDomElement temp_node = xml.createElement("entity"); + root.appendChild(temp_node); + temp_node.appendChild(xml.createTextNode(entry)); + } + + // Save to file + file.open(QIODevice::Truncate | QIODevice::WriteOnly); + file.write(xml.toByteArray()); + file.close(); +} + +w_exclusion::~w_exclusion() +{ + delete ui; +} diff --git a/checker/w_exclusion.h b/checker/w_exclusion.h new file mode 100644 index 0000000..3b0ca07 --- /dev/null +++ b/checker/w_exclusion.h @@ -0,0 +1,38 @@ +#ifndef W_EXCLUSION_H +#define W_EXCLUSION_H + +#include +#include +#include + +namespace Ui { +class w_exclusion; +} + +class w_exclusion : public QDialog +{ + Q_OBJECT + +public: + explicit w_exclusion(QWidget *parent = 0); + void AddItem(QTreeWidget *treeWidget, QTreeWidgetItem *itm, QString string); + QStringList ListFiles(); + void PopulateList(QTreeWidget *treeWidget, QStringList file_list, QStringList exclusion_list); + void CheckChildState(QTreeWidgetItem* item, enum Qt::CheckState eCheckState); + void ValidateParentState(QTreeWidgetItem* item); + QStringList ReadExcludedList(QString filepath); + void WriteToXML(QStringList file_list); + QStringList GetCheckedList(); + ~w_exclusion(); + +public slots: + void modeItemChecked(QTreeWidgetItem * item, int nColumn ); + void GetOutputList(); + +private: + Ui::w_exclusion *ui; + QTreeWidget* treeWidget; + QTreeWidgetItem *topLevelItem; +}; + +#endif // W_EXCLUSION_H diff --git a/checker/w_exclusion.ui b/checker/w_exclusion.ui new file mode 100644 index 0000000..ee55ff2 --- /dev/null +++ b/checker/w_exclusion.ui @@ -0,0 +1,107 @@ + + + w_exclusion + + + + 0 + 0 + 600 + 500 + + + + + 0 + 0 + + + + + 600 + 500 + + + + + 600 + 500 + + + + Choose which files to exclude from update + + + + + + + + 10 + 460 + 581 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 15 + 11 + 571 + 441 + + + + + + + + File + + + + + + + + buttonBox + accepted() + w_exclusion + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + w_exclusion + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/checker/w_main.cpp b/checker/w_main.cpp index cb64e6f..4254f84 100644 --- a/checker/w_main.cpp +++ b/checker/w_main.cpp @@ -46,7 +46,6 @@ w_main::w_main(QWidget *parent) : clear_language_state(); if(loc=="en"){ui->language_en->setChecked(1);} if(loc=="fr"){ui->language_fr->setChecked(1);} - if(loc=="si"){ui->language_si->setChecked(1);} if(loc=="hu"){ui->language_hu->setChecked(1);} if(loc=="fi"){ui->language_fi->setChecked(1);} if(loc=="it"){ui->language_it->setChecked(1);} @@ -64,7 +63,6 @@ w_main::w_main(QWidget *parent) : ui->language_it->setIcon(QIcon("checker/icons/it.png")); ui->language_pl->setIcon(QIcon("checker/icons/pl.png")); ui->language_ru->setIcon(QIcon("checker/icons/ru.png")); - ui->language_si->setIcon(QIcon("checker/icons/si.png")); ui->language_es->setIcon(QIcon("checker/icons/es.png")); ui->actionOpen_mod_folder->setIcon(QIcon("checker/icons/open.png")); ui->actionExit->setIcon(QIcon("checker/icons/exit.png")); @@ -81,6 +79,7 @@ w_main::w_main(QWidget *parent) : ui->menuFix_installation->setIcon(QIcon("checker/icons/fix.png")); ui->actionClean_up->setIcon(QIcon("checker/icons/clean.png")); ui->actionClear_cache->setIcon(QIcon("checker/icons/clear.png")); + ui->actionReset->setIcon(QIcon("checker/icons/reset.png")); // GUI : Set title and background @@ -286,16 +285,6 @@ void w_main::on_language_fr_triggered() ui->language_fr->setChecked(1); } -void w_main::on_language_si_triggered() -{ - translator->load(QString("launcher_si.qm"),"checker/lang/"); - setCheckerParam("Main/Lang","si"); - ui->retranslateUi(this); - modules->UpdateWindow(); - clear_language_state(); - ui->language_si->setChecked(1); -} - void w_main::on_language_hu_triggered() { translator->load(QString("launcher_hu.qm"),"checker/lang/"); @@ -372,3 +361,25 @@ void w_main::on_actionClear_cache_triggered() clearCache(); QMessageBox::information(this,tr("Cache"),tr("The cache is now cleared. NOTE: It is already automatically cleared on update.")); } + +void w_main::on_actionReset_triggered() +{ + f_check reset; + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Reset mod")); + msgBox.setText(tr("This will reset the mod to the default state. Any modification or launcher preferences will be removed.")); + msgBox.setInformativeText(tr("Are you sure to continue ?")); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Cancel); + int ret = msgBox.exec(); + switch (ret) { + case QMessageBox::Ok: + reset.PrepareUpdate(); + reset.ActionReset(); + break; + case QMessageBox::Cancel: + break; + default: + break; + } +} diff --git a/checker/w_main.h b/checker/w_main.h index dcff15c..ce23ac0 100644 --- a/checker/w_main.h +++ b/checker/w_main.h @@ -17,7 +17,7 @@ class installBox; } namespace versions { -const QString CHECKER_VERSION = "1.01"; +const QString CHECKER_VERSION = "1.02"; } namespace tools { @@ -68,7 +68,6 @@ private slots: void clear_language_state(); void on_language_en_triggered(); void on_language_fr_triggered(); - void on_language_si_triggered(); void on_language_hu_triggered(); void on_language_fi_triggered(); void on_language_it_triggered(); @@ -78,6 +77,7 @@ private slots: void on_language_pl_triggered(); void on_actionAddon_Blue_marble_triggered(); void on_actionClear_cache_triggered(); + void on_actionReset_triggered(); private: Ui::w_main *ui; diff --git a/checker/w_main.ui b/checker/w_main.ui index d8b5911..f76d0b4 100644 --- a/checker/w_main.ui +++ b/checker/w_main.ui @@ -210,7 +210,7 @@ 0 0 600 - 21 + 18 @@ -228,6 +228,7 @@ Fix installation + @@ -273,7 +274,6 @@ - @@ -458,6 +458,11 @@ Enter SVN command + + + Reset mod to default state + + diff --git a/checker/w_options.cpp b/checker/w_options.cpp index 9cc52d0..3a5ce5a 100644 --- a/checker/w_options.cpp +++ b/checker/w_options.cpp @@ -1,5 +1,6 @@ #include "w_options.h" #include "w_main.h" +#include "w_exclusion.h" #include "ui_w_options.h" #include "f_civ.h" @@ -57,34 +58,38 @@ void w_options::on_colorBox_currentIndexChanged(int index) switch (index) { case 0: - colorUI = "Black UI"; + colorUI = "default"; break; case 1: - colorUI = "Coal UI"; + colorUI = "Black UI"; break; case 2: - colorUI = "Dark Red UI"; + colorUI = "Coal UI"; break; case 3: - colorUI = "Forest UI"; + colorUI = "Dark Red UI"; break; case 4: - colorUI = "Purple UI"; + colorUI = "Forest UI"; break; case 5: - colorUI = "Red UI"; + colorUI = "Purple UI"; break; case 6: - colorUI = "Silver UI"; + colorUI = "Red UI"; break; case 7: + colorUI = "Silver UI"; + break; + + case 8: colorUI = "Cerulean UI"; break; } @@ -151,3 +156,9 @@ void w_options::on_opt_checkbox_bluemarble_toggled(bool checked) } } + +void w_options::on_bt_exclusions_clicked() +{ + exclusion = new w_exclusion(this); + exclusion->show(); +} diff --git a/checker/w_options.h b/checker/w_options.h index 42ec02b..1d6b21c 100644 --- a/checker/w_options.h +++ b/checker/w_options.h @@ -5,6 +5,7 @@ #include #include #include +#include "w_exclusion.h" namespace Ui { class w_options; @@ -27,11 +28,14 @@ private slots: void on_opt_checkbox_formations_toggled(bool checked); void on_opt_checkbox_bluemarble_toggled(bool checked); + void on_bt_exclusions_clicked(); + private: QCheckBox *startBox; QCheckBox *checkerBox; QLineEdit *opt_text_path; Ui::w_options *ui; + w_exclusion *exclusion; }; #endif // OPTIONBOX_H diff --git a/checker/w_options.ui b/checker/w_options.ui index 8e0415b..082c600 100644 --- a/checker/w_options.ui +++ b/checker/w_options.ui @@ -106,6 +106,11 @@ 25 + + + Dark blue (default) + + Black @@ -232,6 +237,13 @@ + + + + Exclude files from update + + + diff --git a/installer/installer_script.nsi b/installer/installer_script.nsi index 422440b..4debdcc 100644 --- a/installer/installer_script.nsi +++ b/installer/installer_script.nsi @@ -19,19 +19,11 @@ Name "Civilization IV: A New Dawn" OutFile "AND2_installer.exe" ; The default installation directory -InstallDir "$DOCUMENTS\My Games\Beyond the sword\Mods\Rise of Mankind - A New Dawn\" +InstallDir "$DOCUMENTS\My Games\Beyond the sword\Mods\" ; Request application privileges RequestExecutionLevel user -; Shortcut creation -;-------------------------------- - -Function DesktopShortcut -CreateShortcut "$desktop\Civilization IV - A New Dawn.lnk" "$instdir\and2_checker.exe" -FunctionEnd - - ;Variables ;-------------------------------- Var StartMenuFolder @@ -71,7 +63,6 @@ RequestExecutionLevel admin !insertmacro MUI_LANGUAGE "German" !insertmacro MUI_LANGUAGE "Italian" !insertmacro MUI_LANGUAGE "Polish" -!insertmacro MUI_LANGUAGE "Sinhala" !insertmacro MUI_LANGUAGE "Spanish" Function .onInit @@ -79,7 +70,9 @@ Function .onInit FunctionEnd Function .onInstSuccess -Exec "$INSTDIR\and2_checker.exe" +SetOutPath "$INSTDIR\Rise of Mankind - A New Dawn\" +Exec "$INSTDIR\Rise of Mankind - A New Dawn\and2_checker.exe" +SetOutPath "$INSTDIR" FunctionEnd AutoCloseWindow true @@ -147,17 +140,6 @@ LangString SHORTCUT ${LANG_POLISH} "Stwórz skrót na pulpicie" LangString MSVC10 ${LANG_POLISH} "Microsoft Visual C++ 2010 Redist jest nie zainstalowany. Pobieranie oraz instalacja. Proszę czekać..." LangString MSVC13 ${LANG_POLISH} "Microsoft Visual C++ 2013 Redist jest nie zainstalowany. Pobieranie oraz instalacja. Proszę czekać..." -; Sinhala - -LangString WELCOME_TITLE ${LANG_SINHALA} "4 වන ශිෂ්ටාචාරය : නව අවධියක උදාව" -LangString WELCOME ${LANG_SINHALA} "විහිදුවා හරින සංස්කරණය:${VERSION}\nමෙම පිහිටුවීම් ක්‍රමය 4 වන ශිෂ්ධාචාරය ස්ථාපනයට උපදෙස් සපයයි : නව උදාවක් \nමොඩ් ස්ථාපනය කළ යුත්තේ \'මගේ ලියවිලි/මගේ ක්‍රීඩා /කඩු වලට ඔබ්බට ගිය /මොඩ් මුල් ආකාරයෙන් \nඑය මොඩ් දියත් කිරීමට කෙටි මාර්ගයක් සපයයි ,එය පහසුවෙන් භාගත කිරීමට උපකාරී වේ.\nමොඩ් ස්ථානගත කිරීම නවීකරණය හෝ පිළියෙළ කිරීම . \nඅවවාදයයි :පවත්නා ඕනෑම මොඩ් ස්ථාපනයක් අනුකුල වේ .ඔබ සතුව මොඩ් ගොණු තිබේනම් ඒවා නවිකරණ හෝ නැවත ලිවිම කළ යුතුය ." -LangString REQUIRED ${LANG_SINHALA} "required" -LangString DIRECTORY ${LANG_SINHALA} "පරිස්ථිතිය පුළුල් ලෙස පවතින ගොනුවෙහි ස්ථාපනය කළ යුතුය.$\nඑය වෙනස් ගොනුවක ස්ථාපනය කිරීමට ,විමසීම ක්ලික් කර වෙනත් ගොනුවක් තොර ගත යුතුය$\n$\nසටහන :එය වෙනත් ගොනුවක තොර ගැනීම ඉහල ලෙස නිර්දේශ කෙරේ .කෙසේ වෙතත් ඔබට මොඩ් ඍජු ලෙසම ක්‍රීඩා ගොනුවෙහි ස්ථානගත කළ හැක.(\'සිඩ් මෙයිරස් 4 වන ශිෂ්ටාචාරය අසිපත් වලින් එපිටට \ සිපත් වලින් එපිටට\මොඩ්ස්\')." -LangString FINISH ${LANG_SINHALA} "දැන් දියත් කිරීම ස්ථාපිතයි .පළමු දියත් කිරීමේදී ,මොඩ් නාමාවලියෙහි පවතින බව මෙහිදී අනාවරණය කරයි , නොඑසේනම් ස්ථානගත කිරිමේ ක්‍රියාමාර්ගය අනුගමනය කළ යුතුය ." -LangString RUN ${LANG_SINHALA} "මොඩ් දියත් කිරීම අරඹන්න" -LangString SHORTCUT ${LANG_SINHALA} "මුහුණත කෙටිමාර්ගය සකස් කරන්න" -LangString MSVC10 ${LANG_SINHALA} "මයික්‍රොසොෆ්ට් විෂුවල් සී ++ 2010 ස්ථානගත කර නොමැත .භාගත කිරීම සහ ස්ථානගත කිරීම සිදු කරන්න . කරුණාකර රැදී සිටින්න ." -LangString MSVC13 ${LANG_SINHALA} "මයික්‍රොසොෆ්ට් විෂුවල් සී ++ 2013 ස්ථානගත කර නොමැත .භාගත කිරීම සහ ස්ථානගත කිරීම සිදු කරන්න . කරුණාකර රැදී සිටින්න ." ; Spanish @@ -185,26 +167,26 @@ AddSize 1700000 File /r "..\release_files\*" ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" + WriteUninstaller "$INSTDIR\Rise of Mankind - A New Dawn\Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_BEGIN 0 ;Create shortcuts CreateDirectory "$SMPROGRAMS\$StartMenuFolder" - CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" -CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Civilization IV - A New Dawn.lnk" "$INSTDIR\and2_checker.exe" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Rise of Mankind - A New Dawn\Uninstall.exe" +CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Civilization IV - A New Dawn.lnk" "$INSTDIR\Rise of Mankind - A New Dawn\and2_checker.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd ; end the section Section "$(SHORTCUT)" -CreateShortcut "$desktop\Civilization IV - A New Dawn.lnk" "$instdir\and2_checker.exe" +CreateShortcut "$desktop\Civilization IV - A New Dawn.lnk" "$instdir\Rise of Mankind - A New Dawn\and2_checker.exe" SectionEnd Section "MSVC 2010 ($(REQUIRED))" SetOutPath $INSTDIR -ExecWait '"$INSTDIR\checker\vcredist_x86_2010.exe" /passive /norestart' +ExecWait '"$INSTDIR\Rise of Mankind - A New Dawn\checker\vcredist_x86_2010.exe" /passive /norestart' SectionEnd diff --git a/updater/main.cpp b/updater/main.cpp index 3a17114..9e9b94b 100644 --- a/updater/main.cpp +++ b/updater/main.cpp @@ -15,21 +15,38 @@ int main(int argc, char *argv[]) w.show(); w.DebugWindow(3000); - // Write temp file - QFile temp("updating"); - temp.open(QIODevice::WriteOnly | QIODevice::Truncate); - temp.close(); + if(argc > 1) + { + QString arg1 = argv[1]; + if(arg1 == "reset") + { + QFile temp("reset"); + temp.open(QIODevice::WriteOnly | QIODevice::Truncate); + temp.close(); + QString operation = tools::TOOL_RSYNC + QString("-rz --info=progress2 --delete-after --exclude \"cygcrypto-1.0.0.dll\" --exclude \"cyggcc_s-1.dll\" --exclude \"cygiconv-2.dll\" --exclude \"cygssp-0.dll\" --exclude \"cygwin1.dll\" --exclude \"cygz.dll\" --exclude \"rsync.exe\" --exclude \"upd_proc.exe\" --exclude \".svn*\" --exclude \"updating\" afforess.com::ftp/ ."); + w.StartUpdate(operation); + } + else{ + qDebug() << "Unknown argument"; + } + } + else{ + // Write temp file + QFile temp("updating"); + temp.open(QIODevice::WriteOnly | QIODevice::Truncate); + temp.close(); - // Check exclusion file - QString exclusion = w.ReadExcludeList("checker/exclusions.default.xml"); - QString exclusion_custom = w.ReadExcludeList("checker/exclusions.custom.xml"); + // Check exclusion file + QString exclusion = w.ReadExcludeList("checker/exclusions.default.xml"); + QString exclusion_custom = w.ReadExcludeList("checker/exclusions.custom.xml"); - // Initialize update - QString operation = tools::TOOL_RSYNC + QString("-rz --info=progress2 --delete-after %1 %2 afforess.com::ftp/ .").arg(exclusion).arg(exclusion_custom); - qDebug() << operation; - - // Execute update operation - w.StartUpdate(operation); + // Initialize update + QString operation = tools::TOOL_RSYNC + QString("-rz --info=progress2 --delete-after %1%2afforess.com::ftp/ .").arg(exclusion).arg(exclusion_custom); + //operation.replace("\"","\\\""); + qDebug() << operation; + // Execute update operation + w.StartUpdate(operation); + } return 0; }