mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 22:54:12 +02:00
Fix cable numbering rule questions: per project, and a first rule counts
Two defects found while re-testing the cable management after the upstream merge, plus one change of intent for the numbering question. The question "define a cable numbering rule now?" kept its answer in the program settings, so saying no once silenced every project of the program -- the exact opposite of what it should do. The answer now travels with the project itself, stored on the <cable_autonums> element as ask_numbering_rule="false"; a file which does not hold the answer asks again, and taking the rule away in the project properties or in the numbering window brings the question back for that project alone. Read-only projects are no longer asked at all, since there is nowhere in them to define a rule. The numbering window could not hand out the first rule of a project: it drew the rule, worked the numbers out with it, and only wrote the rule into the project together with those numbers -- while the planning refused to run on a project which had no rule saved yet. The counters of a cable rule are kept under its fixed name anyway, so planning now falls back to that name when the project holds no rule yet: a rule which is being drawn in the window counts from the moment it is complete, and the first renumbering of a project works.
This commit is contained in:
@@ -121,8 +121,18 @@ CableRenumberPlan CableRenumber::plan(QETProject *project,
|
||||
"être renumérotés.");
|
||||
return result;
|
||||
}
|
||||
const QString key = project->cableCurrentAutoNum();
|
||||
if (key.isEmpty() || rule.isEmpty())
|
||||
//The rule may be one the numbering window is drawing right now
|
||||
//and has not written into the project yet: the numbering writes
|
||||
//it together with the numbers themselves, so the project does
|
||||
//not have to hold it beforehand. What the counters are kept
|
||||
//under is the name the rule is stored with, which for cables is
|
||||
//fixed either way -- so numbering starts from a project which
|
||||
//has no rule saved yet just as well.
|
||||
QString key = project->cableCurrentAutoNum();
|
||||
if (key.isEmpty()) {
|
||||
key = QETProject::cableAutoNumRuleName();
|
||||
}
|
||||
if (rule.isEmpty())
|
||||
{
|
||||
result.error = QCoreApplication::translate(
|
||||
"CableRenumber",
|
||||
|
||||
Reference in New Issue
Block a user