Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/utils/kis_document_aware_spin_box_unit_manager.cpp
Show All 22 Lines | |||||
23 | #include "KisView.h" | 23 | #include "KisView.h" | ||
24 | #include "KisDocument.h" | 24 | #include "KisDocument.h" | ||
25 | #include "kis_types.h" | 25 | #include "kis_types.h" | ||
26 | #include "kis_image.h" | 26 | #include "kis_image.h" | ||
27 | #include "kis_image_animation_interface.h" | 27 | #include "kis_image_animation_interface.h" | ||
28 | #include "kis_time_range.h" | 28 | #include "kis_time_range.h" | ||
29 | 29 | | |||
30 | 30 | | |||
31 | KisSpinBoxUnitManager* KisDocumentAwareSpinBoxUnitManagerBuilder::buildUnitManager(QObject* parent) | ||||
32 | { | ||||
33 | return new KisDocumentAwareSpinBoxUnitManager(parent); | ||||
34 | } | ||||
35 | | ||||
31 | void KisDocumentAwareSpinBoxUnitManager::setDocumentAwarnessToExistingUnitSpinBox(KisDoubleParseUnitSpinBox* spinBox, bool setUnitFromOutsideToggle) | 36 | void KisDocumentAwareSpinBoxUnitManager::setDocumentAwarnessToExistingUnitSpinBox(KisDoubleParseUnitSpinBox* spinBox, bool setUnitFromOutsideToggle) | ||
32 | { | 37 | { | ||
33 | KisDocumentAwareSpinBoxUnitManager* manager = new KisDocumentAwareSpinBoxUnitManager(spinBox); | 38 | KisDocumentAwareSpinBoxUnitManager* manager = new KisDocumentAwareSpinBoxUnitManager(spinBox); | ||
34 | spinBox->setUnitManager(manager); | 39 | spinBox->setUnitManager(manager); | ||
35 | spinBox->setUnitChangeFromOutsideBehavior(setUnitFromOutsideToggle); | 40 | spinBox->setUnitChangeFromOutsideBehavior(setUnitFromOutsideToggle); | ||
36 | } | 41 | } | ||
37 | 42 | | |||
38 | KisDoubleParseUnitSpinBox* KisDocumentAwareSpinBoxUnitManager::createUnitSpinBoxWithDocumentAwarness(QWidget* parent) | 43 | KisDoubleParseUnitSpinBox* KisDocumentAwareSpinBoxUnitManager::createUnitSpinBoxWithDocumentAwarness(QWidget* parent) | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 65 | { | |||
88 | qreal resX = img->xRes(); | 93 | qreal resX = img->xRes(); | ||
89 | qreal resY = img->yRes(); | 94 | qreal resY = img->yRes(); | ||
90 | qreal sizeX = img->width(); | 95 | qreal sizeX = img->width(); | ||
91 | qreal sizeY = img->height(); | 96 | qreal sizeY = img->height(); | ||
92 | 97 | | |||
93 | switch (dim) { | 98 | switch (dim) { | ||
94 | 99 | | |||
95 | case LENGTH: | 100 | case LENGTH: | ||
96 | if (symbol == "px") { | 101 | if (symbol == "px") { | ||
dkazakov: The symbols should be translatable. What is more, the user should be able to write in both… | |||||
97 | 102 | | |||
98 | if (pixDir == PIX_DIR_X) { | 103 | if (pixDir == PIX_DIR_X) { | ||
99 | factor = resX; | 104 | factor = resX; | ||
100 | } else { | 105 | } else { | ||
101 | factor = resY; | 106 | factor = resY; | ||
102 | } | 107 | } | ||
103 | } else if (symbol == "vw") { | 108 | } else if (symbol == "vw") { | ||
104 | qreal docWidth = sizeX/resX; | 109 | qreal docWidth = sizeX/resX; | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
The symbols should be translatable. What is more, the user should be able to write in both variants: english and localized versions of the units. Just to avoid switching languages. The same applies to ',' and '.' decimal separators