OpenToonz - An open-source full-featured 2D animation creation software
C
Clang formatting applied
Jeremy Bullock59dbbf498a67
diff --git a/toonz/sources/common/tunit/tunit.cpp b/toonz/sources/common/tunit/tunit.cppindex 8cbe4b209..22d8b990f 100644--- a/toonz/sources/common/tunit/tunit.cpp+++ b/toonz/sources/common/tunit/tunit.cpp@@ -347,14 +347,14 @@ TMeasureManager::TMeasureManager() {m->add(cameraYFld.clone());add(m);- const double stage_inch = 53.33333; //Consider changing to 120 or 160+ const double stage_inch = 53.33333; // Consider changing to 120 or 160TUnit fxLength(L"fxLength"),- fxInch(L"in", new TSimpleUnitConverter(1 / stage_inch)),- fxCm(L"cm", new TSimpleUnitConverter(2.54 / stage_inch)),- fxMm(L"mm", new TSimpleUnitConverter(25.4 / stage_inch)),- fxXfld(L"fld", new TSimpleUnitConverter(2 / stage_inch)),- fxPx(L"px", new TSimpleUnitConverter(1));+ fxInch(L"in", new TSimpleUnitConverter(1 / stage_inch)),+ fxCm(L"cm", new TSimpleUnitConverter(2.54 / stage_inch)),+ fxMm(L"mm", new TSimpleUnitConverter(25.4 / stage_inch)),+ fxXfld(L"fld", new TSimpleUnitConverter(2 / stage_inch)),+ fxPx(L"px", new TSimpleUnitConverter(1));fxInch.addExtension(L"inch");fxInch.addExtension(L"\"");fxInch.addExtension(L"''");diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.hindex cb7e8d803..188526a07 100644--- a/toonz/sources/include/toonz/preferences.h+++ b/toonz/sources/include/toonz/preferences.h@@ -418,8 +418,8 @@ private:std::vector<LevelFormat> m_levelFormats;- QString m_units, m_cameraUnits, m_scanLevelType, m_currentRoomChoice,- m_oldUnits, m_oldCameraUnits;+ QString m_units, m_cameraUnits, m_scanLevelType, m_currentRoomChoice,+ m_oldUnits, m_oldCameraUnits;double m_defLevelWidth, m_defLevelHeight, m_defLevelDpi;diff --git a/toonz/sources/include/toonz/tcamera.h b/toonz/sources/include/toonz/tcamera.hindex bb48e3802..3bf62b710 100644--- a/toonz/sources/include/toonz/tcamera.h+++ b/toonz/sources/include/toonz/tcamera.h@@ -39,7 +39,8 @@ class DVAPI TCamera {public:/*!Constructs TCamera with default value, size (12,9) and resolution (768,576).- Constructs TCamera with default value, size (36, 20.25) and resolution (1920,1080).+ Constructs TCamera with default value, size (36, 20.25) and resolution+(1920,1080).- 05/31/16*/TCamera();diff --git a/toonz/sources/include/toonzqt/camerasettingswidget.h b/toonz/sources/include/toonzqt/camerasettingswidget.hindex f922cadac..5cf3e0c2d 100644--- a/toonz/sources/include/toonzqt/camerasettingswidget.h+++ b/toonz/sources/include/toonzqt/camerasettingswidget.h@@ -83,9 +83,9 @@ class DVAPI CameraSettingsWidget final : public QFrame {double m_arValue;DVGui::IntLineEdit *m_xResFld, *m_yResFld;DVGui::DoubleLineEdit *m_xDpiFld, *m_yDpiFld;- QLabel* m_dpiLabel;- QLabel* m_resLabel;- QLabel* m_xLabel;+ QLabel *m_dpiLabel;+ QLabel *m_resLabel;+ QLabel *m_xLabel;QPushButton *m_fspChk; // Force Squared Pixel => dpix == dpiydiff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cppindex 9f54f8e11..1d71631d2 100644--- a/toonz/sources/tnztools/tooloptions.cpp+++ b/toonz/sources/tnztools/tooloptions.cpp@@ -1828,14 +1828,14 @@ RulerToolOptionsBox::RulerToolOptionsBox(QWidget *parent, TTool *tool)m_HpixelFld = new QLabel(this);m_Afld->setMeasure("angle");-- if (Preferences::instance()->getUnits() == "pixel") {- m_Xfld->setMeasure("length.x");- m_Yfld->setMeasure("length.y");- m_Wfld->setMeasure("length.x");- m_Hfld->setMeasure("length.y");- m_Lfld->setMeasure("length.x");- }++ if (Preferences::instance()->getUnits() == "pixel") {+ m_Xfld->setMeasure("length.x");+ m_Yfld->setMeasure("length.y");+ m_Wfld->setMeasure("length.x");+ m_Hfld->setMeasure("length.y");+ m_Lfld->setMeasure("length.x");+ }m_Xfld->setObjectName("RulerToolOptionValues");m_Yfld->setObjectName("RulerToolOptionValues");diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cppindex cc7db294d..4ae3c4437 100644--- a/toonz/sources/toonz/iocommand.cpp+++ b/toonz/sources/toonz/iocommand.cpp@@ -1257,7 +1257,8 @@ bool IoCmd::saveSceneIfNeeded(QString msg) {void IoCmd::newScene() {RenderingSuspender suspender;TApp *app = TApp::instance();- double cameraDpi = 53.33333; //used to be 64, consider changing to 120 or 160+ double cameraDpi = 53.33333; // used to be 64, consider changing to 120 or+ // 160if (!saveSceneIfNeeded(QApplication::tr("New Scene"))) return;IconGenerator::instance()->clearRequests();diff --git a/toonz/sources/toonz/levelcreatepopup.cpp b/toonz/sources/toonz/levelcreatepopup.cppindex 98fc8e2f5..8442974e2 100644--- a/toonz/sources/toonz/levelcreatepopup.cpp+++ b/toonz/sources/toonz/levelcreatepopup.cpp@@ -194,14 +194,14 @@ LevelCreatePopup::LevelCreatePopup()m_levelTypeOm->addItem(RasterLevel);m_levelTypeOm->addItem(ScanLevel);- if (Preferences::instance()->getUnits() == "pixel") {- m_widthFld->setMeasure("camera.lx");- m_heightFld->setMeasure("camera.ly");- } else {- m_widthFld->setMeasure("level.lx");- m_heightFld->setMeasure("level.ly");- }-+ if (Preferences::instance()->getUnits() == "pixel") {+ m_widthFld->setMeasure("camera.lx");+ m_heightFld->setMeasure("camera.ly");+ } else {+ m_widthFld->setMeasure("level.lx");+ m_heightFld->setMeasure("level.ly");+ }+m_widthFld->setRange(0.1, (std::numeric_limits<double>::max)());m_heightFld->setRange(0.1, (std::numeric_limits<double>::max)());m_dpiFld->setRange(0.1, (std::numeric_limits<double>::max)());@@ -277,8 +277,6 @@ LevelCreatePopup::LevelCreatePopup()m_buttonLayout->addStretch(1);}--//---- signal-slot connectionsbool ret = true;ret = ret &&@@ -337,14 +335,12 @@ void LevelCreatePopup::showEvent(QShowEvent *) {nextName();update();m_nameFld->setFocus();- if (Preferences::instance()->getUnits() == "pixel")- {- m_dpiFld->hide();- m_dpiLabel->hide();- }- else {- m_dpiFld->show();- m_dpiLabel->show();+ if (Preferences::instance()->getUnits() == "pixel") {+ m_dpiFld->hide();+ m_dpiLabel->hide();+ } else {+ m_dpiFld->show();+ m_dpiLabel->show();}}diff --git a/toonz/sources/toonz/levelsettingspopup.cpp b/toonz/sources/toonz/levelsettingspopup.cppindex be3e961ea..cf7bdc4a2 100644--- a/toonz/sources/toonz/levelsettingspopup.cpp+++ b/toonz/sources/toonz/levelsettingspopup.cpp@@ -133,8 +133,8 @@ LevelSettingsPopup::LevelSettingsPopup()m_imageDpiLabel = new QLabel(tr(""));m_imageResLabel = new QLabel(tr(""));m_cameraDpiTitle = new QLabel(tr("Camera DPI:"));- m_imageDpiTitle = new QLabel(tr("Image DPI:"));- m_imageResTitle = new QLabel(tr("Resolution:"));+ m_imageDpiTitle = new QLabel(tr("Image DPI:"));+ m_imageResTitle = new QLabel(tr("Resolution:"));// subsamplingm_subsamplingLabel = new QLabel(tr("Subsampling:"));@@ -161,11 +161,11 @@ LevelSettingsPopup::LevelSettingsPopup()/*--- Levelサイズの単位はCameraUnitにする --*/m_widthFld->setMeasure("camera.lx");m_heightFld->setMeasure("camera.ly");-- if (Preferences::instance()->getCameraUnits() == "pixel") {- m_widthFld->setDecimals(0);- m_heightFld->setDecimals(0);- }++ if (Preferences::instance()->getCameraUnits() == "pixel") {+ m_widthFld->setDecimals(0);+ m_heightFld->setDecimals(0);+ }m_doPremultiply->setChecked(false);@@ -203,13 +203,13 @@ LevelSettingsPopup::LevelSettingsPopup()m_topLayout->addWidget(nameBox);//----DPI & Resolution- QGroupBox *dpiBox;- if (Preferences::instance()->getUnits() == "pixel")- dpiBox = new QGroupBox(tr("Resolution"), this);- else- dpiBox = new QGroupBox(tr("DPI && Resolution"), this);+ QGroupBox *dpiBox;+ if (Preferences::instance()->getUnits() == "pixel")+ dpiBox = new QGroupBox(tr("Resolution"), this);+ else+ dpiBox = new QGroupBox(tr("DPI && Resolution"), this);QGridLayout *dpiLayout = new QGridLayout();- dpiLayout->setMargin(5);+ dpiLayout->setMargin(5);dpiLayout->setSpacing(5);{dpiLayout->addWidget(m_dpiTypeOm, 0, 1, 1, 3);@@ -233,7 +233,6 @@ LevelSettingsPopup::LevelSettingsPopup()dpiLayout->addWidget(m_imageResTitle, 6, 0,Qt::AlignRight | Qt::AlignVCenter);dpiLayout->addWidget(m_imageResLabel, 6, 1, 1, 3);-}dpiLayout->setColumnStretch(0, 0);dpiLayout->setColumnStretch(1, 1);@@ -320,32 +319,30 @@ void LevelSettingsPopup::showEvent(QShowEvent *e) {assert(ret);updateLevelSettings();- if (Preferences::instance()->getUnits() == "pixel")- {- m_dpiTypeOm->hide();- m_dpiLabel->hide();- m_dpiFld->hide();- m_squarePixCB->hide();- m_useCameraDpiBtn->hide();- m_cameraDpiLabel->hide();- m_imageDpiLabel->hide();- m_imageDpiTitle->hide();- m_cameraDpiTitle->hide();- m_imageResTitle->hide();- m_imageResLabel->hide();- }- else {- m_dpiTypeOm->show();- m_dpiLabel->show();- m_dpiFld->show();- m_squarePixCB->show();- m_useCameraDpiBtn->show();- m_cameraDpiLabel->show();- m_imageDpiLabel->show();- m_imageDpiTitle->show();- m_cameraDpiTitle->show();- m_imageResTitle->show();- m_imageResLabel->show();+ if (Preferences::instance()->getUnits() == "pixel") {+ m_dpiTypeOm->hide();+ m_dpiLabel->hide();+ m_dpiFld->hide();+ m_squarePixCB->hide();+ m_useCameraDpiBtn->hide();+ m_cameraDpiLabel->hide();+ m_imageDpiLabel->hide();+ m_imageDpiTitle->hide();+ m_cameraDpiTitle->hide();+ m_imageResTitle->hide();+ m_imageResLabel->hide();+ } else {+ m_dpiTypeOm->show();+ m_dpiLabel->show();+ m_dpiFld->show();+ m_squarePixCB->show();+ m_useCameraDpiBtn->show();+ m_cameraDpiLabel->show();+ m_imageDpiLabel->show();+ m_imageDpiTitle->show();+ m_cameraDpiTitle->show();+ m_imageResTitle->show();+ m_imageResLabel->show();}}diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cppindex 8a333a967..965f7a23f 100644--- a/toonz/sources/toonz/preferencespopup.cpp+++ b/toonz/sources/toonz/preferencespopup.cpp@@ -214,76 +214,72 @@ Preferences::LevelFormat PreferencesPopup::FormatProperties::levelFormat()//**********************************************************************************void PreferencesPopup::onPixelsOnlyChanged(int index) {- bool enabled = index == Qt::Checked;- if (enabled) {-- m_pref->setDefLevelDpi(53.33333);- m_pref->setPixelsOnly(true);- TCamera* camera;- camera = TApp::instance()->getCurrentScene()->getScene()->getCurrentCamera();- TDimension camRes = camera->getRes();- TDimensionD camSize;- camSize.lx = camRes.lx / 53.33333;- camSize.ly = camRes.ly / 53.33333;- camera->setSize(camSize);- m_pref->storeOldUnits();- if (m_unitOm->currentIndex() != 4)- m_unitOm->setCurrentIndex(4);- if (m_cameraUnitOm->currentIndex() != 4)- m_cameraUnitOm->setCurrentIndex(4);- m_unitOm->setDisabled(true);- m_cameraUnitOm->setDisabled(true);- m_defLevelDpi->setDisabled(true);- m_defLevelDpi->setValue(53.33333);- m_defLevelWidth->setMeasure("camera.lx");- m_defLevelHeight->setMeasure("camera.ly");- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());- m_defLevelHeight->setDecimals(0);- m_defLevelWidth->setDecimals(0);-- }- else {- QString tempUnit;- int unitIndex;- tempUnit = m_pref->getOldUnits();- unitIndex = m_unitOm->findText(tempUnit);- m_unitOm->setCurrentIndex(unitIndex);- tempUnit = m_pref->getOldCameraUnits();- unitIndex = m_cameraUnitOm->findText(tempUnit);- m_cameraUnitOm->setCurrentIndex(unitIndex);- m_unitOm->setDisabled(false);- m_cameraUnitOm->setDisabled(false);- m_pref->setPixelsOnly(false);- int levelType = m_pref->getDefLevelType();- bool isRaster = levelType != PLI_XSHLEVEL;- if (isRaster) {- m_defLevelDpi->setDisabled(false);- }- m_defLevelHeight->setMeasure("level.ly");- m_defLevelWidth->setMeasure("level.lx");- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());- m_defLevelHeight->setDecimals(4);- m_defLevelWidth->setDecimals(4);- }-+ bool enabled = index == Qt::Checked;+ if (enabled) {+ m_pref->setDefLevelDpi(53.33333);+ m_pref->setPixelsOnly(true);+ TCamera *camera;+ camera =+ TApp::instance()->getCurrentScene()->getScene()->getCurrentCamera();+ TDimension camRes = camera->getRes();+ TDimensionD camSize;+ camSize.lx = camRes.lx / 53.33333;+ camSize.ly = camRes.ly / 53.33333;+ camera->setSize(camSize);+ m_pref->storeOldUnits();+ if (m_unitOm->currentIndex() != 4) m_unitOm->setCurrentIndex(4);+ if (m_cameraUnitOm->currentIndex() != 4) m_cameraUnitOm->setCurrentIndex(4);+ m_unitOm->setDisabled(true);+ m_cameraUnitOm->setDisabled(true);+ m_defLevelDpi->setDisabled(true);+ m_defLevelDpi->setValue(53.33333);+ m_defLevelWidth->setMeasure("camera.lx");+ m_defLevelHeight->setMeasure("camera.ly");+ m_defLevelWidth->setValue(m_pref->getDefLevelWidth());+ m_defLevelHeight->setValue(m_pref->getDefLevelHeight());+ m_defLevelHeight->setDecimals(0);+ m_defLevelWidth->setDecimals(0);++ } else {+ QString tempUnit;+ int unitIndex;+ tempUnit = m_pref->getOldUnits();+ unitIndex = m_unitOm->findText(tempUnit);+ m_unitOm->setCurrentIndex(unitIndex);+ tempUnit = m_pref->getOldCameraUnits();+ unitIndex = m_cameraUnitOm->findText(tempUnit);+ m_cameraUnitOm->setCurrentIndex(unitIndex);+ m_unitOm->setDisabled(false);+ m_cameraUnitOm->setDisabled(false);+ m_pref->setPixelsOnly(false);+ int levelType = m_pref->getDefLevelType();+ bool isRaster = levelType != PLI_XSHLEVEL;+ if (isRaster) {+ m_defLevelDpi->setDisabled(false);+ }+ m_defLevelHeight->setMeasure("level.ly");+ m_defLevelWidth->setMeasure("level.lx");+ m_defLevelWidth->setValue(m_pref->getDefLevelWidth());+ m_defLevelHeight->setValue(m_pref->getDefLevelHeight());+ m_defLevelHeight->setDecimals(4);+ m_defLevelWidth->setDecimals(4);+ }}void PreferencesPopup::onUnitChanged(int index) {- if (index == 4 && m_pixelsOnlyCB->isChecked() == false) {- m_pixelsOnlyCB->setCheckState(Qt::Checked);- }- m_pref->setUnits(::units[index].toStdString());+ if (index == 4 && m_pixelsOnlyCB->isChecked() == false) {+ m_pixelsOnlyCB->setCheckState(Qt::Checked);+ }+ m_pref->setUnits(::units[index].toStdString());}//-----------------------------------------------------------------------------void PreferencesPopup::onCameraUnitChanged(int index) {- if (index == 4 && m_pixelsOnlyCB->isChecked() == false) {- m_pixelsOnlyCB->setChecked(true);- }- m_pref->setCameraUnits(::units[index].toStdString());+ if (index == 4 && m_pixelsOnlyCB->isChecked() == false) {+ m_pixelsOnlyCB->setChecked(true);+ }+ m_pref->setCameraUnits(::units[index].toStdString());}//-----------------------------------------------------------------------------@@ -738,8 +734,7 @@ void PreferencesPopup::onDefLevelTypeChanged(int index) {bool isRaster = levelType != PLI_XSHLEVEL;m_defLevelWidth->setEnabled(isRaster);m_defLevelHeight->setEnabled(isRaster);- if (!m_pixelsOnlyCB->isChecked())- m_defLevelDpi->setEnabled(isRaster);+ if (!m_pixelsOnlyCB->isChecked()) m_defLevelDpi->setEnabled(isRaster);}}@@ -901,9 +896,9 @@ PreferencesPopup::PreferencesPopup()}QComboBox *styleSheetType = new QComboBox(this);m_pixelsOnlyCB =- new CheckBox(tr("All imported images will use the same DPI"), this);- m_unitOm = new QComboBox(this);- m_cameraUnitOm = new QComboBox(this);+ new CheckBox(tr("All imported images will use the same DPI"), this);+ m_unitOm = new QComboBox(this);+ m_cameraUnitOm = new QComboBox(this);// Choose between standard and Studio Ghibli roomsQComboBox *roomChoice = new QComboBox(this);@@ -979,7 +974,7 @@ PreferencesPopup::PreferencesPopup()m_defLevelHeight = new MeasuredDoubleLineEdit(0);m_defLevelDpi = new DoubleLineEdit(0, 66.76);m_autocreationType = new QComboBox(this);- m_dpiLabel = new QLabel(tr("DPI:"), this);+ m_dpiLabel = new QLabel(tr("DPI:"), this);CheckBox *keepOriginalCleanedUpCB =new CheckBox(tr("Keep Original Cleaned Up Drawings As Backup"), this);CheckBox *multiLayerStylePickerCB = new CheckBox(@@ -1085,10 +1080,10 @@ PreferencesPopup::PreferencesPopup()styleSheetType->setCurrentIndex(currentIndex);bool po = m_pref->getPixelsOnly();m_pixelsOnlyCB->setChecked(po);- //m_pixelsOnlyCB->setChecked(true);- if (po){- m_unitOm->setDisabled(true);- m_cameraUnitOm->setDisabled(true);+ // m_pixelsOnlyCB->setChecked(true);+ if (po) {+ m_unitOm->setDisabled(true);+ m_cameraUnitOm->setDisabled(true);}QStringList type;type << tr("cm") << tr("mm") << tr("inch") << tr("field") << tr("pixel");@@ -1196,21 +1191,21 @@ PreferencesPopup::PreferencesPopup()}}- if (Preferences::instance()->getUnits() == "pixel") {- m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());- m_defLevelWidth->setMeasure("camera.lx");- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());- m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());- m_defLevelHeight->setMeasure("camera.ly");- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());- } else {- m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());- m_defLevelWidth->setMeasure("level.lx");- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());- m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());- m_defLevelHeight->setMeasure("level.ly");- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());- }+ if (Preferences::instance()->getUnits() == "pixel") {+ m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());+ m_defLevelWidth->setMeasure("camera.lx");+ m_defLevelWidth->setValue(m_pref->getDefLevelWidth());+ m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());+ m_defLevelHeight->setMeasure("camera.ly");+ m_defLevelHeight->setValue(m_pref->getDefLevelHeight());+ } else {+ m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());+ m_defLevelWidth->setMeasure("level.lx");+ m_defLevelWidth->setValue(m_pref->getDefLevelWidth());+ m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());+ m_defLevelHeight->setMeasure("level.ly");+ m_defLevelHeight->setValue(m_pref->getDefLevelHeight());+ }m_defLevelDpi->setRange(0.1, (std::numeric_limits<double>::max)());m_defLevelDpi->setValue(m_pref->getDefLevelDpi());QStringList autocreationTypes;@@ -1344,10 +1339,10 @@ PreferencesPopup::PreferencesPopup()styleLay->addWidget(new QLabel(tr("Style:")), 0, 0,Qt::AlignRight | Qt::AlignVCenter);styleLay->addWidget(styleSheetType, 0, 1);-- styleLay->addWidget(new QLabel(tr("Pixels Only:"), this), 1, 0,- Qt::AlignRight | Qt::AlignVCenter);- styleLay->addWidget(m_pixelsOnlyCB, 1, 1);++ styleLay->addWidget(new QLabel(tr("Pixels Only:"), this), 1, 0,+ Qt::AlignRight | Qt::AlignVCenter);+ styleLay->addWidget(m_pixelsOnlyCB, 1, 1);styleLay->addWidget(new QLabel(tr("Unit:"), this), 2, 0,Qt::AlignRight | Qt::AlignVCenter);@@ -1529,9 +1524,9 @@ PreferencesPopup::PreferencesPopup()drawingTopLay->addWidget(new QLabel(tr(" Height:")), 2, 2,Qt::AlignRight);drawingTopLay->addWidget(m_defLevelHeight, 2, 3);- drawingTopLay->addWidget(m_dpiLabel, 3, 0, Qt::AlignRight);- drawingTopLay->addWidget(m_defLevelDpi, 3, 1);- drawingTopLay->addWidget(new QLabel(tr("Autocreation:")), 4, 0,+ drawingTopLay->addWidget(m_dpiLabel, 3, 0, Qt::AlignRight);+ drawingTopLay->addWidget(m_defLevelDpi, 3, 1);+ drawingTopLay->addWidget(new QLabel(tr("Autocreation:")), 4, 0,Qt::AlignRight);drawingTopLay->addWidget(m_autocreationType, 4, 1, 1, 3);}@@ -1549,11 +1544,11 @@ PreferencesPopup::PreferencesPopup()}drawingBox->setLayout(drawingFrameLay);stackedWidget->addWidget(drawingBox);- if (m_pixelsOnlyCB->isChecked()) {- m_defLevelDpi->setDisabled(true);- m_defLevelWidth->setDecimals(0);- m_defLevelHeight->setDecimals(0);- }+ if (m_pixelsOnlyCB->isChecked()) {+ m_defLevelDpi->setDisabled(true);+ m_defLevelWidth->setDecimals(0);+ m_defLevelHeight->setDecimals(0);+ }//--- Xsheet --------------------------QWidget *xsheetBox = new QWidget(this);@@ -1754,7 +1749,7 @@ PreferencesPopup::PreferencesPopup()ret = ret && connect(styleSheetType, SIGNAL(currentIndexChanged(int)),SLOT(onStyleSheetTypeChanged(int)));ret = ret && connect(m_pixelsOnlyCB, SIGNAL(stateChanged(int)),- SLOT(onPixelsOnlyChanged(int)));+ SLOT(onPixelsOnlyChanged(int)));ret = ret && connect(m_unitOm, SIGNAL(currentIndexChanged(int)),SLOT(onUnitChanged(int)));ret = ret && connect(m_cameraUnitOm, SIGNAL(currentIndexChanged(int)),diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.hindex 31575a302..07f0c9de6 100644--- a/toonz/sources/toonz/preferencespopup.h+++ b/toonz/sources/toonz/preferencespopup.h@@ -57,7 +57,7 @@ private:DVGui::DoubleLineEdit *m_defLevelDpi;- QLabel* m_dpiLabel;+ QLabel *m_dpiLabel;DVGui::IntLineEdit *m_minuteFld, *m_chunkSizeFld, *m_iconSizeLx,*m_iconSizeLy, *m_viewShrink, *m_viewStep, *m_blanksCount,diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cppindex 4ea61572f..07b234ee8 100644--- a/toonz/sources/toonzlib/preferences.cpp+++ b/toonz/sources/toonzlib/preferences.cpp@@ -208,8 +208,8 @@ bool Preferences::LevelFormat::matches(const TFilePath &fp) const {//**********************************************************************************Preferences::Preferences()- : m_pixelsOnly(true)- , m_units("pixel")+ : m_pixelsOnly(true)+ , m_units("pixel"), m_cameraUnits("pixel"), m_currentRoomChoice("Default"), m_scanLevelType("tif")@@ -374,21 +374,20 @@ Preferences::Preferences()setUndoMemorySize(m_undoMemorySize);m_blankColor = TPixel32(r, g, b);--- //for Pixels only-- getValue(*m_settings, "pixelsOnly", m_pixelsOnly); //doesn't work for some reason.- QString pos = m_settings->value("pixelsOnly").toString();+ // for Pixels only++ getValue(*m_settings, "pixelsOnly",+ m_pixelsOnly); // doesn't work for some reason.+ QString pos = m_settings->value("pixelsOnly").toString();if (pos == "true") m_pixelsOnly = true;-+QString units;- units = m_settings->value("oldUnits", m_units).toString();+ units = m_settings->value("oldUnits", m_units).toString();m_oldUnits = units;- units = m_settings->value("oldCameraUnits", m_cameraUnits).toString();+ units = m_settings->value("oldCameraUnits", m_cameraUnits).toString();m_oldCameraUnits = units;- //end for pixels only+ // end for pixels onlyunits = m_settings->value("linearUnits").toString();if (units != "") m_units = units;@@ -946,15 +945,13 @@ void setCurrentUnits(std::string measureName, std::string units) {//-----------------------------------------------------------------void Preferences::setPixelsOnly(bool state) {- m_pixelsOnly = state;- m_settings->setValue("pixelsOnly", m_pixelsOnly);- if (state) {- storeOldUnits();- }- else- {- resetOldUnits();- }+ m_pixelsOnly = state;+ m_settings->setValue("pixelsOnly", m_pixelsOnly);+ if (state) {+ storeOldUnits();+ } else {+ resetOldUnits();+ }}//-----------------------------------------------------------------@@ -983,19 +980,19 @@ void Preferences::setCameraUnits(std::string units) {//-----------------------------------------------------------------void Preferences::storeOldUnits() {- m_oldUnits = getUnits();- m_oldCameraUnits = getCameraUnits();- m_settings->setValue("oldUnits", m_oldUnits);- m_settings->setValue("oldCameraUnits", m_oldCameraUnits);+ m_oldUnits = getUnits();+ m_oldCameraUnits = getCameraUnits();+ m_settings->setValue("oldUnits", m_oldUnits);+ m_settings->setValue("oldCameraUnits", m_oldCameraUnits);}//-----------------------------------------------------------------void Preferences::resetOldUnits() {- if (m_oldUnits != "" && m_oldCameraUnits != "") {- setUnits(m_oldUnits.toStdString());- setCameraUnits(m_oldCameraUnits.toStdString());- }+ if (m_oldUnits != "" && m_oldCameraUnits != "") {+ setUnits(m_oldUnits.toStdString());+ setCameraUnits(m_oldCameraUnits.toStdString());+ }}//-----------------------------------------------------------------diff --git a/toonz/sources/toonzlib/stage.cpp b/toonz/sources/toonzlib/stage.cppindex 4a7a0d585..56593b439 100644--- a/toonz/sources/toonzlib/stage.cpp+++ b/toonz/sources/toonzlib/stage.cpp@@ -69,7 +69,7 @@ typedef std::vector<Player> PlayerSet;thickness ofimages .pli.*/-const double Stage::inch = 53.33333; //consider changing to 120 or 160+const double Stage::inch = 53.33333; // consider changing to 120 or 160const double Stage::vectorDpi = 53.3333;namespace {diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cppindex 7ccd82eb7..88b1e9a3d 100644--- a/toonz/sources/toonzlib/toonzscene.cpp+++ b/toonz/sources/toonzlib/toonzscene.cpp@@ -1176,7 +1176,8 @@ TXshLevel *ToonzScene::loadLevel(const TFilePath &actualPath,// We must check whether the image actually has a dpi.const TPointD &imageDpi = xl->getImageDpi();- if (imageDpi == TPointD() || Preferences::instance()->getUnits() == "pixel") {+ if (imageDpi == TPointD() ||+ Preferences::instance()->getUnits() == "pixel") {// Change to "Custom Dpi" policy and use camera dpiTStageObjectId cameraId =getXsheet()->getStageObjectTree()->getCurrentCameraId();diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cppindex 9d153a3e9..c798fa85a 100644--- a/toonz/sources/toonzlib/txshsimplelevel.cpp+++ b/toonz/sources/toonzlib/txshsimplelevel.cpp@@ -382,7 +382,7 @@ void TXshSimpleLevel::setPath(const TFilePath &fp, bool keepFrames) {} catch (...) {}}-+if (getType() != PLI_XSHLEVEL) {if (!m_frames.empty()) {std::string imageId = getImageId(getFirstFid());@@ -2169,9 +2169,8 @@ TFilePath TXshSimpleLevel::getExistingHookFile(}assert(h >= 0);- return (h < 0) ? TFilePath()- : decodedLevelPath.getParentDir() +- TFilePath(hookFiles[h].toStdWString());+ return (h < 0) ? TFilePath() : decodedLevelPath.getParentDir() ++ TFilePath(hookFiles[h].toStdWString());}//-----------------------------------------------------------------------------diff --git a/toonz/sources/toonzqt/camerasettingswidget.cpp b/toonz/sources/toonzqt/camerasettingswidget.cppindex 78ae7258d..4c531d398 100644--- a/toonz/sources/toonzqt/camerasettingswidget.cpp+++ b/toonz/sources/toonzqt/camerasettingswidget.cpp@@ -196,7 +196,7 @@ CameraSettingsWidget::CameraSettingsWidget(bool forCleanup)m_dpiLabel = new QLabel(tr("DPI"));m_resLabel = new QLabel(tr("Pixels"));- m_xLabel = new QLabel(tr("x"));+ m_xLabel = new QLabel(tr("x"));m_fspChk = new QPushButton("");@@ -283,8 +283,8 @@ CameraSettingsWidget::CameraSettingsWidget(bool forCleanup)gridLay->addWidget(m_inchPrev, 1, 0, Qt::AlignRight | Qt::AlignVCenter);QString units = Preferences::instance()->getCameraUnits();- gridLay->addWidget(new QLabel(units), 1, 1,- Qt::AlignRight | Qt::AlignVCenter);+ gridLay->addWidget(new QLabel(units), 1, 1,+ Qt::AlignRight | Qt::AlignVCenter);gridLay->addWidget(m_lxFld, 1, 2);gridLay->addWidget(new QLabel("x"), 1, 3, Qt::AlignCenter);gridLay->addWidget(m_lyFld, 1, 4);@@ -294,14 +294,12 @@ CameraSettingsWidget::CameraSettingsWidget(bool forCleanup)gridLay->addWidget(m_arFld, 2, 4);gridLay->addWidget(m_dotPrev, 3, 0, Qt::AlignRight | Qt::AlignVCenter);- gridLay->addWidget(m_resLabel, 3, 1,- Qt::AlignRight | Qt::AlignVCenter);+ gridLay->addWidget(m_resLabel, 3, 1, Qt::AlignRight | Qt::AlignVCenter);gridLay->addWidget(m_xResFld, 3, 2);gridLay->addWidget(m_xLabel, 3, 3, Qt::AlignCenter);gridLay->addWidget(m_yResFld, 3, 4);- gridLay->addWidget(m_dpiLabel, 4, 1,- Qt::AlignRight | Qt::AlignVCenter);+ gridLay->addWidget(m_dpiLabel, 4, 1, Qt::AlignRight | Qt::AlignVCenter);gridLay->addWidget(m_xDpiFld, 4, 2);gridLay->addWidget(m_fspChk, 4, 3, Qt::AlignCenter);gridLay->addWidget(m_yDpiFld, 4, 4);@@ -372,29 +370,27 @@ CameraSettingsWidget::CameraSettingsWidget(bool forCleanup)CameraSettingsWidget::~CameraSettingsWidget() { setCurrentLevel(0); }void CameraSettingsWidget::showEvent(QShowEvent *e) {- if (Preferences::instance()->getCameraUnits() == "pixel")- {- m_resLabel->hide();- m_dpiLabel->hide();- m_xLabel->hide();- m_xResFld->hide();- m_yResFld->hide();- m_xDpiFld->hide();- m_yDpiFld->hide();- m_fspChk->hide();- m_dotPrev->hide();- }- else {- m_resLabel->show();- m_dpiLabel->show();- m_xLabel->show();- m_xResFld->show();- m_yResFld->show();- m_xDpiFld->show();- m_yDpiFld->show();- m_fspChk->show();- m_dotPrev->show();- }+ if (Preferences::instance()->getCameraUnits() == "pixel") {+ m_resLabel->hide();+ m_dpiLabel->hide();+ m_xLabel->hide();+ m_xResFld->hide();+ m_yResFld->hide();+ m_xDpiFld->hide();+ m_yDpiFld->hide();+ m_fspChk->hide();+ m_dotPrev->hide();+ } else {+ m_resLabel->show();+ m_dpiLabel->show();+ m_xLabel->show();+ m_xResFld->show();+ m_yResFld->show();+ m_xDpiFld->show();+ m_yDpiFld->show();+ m_fspChk->show();+ m_dotPrev->show();+ }}void CameraSettingsWidget::loadPresetList() {