/* * rearrangeGroups() * Change a square group's type to another * return void */ void changeGroup(square** &map, int height, int width, int i, int j, int itype, int dtype) { map[i][j].type = dtype; if (i+1<height) if(map[i+1][j].type == itype) changeGroup(map, height, width, i+1, j, itype, dtype); if (j+1<width) if(map[i][j+1].type == itype) changeGroup(map, height, width, i, j+1, itype, dtype); if (i>0) if(map[i-1][j].type == itype) changeGroup(map, height, width, i-1, j, itype, dtype); if (j>0) if(map[i][j-1].type == itype) changeGroup(map, height, width, i, j-1, itype, dtype); }
/** * \\n * \date 01-May-2005\n * \brief Main SCR debug function * * Function Scope \e Public.\n * \param hScr - handle to the SCR object.\n * \param funcType - the specific debug function.\n * \param pParam - parameters for the debug function.\n */ void scrDebugFunction(TI_HANDLE hScr, TI_UINT32 funcType, void *pParam) { switch (funcType) { case DBG_SCR_PRINT_HELP: printScrDbgFunctions(); break; case DBG_SCR_CLIENT_REQUEST_SERVING_CHANNEL: requestAsClient(hScr, *((EScrClientId *) pParam), SCR_RESOURCE_SERVING_CHANNEL); break; case DBG_SCR_CLIENT_RELEASE_SERVING_CHANNEL: releaseAsClient(hScr, *((EScrClientId *) pParam), SCR_RESOURCE_SERVING_CHANNEL); break; case DBG_SCR_CLIENT_REQUEST_PERIODIC_SCAN: requestAsClient(hScr, *((EScrClientId *) pParam), SCR_RESOURCE_PERIODIC_SCAN); break; case DBG_SCR_CLIENT_RELEASE_PERIODIC_SCAN: releaseAsClient(hScr, *((EScrClientId *) pParam), SCR_RESOURCE_PERIODIC_SCAN); break; case DBG_SCR_SET_GROUP: changeGroup(hScr, *((EScrGroupId *) pParam)); break; case DBG_SCR_PRINT_OBJECT: printSCRObject(hScr); break; case DBG_SCR_SET_MODE: changeMode(hScr, *((EScrModeId *) pParam)); break; default: WLAN_OS_REPORT(("Invalid function type in SCR debug function: %d\n", funcType)); break; } }
/* * rearrangeGroups() * Count square groups. Tries to change groups so that map contains all types of squares * return bool */ bool rearrangeGroups(square** &map, int height, int width, int* types) { int itype = max(types[0],max(types[1],types[2])); int dtype = min(types[0],min(types[1],types[2])); int end=0; for(int i = 0; i<height; i++) { for(int j = 0; j<width; j++) { if(map[i][j].type == itype) { changeGroup(map, height, width, i, j, map[i][j].type, dtype); end = 1; break; } } if(end==1) break; } return true; }
void SoundCfg::show ( ) { t_config *p_config = config_get_ptr(); std::string profile_name; mSettingsDirty = false; if ( (p_config->machine_type == media_get_ptr()->machine_type) || (p_config->machine_type != MACHINE_TYPE_5200 && media_get_ptr()->machine_type != MACHINE_TYPE_5200) ) sound_set_profile ( media_get_ptr()->sound_profile ); mSound = g_sound; profile_name = mSound.name; if ( getParent () ) getParent()->moveToTop (this); changeGroup ( profile_name ); setVisible ( true ); }
void SoundCfg::action(const gcn::ActionEvent &actionEvent) { t_config *p_config = config_get_ptr(); std::string new_name; char tmp_string[257]; if ( actionEvent.getId() == "mOk" ) { if ( mSettingsDirty == true ) { saveSettings( mProfileList.getLabelFromIndex(mProfile.getSelected()) ); } hide(); } else if ( actionEvent.getId() == "mCancel" ) { hide(); } else if ( actionEvent.getId() == "mProfile" ) { if ( mSettingsDirty == true ) { saveSettings( mSound.name ); } changeGroup (mProfileList.getLabelFromIndex(mProfile.getSelected()) ); } else if ( actionEvent.getId() == "mRename" ) { if ( !mProfileList.getNumberOfItems() ) { mGuiMain->getInfoPopup()->show("No Existing Profiles. No Action Taken"); return; } mGuiMain->getMessagePopup()->deleteActions(); mGuiMain->getMessagePopup()->addActionListener(this); mGuiMain->getMessagePopup()->setActionEventId("Rename"); mGuiMain->getMessagePopup()->setInput(mProfileList.getLabelFromIndex(mProfile.getSelected())); mGuiMain->getMessagePopup()->show("Enter Profile Name", "Ok", true, "Cancel", true, "", false, true); } else if ( actionEvent.getId() == "Rename" ) { mGuiMain->getMessagePopup()->hide(); if ( mGuiMain->getMessagePopup()->getButton() == 0 ) { new_name = mGuiMain->getMessagePopup()->getInput(); if ( mProfileList.getIndexFromLabel(new_name.c_str()) < mProfileList.getNumberOfItems() ) { mGuiMain->getInfoPopup()->show("Profile Exists. No Action Taken"); } else { sprintf ( tmp_string, "UPDATE Sound SET Name='%s' WHERE Name='%s'", new_name.c_str(), mProfileList.getLabelFromIndex(mProfile.getSelected()) ); db_if_exec_sql ( tmp_string, NULL, NULL ); initProfileList(); changeGroup (new_name ); } } } else if ( actionEvent.getId() == "mSaveAs" ) { mGuiMain->getProfilePopup()->deleteActions(); mGuiMain->getProfilePopup()->addActionListener(this); mGuiMain->getProfilePopup()->setActionEventId("SaveBrowser"); mGuiMain->getProfilePopup()->show( "Choose Profile or Create New", "SELECT Name FROM Sound", mProfileList.getLabelFromIndex(mProfile.getSelected()), true ); } else if ( actionEvent.getId() == "SaveBrowser" ) { if ( mGuiMain->getProfilePopup()->getCancelPressed() == false ) { saveSettings ( mGuiMain->getProfilePopup()->getProfile() ); mSettingsDirty = false; } } else if ( actionEvent.getId() == "mDirty" ) { mSettingsDirty = true; } else if ( actionEvent.getId() == "mFilterEnabled" ) { mSettingsDirty = true; setFilterEnabled ( mFilterEnabled.isSelected() ); } else if ( actionEvent.getId() == "mBass" ) { mSettingsDirty = true; setSoundCaptions(); } else if ( actionEvent.getId() == "mTreble" ) { mSettingsDirty = true; setSoundCaptions(); } }
/** Default constructor */ CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); Settings->loadWidgetInformation(this); mIsStandard = false; ui.headerFrame->setHeaderImage(QPixmap(":/images/user/add_group256.png")); mGroupId = groupId; /* Initialize friends list */ ui.friendList->setHeaderText(tr("Friends")); ui.friendList->setModus(FriendSelectionWidget::MODUS_CHECK); ui.friendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_GPG); ui.friendList->start(); if (mGroupId.empty() == false) { /* edit exisiting group */ RsGroupInfo groupInfo; if (rsPeers->getGroupInfo(mGroupId, groupInfo)) { mIsStandard = (groupInfo.flag & RS_GROUP_FLAG_STANDARD); if (mIsStandard) { ui.groupName->setText(GroupDefs::name(groupInfo)); } else { ui.groupName->setText(misc::removeNewLine(groupInfo.name)); } setWindowTitle(tr("Edit Group")); ui.headerFrame->setHeaderImage(QPixmap(":/images/user/edit_group64.png")); ui.headerFrame->setHeaderText(tr("Edit Group")); ui.groupName->setDisabled(mIsStandard); ui.friendList->setSelectedIds<RsPgpId,FriendSelectionWidget::IDTYPE_GPG>(groupInfo.peerIds, false); } else { /* Group not found, create new */ mGroupId.clear(); } } else { ui.headerFrame->setHeaderText(tr("Create a Group")); } std::list<RsGroupInfo> groupInfoList; rsPeers->getGroupInfoList(groupInfoList); std::list<RsGroupInfo>::iterator groupIt; for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) { if (mGroupId.empty() || groupIt->id != mGroupId) { mUsedGroupNames.append(GroupDefs::name(*groupIt)); } } connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(changeGroup())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(ui.groupName, SIGNAL(textChanged(QString)), this, SLOT(groupNameChanged(QString))); groupNameChanged(ui.groupName->text()); }