void CleanupTab::onPathChange() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); CleanupParameters *params = model->getCurrentParameters(); m_path = params->m_path = TFilePath(m_pathField->getPath().toStdWString()); model->commitChanges(); }
void ProcessingTab::onSharpnessChange(bool dragging = false) { if (dragging) return; CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->getCurrentParameters()->m_sharpness = m_sharpness->getValue(); model->commitChanges(); }
void execute() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); CleanupParameters *params = model->getCurrentParameters(); params->m_transparencyCheckEnabled = !params->m_transparencyCheckEnabled; /*-- OpacityCheckのON/OFFでは、Dirtyフラグは変化させない --*/ bool dirty = params->getDirtyFlag(); model->commitChanges(); params->setDirtyFlag(dirty); }
void CleanupTab::onGenericSettingsChange() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); CleanupParameters *params = model->getCurrentParameters(); params->m_autocenterType = m_autoCenter->isChecked() ? CleanupTypes::AUTOCENTER_FDG : CleanupTypes::AUTOCENTER_NONE; params->m_pegSide = (CleanupTypes::PEGS_SIDE)(m_pegHolesOm->currentIndex() + 1); params->setFdgByName(m_fieldGuideOm->currentText().toStdString()); params->m_rotate = m_rotateOm->currentIndex() * 90; params->m_flipx = m_flipX->isChecked(); params->m_flipy = m_flipY->isChecked(); model->commitChanges(); }
void ProcessingTab::onGenericSettingsChange() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); CleanupParameters *params = model->getCurrentParameters(); params->m_lineProcessingMode = m_lineProcessing->currentIndex(); params->m_noAntialias = (m_antialias->currentIndex() > 0); params->m_postAntialias = (m_antialias->currentIndex() == 2); params->m_despeckling = m_despeckling->getValue(); params->m_aaValue = m_aaValue->getValue(); params->m_autoAdjustMode = (CleanupTypes::AUTO_ADJ_MODE)m_autoadjustOm->currentIndex(); if (params->m_lineProcessingMode == lpNone) params->m_transparencyCheckEnabled = false; model->commitChanges(); }
void CameraTab::updateImageInfo() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); CleanupParameters *params = model->getCurrentParameters(); TDimension outRes(0, 0); TPointD outDpi; params->getOutputImageInfo(outRes, outDpi.x, outDpi.y); setImageInfo(outRes.lx, outRes.ly, outDpi.x, outDpi.y); TXshSimpleLevel *sl; TFrameId fid; model->getCleanupFrame(sl, fid); ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); TFilePath outputPath(sl ? scene->decodeFilePath(model->getOutputPath(sl, params)) : TFilePath()); setImageInfo(outputPath); }
CleanupSettingsPane::CleanupSettingsPane(QWidget *parent) : QFrame(parent), m_attached(false) { // Rotate&Flip QFrame *rotFlipFrame = new QFrame(this); m_rotateOm = new QComboBox(this); m_flipX = new QCheckBox(tr("Horizontal"), this); m_flipY = new QCheckBox(tr("Vertical"), this); // Camera QFrame *cameraFrame = new QFrame(this); m_cameraWidget = new CleanupCameraSettingsWidget(); // LineProcessing QFrame *lineProcFrame = new QFrame(this); m_antialias = new QComboBox(this); m_sharpness = new DoubleField(this); m_despeckling = new IntField(this); m_aaValueLabel = new QLabel(tr("MLAA Intensity:")); m_aaValue = new IntField(this); m_lineProcessing = new QComboBox(this); m_paletteViewer = new CleanupPaletteViewer(this); m_pathField = new CleanupSaveInField(this, QString("")); QPushButton *saveBtn = new QPushButton(tr("Save")); QPushButton *loadBtn = new QPushButton(tr("Load")); QPushButton *resetBtn = new QPushButton(tr("Reset")); // Rotate&Flip rotFlipFrame->setObjectName("CleanupSettingsFrame"); QStringList rotate; rotate << "0" << "90" << "180" << "270"; m_rotateOm->addItems(rotate); // Camera cameraFrame->setObjectName("CleanupSettingsFrame"); m_cameraWidget->setCameraPresetListFile(ToonzFolder::getReslistPath(true)); // LineProcessing lineProcFrame->setObjectName("CleanupSettingsFrame"); QStringList items; items << tr("Standard") << tr("None") << tr("Morphological"); m_antialias->addItems(items); items.clear(); items << tr("Greyscale") << tr("Color"); m_lineProcessing->addItems(items); m_sharpness->setValues(90, 0, 100); m_despeckling->setValues(2, 0, 20); m_aaValue->setValues(70, 0, 100); // Model-related stuff CleanupSettingsModel *model = CleanupSettingsModel::instance(); m_backupParams.assign(model->getCurrentParameters(), false); //----layout QVBoxLayout *mainLay = new QVBoxLayout(); mainLay->setSpacing(2); mainLay->setMargin(5); { // Rotate&Flip QGridLayout *rotFlipLay = new QGridLayout(); rotFlipLay->setMargin(5); rotFlipLay->setSpacing(3); { rotFlipLay->addWidget(new QLabel(tr("Rotate")), 0, 0, Qt::AlignRight | Qt::AlignVCenter); rotFlipLay->addWidget(m_rotateOm, 0, 1, 1, 2); rotFlipLay->addWidget(new QLabel(tr("Flip")), 1, 0, Qt::AlignRight | Qt::AlignVCenter); rotFlipLay->addWidget(m_flipX, 1, 1); rotFlipLay->addWidget(m_flipY, 1, 2); } rotFlipLay->setColumnStretch(0, 0); rotFlipLay->setColumnStretch(1, 0); rotFlipLay->setColumnStretch(2, 1); rotFlipFrame->setLayout(rotFlipLay); mainLay->addWidget(rotFlipFrame, 0); // Camera QVBoxLayout *cleanupCameraFrameLay = new QVBoxLayout(); cleanupCameraFrameLay->setMargin(0); cleanupCameraFrameLay->setSpacing(0); { cleanupCameraFrameLay->addWidget(m_cameraWidget); } cameraFrame->setLayout(cleanupCameraFrameLay); mainLay->addWidget(cameraFrame, 0); // Cleanup Palette QGridLayout *lineProcLay = new QGridLayout(); lineProcLay->setMargin(5); lineProcLay->setSpacing(3); { lineProcLay->addWidget(new QLabel(tr("Line Processing:")), 0, 0, Qt::AlignRight | Qt::AlignVCenter); lineProcLay->addWidget(m_lineProcessing, 0, 1); lineProcLay->addWidget(new QLabel(tr("Antialias:")), 1, 0, Qt::AlignRight | Qt::AlignVCenter); lineProcLay->addWidget(m_antialias, 1, 1); lineProcLay->addWidget(new QLabel(tr("Sharpness:")), 2, 0, Qt::AlignRight | Qt::AlignVCenter); lineProcLay->addWidget(m_sharpness, 2, 1); lineProcLay->addWidget(new QLabel(tr("Despeckling:")), 3, 0, Qt::AlignRight | Qt::AlignVCenter); lineProcLay->addWidget(m_despeckling, 3, 1); lineProcLay->addWidget(m_aaValueLabel, 4, 0, Qt::AlignRight | Qt::AlignVCenter); lineProcLay->addWidget(m_aaValue, 4, 1); lineProcLay->addWidget(m_paletteViewer, 5, 0, 1, 2); } lineProcLay->setRowStretch(0, 0); lineProcLay->setRowStretch(1, 0); lineProcLay->setRowStretch(2, 0); lineProcLay->setRowStretch(3, 0); lineProcLay->setRowStretch(4, 0); lineProcLay->setRowStretch(5, 1); lineProcLay->setColumnStretch(0, 0); lineProcLay->setColumnStretch(1, 1); lineProcFrame->setLayout(lineProcLay); mainLay->addWidget(lineProcFrame, 100); // Bottom Parts QHBoxLayout *pathLay = new QHBoxLayout(); pathLay->setMargin(0); pathLay->setSpacing(3); { pathLay->addWidget(new QLabel("Save In"), 0); pathLay->addWidget(m_pathField); } mainLay->addLayout(pathLay, 0); mainLay->addSpacing(5); QHBoxLayout *saveLoadLay = new QHBoxLayout(); saveLoadLay->setMargin(0); saveLoadLay->setSpacing(1); { saveLoadLay->addWidget(saveBtn); saveLoadLay->addWidget(loadBtn); saveLoadLay->addWidget(resetBtn); } mainLay->addLayout(saveLoadLay, 0); } setLayout(mainLay); //-----signal-slot connections bool ret = true; ret = ret && connect(m_rotateOm, SIGNAL(activated(int)), SLOT(onGenericSettingsChange())); ret = ret && connect(m_flipX, SIGNAL(stateChanged(int)), SLOT(onGenericSettingsChange())); ret = ret && connect(m_flipY, SIGNAL(stateChanged(int)), SLOT(onGenericSettingsChange())); ret = ret && connect(m_pathField, SIGNAL(pathChanged()), SLOT(onPathChange())); ret = ret && connect(m_sharpness, SIGNAL(valueChanged(bool)), SLOT(onSharpnessChange(bool))); ret = ret && connect(m_antialias, SIGNAL(activated(int)), SLOT(onGenericSettingsChange())); ret = ret && connect(m_lineProcessing, SIGNAL(activated(int)), SLOT(onGenericSettingsChange())); ret = ret && connect(m_despeckling, SIGNAL(valueChanged(bool)), SLOT(onGenericSettingsChange())); ret = ret && connect(m_aaValue, SIGNAL(valueChanged(bool)), SLOT(onGenericSettingsChange())); ret = ret && connect(TApp::instance()->getCurrentLevel(), SIGNAL(xshLevelSwitched(TXshLevel *)), SLOT(onLevelSwitched())); ret = ret && connect(m_cameraWidget, SIGNAL(cleanupSettingsChanged()), SLOT(onGenericSettingsChange())); ret = ret && connect(saveBtn, SIGNAL(pressed()), this, SLOT(onSaveSettings())); ret = ret && connect(loadBtn, SIGNAL(pressed()), model, SLOT(promptLoad())); ret = ret && connect(resetBtn, SIGNAL(pressed()), this, SLOT(onRestoreSceneSettings())); assert(ret); }
CleanupSettings::CleanupSettings(QWidget *parent) : QWidget(parent), m_attached(false) { QVBoxLayout *vLayout = new QVBoxLayout(this); vLayout->setMargin(1); // NOTE: This works to show the 1-pix black border, // because this is a QWidget (not QFrame) heir... setLayout(vLayout); // Tabs Container // Used to deal with styled background and other stuff TabBarContainter *tabBarContainer = new TabBarContainter(this); QHBoxLayout *hLayout = new QHBoxLayout(tabBarContainer); hLayout->setMargin(0); hLayout->setAlignment(Qt::AlignLeft); hLayout->addSpacing(6); vLayout->addWidget(tabBarContainer); // Tabs Bar DVGui::TabBar *tabBar = new DVGui::TabBar(this); hLayout->addWidget(tabBar); tabBar->addSimpleTab(tr("Cleanup")); tabBar->addSimpleTab(tr("Processing")); tabBar->addSimpleTab(tr("Camera")); tabBar->setDrawBase(false); // Splitter QSplitter *split = new QSplitter(Qt::Vertical, this); split->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); vLayout->addWidget(split); // Stacked Widget QStackedWidget *stackedWidget = new QStackedWidget(split); stackedWidget->setMinimumWidth(300); //stackedWidget->setMinimumHeight(250); split->addWidget(stackedWidget); split->setStretchFactor(0, 1); // Cleanup Tab QScrollArea *scrollArea = new QScrollArea(stackedWidget); stackedWidget->addWidget(scrollArea); scrollArea->setWidgetResizable(true); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_cleanupTab = new CleanupTab; scrollArea->setWidget(m_cleanupTab); // Processing Tab scrollArea = new QScrollArea(stackedWidget); stackedWidget->addWidget(scrollArea); scrollArea->setWidgetResizable(true); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_processingTab = new ProcessingTab; scrollArea->setWidget(m_processingTab); // Camera Tab scrollArea = new QScrollArea(stackedWidget); stackedWidget->addWidget(scrollArea); scrollArea->setWidgetResizable(true); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_cameraTab = new CameraTab; scrollArea->setWidget(m_cameraTab); m_cameraTab->setCameraPresetListFile(ToonzFolder::getReslistPath(true)); // Swatch m_swatch = new CleanupSwatch(split, 200, 150); split->addWidget(m_swatch); // ToolBar QWidget *toolBarWidget = new QWidget(this); vLayout->addWidget(toolBarWidget); toolBarWidget->setFixedHeight(22); QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget); toolBarWidget->setLayout(toolBarLayout); toolBarLayout->setMargin(0); toolBarLayout->setSpacing(0); QToolBar *leftToolBar = new QToolBar(toolBarWidget); toolBarLayout->addWidget(leftToolBar, 0, Qt::AlignLeft); leftToolBar->setFixedWidth(110); m_swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this); m_swatchAct->setCheckable(true); leftToolBar->addAction(m_swatchAct); leftToolBar->addSeparator(); m_opacityAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Opacity Check"), this); m_opacityAct->setCheckable(true); leftToolBar->addAction(m_opacityAct); QToolBar *spacingToolBar1 = new QToolBar(toolBarWidget); toolBarLayout->addWidget(spacingToolBar1, 1); spacingToolBar1->setMinimumHeight(22); QToolBar *rightToolBar = new QToolBar(toolBarWidget); toolBarLayout->addWidget(rightToolBar, 0, Qt::AlignRight); rightToolBar->setFixedWidth(110); QAction *saveAct = new QAction(createQIconOnOffPNG("save", false), tr("Save Settings"), this); rightToolBar->addAction(saveAct); QAction *loadAct = new QAction(createQIconOnOffPNG("load", false), tr("Load Settings"), this); rightToolBar->addAction(loadAct); rightToolBar->addSeparator(); QAction *resetAct = new QAction(createQIconOnOffPNG("resetsize", false), tr("Reset Settings"), this); rightToolBar->addAction(resetAct); // Model-related stuff CleanupSettingsModel *model = CleanupSettingsModel::instance(); m_backupParams.assign(model->getCurrentParameters(), false); // Connections QAction *opacityCheckCmd = CommandManager::instance()->getAction(MI_OpacityCheck); assert(opacityCheckCmd); bool ret = true; ret = ret && connect(tabBar, SIGNAL(currentChanged(int)), stackedWidget, SLOT(setCurrentIndex(int))); ret = ret && connect(m_swatchAct, SIGNAL(toggled(bool)), SLOT(enableSwatch(bool))); ret = ret && connect(m_opacityAct, SIGNAL(triggered(bool)), opacityCheckCmd, SLOT(trigger())); ret = ret && connect(saveAct, SIGNAL(triggered()), model, SLOT(promptSave())); ret = ret && connect(loadAct, SIGNAL(triggered()), model, SLOT(promptLoad())); ret = ret && connect(resetAct, SIGNAL(triggered()), this, SLOT(onRestoreSceneSettings())); assert(ret); }
void CameraTab::onGenericSettingsChange() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); getFields(model->getCurrentParameters()); model->commitChanges(); }