diff --git a/cmainwindow.cpp b/cmainwindow.cpp index f064cc9..01af80b 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -68,7 +68,8 @@ cMainWindow::cMainWindow(cSplashScreen *lpSplashScreen, QTranslator *lpTranslato m_lpEditToolBar(0), m_lpTextToolBar(0), m_lpFormatToolBar(0), - m_lpOldTextEdit(0) + m_lpOldTextEdit(0), + m_lpOptionsDialog(0) { initUI(); createActions(); @@ -679,12 +680,16 @@ void cMainWindow::updateWindowTitle() setWindowTitle(szWindowTitle); } -void switchTranslator(QTranslator* lpTranslator, const QString& filename) +bool switchTranslator(QTranslator* lpTranslator, const QString& filename) { qApp->removeTranslator(lpTranslator); if(lpTranslator->load(filename)) + { qApp->installTranslator(lpTranslator); + return(true); + } + return(false); } void cMainWindow::onLanguageChanged() @@ -694,7 +699,8 @@ void cMainWindow::onLanguageChanged() QLocale locale = QLocale(szLanguage); QLocale::setDefault(locale); - switchTranslator(m_lpTranslator, QString(":/locale/storyWriter_%1.qm").arg(szLanguage)); + if(!switchTranslator(m_lpTranslator, QString("%1%2storyWriter_%3.qm").arg(localePath()).arg(QDir::separator()).arg(szLanguage))) + switchTranslator(m_lpTranslator, QString(":/locale/storyWriter_%1.qm").arg(szLanguage)); // switchTranslator(m_translatorQt, QString("qt_%1.qm").arg(szLanguage)); } @@ -847,6 +853,9 @@ void cMainWindow::retranslateWindows() lpWidget->retranslateUI(); } + + if(m_lpOptionsDialog) + m_lpOptionsDialog->retranslateUI(); } void cMainWindow::onTextEditGotFocus(cTextEdit* lpTextEdit) @@ -1555,12 +1564,16 @@ void cMainWindow::onFileProperties() void cMainWindow::onToolsOptions() { - cOptionsDialog* lpOptionsDialog = new cOptionsDialog(this); + if(m_lpOptionsDialog) + return; - connect(lpOptionsDialog, &cOptionsDialog::onLanguageChanged, this, &cMainWindow::onLanguageChanged); - lpOptionsDialog->exec(); + m_lpOptionsDialog = new cOptionsDialog(this); - delete lpOptionsDialog; + connect(m_lpOptionsDialog, &cOptionsDialog::onLanguageChanged, this, &cMainWindow::onLanguageChanged); + m_lpOptionsDialog->exec(); + + delete m_lpOptionsDialog; + m_lpOptionsDialog = 0; } void cMainWindow::onHelpContents() diff --git a/cmainwindow.h b/cmainwindow.h index e0d9b06..761dbb3 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -17,6 +17,7 @@ #include "cdoublespinbox.h" #include "cdatetimeedit.h" #include "ccombobox.h" +#include "coptionsdialog.h" #include "csplashscreen.h" @@ -755,6 +756,7 @@ private: cTextEdit* m_lpOldTextEdit; /*!< TODO: describe */ QString m_szOldPath; /*!< TODO: describe */ + cOptionsDialog* m_lpOptionsDialog; /*!< TODO: describe */ /*! \brief diff --git a/coptionsdialog.cpp b/coptionsdialog.cpp index 6e56558..835ee10 100644 --- a/coptionsdialog.cpp +++ b/coptionsdialog.cpp @@ -12,7 +12,8 @@ cOptionsDialog::cOptionsDialog(QWidget *parent) : QDialog(parent), - ui(new Ui::cOptionsDialog) + ui(new Ui::cOptionsDialog), + m_lpGeneralItem(0) { ui->setupUi(this); @@ -23,8 +24,8 @@ cOptionsDialog::cOptionsDialog(QWidget *parent) : ui->m_lpCategoryList->setModel(m_lpCategoryModel); QIcon icon(":/category/category_core.png"); - QStandardItem* lpItem = new QStandardItem(icon, tr("General")); - m_lpCategoryModel->appendRow(lpItem); + m_lpGeneralItem = new QStandardItem(icon, tr("General")); + m_lpCategoryModel->appendRow(m_lpGeneralItem); ui->m_lpCategoryList->resizeColumnToContents(0); @@ -51,12 +52,28 @@ cOptionsDialog::cOptionsDialog(QWidget *parent) : szLanguage = QLocale::languageToString(QLocale(szLocale).language()); ui->m_lpLanguage->addItem(szLanguage, szLocale); - if(!szCur.compare(szLocale, Qt::CaseInsensitive)) - ui->m_lpLanguage->setCurrentIndex(z+2); } + localeList = QDir(szPath).entryList(QStringList() << "storyWriter*.qm"); + + for(int z = 0;z < localeList.count();z++) + { + QString szLocale = localeList[z]; + szLocale.truncate(szLocale.lastIndexOf(".")); + szLocale.remove(0, szLocale.indexOf('_') + 1); + szLanguage = QLocale::languageToString(QLocale(szLocale).language()); + + if(ui->m_lpLanguage->findText(szLanguage) == -1) + ui->m_lpLanguage->addItem(szLanguage, szLocale); + } + + ui->m_lpLanguage->model()->sort(0); + ui->m_lpLanguage->setCurrentText(szCur); + connect(ui->m_lpLanguage, QOverload::of(&QComboBox::currentIndexChanged), this, &cOptionsDialog::onLanguageIndexChanged); connect(ui->m_lpButtonBox, QDialogButtonBox::clicked, this, &cOptionsDialog::onButtonClicked); + + retranslateUI(); } cOptionsDialog::~cOptionsDialog() @@ -64,6 +81,14 @@ cOptionsDialog::~cOptionsDialog() delete ui; } +void cOptionsDialog::retranslateUI() +{ + ui->retranslateUi(this); + + m_lpGeneralItem->setText(tr("General")); +// setWindowTitle(windowTitle() + m_lpPart->name()); +} + void cOptionsDialog::onLanguageIndexChanged(int /*index*/) { QString szLanguage = ui->m_lpLanguage->currentData().toString(); diff --git a/coptionsdialog.h b/coptionsdialog.h index af8fd09..be5e9f4 100644 --- a/coptionsdialog.h +++ b/coptionsdialog.h @@ -36,6 +36,14 @@ public: */ ~cOptionsDialog(); + + /*! + \brief + + \fn retranslateUI + */ + void retranslateUI(); + private slots: /*! \brief @@ -52,6 +60,7 @@ signals: private: Ui::cOptionsDialog* ui; /*!< TODO: describe */ QStandardItemModel* m_lpCategoryModel; /*!< TODO: describe */ + QStandardItem* m_lpGeneralItem; /*!< TODO: describe */ }; #endif // COPTIONSDIALOG_H diff --git a/cwidget.cpp b/cwidget.cpp index 50baeab..0afacc2 100644 --- a/cwidget.cpp +++ b/cwidget.cpp @@ -83,52 +83,54 @@ void cWidget::retranslateUI() switch(m_type) { case TYPE_part: - { - cPartWindow* lpWindow = (cPartWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cPartWindow* lpWindow = (cPartWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } break; case TYPE_chapter: - { - cChapterWindow* lpWindow = (cChapterWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cChapterWindow* lpWindow = (cChapterWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } break; case TYPE_scene: - { - cSceneWindow* lpWindow = (cSceneWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cSceneWindow* lpWindow = (cSceneWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } break; case TYPE_character: - { - cCharacterWindow* lpWindow = (cCharacterWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cCharacterWindow* lpWindow = (cCharacterWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } break; case TYPE_object: - { - cObjectWindow* lpWindow = (cObjectWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cObjectWindow* lpWindow = (cObjectWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } break; case TYPE_place: - { - cPlaceWindow* lpWindow = (cPlaceWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cPlaceWindow* lpWindow = (cPlaceWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } break; case TYPE_recherche: - { - cRechercheWindow* lpWindow = (cRechercheWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cRechercheWindow* lpWindow = (cRechercheWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } break; case TYPE_properties: - { - cPropertiesWindow* lpWindow = (cPropertiesWindow*)m_lpWidget; - lpWindow->retranslateUI(); - } + { + cPropertiesWindow* lpWindow = (cPropertiesWindow*)m_lpWidget; + lpWindow->retranslateUI(); + } + break; + default: break; } } diff --git a/storyWriter.pro b/storyWriter.pro index 85bbf47..cd9fa79 100644 --- a/storyWriter.pro +++ b/storyWriter.pro @@ -12,7 +12,7 @@ QMAKE_TARGET_COPYRIGHT = (c) 2018 WIN-DESIGN QT += core gui xml sql -TRANSLATIONS = storyWriter_de.ts +TRANSLATIONS = storyWriter_de.ts storyWriter_fr.ts greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -155,7 +155,8 @@ DISTFILES += \ images/icon.ico \ resources/icon.png \ images/tango/32x32/actions/document-pdf.png \ - storyWriter_de.ts + storyWriter_de.ts \ + storyWriter_fr.ts RESOURCES += \ storywriter.qrc diff --git a/storyWriter_de.ts b/storyWriter_de.ts index d98d4df..58a1d9f 100644 --- a/storyWriter_de.ts +++ b/storyWriter_de.ts @@ -302,10 +302,10 @@ - - - - + + + + Save Speichern @@ -315,630 +315,705 @@ &Beenden - - - - + + + + has been changed. Do you want to save? wurde geändert.\nMöchtest du speichern? - + + &File &Datei - + File Actions Datei - + + &New &Neu - + + &Open... &Öffnen... - + + &Save &Speichern - + + Save &As... Speichern &als... - + + &Print... &Drucken... - + + Print Preview... Druckvorschau... - + + &Export PDF... &Export PDF... - + + P&roperties... &Einstellungen... - + + &Quit &Beenden - + + &Edit &Bearbeiten - + Edit Actions Bearbeiten - + + &Undo &Rückgängig - + + &Redo &Wiederholen - + + Cu&t &Ausschneiden - + + &Copy &Kopieren - + + &Paste &Einfügen - + + F&ormat F&ormat - - + + Format Actions Format - + + &Bold &Fett - + + &Italic &Kursiv - + + &Underline &Unterstrichen - + + &Left &Links - + + C&enter &Zentriert - + + &Right &Links - + + &Justify &Blocksatz - + + &Color... &Farbe... - + + &Tools &Tools - + + &Options... &Optionen... - + + &Help &Hilfe - + + &Contents &Inhalt - + + &Index &Index - + + &About &Über - + + add part Teil hinzufügen - + + add a new part neuen Teil hinzufügen - + + edit part Teil bearbeiten - + + edit the part Teil bearbeiten - + + delete part Teil löschen - + + delete the part Teil löschen - + + add chapter Kapitel hinzufügen - + + add a new chapter neues Kapitel hinzufügen - + + edit chapter Kapitel bearbeiten - + + edit the chapter Kapitel bearbeiten - + + delete chapter Kapitel löschen - + + delete the chapter Kapitel löschen - + + add scene Szene hinzufügen - + + add a new scene neue Szene hinzufügen - + + edit scene Szene bearbeiten - + + edit the scene Szene bearbeiten - + + delete scene Szene löschen - + + delete the scene Szene löschen - + + add character Figur hinzufügen - + + add a new character neue Figur hinzufügen - + + edit character Figur bearbeiten - + + edit the character Figur bearbeiten - + + delete character Figur löschen - + + delete the character Figur löschen - + + add place Ort hinzufügen - + + add a new place neuen Ort hinzufügen - + + edit place Ort bearbeiten - + + edit the place Ort bearbeiten - + + delete place Ort löschen - + + delete the place Ort löschen - + + add object Objekt hinzufügen - + + add a new object neues Objekt hinzufügen - + + edit object Objekt bearbeiten - + + edit the object Objekt bearbeiten - + + delete object Objekt löschen - + + delete the object Objekt löschen - + + add recherche Recherche hinzufügen - + + add a new recherche neue Recherche hinzufügen - + + edit recherche Recherche bearbeiten - + + edit the recherche Recherche bearbeiten - + + delete recherche Recherche löschen - + + delete the recherche Recherche löschen - + + open link Link öffnen - + + open the link Link öffnen - - - + + + New Part Neuer Teil - - - - - - - + + + + + + + Name: Name: - + Part Name is empty. Name des Teils ist leer. - + Part could not be created. Teil konnte nicht erzeugt werden. - + There are still some chapter in this part. Please delete them before deleting the part. Es befinden sich noch Kapitel in diesem Teil.\nBitte lösche diese zuerst und dann den Teil. - + Are you sure you want to delete this part:<br> Bist du sicher, dass du den Teil löschen möchtest:<br> - - - + + + New Chapter Neues Kapitel - + Chapter Name is empty. Name des Kapitel ist leer. - + Chapter could not be created. Kapitel konnte nicht erstellt werden. - + There are still some scenes in this chapter. Please delete them before deleting the chapter. Es befinden sich noch Scenen in diesem Kapitel.\nBitte lösche diese zuerst und dann das Kapitel. - + Are you sure you want to delete this chapter:<br> Bist du sicher, dass du das Kapitel löschen möchtest:<br> - + <br>from part <br> <br>von Teil<br> - - - + + + New Scene Neue Szene - + Scene Name is empty. Der Name der Szene ist leer. - + Scene could not be created. Die Szene konnte nicht erstellt werden. - + Are you sure you want to delete this scene:<br> Bist du sicher, dass du die Szene löschen möchtest:<br> - + <br>from chapter <br> <br>von Kapitel<br> - - - + + + New Character Neue Figur - + Character Name is empty. Name der Figur ist leer. - + Character could not be created. Figur konnte nicht erstellt werden. - + This character is still in use. Please delete the usage before deleting the character. Diese Figur ist in Verwendung.\nBitte lösche zuerst die Verwendung und danach die Figur. - + Are you sure you want to delete this character:<br> Bist du sicher, dass du die Figur löschen möchtest:<br> - - - + + + New Place Neuer Ort - + Place Name is empty. Name des Ortes ist leer. - + Place could not be created. Ort konnte nicht erzeugt werden. - + This place is still in use. Please delete the usage before deleting the place. Dieser Ort ist in Verwendung.\nBitte lösche zuerst die Verwendung und danach den Ort. - + Are you sure you want to delete this place:<br> Bist du sicher, dass du den Ort löschen möchtest:<br> - - - + + + New Object Neues Objekt - + Object Name is empty. Name des Objekts ist leer. - + Object could not be created. Objekt konnte nicht erzeugt werden. - + This object is still in use. Please delete the usage before deleting the object. Dieses Objekt ist in Verwendung.\nBitte lösche zuerst die Verwendung und danach das Objekt. - + Are you sure you want to delete this object:<br> Bist du sicher, dass du das Objekt löschen möchtest:<br> - - - + + + New Recherche Neue Recherche - + Recherche Name is empty. Name der Recherche ist leer. - + Recherche could not be created. Recherche konnte nicht angelegt werden. - + This recherche is still in use. Please delete the usage before deleting the recherche. Diese Recherche ist in Verwendung.\nBitte lösche zuerst die Verwendung und danach die Recherche. - + Are you sure you want to delete this recherche:<br> Bist du sicher, dass du die Recherche löschen möchtest:<br> - - + + Save Project Sichere Projekt - - + + StoryWriter Files (*.storyWriter) storyWriter Dateien (*.storyWriter) - + &%1 %2 &%1 %2 diff --git a/storyWriter_fr.ts b/storyWriter_fr.ts new file mode 100644 index 0000000..55a43a3 --- /dev/null +++ b/storyWriter_fr.ts @@ -0,0 +1,1463 @@ + + + + + QObject + + + <center>initializing...</denter> + + + + + cChapterWindow + + + [chapter] - + + + + + Description: + + + + + Scenes: + + + + + Name: + + + + + Part: + + + + + name + + + + + cCharacter + + + female + + + + + male + + + + + + undefined + + + + + cCharacterSelectDialog + + + Select Character + + + + + name + + + + + creature + + + + + gender + + + + + cCharacterWindow + + + [character] - + + + + + Basic + + + + + Date of Death: + + + + + Place of Death: + + + + + Height: + + + + + Creature: + + + + + Place of Birth: + + + + + Date of Birth: + + + + + Main Character + + + + + Weight: + + + + + Middle Name: + + + + + First Name: + + + + + Description: + + + + + Last Name: + + + + + Hair Color: + + + + + Hair Cut: + + + + + Hair Length: + + + + + Figure: + + + + + Job: + + + + + Skin: + + + + + School: + + + + + Spoken Languages: + + + + + Nature: + + + + + Gender + + + + + Male + + + + + Female + + + + + Other + + + + + Title: + + + + + Nick Name: + + + + + Images + + + + + cImageWidget + + + Form + + + + + GroupBox + + + + + TextLabel + + + + + cMainWindow + + + qtStoryBook + storyBook + + + + Outline + vue d'ensemble + + + + Character + figure + + + + Place + + + + + Object + + + + + Recherche + + + + + Test1 + + + + + + + + + Save + + + + + &Close + + + + + + + + has been changed. +Do you want to save? + + + + + + &File + + + + + File Actions + + + + + + &New + + + + + + &Open... + + + + + + &Save + + + + + + Save &As... + + + + + + &Print... + + + + + + Print Preview... + + + + + + &Export PDF... + + + + + + P&roperties... + + + + + + &Quit + + + + + + &Edit + + + + + Edit Actions + + + + + + &Undo + + + + + + &Redo + + + + + + Cu&t + + + + + + &Copy + + + + + + &Paste + + + + + + F&ormat + + + + + + Format Actions + + + + + + &Bold + + + + + + &Italic + + + + + + &Underline + + + + + + &Left + + + + + + C&enter + + + + + + &Right + + + + + + &Justify + + + + + + &Color... + + + + + + &Tools + + + + + + &Options... + + + + + + &Help + + + + + + &Contents + + + + + + &Index + + + + + + &About + + + + + + add part + + + + + + add a new part + + + + + + edit part + + + + + + edit the part + + + + + + delete part + + + + + + delete the part + + + + + + add chapter + + + + + + add a new chapter + + + + + + edit chapter + + + + + + edit the chapter + + + + + + delete chapter + + + + + + delete the chapter + + + + + + add scene + + + + + + add a new scene + + + + + + edit scene + + + + + + edit the scene + + + + + + delete scene + + + + + + delete the scene + + + + + + add character + + + + + + add a new character + + + + + + edit character + + + + + + edit the character + + + + + + delete character + + + + + + delete the character + + + + + + add place + + + + + + add a new place + + + + + + edit place + + + + + + edit the place + + + + + + delete place + + + + + + delete the place + + + + + + add object + + + + + + add a new object + + + + + + edit object + + + + + + edit the object + + + + + + delete object + + + + + + delete the object + + + + + + add recherche + + + + + + add a new recherche + + + + + + edit recherche + + + + + + edit the recherche + + + + + + delete recherche + + + + + + delete the recherche + + + + + + open link + + + + + + open the link + + + + + + + New Part + + + + + + + + + + + Name: + + + + + Part Name is empty. + + + + + Part could not be created. + + + + + There are still some chapter in this part. +Please delete them before deleting the part. + + + + + Are you sure you want to delete this part:<br> + + + + + + + New Chapter + + + + + Chapter Name is empty. + + + + + Chapter could not be created. + + + + + There are still some scenes in this chapter. +Please delete them before deleting the chapter. + + + + + Are you sure you want to delete this chapter:<br> + + + + + <br>from part <br> + + + + + + + New Scene + + + + + Scene Name is empty. + + + + + Scene could not be created. + + + + + Are you sure you want to delete this scene:<br> + + + + + <br>from chapter <br> + + + + + + + New Character + + + + + Character Name is empty. + + + + + Character could not be created. + + + + + This character is still in use. +Please delete the usage before deleting the character. + + + + + Are you sure you want to delete this character:<br> + + + + + + + New Place + + + + + Place Name is empty. + + + + + Place could not be created. + + + + + This place is still in use. +Please delete the usage before deleting the place. + + + + + Are you sure you want to delete this place:<br> + + + + + + + New Object + + + + + Object Name is empty. + + + + + Object could not be created. + + + + + This object is still in use. +Please delete the usage before deleting the object. + + + + + Are you sure you want to delete this object:<br> + + + + + + + New Recherche + + + + + Recherche Name is empty. + + + + + Recherche could not be created. + + + + + This recherche is still in use. +Please delete the usage before deleting the recherche. + + + + + Are you sure you want to delete this recherche:<br> + + + + + + Save Project + + + + + + StoryWriter Files (*.storyWriter) + + + + + &%1 %2 + + + + + cObjectSelectDialog + + + Dialog + + + + + name + + + + + type + + + + + cObjectWindow + + + [object] - + + + + + Basic + + + + + Description: + + + + + Type: + + + + + Name: + + + + + Images + + + + + cOptionsDialog + + + Dialog + + + + + + General + + + + + Language: + + + + + cPartWindow + + + [part] - + + + + + Description: + + + + + Name: + + + + + Chapters: + + + + + name + + + + + cPlaceSelectDialog + + + Dialog + + + + + name + + + + + location + + + + + type + + + + + cPlaceWindow + + + [place] - + + + + + Basic + + + + + Location: + + + + + Type: + + + + + Description: + + + + + Name: + + + + + Images + + + + + cPropertiesWindow + + + [properties] + + + + + Started at: + + + + + Short Description: + + + + + Finished at: + + + + + Author: + + + + + Description: + + + + + Title: + + + + + Subtitle: + + + + + Target Date: + + + + + cRechercheWindow + + + [recherche] - + + + + + Basic + + + + + Name: + + + + + Link: + + + + + Description: + + + + + Images + + + + + Character + + + + + + + details... + + + + + + + add... + + + + + + + remove + + + + + Place + + + + + Object + + + + + + + Do you want to delete "%1" from list? + + + + + cScene + + + unknown + + + + + initialized + + + + + progress + + + + + delayed + + + + + finished + + + + + cSceneWindow + + + [scene] - + + + + + Basic + + + + + Chapter: + + + + + Name: + + + + + Finished: + + + + + Started: + + + + + State: + + + + + Part: + + + + + Target Date: + + + + + Description: + + + + + Character + + + + + + + details... + + + + + + + add... + + + + + + + remove + + + + + Place + + + + + Object + + + + + + + Do you want to delete "%1" from list? + + + + + cStoryBook + + + + + + + name + + + + + state + + + + + creature + + + + + gender + + + + + location + + + + + + type + + + + + link + + + +