From 3b92aea559b4e5bbded519f89e740076f3b98bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Cuj=C3=A9?= Date: Thu, 7 Mar 2019 17:26:50 +0100 Subject: [PATCH] Add auto-load for most recent file. Relates #216 --- common/lc_application.cpp | 4 +- common/lc_application.h | 1 + common/lc_profile.cpp | 1 + common/lc_profile.h | 1 + qt/lc_qpreferencesdialog.cpp | 4 +- qt/lc_qpreferencesdialog.ui | 7 ++ resources/leocad_de.ts | 237 ++++++++++++++++++----------------- resources/leocad_fr.ts | 237 ++++++++++++++++++----------------- resources/leocad_pt.ts | 237 ++++++++++++++++++----------------- 9 files changed, 379 insertions(+), 350 deletions(-) diff --git a/common/lc_application.cpp b/common/lc_application.cpp index dc7e7360..791342bc 100644 --- a/common/lc_application.cpp +++ b/common/lc_application.cpp @@ -30,6 +30,7 @@ void lcPreferences::LoadDefaults() mViewSphereColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR); mViewSphereTextColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_TEXT_COLOR); mViewSphereHighlightColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_HIGHLIGHT_COLOR); + autoLoadMostRecent = lcGetProfileInt(LC_PROFILE_AUTOLOAD_MOSTRECENT); } void lcPreferences::SaveDefaults() @@ -50,6 +51,7 @@ void lcPreferences::SaveDefaults() lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR, mViewSphereColor); lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_TEXT_COLOR, mViewSphereTextColor); lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_HIGHLIGHT_COLOR, mViewSphereHighlightColor); + lcSetProfileInt(LC_PROFILE_AUTOLOAD_MOSTRECENT, autoLoadMostRecent); } lcApplication::lcApplication(int& Argc, char** Argv) @@ -196,7 +198,7 @@ bool lcApplication::Initialize(QList>& LibraryPaths, bool& QString ModelName; QString CameraName; QString ViewpointName; - QString ProjectName; + QString ProjectName = lcGetProfileInt(LC_PROFILE_AUTOLOAD_MOSTRECENT) ? lcGetProfileString(LC_PROFILE_RECENT_FILE1) : QString(); QString SaveWavefrontName; QString Save3DSName; QString SaveCOLLADAName; diff --git a/common/lc_application.h b/common/lc_application.h index b14cc6f1..717af667 100644 --- a/common/lc_application.h +++ b/common/lc_application.h @@ -44,6 +44,7 @@ public: quint32 mViewSphereColor; quint32 mViewSphereTextColor; quint32 mViewSphereHighlightColor; + bool autoLoadMostRecent; }; class lcApplication : public QApplication diff --git a/common/lc_profile.cpp b/common/lc_profile.cpp index 78d6d2ba..19e380ec 100644 --- a/common/lc_profile.cpp +++ b/common/lc_profile.cpp @@ -82,6 +82,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] = lcProfileEntry("Settings", "RecentFile2", ""), // LC_PROFILE_RECENT_FILE2 lcProfileEntry("Settings", "RecentFile3", ""), // LC_PROFILE_RECENT_FILE3 lcProfileEntry("Settings", "RecentFile4", ""), // LC_PROFILE_RECENT_FILE4 + lcProfileEntry("Settings", "AutoLoadMostRecent", false), // LC_PROFILE_AUTOLOAD_MOSTRECENT lcProfileEntry("Settings", "AutosaveInterval", 10), // LC_PROFILE_AUTOSAVE_INTERVAL lcProfileEntry("Settings", "MouseSensitivity", 11), // LC_PROFILE_MOUSE_SENSITIVITY lcProfileEntry("Settings", "ImageWidth", 1280), // LC_PROFILE_IMAGE_WIDTH diff --git a/common/lc_profile.h b/common/lc_profile.h index 7a835f5f..a0b3cd7d 100644 --- a/common/lc_profile.h +++ b/common/lc_profile.h @@ -30,6 +30,7 @@ enum LC_PROFILE_KEY LC_PROFILE_RECENT_FILE2, LC_PROFILE_RECENT_FILE3, LC_PROFILE_RECENT_FILE4, + LC_PROFILE_AUTOLOAD_MOSTRECENT, LC_PROFILE_AUTOSAVE_INTERVAL, LC_PROFILE_MOUSE_SENSITIVITY, LC_PROFILE_IMAGE_WIDTH, diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp index 9d8a2445..aef130a6 100644 --- a/qt/lc_qpreferencesdialog.cpp +++ b/qt/lc_qpreferencesdialog.cpp @@ -43,7 +43,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) : ui->lgeoPath->setText(options->LGEOPath); ui->mouseSensitivity->setValue(options->Preferences.mMouseSensitivity); ui->checkForUpdates->setCurrentIndex(options->CheckForUpdates); - ui->fixedDirectionKeys->setChecked((options->Preferences.mFixedAxes) != 0); + ui->fixedDirectionKeys->setChecked(options->Preferences.mFixedAxes); + ui->autoLoadMostRecent->setChecked(options->Preferences.autoLoadMostRecent); ui->antiAliasing->setChecked(options->AASamples != 1); if (options->AASamples == 8) @@ -145,6 +146,7 @@ void lcQPreferencesDialog::accept() options->Preferences.mMouseSensitivity = ui->mouseSensitivity->value(); options->CheckForUpdates = ui->checkForUpdates->currentIndex(); options->Preferences.mFixedAxes = ui->fixedDirectionKeys->isChecked(); + options->Preferences.autoLoadMostRecent = ui->autoLoadMostRecent->isChecked(); if (!ui->antiAliasing->isChecked()) options->AASamples = 1; diff --git a/qt/lc_qpreferencesdialog.ui b/qt/lc_qpreferencesdialog.ui index 9e0ded10..e358615c 100644 --- a/qt/lc_qpreferencesdialog.ui +++ b/qt/lc_qpreferencesdialog.ui @@ -167,6 +167,13 @@ + + + + Open most recent file on startup + + + diff --git a/resources/leocad_de.ts b/resources/leocad_de.ts index 53349dd7..f7023a1a 100644 --- a/resources/leocad_de.ts +++ b/resources/leocad_de.ts @@ -3203,15 +3203,15 @@ lcApplication - - + + LeoCAD LeoCAD - + LeoCAD could not find a compatible Parts Library so only a small number of parts will be available. Please visit https://www.leocad.org for information on how to download and install a library. @@ -3220,7 +3220,7 @@ Please visit https://www.leocad.org for information on how to download and insta Bitte lesen sie unter https://www.leocad.org nach wie man eine Bibliothek herunterläd und installiert. - + LeoCAD could not load Parts Library. Please visit https://www.leocad.org for information on how to download and install a library. @@ -3229,17 +3229,17 @@ Please visit https://www.leocad.org for information on how to download and insta Bitte lesen sie unter https://www.leocad.org nach wie man eine Bibliothek herunterläd und installiert. - + Parts library and Anti-aliasing changes will only take effect the next time you start LeoCAD. Die Teilebibliothek und Einstellungen zu Aliasing werden erst nach Neustart von LeoCAD wirksam. - + Parts library changes will only take effect the next time you start LeoCAD. Die Teilebibliothek werden erst nach Neustart von LeoCAD wirksam. - + Anti-aliasing changes will only take effect the next time you start LeoCAD. Einstellungen zu Aliasing werden erst nach Neustart von LeoCAD wirksam. @@ -4661,77 +4661,82 @@ GL_EXT_texture_filter_anisotropic extension: %5 Eigene Teilebibliothek: - + + Open most recent file on startup + Öffne die zuletzt verwendete Datei beim Start + + + Mouse Maus - + Mouse Shortcuts Maus-Kurzbefehle - + Action Aktion - + Shortcut 1 Tastenkürzel 1 - + Shortcut 2 Tastenkürzel 2 - + Button: Maustaste: - + None Keine - + Left Links - + Middle Mitte - + Right Rechts - + Modifiers: Sondertaste: - + Control Strg - + Alt Alt - + Shift Shift - + Mouse sensitivity: Mausempfindlichkeit: @@ -4771,416 +4776,416 @@ GL_EXT_texture_filter_anisotropic extension: %5 Feste Richtungstasten - + Rendering Rendern - + Edge lines Randlinien - + Axis icon Achsenbeschriftung - + width Breite - + Anti-aliasing Anti-aliasing - + 2x 2x - + 4x 4x - + 8x 8x - + Shading Mode: Schattenmodus: - + Wireframe Drahtmodell - + Flat Shading Einfache Schatten - + Default Lights Voreingestellte Beleuchtung - + Base Grid Grundraster - + Draw studs Noppen darstellen - + studs Noppen - + Draw lines every Linien zeichnen alle - + View Sphere Ansichtskugel - + Disabled Deaktiviert - + Small Klein - + Medium Mittel - + Large Groß - + Highlight Color: Hervorhebungsfarbe: - + Size: Größe: - + Color: Farbe: - + Text Color: Textfarbe: - + Location: Position: - + Top Left Oben links - + Top Right Oben rechts - + Bottom Left Unten links - + Bottom Right Oben rechts - - + + Categories Kategorie - + Parts Library Categories Kategorie der Teilebibliothek - + Name Name - + Number Nummer - - + + Import... Importieren… - - + + Export... Exportieren… - - - + + + Reset... Zurücksetzen… - + Category Kategorie - + New... Neu… - + Edit... Bearbeiten… - + Delete... Löschen… - + Keyboard Tastatur - + Keyboard Shortcuts Tastenkürzel - + Command Befehl - - - + + + Shortcut Kürzel - + Key se&quence: Tasten&folge: - - + + Assign Zuweisen - - + + Remove Entfernen - + Grid spacing must be greater than 0. Rasterweite muss grösser als 0 sein. - + Select Parts Library Folder... Ordner der Teilebibliothek auswählen... - + Select Parts Library Archive... Archiv der Teilebibliothek auswählen... - + Supported Archives (*.zip *.bin);;All Files (*.*) Unterstütze Bibliotheken (*.zip *.bin);;Alle Dateien (*.*) - + Executable Files (*.exe);;All Files (*.*) Asuführbare Dateien (*.exe);;Alle Dateien (*.*) - + All Files (*.*) Alle Dateien (*.*) - + Open POV-Ray Executable Asuführbares POV-Ray öffnen - + Open LGEO Folder LGEO Ordner öffnen - + Select Grid Stud Color Farbe der Noppen im Gitter wählen - + Select Grid Line Color Farbe der Gitterlinien wählen - + Select View Sphere Color Wähle Ansichtskugelfarbe - + Select View Sphere Text Color Wähle Ansichtskugel Textfarbe - + Select View Sphere Highlight Color Wähle Ansichtskugel Hervorhebungsfarbe - + Unassigned Unbestimmt - + Are you sure you want to delete the category '%1'? Sind sie sicher dass sie die Kategorie » %1 « löschen möchten? - + Import Categories Kategorien importieren - - - - + + + + Text Files (*.txt);;All Files (*.*) Textdateien (*.txt);;Alle Dateien (*.*) - + Error loading categories file. Fehler beim Laden der Kategoriedatei. - + Export Categories Kategorien exportieren - + Error saving categories file. Fehler beim Speichern der Kategoriendatei. - + Are you sure you want to load the default categories? Sind sie sicher dass sie die voreingestellten Kategorien laden möchten? - + Import shortcuts Tastenkürzel laden - + Error loading keyboard shortcuts file. Fehler beim Laden der Tastaturkürzel-Datei. - + Export shortcuts Tastaturkürzel exportieren - + Error saving keyboard shortcuts file. Fehler beim Speichern der Tastaturkürzel-Datei. - + Are you sure you want to load the default keyboard shortcuts? Sind sie sicher dass sie die voreingestellten Tastaturkürzel laden möchten? - + Left Button Linke Maustaste - + Middle Button Mittlere Maustaste - + Right Button Rechte Maustaste - - + + Override Shortcut Tastaturkürzel ändern - - + + This shortcut is already assigned to '%1', do you want to replace it? Dieses Tastaturkürzel ist bereits » %1 « zugewiesen, möchten sie es ersetzen? - + Are you sure you want to load the default mouse shortcuts? Sind sie sicher dass sie die voreingestellten Mauskürzel laden möchten? diff --git a/resources/leocad_fr.ts b/resources/leocad_fr.ts index 39dc9c50..2f28d0db 100644 --- a/resources/leocad_fr.ts +++ b/resources/leocad_fr.ts @@ -3203,15 +3203,15 @@ lcApplication - - + + LeoCAD LeoCAD - + LeoCAD could not find a compatible Parts Library so only a small number of parts will be available. Please visit https://www.leocad.org for information on how to download and install a library. @@ -3220,7 +3220,7 @@ Please visit https://www.leocad.org for information on how to download and insta SVP visitez https://www.leocad.org pour apprendre comment télécharger et installer une bibliothèque. - + LeoCAD could not load Parts Library. Please visit https://www.leocad.org for information on how to download and install a library. @@ -3229,17 +3229,17 @@ Please visit https://www.leocad.org for information on how to download and insta SVP visitez https://www.leocad.org pour apprendre comment télécharger et installer une bibliothèque. - + Parts library and Anti-aliasing changes will only take effect the next time you start LeoCAD. Les changements concernant la bibliothèque de pièces et l’anti-aliasing ne prendront effet qu’au prochain lancement de LeoCAD. - + Parts library changes will only take effect the next time you start LeoCAD. Les changement concernant la bibliothèque de pièces ne prendront effet qu’au prochain lancement de LeoCAD. - + Anti-aliasing changes will only take effect the next time you start LeoCAD. Les changement concernant l’anti-aliasing ne prendront effet qu’au prochain lancement de LeoCAD. @@ -4656,77 +4656,82 @@ GL_EXT_texture_filter_anisotropic extension: %5 Bibliothèque de pièces personnalisées : - + + Open most recent file on startup + + + + Mouse Souris - + Mouse Shortcuts Raccourcis souris - + Action Action - + Shortcut 1 - + Shortcut 2 - + Button: Bouton : - + None Aucun - + Left Gauche - + Middle Central - + Right Droit - + Modifiers: Modificateurs : - + Control Contrôle - + Alt Alt - + Shift Maj - + Mouse sensitivity: Sensibilité de la souris : @@ -4766,416 +4771,416 @@ GL_EXT_texture_filter_anisotropic extension: %5 Touches de directions fixes - + Rendering Rendu - + Edge lines Bordures - + Axis icon Icônes d’axes - + width largeur - + Anti-aliasing Anti-aliasing - + 2x 2x - + 4x 4x - + 8x 8x - + Shading Mode: - + Wireframe - + Flat Shading - + Default Lights - + Base Grid Grille de base - + Draw studs Dessiner les tenons - + studs tenons - + Draw lines every Dessine des lignes tous les - + View Sphere - + Disabled - + Small - + Medium - + Large - + Highlight Color: - + Size: - + Color: Couleur : - + Text Color: - + Location: - + Top Left - + Top Right - + Bottom Left - + Bottom Right - - + + Categories Catégories - + Parts Library Categories Catégories de la bibliothèque de pièces - + Name Nom - + Number Nombre - - + + Import... Importer… - - + + Export... Exporter… - - - + + + Reset... Réinitialiser… - + Category Catégorie - + New... Nouveau… - + Edit... Éditer… - + Delete... Supprimer… - + Keyboard Clavier - + Keyboard Shortcuts Raccourcis clavier - + Command Commande - - - + + + Shortcut Raccourcis - + Key se&quence: - - + + Assign Attribuer - - + + Remove Supprimer - + Grid spacing must be greater than 0. L’espacement de la grille doit être plus grand que 0. - + Select Parts Library Folder... - + Select Parts Library Archive... - + Supported Archives (*.zip *.bin);;All Files (*.*) - + Executable Files (*.exe);;All Files (*.*) Fichiers exécutables (*.exe);;Tous les fichiers (*.*) - + All Files (*.*) Tous les fichiers (*.*) - + Open POV-Ray Executable Lancer l’exécutable POV-Ray - + Open LGEO Folder Ouvrir le dossier LGEO - + Select Grid Stud Color Choisir le couleur des tenons de la grille - + Select Grid Line Color Choisir la couleur des lignes de la grille - + Select View Sphere Color - + Select View Sphere Text Color - + Select View Sphere Highlight Color - + Unassigned Non-attribué - + Are you sure you want to delete the category '%1'? Êtes-vous sûr de vouloir supprimer la catégorie « %1 » ? - + Import Categories Importer les catégories - - - - + + + + Text Files (*.txt);;All Files (*.*) Fichiers texte (*.txt);;Tous les fichiers (*.*) - + Error loading categories file. Erreur au chargement du fichier des catégories. - + Export Categories Exporter les catégories - + Error saving categories file. Erreur à l’enregistrement du fichier des catégories. - + Are you sure you want to load the default categories? Êtes-vous sûr de vouloir charger les catégories par défaut ? - + Import shortcuts Importer les raccourcis - + Error loading keyboard shortcuts file. Erreur au chargement du fichier des raccourcis clavier. - + Export shortcuts Exporter les raccourcis - + Error saving keyboard shortcuts file. Erreur à l’enregistrement du fichier des raccourcis clavier. - + Are you sure you want to load the default keyboard shortcuts? Êtes-vous sûr de vouloir charger les raccourcis clavier par défaut ? - + Left Button Bouton gauche - + Middle Button Bouton central - + Right Button Bouton droit - - + + Override Shortcut Écraser le raccourcis - - + + This shortcut is already assigned to '%1', do you want to replace it? Ce raccourcis est déjà attribué à « %1 », voulez-vous le remplacer ? - + Are you sure you want to load the default mouse shortcuts? Êtes-vous sûr de vouloir charger les raccourcis souris par défaut ? diff --git a/resources/leocad_pt.ts b/resources/leocad_pt.ts index 67cbe8e3..57ec3a29 100644 --- a/resources/leocad_pt.ts +++ b/resources/leocad_pt.ts @@ -3203,15 +3203,15 @@ lcApplication - - + + LeoCAD LeoCAD - + LeoCAD could not find a compatible Parts Library so only a small number of parts will be available. Please visit https://www.leocad.org for information on how to download and install a library. @@ -3220,7 +3220,7 @@ Please visit https://www.leocad.org for information on how to download and insta Veja https://www.leocad.org para saber como descarragar e instalar uma biblioteca. - + LeoCAD could not load Parts Library. Please visit https://www.leocad.org for information on how to download and install a library. @@ -3229,17 +3229,17 @@ Please visit https://www.leocad.org for information on how to download and insta Veja https://www.leocad.org para saber como descarragar e instalar uma biblioteca. - + Parts library and Anti-aliasing changes will only take effect the next time you start LeoCAD. As mudanças de Biblioteca e de Antisserrilhamento só tomam efeito após o próximo arranque do LeoCAD. - + Parts library changes will only take effect the next time you start LeoCAD. As mudanças de Biblioteca só tomam efeito após o próximo arranque do LeoCAD. - + Anti-aliasing changes will only take effect the next time you start LeoCAD. As mudanças de Antisserrilhamento só tomam efeito após o próximo arranque do LeoCAD. @@ -4656,7 +4656,7 @@ GL_EXT_texture_filter_anisotropic extension: %5 Biblioteca de peças personalizada: - + Mouse sensitivity: Sensibilidade do rato : @@ -4696,486 +4696,491 @@ GL_EXT_texture_filter_anisotropic extension: %5 Teclas de direcção fixas - + + Open most recent file on startup + + + + Rendering Restituir - + Edge lines Contornos - + Axis icon Eixos - + width largura - + Anti-aliasing Suavização - + 2x 2x - + 4x 4x - + 8x 8x - + Shading Mode: - + Wireframe - + Flat Shading - + Default Lights - + Base Grid Grelha de Base - + Draw studs Desenhar pregos - + studs pregos - + Draw lines every Desenhar linhas cada - + View Sphere - + Disabled - + Small - + Medium - + Large - + Highlight Color: - + Size: - + Color: Cor: - + Text Color: - + Location: - + Top Left - + Top Right - + Bottom Left - + Bottom Right - - + + Categories Categorias - + Parts Library Categories Categorias de Peças na Biblioteca - + Name Nome - + Number Número - - + + Import... Importar.... - - + + Export... Exportar... - - - + + + Reset... Reiniciar... - + Category Categoria - + New... Novo... - + Edit... Editar... - + Delete... Apagar... - + Keyboard Teclado - + Keyboard Shortcuts Atalhos de Teclado - + Command Commando - - - + + + Shortcut Atalho - + Key se&quence: - + Mouse - + Mouse Shortcuts - + Action - + Shortcut 1 - + Shortcut 2 - + Button: - + None Nenhum - + Left Left - + Middle - + Right Right - + Modifiers: - + Control - + Alt - + Shift - - + + Assign Definir - - + + Remove Remover - + Grid spacing must be greater than 0. O espaço de grelha deve ser superior a 0. - + Select Parts Library Folder... - + Select Parts Library Archive... - + Supported Archives (*.zip *.bin);;All Files (*.*) - + Executable Files (*.exe);;All Files (*.*) Ficheiros Executaveis(*.exe);;Todos os Ficheiros (*.*) - + All Files (*.*) Todos os Ficheiros (*.*) - + Open POV-Ray Executable Escolher o programa POV-Ray - + Open LGEO Folder Escolher a Pasta LGEO - + Select Grid Stud Color Cor dos Pregos na Grelha - + Select Grid Line Color Cor das Linhas na Grelha - + Select View Sphere Color - + Select View Sphere Text Color - + Select View Sphere Highlight Color - + Unassigned Por Definir - + Are you sure you want to delete the category '%1'? Confirmar querer apagar a categoria '%1'? - + Import Categories Importar Categorias - - - - + + + + Text Files (*.txt);;All Files (*.*) Ficheiros Texto (*.txt);;Todos os Ficheiros (*.*) - + Error loading categories file. Erro ao carregar o ficheiro de categorias. - + Export Categories Exportar Categorias - + Error saving categories file. Erro ao gravar o ficheiro de categorias. - + Are you sure you want to load the default categories? Confirmar querer carregar as categorias por omissão? - + Import shortcuts Importar Atalhos de Teclado - + Error loading keyboard shortcuts file. Erro ao carregar o ficheiro de atalhos de teclado. - + Export shortcuts Exportar Atalhos de Teclado - + Error saving keyboard shortcuts file. Erro ao gravar o ficheiro de atalhos de teclado. - + Are you sure you want to load the default keyboard shortcuts? Confirmar querer carregar os atalhos de teclado por omissão? - + Left Button - + Middle Button - + Right Button - - + + Override Shortcut - - + + This shortcut is already assigned to '%1', do you want to replace it? - + Are you sure you want to load the default mouse shortcuts?