void Preferences::_initializeCallbacks(){ addCommandCallback( "setMenuVisible", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { std::set<QString> keys = {SHOW_MENU}; std::map<QString,QString> dataValues = Carta::State::UtilState::parseParamMap( params, keys ); bool validBool = false; bool visible = Util::toBool( dataValues[*keys.begin()], &validBool ); QString result; if ( validBool ){ setMenuVisibility( visible ); } else { result = "Menu visibility must be a bool : " + dataValues[0]; } Util::commandPostProcess( result ); return result; }); addCommandCallback( "setToolBarVisible", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { std::set<QString> keys = {SHOW_TOOLBAR}; std::map<QString,QString> dataValues = Carta::State::UtilState::parseParamMap( params, keys ); bool validBool = false; bool visible = Util::toBool( dataValues[*keys.begin()], &validBool ); QString result; if ( validBool ){ setToolbarVisibility( visible ); } else { result = "Toolbar visibility must be a bool : " + dataValues[0]; } Util::commandPostProcess( result ); return result; }); addCommandCallback( "setStatusVisible", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { std::set<QString> keys = {SHOW_STATUS}; std::map<QString,QString> dataValues = Carta::State::UtilState::parseParamMap( params, keys ); bool validBool = false; bool visible = Util::toBool( dataValues[*keys.begin()], &validBool ); QString result; if ( validBool ){ setStatusVisibility( visible ); } else { result = "Status bar visibility must be a bool : " + dataValues[0]; } Util::commandPostProcess( result ); return result; }); }
void Fonts::_initializeCallbacks(){ addCommandCallback( "getFontFamilies", [=] (const QString & /*cmd*/, const QString & /*params*/, const QString & /*sessionId*/) -> QString { QStringList fontList = getFontFamilies(); QString result = fontList.join(","); return result; }); addCommandCallback( "getFontSizes", [=] (const QString & /*cmd*/, const QString & /*params*/, const QString & /*sessionId*/) -> QString { QStringList fontList = getFontSizes(); QString result = fontList.join(","); return result; }); }
void Themes::_initializeCallbacks(){ addCommandCallback( "getThemes", [=] (const QString & /*cmd*/, const QString & /*params*/, const QString & /*sessionId*/) -> QString { QStringList themeList = getThemes(); QString result = themeList.join(","); return result; }); }
void CoordinateSystems::_initializeCallbacks(){ addCommandCallback( "getCoordSystems", [=] (const QString & /*cmd*/, const QString & /*params*/, const QString & /*sessionId*/) -> QString { QStringList coordList = getCoordinateSystems(); QString result = coordList.join(","); return result; }); }
void Region::_initializeCallbacks(){ addCommandCallback( "shapeChanged", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { std::set<QString> keys = { "info"}; std::map<QString,QString> dataValues = Carta::State::UtilState::parseParamMap( params, keys ); //resetStateData( dataValues[ *keys.begin()]); return ""; }); }
void Settings::_initializeCallbacks(){ addCommandCallback( "setSettingsVisible", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { bool visible = false; bool validBool = _processParams( params, &visible ); QString result; if ( validBool ){ setVisible( visible ); } else { result = "Setting visibility must be a bool : " + params; } Util::commandPostProcess( result ); return result; }); }
void AnimatorType::_initializeCommands(){ //A new image frame is being selected. addCommandCallback( COMMAND_SET_FRAME, [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { QString result; bool validInt = false; int index = params.toInt( &validInt ); if ( validInt ){ result = setFrame( index ); } else { result = "Animator index must be a valid integer "+params; } Util::commandPostProcess( result ); return result; }); addCommandCallback( "setUpperBoundUser", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { QString result; bool validInt = false; int index = params.toInt( &validInt ); if ( validInt ){ result = setUpperBoundUser( index ); } else { result = "Animator upper bound must be a valid integer "+params; } Util::commandPostProcess( result ); return result; }); addCommandCallback( "setLowerBoundUser", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { QString result; bool validInt = false; int index = params.toInt( &validInt ); if ( validInt ){ result = setLowerBoundUser( index ); } else { result = "Animator lower bound must be a valid integer "+params; } Util::commandPostProcess( result ); return result; }); addCommandCallback( "getSelection", [=] (const QString & /*cmd*/, const QString & /*params*/, const QString & /*sessionId*/) -> QString { QString selectId; if ( m_select != nullptr){ selectId = m_select->getPath(); } else { selectId = _makeSelection(); } return selectId; }); addCommandCallback( "setEndBehavior", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { QString result; std::set<QString> keys = {END_BEHAVIOR}; std::map<QString,QString> dataValues = Carta::State::UtilState::parseParamMap( params, keys ); QString endStr = dataValues[*keys.begin()]; result = setEndBehavior( endStr ); Util::commandPostProcess( result ); return result; }); addCommandCallback( "setFrameRate", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { QString result; std::set<QString> keys = {RATE}; std::map<QString,QString> dataValues = Carta::State::UtilState::parseParamMap( params, keys ); QString rateStr = dataValues[*keys.begin()]; bool validRate = false; int rate = rateStr.toInt( &validRate ); if ( validRate ){ result = setFrameRate( rate ); } else { result = "Frame rate must be an integer: "+params; } Util::commandPostProcess( result ); return result; }); addCommandCallback( "setFrameStep", [=] (const QString & /*cmd*/, const QString & params, const QString & /*sessionId*/) -> QString { QString result; std::set<QString> keys = {STEP}; std::map<QString,QString> dataValues = Carta::State::UtilState::parseParamMap( params, keys ); QString stepStr = dataValues[*keys.begin()]; bool validStep = false; int step = stepStr.toInt( &validStep ); if ( validStep ){ result = setFrameStep( step ); } else { result = "Frame step must be a positive integer: "+params; } Util::commandPostProcess( result ); return result; }); }