Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

revert and additional fixes

shun-iwasawac9a4a1ecbfe4
diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h
index 67ef65b09..07dffcd41 100644
--- a/toonz/sources/include/toonz/preferencesitemids.h
+++ b/toonz/sources/include/toonz/preferencesitemids.h
@@ -5,16 +5,9 @@ enum PreferencesItemId {
// General
defaultViewerEnabled,
rasterOptimizedMemory,
- autosaveEnabled,
- autosavePeriod,
- autosaveSceneEnabled,
- autosaveOtherFilesEnabled,
startupPopupEnabled,
undoMemorySize,
taskchunksize,
- replaceAfterSaveLevelAs,
- backupEnabled,
- backupKeepCount,
sceneNumberingEnabled,
watchFileSystemEnabled,
projectRoot,
@@ -66,6 +59,13 @@ enum PreferencesItemId {
//----------
// Saving
+ autosaveEnabled,
+ autosavePeriod,
+ autosaveSceneEnabled,
+ autosaveOtherFilesEnabled,
+ replaceAfterSaveLevelAs,
+ backupEnabled,
+ backupKeepCount,
rasterBackgroundColor,
resetUndoOnSavingLevel,
diff --git a/toonz/sources/toonz/convertpopup.cpp b/toonz/sources/toonz/convertpopup.cpp
index c3a57319d..659843edc 100644
--- a/toonz/sources/toonz/convertpopup.cpp
+++ b/toonz/sources/toonz/convertpopup.cpp
@@ -330,8 +330,6 @@ ConvertPopup::ConvertPopup(bool specifyInput)
, m_isConverting(false) {
// Su MAC i dialog modali non hanno bottoni di chiusura nella titleBar
setModal(false);
- m_mainFrame->setFixedHeight(220);
- this->layout()->setSizeConstraint(QLayout::SetFixedSize);
TlvMode_Unpainted = tr("Unpainted tlv");
TlvMode_UnpaintedFromNonAA = tr("Unpainted tlv from non AA source");
TlvMode_PaintedFromTwoImages = tr("Painted tlv from two images");
@@ -513,6 +511,8 @@ ConvertPopup::ConvertPopup(bool specifyInput)
ret = ret && connect(m_convertFileFld, SIGNAL(pathChanged()), this,
SLOT(onFileInChanged()));
+ // resize the dialog
+ onFormatSelected(m_fileFormat->currentText());
// update unable/enable of checkboxes
onTlvModeSelected(m_tlvMode->currentText());
@@ -764,6 +764,11 @@ void ConvertPopup::onFormatSelected(const QString &format) {
m_saveBackupToNopaint->setEnabled(m_tlvMode->currentText() ==
TlvMode_Unpainted);
}
+ // For unknown reasons, calling adjustSize twice is needed to
+ // prevent the dialog from remaining large size when the current
+ // format is switched from tlv to another format.
+ adjustSize();
+ adjustSize();
}
//------------------------------------------------------------------
diff --git a/toonz/sources/toonz/levelsettingspopup.cpp b/toonz/sources/toonz/levelsettingspopup.cpp
index 283c12b47..454071177 100644
--- a/toonz/sources/toonz/levelsettingspopup.cpp
+++ b/toonz/sources/toonz/levelsettingspopup.cpp
@@ -320,8 +320,6 @@ LevelSettingsPopup::LevelSettingsPopup()
, m_whiteTransp(0)
, m_scanPathFld(0) {
setWindowTitle(tr("Level Settings"));
- m_mainFrame->setFixedHeight(280);
- this->layout()->setSizeConstraint(QLayout::SetFixedSize);
m_nameFld = new LineEdit();
m_pathFld = new FileField(); // Path
@@ -614,6 +612,7 @@ void LevelSettingsPopup::onPreferenceChanged(const QString &propertyName) {
int decimals = (pixelsMode) ? 0 : 4;
m_widthFld->setDecimals(decimals);
m_heightFld->setDecimals(decimals);
+ adjustSize();
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index 4df4bdc2b..11a91472d 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -51,6 +51,7 @@
#include <QStringList>
#include <QListWidget>
#include <QGroupBox>
+#include <QKeySequence>
using namespace DVGui;
@@ -998,6 +999,13 @@ void PreferencesPopup::insertFootNote(QGridLayout* layout) {
//-----------------------------------------------------------------------------
QString PreferencesPopup::getUIString(PreferencesItemId id) {
+ auto CtrlAltStr = []() {
+ QString str =
+ QKeySequence(Qt::CTRL + Qt::ALT).toString(QKeySequence::NativeText);
+ if (str.endsWith("+")) str.chop(1);
+ return str;
+ };
+
const static QMap<PreferencesItemId, QString> uiStringTable = {
// General
{defaultViewerEnabled, tr("Use Default Viewer for Movie Formats")},
@@ -1112,7 +1120,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
{cursorBrushStyle, tr("Cursor Style:")},
{cursorOutlineEnabled, tr("Show Cursor Size Outlines")},
{levelBasedToolsDisplay, tr("Toolbar Display Behaviour:")},
- {useCtrlAltToResizeBrush, tr("Use Ctrl+Alt to Resize Brush")},
+ {useCtrlAltToResizeBrush, tr("Use %1 to Resize Brush").arg(CtrlAltStr())},
// Xsheet
{xsheetLayoutPreference, tr("Column Header Layout*:")},
@@ -1614,9 +1622,9 @@ QWidget* PreferencesPopup::createSavingPage() {
setupLayout(lay);
QGridLayout* autoSaveLay = insertGroupBoxUI(autosaveEnabled, lay);
{
- insertUI(autosavePeriod, autoSaveLay);
- insertUI(autosaveSceneEnabled, autoSaveLay);
- insertUI(autosaveOtherFilesEnabled, autoSaveLay);
+ insertUI(autosavePeriod, autoSaveLay);
+ insertUI(autosaveSceneEnabled, autoSaveLay);
+ insertUI(autosaveOtherFilesEnabled, autoSaveLay);
}
insertUI(replaceAfterSaveLevelAs, lay);
QGridLayout* backupLay = insertGroupBoxUI(backupEnabled, lay);
@@ -1626,7 +1634,7 @@ QWidget* PreferencesPopup::createSavingPage() {
"raster levels with transparent pixels\nin non "
"alpha-enabled image format."),
this);
- lay->addWidget(matteColorLabel, 0, 0, 1, 3, Qt::AlignLeft);
+ lay->addWidget(matteColorLabel, lay->rowCount(), 0, 1, 3, Qt::AlignLeft);
insertUI(rasterBackgroundColor, lay);
insertUI(resetUndoOnSavingLevel, lay);
@@ -1744,7 +1752,7 @@ QWidget* PreferencesPopup::createToolsPage() {
}
insertUI(levelBasedToolsDisplay, lay,
getComboItemList(levelBasedToolsDisplay));
- //insertUI(useCtrlAltToResizeBrush, lay);
+ insertUI(useCtrlAltToResizeBrush, lay);
lay->setRowStretch(lay->rowCount(), 1);
widget->setLayout(lay);
diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp
index 143314cf2..65d711c5f 100644
--- a/toonz/sources/toonzlib/preferences.cpp
+++ b/toonz/sources/toonzlib/preferences.cpp
@@ -337,19 +337,9 @@ void Preferences::definePreferenceItems() {
define(defaultViewerEnabled, "defaultViewerEnabled", QMetaType::Bool, false);
define(rasterOptimizedMemory, "rasterOptimizedMemory", QMetaType::Bool,
false);
- define(autosaveEnabled, "autosaveEnabled", QMetaType::Bool, false);
- define(autosavePeriod, "autosavePeriod", QMetaType::Int, 15, 1, 60);
- define(autosaveSceneEnabled, "autosaveSceneEnabled", QMetaType::Bool, true);
- define(autosaveOtherFilesEnabled, "autosaveOtherFilesEnabled",
- QMetaType::Bool, true);
define(startupPopupEnabled, "startupPopupEnabled", QMetaType::Bool, true);
define(undoMemorySize, "undoMemorySize", QMetaType::Int, 100, 0, 2000);
define(taskchunksize, "taskchunksize", QMetaType::Int, 10, 1, 2000);
- define(replaceAfterSaveLevelAs, "replaceAfterSaveLevelAs", QMetaType::Bool,
- true);
- define(backupEnabled, "backupEnabled", QMetaType::Bool, true);
- define(backupKeepCount, "backupKeepCount", QMetaType::Int, 1, 1,
- std::numeric_limits<int>::max());
define(sceneNumberingEnabled, "sceneNumberingEnabled", QMetaType::Bool,
false);
define(watchFileSystemEnabled, "watchFileSystemEnabled", QMetaType::Bool,
@@ -359,8 +349,6 @@ void Preferences::definePreferenceItems() {
define(pathAliasPriority, "pathAliasPriority", QMetaType::Int,
(int)ProjectFolderOnly);
- setCallBack(autosaveEnabled, &Preferences::enableAutosave);
- setCallBack(autosavePeriod, &Preferences::setAutosavePeriod);
setCallBack(undoMemorySize, &Preferences::setUndoMemorySize);
// Interface
@@ -431,12 +419,24 @@ void Preferences::definePreferenceItems() {
//"levelFormats" need to be handle separately
// Saving
+ define(autosaveEnabled, "autosaveEnabled", QMetaType::Bool, false);
+ define(autosavePeriod, "autosavePeriod", QMetaType::Int, 15, 1, 60);
+ define(autosaveSceneEnabled, "autosaveSceneEnabled", QMetaType::Bool, true);
+ define(autosaveOtherFilesEnabled, "autosaveOtherFilesEnabled",
+ QMetaType::Bool, true);
+ define(replaceAfterSaveLevelAs, "replaceAfterSaveLevelAs", QMetaType::Bool,
+ true);
+ define(backupEnabled, "backupEnabled", QMetaType::Bool, true);
+ define(backupKeepCount, "backupKeepCount", QMetaType::Int, 1, 1,
+ std::numeric_limits<int>::max());
define(rasterBackgroundColor, "rasterBackgroundColor", QMetaType::QColor,
QColor(Qt::white));
define(resetUndoOnSavingLevel, "resetUndoOnSavingLevel", QMetaType::Bool,
true);
setCallBack(rasterBackgroundColor, &Preferences::setRasterBackgroundColor);
+ setCallBack(autosaveEnabled, &Preferences::enableAutosave);
+ setCallBack(autosavePeriod, &Preferences::setAutosavePeriod);
// Import / Export
define(ffmpegPath, "ffmpegPath", QMetaType::QString, "");
diff --git a/toonz/sources/toonzqt/functionsegmentviewer.cpp b/toonz/sources/toonzqt/functionsegmentviewer.cpp
index f7cadf526..c4cc81219 100644
--- a/toonz/sources/toonzqt/functionsegmentviewer.cpp
+++ b/toonz/sources/toonzqt/functionsegmentviewer.cpp
@@ -117,9 +117,9 @@ SpeedInOutSegmentPage::SpeedInOutSegmentPage(FunctionSegmentViewer *parent)
bool ret = connect(m_speed0xFld, SIGNAL(editingFinished()), this,
SLOT(onFirstHandleXChanged()));
- ret = ret && connect(m_speed0yFld, SIGNAL(editingFinished()), this,
+ ret = ret && connect(m_speed0yFld, SIGNAL(editingFinished()), this,
SLOT(onFirstHandleYChanged()));
- ret = ret && connect(m_firstSpeedFld, SIGNAL(editingFinished()), this,
+ ret = ret && connect(m_firstSpeedFld, SIGNAL(editingFinished()), this,
SLOT(onFirstSpeedChanged()));
ret = ret && connect(m_speed1xFld, SIGNAL(editingFinished()), this,
@@ -557,11 +557,11 @@ void FunctionExpressionSegmentPage::init(int segmentLength) {
/*--- すでにあるカーブをExpressionに切り替えた場合 ---*/
if (kIndex >= 0) {
- TDoubleKeyframe keyFrame = curve->getKeyframe(kIndex);
- double value = curve->getValue(keyFrame.m_frame);
- const TUnit *unit = 0;
+ TDoubleKeyframe keyFrame = curve->getKeyframe(kIndex);
+ double value = curve->getValue(keyFrame.m_frame);
+ const TUnit *unit = 0;
if (curve->getMeasure()) unit = curve->getMeasure()->getCurrentUnit();
- if (unit) value = unit->convertTo(value);
+ if (unit) value = unit->convertTo(value);
m_expressionFld->setExpression(QString::number(value).toStdString());
/*--- unitがある場合だけUnitを表示 ---*/
if (unit)
@@ -704,20 +704,20 @@ FileSegmentPage::FileSegmentPage(FunctionSegmentViewer *parent)
void FileSegmentPage::refresh() {
TDoubleKeyframe kf;
TDoubleParam *curve = getCurve();
- if (curve) kf = curve->getKeyframeAt(getR0());
+ if (curve) kf = curve->getKeyframeAt(getR0());
if (curve && kf.m_isKeyframe) {
TFilePath path;
int fieldIndex = 0;
std::string unitName = "";
if (kf.m_type == TDoubleKeyframe::File) {
- path = kf.m_fileParams.m_path;
- fieldIndex = kf.m_fileParams.m_fieldIndex;
+ path = kf.m_fileParams.m_path;
+ fieldIndex = kf.m_fileParams.m_fieldIndex;
if (fieldIndex < 0) fieldIndex = 0;
- unitName = kf.m_unitName;
+ unitName = kf.m_unitName;
if (unitName == "") {
TMeasure *measure = curve->getMeasure();
if (measure) {
- const TUnit *unit = measure->getCurrentUnit();
+ const TUnit *unit = measure->getCurrentUnit();
if (unit) unitName = ::to_string(unit->getDefaultExtension());
}
}
@@ -735,7 +735,7 @@ void FileSegmentPage::init(int segmentLength) {
TMeasure *measure = curve->getMeasure();
std::string unitName = "";
if (measure) {
- const TUnit *unit = measure->getCurrentUnit();
+ const TUnit *unit = measure->getCurrentUnit();
if (unit) unitName = ::to_string(unit->getDefaultExtension());
}
m_measureFld->setText(QString::fromStdString(unitName));
@@ -1042,17 +1042,17 @@ FunctionSegmentViewer::FunctionSegmentViewer(QWidget *parent,
bool ret = true;
ret = ret && connect(m_typeCombo, SIGNAL(currentIndexChanged(int)),
m_parametersPanel, SLOT(setCurrentIndex(int)));
- ret = ret && connect(m_typeCombo, SIGNAL(activated(int)), this,
+ ret = ret && connect(m_typeCombo, SIGNAL(activated(int)), this,
SLOT(onSegmentTypeChanged(int)));
- ret = ret && connect(applyButton, SIGNAL(clicked()), this,
+ ret = ret && connect(applyButton, SIGNAL(clicked()), this,
SLOT(onApplyButtonPressed()));
- ret = ret && connect(m_prevCurveButton, SIGNAL(clicked()), this,
+ ret = ret && connect(m_prevCurveButton, SIGNAL(clicked()), this,
SLOT(onPrevCurveButtonPressed()));
- ret = ret && connect(m_nextCurveButton, SIGNAL(clicked()), this,
+ ret = ret && connect(m_nextCurveButton, SIGNAL(clicked()), this,
SLOT(onNextCurveButtonPressed()));
- ret = ret && connect(m_prevLinkButton, SIGNAL(clicked()), this,
+ ret = ret && connect(m_prevLinkButton, SIGNAL(clicked()), this,
SLOT(onPrevLinkButtonPressed()));
- ret = ret && connect(m_nextLinkButton, SIGNAL(clicked()), this,
+ ret = ret && connect(m_nextLinkButton, SIGNAL(clicked()), this,
SLOT(onNextLinkButtonPressed()));
assert(ret);
@@ -1104,7 +1104,7 @@ void FunctionSegmentViewer::setSegmentByFrame(TDoubleParam *curve, int frame) {
if (k1 >= 1)
segmentIndex = k1 - 1;
else {
- int k0 = m_curve->getPrevKeyframe(frame);
+ int k0 = m_curve->getPrevKeyframe(frame);
if (k0 >= 0) segmentIndex = k0;
}
} else {
@@ -1276,9 +1276,9 @@ void FunctionSegmentViewer::onCurveChanged() {
void FunctionSegmentViewer::onStepFieldChanged(const QString &text) {
if (!segmentIsValid()) return;
- int step = 1;
+ int step = 1;
if (text != "") step = text.toInt();
- if (step < 1) step = 1;
+ if (step < 1) step = 1;
KeyframeSetter setter(m_curve, m_segmentIndex);
setter.setStep(step);
}
@@ -1383,8 +1383,8 @@ void FunctionSegmentViewer::onApplyButtonPressed() {
/*--- from -
* toに合わせてキーフレームを作成しようと試みる。すでに有る場合はスキップ
* ---*/
- if (fromFrame < 0) fromFrame = 0;
- if (toFrame < 0) toFrame = 0;
+ if (fromFrame < 0) fromFrame = 0;
+ if (toFrame < 0) toFrame = 0;
if (fromFrame >= toFrame) fromFrame = toFrame + 1;
if (!m_curve->isKeyframe(fromFrame))