diff --git a/lang/qet_ca.ts b/lang/qet_ca.ts index 88faf97bf..40f078084 100644 --- a/lang/qet_ca.ts +++ b/lang/qet_ca.ts @@ -1194,8 +1194,8 @@ Les changements seront définitifs. - Importer un nouveau modèle - Importar un nou model + Nouveau modèle + @@ -4071,137 +4071,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry - + + Enregistrer sous + menu entry + + + + &Quitter menu entry Sortir - + &Configurer QElectroTech menu entry Configurar QElectroTech - + À &propos de QElectroTech menu entry Quant a QElectroTech - + À propos de &Qt menu entry - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit - + Ctrl+K shortcut to merge cells - + Ctrl+J shortcut to split merged cell - + Permet de régler différents paramètres de QElectroTech status bar tip - + Affiche des informations sur QElectroTech status bar tip - + Affiche des informations sur la bibliothèque Qt status bar tip - + &Fichier menu title Fitxer - + &Édition menu title - + &Configuration menu title Configuració - + &Aide menu title Ajuda - + Aucune modification label displayed in the undo list when empty Cap canvi - + Annulations dock title Anulacions - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title - + %1 - %2 window title: %1 is the base window title, %2 is a template name %1 - %2 + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5438,6 +5450,33 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_cs.ts b/lang/qet_cs.ts index e5cfb4b82..2f5608bc0 100644 --- a/lang/qet_cs.ts +++ b/lang/qet_cs.ts @@ -1166,11 +1166,6 @@ Provedené změny budou konečné. Abaisser ce schéma Posunout tento výkres dolů - - - Importer un nouveau modèle - Zavést nový vzor - Éditer ce modèle @@ -1233,6 +1228,11 @@ Provedené změny budou konečné. Propriétés du projet Vlastnosti projektu + + + Nouveau modèle + + Déplacer dans cette catégorie @@ -4077,137 +4077,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry &Uložit - + + Enregistrer sous + menu entry + Uložit jako + + + &Quitter menu entry &Ukončit - + &Configurer QElectroTech menu entry &Nastavit QElectroTech - + À &propos de QElectroTech menu entry &O QElectroTechu - + À propos de &Qt menu entry O &Qt - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip Umožní pro QElectroTech stanovit různé parametry - + Affiche des informations sur QElectroTech status bar tip Zobrazí informace o QElectroTechu - + Affiche des informations sur la bibliothèque Qt status bar tip Zobrazí informace o knihovně Qt - + &Fichier menu title &Soubor - + &Édition menu title &Úpravy - + &Configuration menu title N&astavení - + &Aide menu title &Nápověda - + Aucune modification label displayed in the undo list when empty Žádná úprava - + Annulations dock title Zpět - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title QElectroTech - Editor vzoru vloženého rámečku - + %1 - %2 window title: %1 is the base window title, %2 is a template name + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5448,6 +5460,33 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_de.ts b/lang/qet_de.ts index 52e4633c6..cc44fb02e 100644 --- a/lang/qet_de.ts +++ b/lang/qet_de.ts @@ -1006,10 +1006,6 @@ Die Änderungen sind endgültig. Vous pouvez utiliser ce gestionnaire pour ajouter, supprimer ou modifier les catégories. Sie können die Verwaltung verwenden um Kategorien hinzuzufügen, löschen oder zu bearbeiten. - - Importer un nouveau modèle - - Éditer ce modèle @@ -1032,6 +1028,10 @@ Die Änderungen sind endgültig. Ouvrir un fichier élément + + Nouveau modèle + + EllipseEditor @@ -3433,6 +3433,16 @@ Que désirez vous faire ? menu title &Hilfe + + Enregistrer sous + menu entry + Speichern unter + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -4449,6 +4459,29 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + Projet parent + used in save as form + + + + Modèle existant + used in save as form + + + + ou nouveau nom + used in save as form + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_en.qm b/lang/qet_en.qm index 09d4f48f4..500b2e637 100644 Binary files a/lang/qet_en.qm and b/lang/qet_en.qm differ diff --git a/lang/qet_en.ts b/lang/qet_en.ts index d753e4d40..cf527ba13 100644 --- a/lang/qet_en.ts +++ b/lang/qet_en.ts @@ -1166,11 +1166,6 @@ Changes will be definitive. Abaisser ce schéma Move down - - - Importer un nouveau modèle - Import a new template - Éditer ce modèle @@ -1233,6 +1228,11 @@ Changes will be definitive. Propriétés du projet Project properties + + + Nouveau modèle + New template + Déplacer dans cette catégorie @@ -4074,137 +4074,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry &Save - + + Enregistrer sous + menu entry + Save as + + + &Quitter menu entry &Quit - + &Configurer QElectroTech menu entry &Configure QElectroTech - + À &propos de QElectroTech menu entry A&bout QElectroTech - + À propos de &Qt menu entry About &Qt - + &Fusionner les cellules menu entry &Merge cells - + &Séparer les cellules menu entry &Split cells - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip Allows to specify various parameters for QElectroTech - + Affiche des informations sur QElectroTech status bar tip Displays informations about QElectroTech - + Affiche des informations sur la bibliothèque Qt status bar tip Displays informations about Qt library - + &Fichier menu title &File - + &Édition menu title &Edit - + &Configuration menu title &Settings - + &Aide menu title &Help - + Aucune modification label displayed in the undo list when empty No modification - + Annulations dock title Undo - + Propriétés de la cellule dock title Cell properties - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title QElectroTech - Title block template editor - + %1 - %2 window title: %1 is the base window title, %2 is a template name %1 - %2 + + + Enregistrer le modèle sous + dialog window title + Save template as + QFileNameEdit @@ -5442,6 +5454,33 @@ Que désirez vous faire ? Cell edition: %1 + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + Parent project + + + + Modèle existant + used in save as form + Existing template + + + + ou nouveau nom + used in save as form + or new name + + + + Nouveau modèle (entrez son nom) + combox box entry + New template (enter its name) + + TitleBlockTemplateLogoManager diff --git a/lang/qet_es.ts b/lang/qet_es.ts index 3432d38d1..6dcc0d4fd 100644 --- a/lang/qet_es.ts +++ b/lang/qet_es.ts @@ -1192,11 +1192,6 @@ Los cambios no podrían ser revertidos. Abaisser ce schéma Bajar este esquema - - - Importer un nouveau modèle - Importar un nuevo modelo - Éditer ce modèle @@ -1239,6 +1234,11 @@ Los cambios no podrían ser revertidos. Déplacer dans cette catégorie Mover en esta categoría + + + Nouveau modèle + + Copier dans cette catégorie @@ -4076,137 +4076,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry &Guardar - + + Enregistrer sous + menu entry + Guardar como + + + &Quitter menu entry &Salir - + &Configurer QElectroTech menu entry &Configurar QElectroTech - + À &propos de QElectroTech menu entry &Acerca de QElectroTech - + À propos de &Qt menu entry Acerca de &Qt - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip Permite arreglar los párametros de QElectroTech - + Affiche des informations sur QElectroTech status bar tip Mostrar las informaciones sobre QElectroTech - + Affiche des informations sur la bibliothèque Qt status bar tip Mostrar las informaciones sobre la biblioteca Qt - + &Fichier menu title &Archivo - + &Édition menu title &Editar - + &Configuration menu title &Preferencias - + &Aide menu title A&yuda - + Aucune modification label displayed in the undo list when empty Ninguna modificación - + Annulations dock title Anulaciones - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title QElectroTech - Editor de modelo de cartucho - + %1 - %2 window title: %1 is the base window title, %2 is a template name + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5444,6 +5456,33 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_it.ts b/lang/qet_it.ts index e930dd6c4..23912cea7 100644 --- a/lang/qet_it.ts +++ b/lang/qet_it.ts @@ -1160,11 +1160,6 @@ I cambiamenti saranno irreversibili. Abaisser ce schéma Abbassare questo schema - - - Importer un nouveau modèle - Importare un nuovo modello - Éditer ce modèle @@ -1227,6 +1222,11 @@ I cambiamenti saranno irreversibili. Propriétés du projet Proprietà del progetto + + + Nouveau modèle + + Déplacer dans cette catégorie @@ -4068,137 +4068,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry Salvar&e - + + Enregistrer sous + menu entry + Salva come + + + &Quitter menu entry - + &Configurer QElectroTech menu entry &Configura QElectroTech - + À &propos de QElectroTech menu entry - + À propos de &Qt menu entry A proposito di &Qt - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip - + Affiche des informations sur QElectroTech status bar tip Mostra informazioni su QElectroTech - + Affiche des informations sur la bibliothèque Qt status bar tip - + &Fichier menu title &File - + &Édition menu title &Edita - + &Configuration menu title &Configurazione - + &Aide menu title &Aiuto - + Aucune modification label displayed in the undo list when empty Nessuna modifica - + Annulations dock title - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title QElectrotech - Editor di modelli di cartiglio - + %1 - %2 window title: %1 is the base window title, %2 is a template name + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5436,6 +5448,33 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_pl.ts b/lang/qet_pl.ts index 7961564a6..7eba5cfa2 100644 --- a/lang/qet_pl.ts +++ b/lang/qet_pl.ts @@ -1169,11 +1169,6 @@ Zmiany zostaną zapisane. Abaisser ce schéma Przenieść w dół - - - Importer un nouveau modèle - Importuj nowy szablon - Éditer ce modèle @@ -1236,6 +1231,11 @@ Zmiany zostaną zapisane. Propriétés du projet Właściwości projektu + + + Nouveau modèle + + Déplacer dans cette catégorie @@ -4081,137 +4081,149 @@ Co chcesz zrobić ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry &Zapisz - + + Enregistrer sous + menu entry + Zapisz jako + + + &Quitter menu entry - + &Configurer QElectroTech menu entry &Konfiguracja QElectroTech - + À &propos de QElectroTech menu entry &O QElectroTech - + À propos de &Qt menu entry O &Qt - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip - + Affiche des informations sur QElectroTech status bar tip Wyświetla informacje o QElectroTech - + Affiche des informations sur la bibliothèque Qt status bar tip - + &Fichier menu title &Plik - + &Édition menu title &Edycja - + &Configuration menu title &Ustawienia - + &Aide menu title &Pomoc - + Aucune modification label displayed in the undo list when empty Bez zmian - + Annulations dock title Cofnij - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title QElectroTech - Edytor szablonów tabliczki rysunkowej - + %1 - %2 window title: %1 is the base window title, %2 is a template name %1 - %2 + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5452,6 +5464,33 @@ Co chcesz zrobić ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_pt.ts b/lang/qet_pt.ts index 296d3cdae..f689774e4 100644 --- a/lang/qet_pt.ts +++ b/lang/qet_pt.ts @@ -1166,11 +1166,6 @@ As alterações serão definitivas. Abaisser ce schéma Descer o esquema - - - Importer un nouveau modèle - Importar um novo modelo - Éditer ce modèle @@ -1233,6 +1228,11 @@ As alterações serão definitivas. Propriétés du projet Propriedades do projecto + + + Nouveau modèle + + Déplacer dans cette catégorie @@ -4074,137 +4074,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry &Guardar - + + Enregistrer sous + menu entry + + + + &Quitter menu entry &Sair - + &Configurer QElectroTech menu entry &Configurar QElectroTech - + À &propos de QElectroTech menu entry &Sobre QElectroTech - + À propos de &Qt menu entry Sobre &Qt - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip Permite especificar vários parâmetros para QElectroTech - + Affiche des informations sur QElectroTech status bar tip Apresenta informações sobre QElectroTech - + Affiche des informations sur la bibliothèque Qt status bar tip Apresenta informações sobre as bibliotecas Qt - + &Fichier menu title &Ficheiro - + &Édition menu title &Editar - + &Configuration menu title &Configurações - + &Aide menu title &Ajuda - + Aucune modification label displayed in the undo list when empty - + Annulations dock title Desfazer - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title QElectrotech - Editor de modelos de moldura - + %1 - %2 window title: %1 is the base window title, %2 is a template name + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5442,6 +5454,33 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_ro.ts b/lang/qet_ro.ts index 98fff84c0..e9ad3f4a8 100644 --- a/lang/qet_ro.ts +++ b/lang/qet_ro.ts @@ -1197,7 +1197,7 @@ Modificarea va fi definitiva. - Importer un nouveau modèle + Nouveau modèle @@ -4076,137 +4076,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry &Salvare - + + Enregistrer sous + menu entry + + + + &Quitter menu entry - + &Configurer QElectroTech menu entry &Configurare QElectroTech - + À &propos de QElectroTech menu entry - + À propos de &Qt menu entry Despre &Qt - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip Permite reglarea parametrilor QElectroTech - + Affiche des informations sur QElectroTech status bar tip Afișează informații despre QElectroTech - + Affiche des informations sur la bibliothèque Qt status bar tip Afișează informații despre biblioteca Qt - + &Fichier menu title &Fișier - + &Édition menu title &Editare - + &Configuration menu title &Configurare - + &Aide menu title &Asistență - + Aucune modification label displayed in the undo list when empty Nicio modificare - + Annulations dock title Anulări - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title - + %1 - %2 window title: %1 is the base window title, %2 is a template name + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5446,6 +5458,33 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/lang/qet_ru.ts b/lang/qet_ru.ts index 7c8a73fb0..db2d64611 100644 --- a/lang/qet_ru.ts +++ b/lang/qet_ru.ts @@ -1198,7 +1198,7 @@ Les changements seront définitifs. - Importer un nouveau modèle + Nouveau modèle @@ -4076,137 +4076,149 @@ Que désirez vous faire ? QETTitleBlockTemplateEditor - + &Enregistrer menu entry &Сохранить - + + Enregistrer sous + menu entry + Сохранить как + + + &Quitter menu entry &Выход - + &Configurer QElectroTech menu entry &Настройка QElectroTech - + À &propos de QElectroTech menu entry &О программе - + À propos de &Qt menu entry О &библиотеке Qt - + &Fusionner les cellules menu entry - + &Séparer les cellules menu entry - + Ctrl+Q shortcut to quit Ctrl+Q - + Ctrl+K shortcut to merge cells Ctrl+K - + Ctrl+J shortcut to split merged cell Ctrl+J - + Permet de régler différents paramètres de QElectroTech status bar tip Позволяет завать различные параметры QElectroTech - + Affiche des informations sur QElectroTech status bar tip Отобразить информацию о QElectroTech - + Affiche des informations sur la bibliothèque Qt status bar tip Отобразить информацию о библиотеке Qt - + &Fichier menu title &Файл - + &Édition menu title &Правка - + &Configuration menu title &Настройка - + &Aide menu title &Справка - + Aucune modification label displayed in the undo list when empty Нет изменений - + Annulations dock title История - + Propriétés de la cellule dock title - + QElectroTech - Éditeur de modèle de cartouche titleblock template editor: base window title - + %1 - %2 window title: %1 is the base window title, %2 is a template name + + + Enregistrer le modèle sous + dialog window title + + QFileNameEdit @@ -5446,6 +5458,33 @@ Que désirez vous faire ? + + TitleBlockTemplateLocationChooser + + + Projet parent + used in save as form + + + + + Modèle existant + used in save as form + + + + + ou nouveau nom + used in save as form + + + + + Nouveau modèle (entrez son nom) + combox box entry + + + TitleBlockTemplateLogoManager diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 7819d0b7f..f3ad0db03 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -68,7 +68,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce sch\351ma"), this); prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce sch\351ma"), this); prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce sch\351ma"), this); - tbt_add = new QAction(QET::Icons::TitleBlock, tr("Importer un nouveau mod\350le"), this); + tbt_add = new QAction(QET::Icons::TitleBlock, tr("Nouveau mod\350le"), this); tbt_edit = new QAction(QET::Icons::TitleBlock, tr("\311diter ce mod\350le"), this); tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce mod\350le"), this); move_elements_ = new QAction(QET::Icons::MoveFile, tr("D\351placer dans cette cat\351gorie"), this); diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 456bfde8d..413ec2d0f 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -22,6 +22,7 @@ #include "templatecellwidget.h" #include "templatecommands.h" #include "templateview.h" +#include "templatelocationchooser.h" #include "templatelogomanager.h" #include "templatecellwidget.h" @@ -46,6 +47,13 @@ QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor(QWidget *parent) : QETTitleBlockTemplateEditor::~QETTitleBlockTemplateEditor() { } +/** + @return the location of the currently edited template +*/ +TitleBlockTemplateLocation QETTitleBlockTemplateEditor::location() const { + return(TitleBlockTemplateLocation(parent_project_, template_name_)); +} + /** Edit the given template. @param project Parent project of the template to edit. @@ -101,6 +109,7 @@ void QETTitleBlockTemplateEditor::initActions() { QETApp *qet_app = QETApp::instance(); save_ = new QAction(QET::Icons::DocumentSave, tr("&Enregistrer", "menu entry"), this); + save_as_ = new QAction(QET::Icons::DocumentSave, tr("Enregistrer sous", "menu entry"), this); quit_ = new QAction(QET::Icons::ApplicationExit, tr("&Quitter", "menu entry"), this); configure_ = new QAction(QET::Icons::Configure, tr("&Configurer QElectroTech", "menu entry"), this); about_qet_ = new QAction(QET::Icons::QETLogo, tr("\300 &propos de QElectroTech", "menu entry"), this); @@ -118,6 +127,7 @@ void QETTitleBlockTemplateEditor::initActions() { about_qt_ -> setStatusTip(tr("Affiche des informations sur la biblioth\350que Qt", "status bar tip")); connect(save_, SIGNAL(triggered()), this, SLOT(save())); + connect(save_as_, SIGNAL(triggered()), this, SLOT(saveAs())); connect(quit_, SIGNAL(triggered()), this, SLOT(quit())); connect(configure_, SIGNAL(triggered()), qet_app, SLOT(configureQET())); connect(about_qet_, SIGNAL(triggered()), qet_app, SLOT(aboutQET())); @@ -141,6 +151,7 @@ void QETTitleBlockTemplateEditor::initMenus() { help_menu_ -> setTearOffEnabled(true); file_menu_ -> addAction(save_); + file_menu_ -> addAction(save_as_); file_menu_ -> addSeparator(); file_menu_ -> addAction(quit_); @@ -273,19 +284,72 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() { } /** - Save the currently edited title block template back to its parent project. + Save the template as \a name within \a project. + @see QETProject::setTemplateXmlDescription() + @param project Parent project + @param name Template name */ -void QETTitleBlockTemplateEditor::save() { +void QETTitleBlockTemplateEditor::saveAs(QETProject *project, const QString &name) { + if (!project || name.isEmpty()) return; + QDomDocument doc; QDomElement elmt = doc.createElement("root"); tb_template_ -> saveToXmlElement(elmt); + elmt.setAttribute("name", name); doc.appendChild(elmt); + project -> setTemplateXmlDescription(name, elmt); + + parent_project_ = project; + template_name_ = name; +} + +/** + Save the currently edited title block template back to its parent project. +*/ +void QETTitleBlockTemplateEditor::save() { if (parent_project_ && !template_name_.isEmpty()) { - parent_project_ -> setTemplateXmlDescription(template_name_, elmt); + saveAs(parent_project_, template_name_); + } else { + saveAs(); } } +/** + Ask the user where he wishes to save the currently edited template. +*/ +void QETTitleBlockTemplateEditor::saveAs() { + TitleBlockTemplateLocation location = getTitleBlockTemplateLocationFromUser(); + if (location.isValid()) { + saveAs(location.project(), location.name()); + } +} + +/** + Ask the user for a title block template location + @return The location chosen by the user, or an empty TitleBlockTemplateLocation if the user cancelled the dialog +*/ +TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLocationFromUser() { + TitleBlockTemplateLocationChooser *chooser = new TitleBlockTemplateLocationChooser(location()); + QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + + QVBoxLayout *dialog_layout = new QVBoxLayout(); + dialog_layout -> addWidget(chooser); + dialog_layout -> addWidget(buttons); + + QDialog dialog; + dialog.setWindowTitle(tr("Enregistrer le mod\350le sous", "dialog window title")); + dialog.setLayout(dialog_layout); + + connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept())); + connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject())); + + if (dialog.exec() == QDialog::Accepted) { + return(chooser -> location()); + } + return TitleBlockTemplateLocation(); +} + /** Close the current editor. */ diff --git a/sources/titleblock/qettemplateeditor.h b/sources/titleblock/qettemplateeditor.h index 01dd6d52e..b32f8efec 100644 --- a/sources/titleblock/qettemplateeditor.h +++ b/sources/titleblock/qettemplateeditor.h @@ -20,6 +20,7 @@ #include #include "qet.h" #include "templateview.h" +#include "templatelocation.h" class ModifyTitleBlockCellCommand; class TitleBlockTemplateCommand; class TitleBlockTemplateCellWidget; @@ -48,7 +49,7 @@ class QETTitleBlockTemplateEditor : public QMainWindow { /// menus TODO QMenu *file_menu_, *edit_menu_,/* *paste_from_menu_, *display_menu_, *tools_menu_,*/ *config_menu_, *help_menu_; /// actions - QAction *save_, *quit_, *configure_, *about_qt_, *about_qet_, *merge_cells_, *split_cell_; + QAction *save_, *save_as_, *quit_, *configure_, *about_qt_, *about_qet_, *merge_cells_, *split_cell_; /// Parent project of the currently edited template QETProject *parent_project_; /// Name of the currently edited template @@ -70,6 +71,7 @@ class QETTitleBlockTemplateEditor : public QMainWindow { // methods public: + TitleBlockTemplateLocation location() const; protected: @@ -82,14 +84,17 @@ class QETTitleBlockTemplateEditor : public QMainWindow { void selectedCellsChanged(QList); bool edit(QETProject *, const QString &); void editLogos(); + void save(); + void saveAs(); + void quit(); private slots: + TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser(); void pushCellUndoCommand(ModifyTitleBlockCellCommand *); void pushGridUndoCommand(TitleBlockTemplateCommand *); void pushUndoCommand(QUndoCommand *); void updateEditorTitle(); - void save(); - void quit(); + void saveAs(QETProject *, const QString &); }; #endif diff --git a/sources/titleblock/templatelocation.cpp b/sources/titleblock/templatelocation.cpp new file mode 100644 index 000000000..aa1dbdf65 --- /dev/null +++ b/sources/titleblock/templatelocation.cpp @@ -0,0 +1,71 @@ +/* + Copyright 2006-2011 Xavier Guerrin + This file is part of QElectroTech. + + QElectroTech is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + QElectroTech is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . +*/ +#include "templatelocation.h" + +/** + Constructor + @param project Parent project of the title block template + @param name Name of the title block template within its parent project or collection +*/ +TitleBlockTemplateLocation::TitleBlockTemplateLocation(QETProject *project, const QString &name) : + project_(project), + name_(name) +{ +} + +/** + Destructor +*/ +TitleBlockTemplateLocation::~TitleBlockTemplateLocation() { +} + +/** + @return the parent project of the template, or 0 if none was defined +*/ +QETProject *TitleBlockTemplateLocation::project() const { + return(project_); +} + +/** + @param project The new parent project of the template, or 0 if none + applies. +*/ +void TitleBlockTemplateLocation::setProject(QETProject *project) { + project_ = project; +} + +/** + @return the name of this template within its parent project or collection. +*/ +QString TitleBlockTemplateLocation::name() const { + return(name_); +} + +/** + @param name The new name of this template. +*/ +void TitleBlockTemplateLocation::setName(const QString &name) { + name_ = name; +} + +/** + @return true if this location is null, false otherwise +*/ +bool TitleBlockTemplateLocation::isValid() const { + return(project_ && !name_.isEmpty()); +} diff --git a/sources/titleblock/templatelocation.h b/sources/titleblock/templatelocation.h new file mode 100644 index 000000000..6a9645b0c --- /dev/null +++ b/sources/titleblock/templatelocation.h @@ -0,0 +1,45 @@ +/* + Copyright 2006-2011 Xavier Guerrin + This file is part of QElectroTech. + + QElectroTech is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + QElectroTech is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . +*/ +#ifndef TITLEBLOCK_SLASH_TEMPLATE_LOCATION_H +#define TITLEBLOCK_SLASH_TEMPLATE_LOCATION_H +#include +class QETProject; + +/** + This class represents the location of a title block template. +*/ +class TitleBlockTemplateLocation { + // constructor, destructor + public: + TitleBlockTemplateLocation(QETProject * = 0, const QString & = QString()); + virtual ~TitleBlockTemplateLocation(); + + // methods + public: + QETProject *project() const; + void setProject(QETProject *); + QString name() const; + void setName(const QString &); + bool isValid() const; + + // attributes + private: + QETProject *project_; ///< Parent project of the template, if any + QString name_; ///< Name of the template +}; +#endif diff --git a/sources/titleblock/templatelocationchooser.cpp b/sources/titleblock/templatelocationchooser.cpp new file mode 100644 index 000000000..ad09f29a5 --- /dev/null +++ b/sources/titleblock/templatelocationchooser.cpp @@ -0,0 +1,118 @@ +#include "templatelocationchooser.h" +#include "qetapp.h" +#include "qetproject.h" + +/** + Constructor + @param location Initial location displayed by the widget + @param widget Parent QWidget +*/ +TitleBlockTemplateLocationChooser::TitleBlockTemplateLocationChooser( + const TitleBlockTemplateLocation &location, + QWidget *parent +) : + QWidget(parent) +{ + init(); + setLocation(location); +} + +/** + Destructor +*/ +TitleBlockTemplateLocationChooser::~TitleBlockTemplateLocationChooser() { +} + +/** + @return the current location +*/ +TitleBlockTemplateLocation TitleBlockTemplateLocationChooser::location() const { + return(TitleBlockTemplateLocation(project(), name())); +} + +/** + @return the currently selected project +*/ +QETProject *TitleBlockTemplateLocationChooser::project() const { + uint project_id = projects_ -> itemData(projects_ -> currentIndex()).toUInt(); + return(QETApp::project(project_id)); +} + +/** + @return the currently selected/entered name +*/ +QString TitleBlockTemplateLocationChooser::name() const { + int template_index = templates_ -> currentIndex(); + return(template_index ? templates_ -> currentText() : new_name_ -> text()); +} + +/** + Set the location displayed by this widget + @param location to be displayed by this widget +*/ +void TitleBlockTemplateLocationChooser::setLocation(const TitleBlockTemplateLocation &location) { + // we need a project id + int project_id = QETApp::projectId(location.project()); + if (project_id == -1) return; + + // attempt to find this project id in our project combo box + int project_index = projects_ -> findData(QVariant(static_cast(project_id))); + if (project_index == -1) return; + + projects_ -> setCurrentIndex(project_index); + + if (!location.name().isEmpty()) { + int template_index = templates_ -> findText(location.name()); + if (template_index != -1) { + templates_ -> setCurrentIndex(template_index); + } else { + templates_ -> setCurrentIndex(0); + } + } +} + +/** + Initialize this widget. + @param location Initial location displayed by the widget +*/ +void TitleBlockTemplateLocationChooser::init() { + projects_ = new QComboBox(); + templates_ = new QComboBox(); + new_name_ = new QLineEdit(); + + QMap projects = QETApp::registeredProjects(); + foreach (uint project_id, projects.keys()) { + projects_ -> addItem(projects[project_id] -> title(), project_id); + } + updateTemplates(); + connect(projects_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTemplates())); + + QFormLayout *form_layout = new QFormLayout(); + form_layout -> addRow(tr("Projet parent", "used in save as form"), projects_); + form_layout -> addRow(tr("Modle existant", "used in save as form"), templates_); + form_layout -> addRow(tr("ou nouveau nom", "used in save as form"), new_name_); + setLayout(form_layout); +} + +/** + Update the templates list according to the selected project. +*/ +void TitleBlockTemplateLocationChooser::updateTemplates() { + int current_index = projects_ -> currentIndex(); + if (current_index == -1) return; + + uint project_id = projects_ -> itemData(current_index).toUInt(); + QETProject *project = QETApp::project(project_id); + if (!project) return; + + templates_ -> clear(); + templates_ -> addItem(tr("Nouveau modle (entrez son nom)", "combox box entry"), QVariant(false)); + + QStringList available_templates = project -> embeddedTitleBlockTemplates(); + if (available_templates.count()) { + templates_ -> insertSeparator(1); + foreach (QString template_name, available_templates) { + templates_ -> addItem(template_name, QVariant(true)); + } + } +} diff --git a/sources/titleblock/templatelocationchooser.h b/sources/titleblock/templatelocationchooser.h new file mode 100644 index 000000000..30d6b0ede --- /dev/null +++ b/sources/titleblock/templatelocationchooser.h @@ -0,0 +1,54 @@ +/* + Copyright 2006-2011 Xavier Guerrin + This file is part of QElectroTech. + + QElectroTech is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + QElectroTech is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . +*/ +#ifndef TITLEBLOCK_SLASH_LOCATION_CHOOSER_H +#define TITLEBLOCK_SLASH_LOCATION_CHOOSER_H +#include +#include "templatelocation.h" +/** + This class is a widget that allows the user to choose a target title block + template. +*/ +class TitleBlockTemplateLocationChooser : public QWidget { + Q_OBJECT + // Constructor, destructor + public: + TitleBlockTemplateLocationChooser(const TitleBlockTemplateLocation &, QWidget * = 0); + ~TitleBlockTemplateLocationChooser(); + private: + TitleBlockTemplateLocationChooser(const TitleBlockTemplateLocationChooser &); + + // methods + public: + TitleBlockTemplateLocation location() const; + QETProject *project() const; + QString name() const; + void setLocation(const TitleBlockTemplateLocation &); + private: + void init(); + + // slots + private slots: + void updateTemplates(); + + // attributes + private: + QComboBox *projects_; ///< Projects combo box + QComboBox *templates_; ///< Existing templates combo box + QLineEdit *new_name_; ///< New template name textfield +}; +#endif