Changeset View
Changeset View
Standalone View
Standalone View
libs/widgetutils/kis_spin_box_unit_manager.cpp
Show All 17 Lines | |||||
18 | 18 | | |||
19 | #include "kis_spin_box_unit_manager.h" | 19 | #include "kis_spin_box_unit_manager.h" | ||
20 | 20 | | |||
21 | #include "KoUnit.h" | 21 | #include "KoUnit.h" | ||
22 | #include <klocalizedstring.h> | 22 | #include <klocalizedstring.h> | ||
23 | 23 | | |||
24 | #include <QtMath> | 24 | #include <QtMath> | ||
25 | 25 | | |||
26 | | ||||
27 | KisSpinBoxUnitManagerBuilder* KisSpinBoxUnitManagerFactory::builder = nullptr; | ||||
28 | | ||||
29 | KisSpinBoxUnitManager* KisSpinBoxUnitManagerFactory::buildDefaultUnitManager(QObject* parent) | ||||
30 | { | ||||
31 | if (builder == nullptr) { | ||||
32 | return new KisSpinBoxUnitManager(parent); | ||||
33 | } | ||||
34 | | ||||
35 | return builder->buildUnitManager(parent); | ||||
36 | } | ||||
37 | | ||||
38 | void KisSpinBoxUnitManagerFactory::setDefaultUnitManagerBuilder(KisSpinBoxUnitManagerBuilder* pBuilder) | ||||
39 | { | ||||
40 | if (builder != nullptr) { | ||||
41 | delete builder; //The factory took over the lifecycle of the builder, so it delete it when replaced. | ||||
42 | } | ||||
43 | | ||||
44 | builder = pBuilder; | ||||
45 | } | ||||
46 | | ||||
47 | void KisSpinBoxUnitManagerFactory::clearUnitManagerBuilder() | ||||
48 | { | ||||
49 | if (builder != nullptr) { | ||||
50 | delete builder; //The factory took over the lifecycle of the builder, so it delete it when replaced. | ||||
51 | } | ||||
52 | | ||||
53 | builder = nullptr; | ||||
54 | } | ||||
55 | | ||||
26 | const QStringList KisSpinBoxUnitManager::referenceUnitSymbols = {"pt", "°", "frame"}; | 56 | const QStringList KisSpinBoxUnitManager::referenceUnitSymbols = {"pt", "°", "frame"}; | ||
27 | 57 | | |||
28 | const QStringList KisSpinBoxUnitManager::documentRelativeLengthUnitSymbols = {"px", "vw", "vh"}; //px are relative to the resolution, vw and vh to the width and height. | 58 | const QStringList KisSpinBoxUnitManager::documentRelativeLengthUnitSymbols = {"px", "vw", "vh"}; //px are relative to the resolution, vw and vh to the width and height. | ||
29 | const QStringList KisSpinBoxUnitManager::documentRelativeTimeUnitSymbols = {"s", "%"}; //secondes are relative to the framerate, % to the sequence length. | 59 | const QStringList KisSpinBoxUnitManager::documentRelativeTimeUnitSymbols = {"s", "%"}; //secondes are relative to the framerate, % to the sequence length. | ||
30 | 60 | | |||
31 | class Q_DECL_HIDDEN KisSpinBoxUnitManager::Private | 61 | class Q_DECL_HIDDEN KisSpinBoxUnitManager::Private | ||
32 | { | 62 | { | ||
33 | public: | 63 | public: | ||
▲ Show 20 Lines • Show All 388 Lines • Show Last 20 Lines |