Merge branch 'master' of ssh://git.tuxfamily.org/gitroot/qet/qet

This commit is contained in:
pavelfric
2020-11-02 22:04:40 +01:00
12 changed files with 248 additions and 115 deletions

67
.clang-format Normal file
View File

@@ -0,0 +1,67 @@
---
BasedOnStyle: LLVM
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'false'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'true'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: 'true'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'true'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakAfterJavaFieldAnnotations: 'true'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: 'false'
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: 'true'
ColumnLimit: '80'
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
Cpp11BracedListStyle: 'true'
FixNamespaceComments: 'true'
IncludeBlocks: Regroup
IndentCaseLabels: 'false'
IndentPPDirectives: AfterHash
IndentWidth: '4'
JavaScriptWrapImports: 'true'
Language: Cpp
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: All
PointerAlignment: Left
ReflowComments: 'true'
SortIncludes: 'true'
SortUsingDeclarations: 'true'
SpaceAfterCStyleCast: 'true'
SpaceAfterLogicalNot: 'true'
SpaceAfterTemplateKeyword: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
TabWidth: '4'
UseTab: Always
...

Binary file not shown.

View File

@@ -1625,7 +1625,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun
<location filename="../sources/elementdialog.cpp" line="62"/> <location filename="../sources/elementdialog.cpp" line="62"/>
<source>Ouvrir un élément</source> <source>Ouvrir un élément</source>
<comment>dialog title</comment> <comment>dialog title</comment>
<translation>Åbne symbol</translation> <translation>Åbn symbol</translation>
</message> </message>
<message> <message>
<location filename="../sources/elementdialog.cpp" line="63"/> <location filename="../sources/elementdialog.cpp" line="63"/>
@@ -1649,7 +1649,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun
<location filename="../sources/elementdialog.cpp" line="70"/> <location filename="../sources/elementdialog.cpp" line="70"/>
<source>Ouvrir une catégorie</source> <source>Ouvrir une catégorie</source>
<comment>dialog title</comment> <comment>dialog title</comment>
<translation>Åbne kategori</translation> <translation>Åbn kategori</translation>
</message> </message>
<message> <message>
<location filename="../sources/elementdialog.cpp" line="71"/> <location filename="../sources/elementdialog.cpp" line="71"/>
@@ -2111,7 +2111,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun
<message> <message>
<location filename="../sources/dataBase/ui/elementquerywidget.ui" line="330"/> <location filename="../sources/dataBase/ui/elementquerywidget.ui" line="330"/>
<source>Ouvrir la configuration sélectionné</source> <source>Ouvrir la configuration sélectionné</source>
<translation>Åbne valgt konfiguration</translation> <translation>Åbn valgt konfiguration</translation>
</message> </message>
<message> <message>
<location filename="../sources/dataBase/ui/elementquerywidget.ui" line="357"/> <location filename="../sources/dataBase/ui/elementquerywidget.ui" line="357"/>
@@ -2287,7 +2287,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun
<message> <message>
<location filename="../sources/ElementsCollection/elementscollectionwidget.cpp" line="145"/> <location filename="../sources/ElementsCollection/elementscollectionwidget.cpp" line="145"/>
<source>Ouvrir le dossier correspondant</source> <source>Ouvrir le dossier correspondant</source>
<translation>Åbne mappe</translation> <translation>Åbn mappe</translation>
</message> </message>
<message> <message>
<location filename="../sources/ElementsCollection/elementscollectionwidget.cpp" line="147"/> <location filename="../sources/ElementsCollection/elementscollectionwidget.cpp" line="147"/>
@@ -2488,7 +2488,7 @@ Alle symboler og fil indhold bliver slettet.</translation>
<message> <message>
<location filename="../sources/elementspanelwidget.cpp" line="53"/> <location filename="../sources/elementspanelwidget.cpp" line="53"/>
<source>Ouvrir le dossier correspondant</source> <source>Ouvrir le dossier correspondant</source>
<translation>Åbne mappe</translation> <translation>Åbn mappe</translation>
</message> </message>
<message> <message>
<location filename="../sources/elementspanelwidget.cpp" line="54"/> <location filename="../sources/elementspanelwidget.cpp" line="54"/>
@@ -5629,7 +5629,7 @@ Kommandovalg:
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="817"/> <location filename="../sources/qetdiagrameditor.cpp" line="817"/>
<source>Affiche ou non le panel d&apos;appareils</source> <source>Affiche ou non le panel d&apos;appareils</source>
<translation>Vise eller skjule symbol panel</translation> <translation>Vis eller skjul symbol panel</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="550"/> <location filename="../sources/qetdiagrameditor.cpp" line="550"/>
@@ -5840,7 +5840,7 @@ Kommandovalg:
<location filename="../sources/qetdiagrameditor.cpp" line="534"/> <location filename="../sources/qetdiagrameditor.cpp" line="534"/>
<source>Ouvre un projet existant</source> <source>Ouvre un projet existant</source>
<comment>status bar tip</comment> <comment>status bar tip</comment>
<translation>Åbne eksisterende projekt</translation> <translation>Åbn eksisterende projekt</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="535"/> <location filename="../sources/qetdiagrameditor.cpp" line="535"/>
@@ -6017,12 +6017,12 @@ Kommandovalg:
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="523"/> <location filename="../sources/qetdiagrameditor.cpp" line="523"/>
<source>&amp;Ouvrir</source> <source>&amp;Ouvrir</source>
<translation>&amp;Åbne</translation> <translation>&amp;Åbn</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="974"/> <location filename="../sources/qetdiagrameditor.cpp" line="974"/>
<source>Ouvrir un fichier</source> <source>Ouvrir un fichier</source>
<translation>Åbne fil</translation> <translation>Åbn fil</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="618"/> <location filename="../sources/qetdiagrameditor.cpp" line="618"/>
@@ -6092,17 +6092,17 @@ Kommandovalg:
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="814"/> <location filename="../sources/qetdiagrameditor.cpp" line="814"/>
<source>Affiche ou non la barre d&apos;outils principale</source> <source>Affiche ou non la barre d&apos;outils principale</source>
<translation>Vise eller skjule værktøjslinje</translation> <translation>Vis eller skjul værktøjslinje</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="815"/> <location filename="../sources/qetdiagrameditor.cpp" line="815"/>
<source>Affiche ou non la barre d&apos;outils Affichage</source> <source>Affiche ou non la barre d&apos;outils Affichage</source>
<translation>Vise eller skjule værktøjslinjen Vise</translation> <translation>Vis eller skjul værktøjslinjen Vis</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="816"/> <location filename="../sources/qetdiagrameditor.cpp" line="816"/>
<source>Affiche ou non la barre d&apos;outils Schéma</source> <source>Affiche ou non la barre d&apos;outils Schéma</source>
<translation>Vise eller skjule værktøjslinjen Diagram</translation> <translation>Vis eller skjul værktøjslinjen Diagram</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="696"/> <location filename="../sources/qetdiagrameditor.cpp" line="696"/>
@@ -6127,7 +6127,7 @@ Kommandovalg:
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="818"/> <location filename="../sources/qetdiagrameditor.cpp" line="818"/>
<source>Affiche ou non la liste des modifications</source> <source>Affiche ou non la liste des modifications</source>
<translation>Vise eller skjule gendan liste</translation> <translation>Vis eller skjul gendan liste</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="572"/> <location filename="../sources/qetdiagrameditor.cpp" line="572"/>
@@ -6159,7 +6159,7 @@ Kommandovalg:
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="676"/> <location filename="../sources/qetdiagrameditor.cpp" line="676"/>
<source>Chercher/remplacer</source> <source>Chercher/remplacer</source>
<translation>Søge/erstatte</translation> <translation>Søg/erstat</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="752"/> <location filename="../sources/qetdiagrameditor.cpp" line="752"/>
@@ -6169,7 +6169,7 @@ Kommandovalg:
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="764"/> <location filename="../sources/qetdiagrameditor.cpp" line="764"/>
<source>&amp;Récemment ouverts</source> <source>&amp;Récemment ouverts</source>
<translation>&amp;Seneste åbnet</translation> <translation>&amp;Senest åbnet</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="903"/> <location filename="../sources/qetdiagrameditor.cpp" line="903"/>
@@ -6367,7 +6367,7 @@ Kommandovalg:
<location filename="../sources/qetdiagrameditor.cpp" line="464"/> <location filename="../sources/qetdiagrameditor.cpp" line="464"/>
<source>Présente les différents projets ouverts dans des sous-fenêtres</source> <source>Présente les différents projets ouverts dans des sous-fenêtres</source>
<comment>status bar tip</comment> <comment>status bar tip</comment>
<translation>Vise åbne projekter i vinduer</translation> <translation>Vis åbne projekter i vinduer</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="420"/> <location filename="../sources/qetdiagrameditor.cpp" line="420"/>
@@ -6378,7 +6378,7 @@ Kommandovalg:
<location filename="../sources/qetdiagrameditor.cpp" line="459"/> <location filename="../sources/qetdiagrameditor.cpp" line="459"/>
<source>Présente les différents projets ouverts des onglets</source> <source>Présente les différents projets ouverts des onglets</source>
<comment>status bar tip</comment> <comment>status bar tip</comment>
<translation>Vise åbne projekter i faneblade</translation> <translation>Vis åbne projekter i faneblade</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="483"/> <location filename="../sources/qetdiagrameditor.cpp" line="483"/>
@@ -6541,7 +6541,7 @@ Kommandovalg:
<message> <message>
<location filename="../sources/editor/qetelementeditor.cpp" line="142"/> <location filename="../sources/editor/qetelementeditor.cpp" line="142"/>
<source>&amp;Ouvrir</source> <source>&amp;Ouvrir</source>
<translation>&amp;Åbne</translation> <translation>&amp;Åbn</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/qetelementeditor.cpp" line="145"/> <location filename="../sources/editor/qetelementeditor.cpp" line="145"/>
@@ -6687,7 +6687,7 @@ Kommandovalg:
<message> <message>
<location filename="../sources/editor/qetelementeditor.cpp" line="143"/> <location filename="../sources/editor/qetelementeditor.cpp" line="143"/>
<source>&amp;Ouvrir depuis un fichier</source> <source>&amp;Ouvrir depuis un fichier</source>
<translation>&amp;Åbne fra fil</translation> <translation>&amp;Åbn fra fil</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/qetelementeditor.cpp" line="147"/> <location filename="../sources/editor/qetelementeditor.cpp" line="147"/>
@@ -6855,7 +6855,7 @@ Gør den kørbar: chmod +x ./DXFtoQET
<message> <message>
<location filename="../sources/editor/qetelementeditor.cpp" line="382"/> <location filename="../sources/editor/qetelementeditor.cpp" line="382"/>
<source>&amp;Récemment ouverts</source> <source>&amp;Récemment ouverts</source>
<translation>&amp;Seneste åbnet</translation> <translation>&amp;Senest åbnet</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/qetelementeditor.cpp" line="394"/> <location filename="../sources/editor/qetelementeditor.cpp" line="394"/>
@@ -7102,7 +7102,7 @@ betingelser ikke gyldig</translation>
<location filename="../sources/editor/qetelementeditor.cpp" line="1596"/> <location filename="../sources/editor/qetelementeditor.cpp" line="1596"/>
<source>Ouvrir un fichier</source> <source>Ouvrir un fichier</source>
<comment>dialog title</comment> <comment>dialog title</comment>
<translation>Åbne fil</translation> <translation>Åbn fil</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/qetelementeditor.cpp" line="1598"/> <location filename="../sources/editor/qetelementeditor.cpp" line="1598"/>
@@ -7437,13 +7437,13 @@ Hvad skal ske?</translation>
<location filename="../sources/titleblock/qettemplateeditor.cpp" line="368"/> <location filename="../sources/titleblock/qettemplateeditor.cpp" line="368"/>
<source>&amp;Ouvrir</source> <source>&amp;Ouvrir</source>
<comment>menu entry</comment> <comment>menu entry</comment>
<translation>&amp;Åbne</translation> <translation>&amp;Åbn</translation>
</message> </message>
<message> <message>
<location filename="../sources/titleblock/qettemplateeditor.cpp" line="369"/> <location filename="../sources/titleblock/qettemplateeditor.cpp" line="369"/>
<source>Ouvrir depuis un fichier</source> <source>Ouvrir depuis un fichier</source>
<comment>menu entry</comment> <comment>menu entry</comment>
<translation>Åbne fra fil</translation> <translation>Åbn fra fil</translation>
</message> </message>
<message> <message>
<location filename="../sources/titleblock/qettemplateeditor.cpp" line="370"/> <location filename="../sources/titleblock/qettemplateeditor.cpp" line="370"/>
@@ -8591,27 +8591,27 @@ Voulez-vous la remplacer ?</source>
<message> <message>
<location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="55"/> <location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="55"/>
<source>Chercher/remplacer les propriétés de folio</source> <source>Chercher/remplacer les propriétés de folio</source>
<translation>Søge/erstatte ark egenskaber</translation> <translation>Søg/erstat ark egenskaber</translation>
</message> </message>
<message> <message>
<location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="119"/> <location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="119"/>
<source>Chercher/remplacer les propriétés d&apos;éléments.</source> <source>Chercher/remplacer les propriétés d&apos;éléments.</source>
<translation>Søge/erstatte symbol egenskaber.</translation> <translation>Søg/erstat symbol egenskaber.</translation>
</message> </message>
<message> <message>
<location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="211"/> <location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="211"/>
<source>Chercher/remplacer les propriétés de conducteurs.</source> <source>Chercher/remplacer les propriétés de conducteurs.</source>
<translation>Søge/erstatte ledere egenskaber.</translation> <translation>Søg/erstat ledere egenskaber.</translation>
</message> </message>
<message> <message>
<location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="298"/> <location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="298"/>
<source>Rechercher / remplacer avancé</source> <source>Rechercher / remplacer avancé</source>
<translation>Søge/erstatte avanceret</translation> <translation>Søg/erstat avanceret</translation>
</message> </message>
<message> <message>
<location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="171"/> <location filename="../sources/SearchAndReplace/searchandreplaceworker.cpp" line="171"/>
<source>Chercher/remplacer des textes independants</source> <source>Chercher/remplacer des textes independants</source>
<translation>Søge/erstatte uafhængige tekste</translation> <translation>Søg/erstat uafhængige tekste</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetinformation.cpp" line="67"/> <location filename="../sources/qetinformation.cpp" line="67"/>
@@ -9999,13 +9999,13 @@ De andre felter anvendes ikke.</translation>
<location filename="../sources/editor/styleeditor.cpp" line="55"/> <location filename="../sources/editor/styleeditor.cpp" line="55"/>
<source>Pink : HotPink</source> <source>Pink : HotPink</source>
<comment>element part color</comment> <comment>element part color</comment>
<translation type="unfinished"></translation> <translation>Lyserød : Varm lyserød</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/styleeditor.cpp" line="56"/> <location filename="../sources/editor/styleeditor.cpp" line="56"/>
<source>Pink : DeepPink</source> <source>Pink : DeepPink</source>
<comment>element part color</comment> <comment>element part color</comment>
<translation type="unfinished"></translation> <translation>Lyserød : Dyb lyserød</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/styleeditor.cpp" line="57"/> <location filename="../sources/editor/styleeditor.cpp" line="57"/>
@@ -10017,13 +10017,13 @@ De andre felter anvendes ikke.</translation>
<location filename="../sources/editor/styleeditor.cpp" line="58"/> <location filename="../sources/editor/styleeditor.cpp" line="58"/>
<source>Pink : MediumVioletRed</source> <source>Pink : MediumVioletRed</source>
<comment>element part color</comment> <comment>element part color</comment>
<translation type="unfinished"></translation> <translation>Lyserød : Mellem violet rød</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/styleeditor.cpp" line="59"/> <location filename="../sources/editor/styleeditor.cpp" line="59"/>
<source>Red : LightSalmon</source> <source>Red : LightSalmon</source>
<comment>element part color</comment> <comment>element part color</comment>
<translation type="unfinished"></translation> <translation>Rød : Lys laks</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/styleeditor.cpp" line="60"/> <location filename="../sources/editor/styleeditor.cpp" line="60"/>
@@ -10035,7 +10035,7 @@ De andre felter anvendes ikke.</translation>
<location filename="../sources/editor/styleeditor.cpp" line="61"/> <location filename="../sources/editor/styleeditor.cpp" line="61"/>
<source>Red : DarkSalmon</source> <source>Red : DarkSalmon</source>
<comment>element part color</comment> <comment>element part color</comment>
<translation type="unfinished"></translation> <translation>Rød : Mørk laks</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/styleeditor.cpp" line="62"/> <location filename="../sources/editor/styleeditor.cpp" line="62"/>
@@ -10047,7 +10047,7 @@ De andre felter anvendes ikke.</translation>
<location filename="../sources/editor/styleeditor.cpp" line="63"/> <location filename="../sources/editor/styleeditor.cpp" line="63"/>
<source>Red : IndianRed</source> <source>Red : IndianRed</source>
<comment>element part color</comment> <comment>element part color</comment>
<translation type="unfinished"></translation> <translation>Rød : Indianer rød</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/styleeditor.cpp" line="64"/> <location filename="../sources/editor/styleeditor.cpp" line="64"/>
@@ -10060,7 +10060,7 @@ De andre felter anvendes ikke.</translation>
<location filename="../sources/editor/styleeditor.cpp" line="65"/> <location filename="../sources/editor/styleeditor.cpp" line="65"/>
<source>Red : Firebrick</source> <source>Red : Firebrick</source>
<comment>element part color</comment> <comment>element part color</comment>
<translation type="unfinished"></translation> <translation>Rød : Ild fast sten</translation>
</message> </message>
<message> <message>
<location filename="../sources/editor/styleeditor.cpp" line="66"/> <location filename="../sources/editor/styleeditor.cpp" line="66"/>
@@ -11898,7 +11898,7 @@ De andre felter anvendes ikke.</translation>
<message> <message>
<location filename="../sources/dataBase/ui/summaryquerywidget.ui" line="51"/> <location filename="../sources/dataBase/ui/summaryquerywidget.ui" line="51"/>
<source>Information à afficher</source> <source>Information à afficher</source>
<translation>Vise information</translation> <translation>Vis information</translation>
</message> </message>
<message> <message>
<location filename="../sources/dataBase/ui/summaryquerywidget.ui" line="145"/> <location filename="../sources/dataBase/ui/summaryquerywidget.ui" line="145"/>
@@ -13122,7 +13122,7 @@ Maksimum længde: %2piksel
<message> <message>
<location filename="../sources/SearchAndReplace/ui/replaceadvanceddialog.ui" line="14"/> <location filename="../sources/SearchAndReplace/ui/replaceadvanceddialog.ui" line="14"/>
<source>Rechercher/Remplacer avancé</source> <source>Rechercher/Remplacer avancé</source>
<translation>Søge/erstatte avanceret</translation> <translation>Søg/erstat avanceret</translation>
</message> </message>
<message> <message>
<location filename="../sources/SearchAndReplace/ui/replaceadvanceddialog.ui" line="27"/> <location filename="../sources/SearchAndReplace/ui/replaceadvanceddialog.ui" line="27"/>

View File

@@ -282,9 +282,8 @@ void FileElementCollectionItem::setUpData()
ElementsLocation loc(collectionPath()); ElementsLocation loc(collectionPath());
DiagramContext context = loc.elementInformations(); DiagramContext context = loc.elementInformations();
QStringList search_list; QStringList search_list;
for (QString key : context.keys()) { for (QString& key : context.keys())
search_list.append(context.value(key).toString()); { search_list.append(context.value(key).toString()); }
}
search_list.append(localName(loc)); search_list.append(localName(loc));
setData(search_list.join(" ")); setData(search_list.join(" "));
} }
@@ -352,8 +351,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
QDir dir (fileSystemPath()); QDir dir (fileSystemPath());
//Get all directory in this directory. //Get all directory in this directory.
for(auto str : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, for (auto& str :
QDir::Name)) dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
{ {
FileElementCollectionItem *feci = new FileElementCollectionItem(); FileElementCollectionItem *feci = new FileElementCollectionItem();
appendRow(feci); appendRow(feci);
@@ -367,8 +366,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
//Get all elmt file in this directory //Get all elmt file in this directory
dir.setNameFilters(QStringList() << "*.elmt"); dir.setNameFilters(QStringList() << "*.elmt");
for(auto str : dir.entryList(QDir::Files | QDir::NoDotAndDotDot, for (auto& str :
QDir::Name)) dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
{ {
FileElementCollectionItem *feci = new FileElementCollectionItem(); FileElementCollectionItem *feci = new FileElementCollectionItem();
appendRow(feci); appendRow(feci);

View File

@@ -229,28 +229,25 @@ bool NamesList::operator==(const NamesList &nl) const
} }
/** /**
Return the adequate name regarding the current system locale. * @brief NamesList::name
By order of preference, this function chooses: * Return the adequate name regarding the current system locale.
- the name in the system language * By order of preference, this function chooses:
- the English name * - the name in the system language
- the provided fallback name if non-empty * - the English name
- the first language encountered in the list * - the provided fallback name if non-empty
- an empty string * - the first language encountered in the list
@param fallback_name name to be returned when no adequate name has been found * - an empty string
@return The adequate name regarding the current system locale. * @param fallback_name
* name to be returned when no adequate name has been found
* @return The adequate name regarding the current system locale.
*/ */
QString NamesList::name(const QString &fallback_name) const QString NamesList::name(const QString &fallback_name) const
{ {
QString system_language = QETApp::langFromSetting(); QString system_language = QETApp::langFromSetting();
QString returned_name; if (! hash_names[system_language].isEmpty())
if (!hash_names[system_language].isEmpty()) { return (hash_names[system_language]);
returned_name = hash_names[system_language]; if (! hash_names["en"].isEmpty()) return (hash_names["en"]);
} else if (!hash_names["en"].isEmpty()) { if (! fallback_name.isEmpty()) return (fallback_name);
returned_name = hash_names["en"]; if (hash_names.count()) return (hash_names.begin().value());
} else if (!fallback_name.isEmpty()) { return (QString(""));
returned_name = fallback_name;
} else if (hash_names.count()) {
returned_name = hash_names.value(hash_names.keys().first());
}
return(returned_name);
} }

View File

@@ -1,4 +1,4 @@
/* /*
Copyright 2006-2020 QElectroTech Team Copyright 2006-2020 QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
@@ -42,6 +42,28 @@ projectDataBase::projectDataBase(QETProject *project, QObject *parent) :
m_project(project) m_project(project)
{ {
createDataBase(); createDataBase();
connect(m_project, &QETProject::diagramAdded, [this](QETProject *, Diagram *diagram) {
this->addDiagram(diagram);
});
connect(m_project, &QETProject::diagramRemoved, [this](QETProject *, Diagram *diagram) {
this->removeDiagram(diagram);
});
connect(m_project, &QETProject::projectDiagramsOrderChanged, [this]()
{
for (auto diagram : m_project->diagrams())
{
m_diagram_order_changed.bindValue(":pos", m_project->folioIndex(diagram)+1);
m_diagram_order_changed.bindValue(":uuid", diagram->uuid());
m_diagram_order_changed.exec();
m_diagram_info_order_changed.bindValue(":folio", diagram->border_and_titleblock.titleblockInformation().value("folio"));
m_diagram_info_order_changed.bindValue(":uuid", diagram->uuid());
m_diagram_info_order_changed.exec();
}
emit dataBaseUpdated();
});
} }
/** /**
@@ -151,33 +173,29 @@ void projectDataBase::elementInfoChanged(Element *element)
void projectDataBase::addDiagram(Diagram *diagram) void projectDataBase::addDiagram(Diagram *diagram)
{ {
m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString()); m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString());
m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)); m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)+1);
if(!m_insert_diagram_query.exec()) { if(!m_insert_diagram_query.exec()) {
qDebug() << "projectDataBase::addDiagram insert error : " << m_insert_diagram_query.lastError(); qDebug() << "projectDataBase::addDiagram insert error : " << m_insert_diagram_query.lastError();
} }
bindDiagramInfoValues(m_insert_diagram_info_query, diagram);
m_insert_diagram_info_query.bindValue(":uuid", diagram->uuid());
auto infos = diagram->border_and_titleblock.titleblockInformation();
for (auto key : QETApp::diagramInfoKeys())
{
if (key == "date")
{
m_insert_diagram_info_query.bindValue( ":date",
QLocale::system().toDate(infos.value("date").toString(),
QLocale::ShortFormat));
} else {
auto value = infos.value(key);
auto bind = key.prepend(":");
m_insert_diagram_info_query.bindValue(bind, value);
}
}
if (!m_insert_diagram_info_query.exec()) { if (!m_insert_diagram_info_query.exec()) {
qDebug() << "projectDataBase::addDiagram insert info error : " << m_insert_diagram_info_query.lastError(); qDebug() << "projectDataBase::addDiagram insert info error : " << m_insert_diagram_info_query.lastError();
} else {
emit dataBaseUpdated();
} }
//The information "folio" of other existing diagram can have the variable %total,
//so when a new diagram is added this variable change.
//We need to update this information in the database.
for (auto diagram : project()->diagrams())
{
m_diagram_info_order_changed.bindValue(":folio", diagram->border_and_titleblock.titleblockInformation().value("folio"));
m_diagram_info_order_changed.bindValue(":uuid", diagram->uuid());
if (!m_diagram_info_order_changed.exec()) {
qDebug() << "projectDataBase::addDiagram update diagram infp order error : " << m_diagram_info_order_changed.lastError();
}
}
emit dataBaseUpdated();
} }
void projectDataBase::removeDiagram(Diagram *diagram) void projectDataBase::removeDiagram(Diagram *diagram)
@@ -190,6 +208,21 @@ void projectDataBase::removeDiagram(Diagram *diagram)
} }
} }
void projectDataBase::diagramInfoChanged(Diagram *diagram)
{
bindDiagramInfoValues(m_update_diagram_info_query, diagram);
if (!m_update_diagram_info_query.exec()) {
qDebug() << "projectDataBase::diagramInfoChanged update error : " << m_update_diagram_info_query.lastError();
} else {
emit dataBaseUpdated();
}
}
void projectDataBase::diagramOrderChanged()
{
}
/** /**
@brief projectDataBase::createDataBase @brief projectDataBase::createDataBase
Create the data base Create the data base
@@ -342,7 +375,7 @@ void projectDataBase::populateDiagramTable()
for (auto diagram : m_project->diagrams()) for (auto diagram : m_project->diagrams())
{ {
m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString()); m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString());
m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)); m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)+1);
if(!m_insert_diagram_query.exec()) { if(!m_insert_diagram_query.exec()) {
qDebug() << "projectDataBase::populateDiagramTable insert error : " << m_insert_diagram_query.lastError(); qDebug() << "projectDataBase::populateDiagramTable insert error : " << m_insert_diagram_query.lastError();
} }
@@ -417,21 +450,7 @@ void projectDataBase::populateDiagramInfoTable()
for (auto *diagram : m_project->diagrams()) for (auto *diagram : m_project->diagrams())
{ {
m_insert_diagram_info_query.bindValue(":uuid", diagram->uuid()); bindDiagramInfoValues(m_insert_diagram_info_query, diagram);
auto infos = diagram->border_and_titleblock.titleblockInformation();
for (auto key : QETApp::diagramInfoKeys())
{
if (key == "date") {
m_insert_diagram_info_query.bindValue( ":date",
QLocale::system().toDate(infos.value("date").toString(),
QLocale::ShortFormat));
} else {
auto value = infos.value(key);
auto bind = key.prepend(":");
m_insert_diagram_info_query.bindValue(bind, value);
}
}
if (!m_insert_diagram_info_query.exec()) { if (!m_insert_diagram_info_query.exec()) {
qDebug() << "projectDataBase::populateDiagramInfoTable insert error : " << m_insert_diagram_info_query.lastError(); qDebug() << "projectDataBase::populateDiagramInfoTable insert error : " << m_insert_diagram_info_query.lastError();
@@ -462,6 +481,22 @@ void projectDataBase::prepareQuery()
")"); ")");
m_insert_diagram_info_query.prepare(insert_diag_info); m_insert_diagram_info_query.prepare(insert_diag_info);
//UPDATE DIAGRAM INFO
QString update_diagram_str("UPDATE diagram_info SET ");
for (auto str : QETApp::diagramInfoKeys()) {
update_diagram_str.append(str + " = :" + str + ", ");
}
update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", "
update_diagram_str.append(" WHERE diagram_uuid = :uuid");
m_update_diagram_info_query = QSqlQuery(m_data_base);
m_update_diagram_info_query.prepare(update_diagram_str);
//UPDATE DIAGRAM ORDER
m_diagram_order_changed = QSqlQuery(m_data_base);
m_diagram_order_changed.prepare("UPDATE diagram SET pos = :pos WHERE uuid = :uuid");
m_diagram_info_order_changed = QSqlQuery(m_data_base);
m_diagram_info_order_changed.prepare("UPDATE diagram_info SET folio = :folio WHERE diagram_uuid = :uuid");
//INSERT ELEMENT //INSERT ELEMENT
QString insert_element_query("INSERT INTO element (uuid, diagram_uuid, pos, type, sub_type) VALUES (:uuid, :diagram_uuid, :pos, :type, :sub_type)"); QString insert_element_query("INSERT INTO element (uuid, diagram_uuid, pos, type, sub_type) VALUES (:uuid, :diagram_uuid, :pos, :type, :sub_type)");
m_insert_elements_query = QSqlQuery(m_data_base); m_insert_elements_query = QSqlQuery(m_data_base);
@@ -518,6 +553,25 @@ QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
return hash; return hash;
} }
void projectDataBase::bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram)
{
query.bindValue(":uuid", diagram->uuid());
auto infos = diagram->border_and_titleblock.titleblockInformation();
for (auto key : QETApp::diagramInfoKeys())
{
if (key == "date") {
query.bindValue( ":date",
QLocale::system().toDate(infos.value("date").toString(),
QLocale::ShortFormat));
} else {
auto value = infos.value(key);
auto bind = key.prepend(":");
query.bindValue(bind, value);
}
}
}
#ifdef QET_EXPORT_PROJECT_DB #ifdef QET_EXPORT_PROJECT_DB
/** /**
@brief projectDataBase::sqliteHandle @brief projectDataBase::sqliteHandle

View File

@@ -47,11 +47,15 @@ class projectDataBase : public QObject
void updateDB(); void updateDB();
QETProject *project() const; QETProject *project() const;
QSqlQuery newQuery(const QString &query = QString()); QSqlQuery newQuery(const QString &query = QString());
void addElement (Element *element); void addElement (Element *element);
void removeElement (Element *element); void removeElement (Element *element);
void elementInfoChanged (Element *element); void elementInfoChanged (Element *element);
void addDiagram (Diagram *diagram); void addDiagram (Diagram *diagram);
void removeDiagram (Diagram *diagram); void removeDiagram (Diagram *diagram);
void diagramInfoChanged (Diagram *diagram);
void diagramOrderChanged();
signals: signals:
void dataBaseUpdated(); void dataBaseUpdated();
@@ -67,6 +71,7 @@ class projectDataBase : public QObject
void prepareQuery(); void prepareQuery();
static QHash<QString, QString> elementInfoToString( static QHash<QString, QString> elementInfoToString(
Element *elmt); Element *elmt);
void bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram);
private: private:
QPointer<QETProject> m_project; QPointer<QETProject> m_project;
@@ -77,7 +82,10 @@ class projectDataBase : public QObject
m_update_element_query, m_update_element_query,
m_insert_diagram_query, m_insert_diagram_query,
m_remove_diagram_query, m_remove_diagram_query,
m_insert_diagram_info_query; m_insert_diagram_info_query,
m_update_diagram_info_query,
m_diagram_order_changed,
m_diagram_info_order_changed;
#ifdef QET_EXPORT_PROJECT_DB #ifdef QET_EXPORT_PROJECT_DB
public: public:

View File

@@ -61,6 +61,7 @@ QString SummaryQueryWidget::queryStr() const
QStringList keys = selectedKeys(); QStringList keys = selectedKeys();
QString select ="SELECT "; QString select ="SELECT ";
QString order_by = " ORDER BY ";
QString column; QString column;
bool first = true; bool first = true;
@@ -69,13 +70,15 @@ QString SummaryQueryWidget::queryStr() const
first = false; first = false;
} else { } else {
column += ", "; column += ", ";
order_by +=", ";
} }
column += key; column += key;
order_by += key;
} }
QString from = " FROM project_summary_view"; QString from = " FROM project_summary_view";
QString q(select + column + from); QString q(select + column + from + order_by);
return q; return q;
} }

View File

@@ -1650,6 +1650,8 @@ void Diagram::setTitleBlockTemplate(const QString &template_name)
if (template_name != current_name) if (template_name != current_name)
emit(usedTitleBlockTemplateChanged(template_name)); emit(usedTitleBlockTemplateChanged(template_name));
project()->dataBase()->diagramInfoChanged(this);
} }
/** /**

View File

@@ -441,5 +441,7 @@ void QetGraphicsHeaderItem::adjustSize()
void QetGraphicsHeaderItem::modelReseted() void QetGraphicsHeaderItem::modelReseted()
{ {
setUpMinimumSectionsSize(); setUpMinimumSectionsSize();
m_current_sections_width.clear();
m_current_sections_width.resize(m_sections_minimum_width.size());
adjustSize(); adjustSize();
} }

View File

@@ -1015,12 +1015,13 @@ bool Element::fromXml(
if(deti->textFrom()== DynamicElementTextItem::ElementInfo if(deti->textFrom()== DynamicElementTextItem::ElementInfo
&& deti->infoName() == "label") && deti->infoName() == "label")
{ {
qDebug() << "see 'Mod overlapping comparisons' in git";
qreal rotation = deti->rotation(); qreal rotation = deti->rotation();
//Create the comment item //Create the comment item
DynamicElementTextItem *comment_text = nullptr; DynamicElementTextItem *comment_text = nullptr;
if (m_link_type != PreviousReport if (m_link_type != PreviousReport
|| m_link_type !=NextReport) && m_link_type != NextReport)
{ {
m_state = QET::GIOK; m_state = QET::GIOK;
return(true); return(true);
@@ -1041,7 +1042,8 @@ bool Element::fromXml(
} }
//create the location item //create the location item
DynamicElementTextItem *location_text = nullptr; DynamicElementTextItem *location_text = nullptr;
if (m_link_type !=PreviousReport || m_link_type !=NextReport) if (m_link_type != PreviousReport
&& m_link_type != NextReport)
{ {
m_state = QET::GIOK; m_state = QET::GIOK;
return(true); return(true);
@@ -1062,7 +1064,7 @@ bool Element::fromXml(
QPointF pos = deti->pos(); QPointF pos = deti->pos();
if (m_link_type != PreviousReport if (m_link_type != PreviousReport
|| m_link_type !=NextReport) && m_link_type != NextReport)
{ {
m_state = QET::GIOK; m_state = QET::GIOK;
return(true); return(true);

View File

@@ -1221,7 +1221,6 @@ void QETProject::removeDiagram(Diagram *diagram)
if (m_diagrams_list.removeAll(diagram)) if (m_diagrams_list.removeAll(diagram))
{ {
m_data_base.removeDiagram(diagram);
emit(diagramRemoved(this, diagram)); emit(diagramRemoved(this, diagram));
diagram->deleteLater(); diagram->deleteLater();
} }
@@ -1652,7 +1651,7 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
} else { } else {
m_diagrams_list.insert(pos, diagram); m_diagrams_list.insert(pos, diagram);
} }
m_data_base.addDiagram(diagram);
updateDiagramsFolioData(); updateDiagramsFolioData();
} }