void PreviewToggleCommand::enable() { // Cleanup Preview and Camera Test are exclusive. In case, disable the latter. // NOTE: This is done *before* attaching, since attach may invoke a preview // rebuild. CameraTestCheck *tc = CameraTestCheck::instance(); tc->setIsEnabled(false); // Attach to the model CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->attach(CleanupSettingsModel::LISTENER | CleanupSettingsModel::PREVIEWER); // Connect signals bool ret = true; ret = ret && connect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged())); ret = ret && connect(model, SIGNAL(modelChanged(bool)), this, SLOT(onModelChanged(bool))); ret = ret && connect(&m_timer, SIGNAL(timeout()), this, SLOT(postProcess())); TPaletteHandle *ph = TApp::instance()->getPaletteController()->getCurrentCleanupPalette(); ret = ret && connect(ph, SIGNAL(colorStyleChanged()), &m_timer, SLOT(start())); ret = ret && connect(ph, SIGNAL(paletteChanged()), &m_timer, SLOT(start())); assert(ret); onPreviewDataChanged(); // in preview cleanup mode, tools are forbidden! Reverting to hand... TApp::instance()->getCurrentTool()->setTool(T_Hand); }
void CleanupSettingsPane::showEvent(QShowEvent *se) { QFrame::showEvent(se); if (!m_attached) { m_attached = true; // Should ensure that swatch is off... CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->attach(CleanupSettingsModel::LISTENER); bool ret = true; ret = ret && connect(model, SIGNAL(imageSwitched()), this, SLOT(onImageSwitched())); ret = ret && connect(model, SIGNAL(modelChanged(bool)), this, SLOT(updateGui(bool))); ret = ret && connect(model, SIGNAL(clnLoaded()), this, SLOT(onClnLoaded())); assert(ret); m_cameraWidget->setCurrentLevel( TApp::instance()->getCurrentLevel()->getLevel()); updateGui(false); onImageSwitched(); onClnLoaded(); }
void CameraTestToggleCommand::enable() { /*---既に現在のツールがCameraTestになっている場合はreturn---*/ m_oldTool = TApp::instance()->getCurrentTool()->getTool(); if (m_oldTool->getName().compare("T_CameraTest") == 0) { CameraTestCheck::instance()->setIsEnabled(true); disable(); return; } // Cleanup Preview and Camera Test are exclusive. In case, disable the latter. // NOTE: This is done *before* attaching, since attach may invoke a preview // rebuild. CleanupPreviewCheck *pc = CleanupPreviewCheck::instance(); pc->setIsEnabled(false); // Attach to the model CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->attach( CleanupSettingsModel::LISTENER | CleanupSettingsModel::CAMERATEST, false); // Connect signals bool ret = true; ret = ret && connect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged())); assert(ret); onPreviewDataChanged(); TApp::instance()->getCurrentTool()->setTool("T_CameraTest"); }