static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) { CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER); if (!pPlugin) return; switch (id) { case IDC_COMBO_API_CALL: if(codeNotify != CBN_SELCHANGE) break; updateUI(hWnd); break; case IDC_BUTTON_GO: pLogger->blockDumpToFile(FALSE); onGo(hWnd); break; case IDC_EDIT_ARG1: case IDC_EDIT_ARG2: case IDC_EDIT_ARG3: case IDC_EDIT_ARG4: case IDC_EDIT_ARG5: case IDC_EDIT_ARG6: case IDC_EDIT_ARG7: { if(codeNotify == EN_SETFOCUS) pPlugin->m_hWndLastEditFocus = hWndCtl; char szString[80]; char szEdit[128]; int iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_API_CALL)); ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_API_CALL), iIndex, szString); if( ((strcmp(szString, STRING_NPN_POSTURL) == 0) || (strcmp(szString, STRING_NPN_POSTURLNOTIFY) == 0)) && (id == IDC_EDIT_ARG5) && (codeNotify == EN_CHANGE)) { Edit_GetText(hWndCtl, szEdit, sizeof(szEdit)); int iLength = strlen(szEdit); SetDlgItemInt(hWnd, IDC_EDIT_ARG4, iLength, FALSE); } if( ((strcmp(szString, STRING_NPN_WRITE) == 0)) && (id == IDC_EDIT_ARG4) && (codeNotify == EN_CHANGE)) { Edit_GetText(hWndCtl, szEdit, sizeof(szEdit)); int iLength = strlen(szEdit); SetDlgItemInt(hWnd, IDC_EDIT_ARG3, iLength, FALSE); } // save values of window size on the fly as we type it if( (strcmp(szString, STRING_NPN_SETVALUE) == 0) && ((id == IDC_EDIT_ARG3) || (id == IDC_EDIT_ARG4)) && (codeNotify == EN_CHANGE) && (hWndCtl == GetFocus())) { iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_ARG2)); ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_ARG2), iIndex, szString); if(strcmp(szString, "NPPVpluginWindowSize") == 0) { BOOL bTranslated = FALSE; int iWidth = GetDlgItemInt(hWnd, IDC_EDIT_ARG3, &bTranslated, TRUE); int iHeight = GetDlgItemInt(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE); if(pPlugin->m_iWidth != iWidth) pPlugin->m_iWidth = iWidth; if(pPlugin->m_iHeight != iHeight) pPlugin->m_iHeight = iHeight; } } break; } case IDC_COMBO_ARG2: { if(codeNotify != CBN_SELCHANGE) break; ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARG4), SW_HIDE); ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG4), SW_HIDE); Static_SetText(GetDlgItem(hWnd, IDC_STATIC_ARG3), "*value:"); Edit_SetText(GetDlgItem(hWnd, IDC_EDIT_ARG3), ""); char szString[80]; int iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_API_CALL)); ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_API_CALL), iIndex, szString); if(strcmp(szString, STRING_NPN_SETVALUE) == 0) { iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_ARG2)); ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_ARG2), iIndex, szString); if((strcmp(szString, "NPPVpluginWindowBool") == 0) || (strcmp(szString, "NPPVpluginTransparentBool") == 0) || (strcmp(szString, "NPPVpluginKeepLibraryInMemory") == 0)) { HWND hWndCombo = GetDlgItem(hWnd, IDC_COMBO_ARG3); ComboBox_ResetContent(hWndCombo); ComboBox_AddString(hWndCombo, "TRUE"); ComboBox_AddString(hWndCombo, "FALSE"); ComboBox_SetCurSel(hWndCombo, 0); ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG3), SW_HIDE); ShowWindow(hWndCombo, SW_SHOW); } else { ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG3), SW_SHOW); ShowWindow(GetDlgItem(hWnd, IDC_COMBO_ARG3), SW_HIDE); if(strcmp(szString, "NPPVpluginWindowSize") == 0) { EnableWindow(GetDlgItem(hWnd, IDC_EDIT_ARG4), TRUE); ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG4), SW_SHOW); ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARG4), SW_SHOW); Static_SetText(GetDlgItem(hWnd, IDC_STATIC_ARG3), "width:"); Static_SetText(GetDlgItem(hWnd, IDC_STATIC_ARG4), "height:"); SetDlgItemInt(hWnd, IDC_EDIT_ARG3, pPlugin->m_iWidth, TRUE); SetDlgItemInt(hWnd, IDC_EDIT_ARG4, pPlugin->m_iHeight, TRUE); } } } break; } case IDC_BUTTON_PASTE: onPaste(pPlugin->m_hWndLastEditFocus); break; default: break; } }
void RS_Engine::moveLeft() { //qDebug("move left"); if( block->left() == 0 ) updateUI(); }
/** \fn save */ bool muxerAvi::save(void) { printf("[AviMuxer] Saving\n"); uint32_t bufSize=vStream->getWidth()*vStream->getHeight()*3; bool result=true; uint64_t rawDts; uint64_t lastVideoDts=0; int ret; int written=0; audioPackets=new aviAudioPacket[nbAStreams]; videoBuffer=new uint8_t[bufSize]; ADM_info("[AviMuxer]avg fps=%u\n",vStream->getAvgFps1000()); ADMBitstream in(bufSize); in.data=videoBuffer; uint64_t aviTime=0; if(in.dts==ADM_NO_PTS) in.dts=0; lastVideoDts=in.dts; initUI("Saving Avi"); encoding->setContainer("AVI/OpenDML"); if(false==prefill(&in)) goto abt; while(1) { aprintf("Current clock=%s\n",ADM_us2plain(aviTime)); aprintf("Video in dts=%s\n",ADM_us2plain(in.dts)); if(in.dts>aviTime+videoIncrement) { aprintf("Too far in the future, writting dummy frame\n"); writter.saveVideoFrame( 0, 0,videoBuffer); // Insert dummy video frame encoding->pushVideoFrame(0,0,in.dts); }else { aprintf("Writting video frame\n"); if(!writter.saveVideoFrame( in.len, in.flags,videoBuffer)) // Put our real video { ADM_warning("[AviMuxer] Error writting video frame\n"); result=false; goto abt; } encoding->pushVideoFrame(in.len,in.out_quantizer,in.dts); if(false==vStream->getPacket(&in)) goto abt; if(in.dts==ADM_NO_PTS) { in.dts=lastVideoDts+videoIncrement; }else rescaleVideo(&in,firstPacketOffset); lastVideoDts=in.dts; } fillAudio(aviTime+videoIncrement); // and matching audio if(updateUI()==false) { result=false; goto abt; } written++; aviTime+=videoIncrement; } abt: closeUI(); writter.setEnd(); delete [] videoBuffer; videoBuffer=NULL; delete [] audioPackets; audioPackets=NULL; ADM_info("[AviMuxer] Wrote %d frames, nb audio streams %d\n",written,nbAStreams); return result; }
void RS_Engine::moveDown() { //qDebug("move down"); if( block->down() == 0 ) updateUI(); }
void RS_Engine::doShake1() { units.flagFullLines(); updateUI(); QTimer::singleShot(200, this, SLOT(doShake2())); }
void QgsDwgImportDialog::on_leDatabase_textChanged( const QString &text ) { Q_UNUSED( text ); updateUI(); }
void FixtureMainTimingUI::setSongCursor(unsigned int cursor) { m_uiCursor = cursor; updateUI(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); QSettings settings; libraryWidget_ = new LibraryWidget; setCentralWidget(libraryWidget_); { outputDock_ = new QDockWidget(tr("Output"), this); outputDock_->setObjectName("output"); outputWidget_ = new QTextEditEx(outputDock_); connect(outputWidget_, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(outputMouseDoubleClick(QMouseEvent*))); outputWidget_->setReadOnly(true); outputDock_->setWidget(outputWidget_); addDockWidget(Qt::BottomDockWidgetArea, outputDock_); } ui.actionStart_Player->setIcon(IconLibrary::instance().icon("gamepad")); connect(ui.actionStart_Player, SIGNAL(triggered()), this, SLOT(startPlayer())); ui.actionStart->setIcon(IconLibrary::instance().icon("start")); ui.actionStart->setEnabled(false); connect(ui.actionStart, SIGNAL(triggered()), this, SLOT(start())); ui.actionStop->setIcon(IconLibrary::instance().icon("stop")); ui.actionStop->setEnabled(false); connect(ui.actionStop, SIGNAL(triggered()), this, SLOT(stop())); connect(ui.actionNew_Project, SIGNAL(triggered()), this, SLOT(newProject())); connect(ui.actionClose_Project, SIGNAL(triggered()), this, SLOT(closeProject())); connect(ui.actionSave_Project, SIGNAL(triggered()), this, SLOT(saveProject())); connect(ui.actionOpen_Project, SIGNAL(triggered()), this, SLOT(openProject())); connect(ui.actionExport_Project, SIGNAL(triggered()), this, SLOT(exportProject())); connect(ui.actionProject1, SIGNAL(triggered()), this, SLOT(openRecentProject())); connect(ui.actionProject2, SIGNAL(triggered()), this, SLOT(openRecentProject())); connect(ui.actionProject3, SIGNAL(triggered()), this, SLOT(openRecentProject())); connect(ui.actionProject4, SIGNAL(triggered()), this, SLOT(openRecentProject())); connect(ui.actionProject5, SIGNAL(triggered()), this, SLOT(openRecentProject())); connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui.actionPlayer_Settings, SIGNAL(triggered()), this, SLOT(playerSettings())); connect(ui.actionFile_Associations, SIGNAL(triggered()), this, SLOT(fileAssociations())); connect(libraryWidget_, SIGNAL(openRequest(const QString&, const QString&)), this, SLOT(onOpenRequest(const QString&, const QString&))); QString playerip = settings.value("player ip", QString("127.0.0.1")).toString(); client_ = new GiderosNetworkClient(playerip, 15000); connect(client_, SIGNAL(connected()), this, SLOT(connected())); connect(client_, SIGNAL(disconnected()), this, SLOT(disconnected())); connect(client_, SIGNAL(dataReceived(const QByteArray&)), this, SLOT(dataReceived(const QByteArray&))); connect(client_, SIGNAL(ackReceived(unsigned int)), this, SLOT(ackReceived(unsigned int))); updateUI(); setWindowTitle(tr("Gideros")); updateRecentProjectActions(); QTimer* timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(onTimer())); timer->start(1); isTransferring_ = false; QList<QVariant> v = settings.value("fileAssociations", QList<QVariant>()).toList(); for (int i = 0; i < v.size(); ++i) fileAssociations_.push_back(v[i].toStringList()); localServer_.listen("GiderosProjectManager"); connect(&localServer_, SIGNAL(newConnection()), this, SLOT(onLocalServerNewConnection())); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); }
int main(void) { // Setup window and give pointer GLFWwindow* window = windowSetup(); // Create objects render renderMain; shared sharedMain; // Create access pointers render* renderAP = &renderMain; shared* sharedAP = &sharedMain; setupDefaultScenario(renderAP, sharedAP); setupGUI(window, renderAP); // Create simulation thread std::thread simThread(startup, sharedAP); // Main Runtime Loop while(!glfwWindowShouldClose(window)) { // Clear screen before drawing glClear(GL_COLOR_BUFFER_BIT); sharedAP->updateControl(renderAP->getControl()); if(renderAP->getPaused()) { updateBody(renderAP); // Update body storage from interface // Send update to shared sharedAP->updateBodies(renderAP->getBodies()); } else { updateUI(renderAP); // Update interface from body store // Get update from shared renderAP->updateBodies(sharedAP->getBodies()); } // Wake sim thread sharedAP->simWait.notify_all(); // Render scene renderAP->drawScene(); // Apply camera transform and scale applyCamera(); // Draw GUI TwDraw(); // Display is double buffered to prevent screen tearing // Swap display buffers glfwSwapBuffers(window); // Poll and process events glfwPollEvents(); } // Unpause and Exit, direct to shared sharedAP->setPaused(0); sharedAP->setExit(1); // Repeat sim wait notify until exit is acknowleged, directly check shared while(sharedAP->getExit()) { sharedAP->simWait.notify_all(); } // Program exit simThread.join(); // Terminate Libraries glfwDestroyWindow(window); glfwTerminate(); #ifdef EXITNOTE std::cerr << "Main Exit" << std::endl; #endif return 0; }
// Reads in mesh data file. // bool Control::readMeshFile(char* mesh_filename, char* mesh_type, bool create_new_model, enum ecif_modelDimension m_dim) { char fname[1 + 1024]; FILE* mesh_file = NULL; // *** Check that input-file exists. if ( (mesh_file = fopen(mesh_filename, "r")) == NULL ) { theUI->errMsg(0, "Error! Can't open the file: ", mesh_filename); return false; } fclose(mesh_file); deactivateUI(); strncpy(fname, mesh_filename, 1024); LibFront::toLower(fname); //*** CHECK INPUT FILE TYPE *** bool is_abaqus = false; bool is_elmer = false; bool is_fidap = false; bool is_ideas = false; bool is_thetis = false; if ( LibFront::in(mesh_type, "abaqus2d") ) { is_abaqus = true; m_dim = ECIF_2D; } else if ( LibFront::in(mesh_type, "abaqus3d") ) { is_abaqus = true; m_dim = ECIF_3D; } else if ( LibFront::in(mesh_type, "elmer2d") ) { is_elmer = true; m_dim = ECIF_2D; } else if ( LibFront::in(mesh_type, "elmer3d") ) { is_elmer = true; m_dim = ECIF_3D; } else if ( LibFront::in(mesh_type, "fidap2d") ) { is_fidap = true; m_dim = ECIF_2D; } else if ( LibFront::in(mesh_type, "fidap3d") ) { is_fidap = true; m_dim = ECIF_3D; } else if ( LibFront::in(mesh_type, "ideas2d") ) { is_ideas = true; m_dim = ECIF_2D; } else if ( LibFront::in(mesh_type, "ideas3d") ) { is_ideas = true; m_dim = ECIF_3D; } else if ( LibFront::in(mesh_type, "thetis2d") ) { is_thetis = true; m_dim = ECIF_2D; } else if ( LibFront::in(mesh_type, "thetis3d") ) { is_thetis = true; m_dim = ECIF_3D; } //****** UNKNOWN FILE FORMAT ****** if ( !(is_abaqus || is_elmer || is_fidap || is_ideas || is_thetis) ) { theUI->errMsg(0, "Error! Unknown mesh-file format: ", mesh_filename); return false; } //*** KNOWN FILE FORMAT *** // Read mesh file and select renderer-type based on the model type. Input* in = NULL; //ifstream in_file(mesh_filename, ios::nocreate); ifstream in_file(mesh_filename); //---Select input-type and create model object if (is_abaqus) { in = new InputAbaqus(m_dim, in_file, mesh_filename); } else if (is_elmer) { in = new InputElmer(m_dim, in_file, mesh_filename); } else if (is_fidap) { in = new InputFidap(m_dim, in_file, mesh_filename); } else if (is_ideas) { in = new InputIdeas(m_dim, in_file, mesh_filename); } else if (is_thetis) { in = new InputThetis(m_dim, in_file, mesh_filename); } // Clear renderer window if ( theRenderer != NULL ) { theRenderer->clear(); } // Delete current model and cretate a new model if ( create_new_model || theModel == NULL ) { // First delete possible old model and create new model if (theModel != NULL) { delete theModel; theModel = NULL; } // Create new model theModel = new Model("", ECIF_MESH_FILE, mesh_filename); // Delete only current mesh data, but use bodies etc. // NOTE: Used when remeshing an external mesh!!! } else if ( theModel != NULL ) { theModel->resetModelData(); theModel->resetMeshData(); } // Elmer mesh specific if (is_elmer) { theModel->updateModelNameInfo(); theModel->updateModelDirectoryInfo(); theModel->updateMeshDirectoryInfo(); } //---Read meshfile, update model-type and create suitable renderer ecif_modelDimension m_out_dim = ECIF_ND; bool mesh_ok = true; #if defined(FRONT_DEBUG) m_out_dim = in->readMeshFile(); #else // Try to read mesh-geomtry file // ----------------------------- // try { m_out_dim = in->readMeshFile(); } // If error // catch (...) { m_out_dim = ECIF_ND; } #endif in_file.close(); if ( m_out_dim == ECIF_ND ) { mesh_ok = false; if ( !breakMeshInput ) { theUI->errMsg(0, "Error! Incorrect data in the mesh inputfile: ", mesh_filename); } } //---If ok so far, process mesh data and create suitable renderer if (mesh_ok) { mesh_ok = theModel->processMeshFileData(in); if (!mesh_ok) { theUI->errMsg(0, "Error! Mesh file data not correct, mesh not read!"); } } delete in; breakMeshInput = false; //---If not ok if (!mesh_ok) { theModel->resetMeshData(); theUI->configureButtons("break", 0); return false; } //---Ok. Create renderer createRenderer(m_out_dim); //---Update data and activate GUI menus updateUI(); // NOTE: We reset always the mesh unit factor after a succesful read!!! // Model::setMeshInputUnit(1.0); return true; }
int main(void) { SYS_Init(); // Init Atmel Lightweight Mesh stack SYS_TaskHandler(); // Call the system task handler once before we configure the radio NWK_SetAddr(eeprom_read_word((uint16_t*)0)); NWK_SetPanId(0); // Default PAN ID will be 0, can be changed using the set PAN command PHY_SetChannel(APP_CHANNEL); //NWK_SetSecurityKey(APP_SECURITY_KEY); PHY_SetRxState(true); NWK_OpenEndpoint(APP_ENDPOINT, rfReceivePacket); PHY_SetTxPower(0); // Seed the pseudorandom number generator srand(eeprom_read_word((uint16_t*)0)); // Read eeprom data eeprom_read_block(&deviceCalibration, (void*)8, sizeof(deviceCalibration)); if (eeprom_read_byte((uint8_t*)26)) { // There is valid data in the network information struct eeprom_read_block(baseStationList, (void*)27, sizeof(struct baseStation)); uint8_t ch = 17; while ((baseStationList[0].name[ch] == ' ') || (baseStationList[0].name[ch] == '\0') || (baseStationList[0].name[ch] == 0xFF)) { baseStationList[0].name[ch] = ' '; ch -= 1; } baseStationList[0].nameLen = ch+1; baseStationListLength += 1; for (int cnt = 0; cnt < BASESTATION_LIST_SIZE; cnt++) { baseStationList[cnt].name[16] = ' '; baseStationList[cnt].name[17] = ' '; } sendConnectionRequest(0, &deviceCalibration); } initDataAck(); initLCD(display_cmd_buffer, 64); initUI(); TCCR0B |= (1<<CS01); TCCR3B |= (1<<CS32) | (1<<CS30); sei(); startDataAck(); while (1) { SYS_TaskHandler(); if (receivedDataRequest) { handleDataRequest(); receivedDataRequest = false; } if (receivedColdStart) { if (connectedBaseStation == -1) sendConnectionRequest(0, &deviceCalibration); else sendConnectionRequest(connectedBaseStation, &deviceCalibration); ui_baseStationDisconnected(); receivedColdStart = false; } updateUI(); if (sampleCount > 40000) { if (dataPacket.sampleCount != 0) removeSamples(&dataPacket); // If the last transmitted data has not been acked then first remove the old data. getData(&dataPacket); // Sample new data ui_updatePowerValues(&dataPacket); // Update display removeSamples(&dataPacket); // Get rid of these samples now } if (TCNT0 > 80) { serviceLCD(); TCNT0 = 0; } TCCR3B &= ~((1<<CS32) | (1<<CS30)); if (TCNT3 != 0) { for (uint8_t cnt = 0; cnt < DATA_REQ_BUFFER_CNT; cnt++) { if (dataReqBusy[cnt] && (retransmit_time[cnt] != 0)) { if (retransmit_time[cnt] <= TCNT3) { NWK_DataReq(&(nwkPacket[cnt])); retransmit_time[cnt] = 0; } else retransmit_time[cnt] -= TCNT3; } } } TCNT3 = 0; TCCR3B |= (1<<CS32) | (1<<CS30); } }
// Reads in CAD model data file. // bool Control::readCADFile(char* CAD_filename, char* CAD_type, enum ecif_modelDimension m_dim) { char fname[1 + 1024]; FILE* CAD_file = NULL; // *** Check that input-file exists. if ( (CAD_file = fopen(CAD_filename, "r")) == NULL ) { theUI->errMsg(0, "Error! Can't open the file: ", CAD_filename); return false; } fclose(CAD_file); // *** Ok, continue // Deactivate first menus deactivateUI(); strncpy(fname, CAD_filename, 1024); LibFront::toLower(fname); // *** CHECK INPUT FILE ****** bool is_egf = false; bool is_ideas = false; bool is_iges = false; // Quess fron the file extension if ( CAD_type == NULL || CAD_type[0] == '\0' || LibFront::in(CAD_type, "default") ) { is_egf = checkFname(fname, ".egf"); is_ideas = checkFname(fname, ".unv"); is_iges = checkFname(fname, ".igs"); // User has specified the type } else { if ( LibFront::in(CAD_type, "elmer") ) is_egf = true; else if ( LibFront::in(CAD_type, "iges") ) is_iges = true; else if ( LibFront::in(CAD_type, "ideas") ) is_ideas = true; } //****** UNKNOWN FILE FORMAT ****** if ( !(is_egf || is_ideas || is_iges) ) { theUI->errMsg(0, "Error! Unknown CAD-file format: ", CAD_filename); return false; } //****** KNOWN FILE FORMAT ****** // Read CAD file and select renderer-type based on the model type. // Clear renderer window if ( theRenderer != NULL ) { theRenderer->clear(); } // First delete possible old model if (theModel != NULL) { delete theModel; theModel = NULL; } Input* in = NULL; //ifstream in_file(CAD_filename, ios::nocreate); ifstream in_file(CAD_filename); theModel = new Model("", ECIF_CAD_FILE, CAD_filename); //---Select input-type and create model object if (is_egf) { // NOTE: Egf-file errors are handled by the input routine, so // we can give the dimension already here --> Dimension // keyword is not necessary in the egf-file // MVe, 12.01.03 m_dim = ECIF_2D; in = new InputEgf(m_dim, in_file, CAD_filename); } else if (is_ideas) { in = new InputIdeas(m_dim, in_file, CAD_filename); } else if (is_iges) { in = new InputIges(m_dim, in_file, CAD_filename); } //---Read CAD-file, update model-type and create suitable renderer enum ecif_modelDimension m_out_dim; #if defined(FRONT_DEBUG) m_out_dim = in->readCadFile(); #else // Try to read cad-geometry file // ----------------------------- try { m_out_dim = in->readCadFile(); } // If error // -------- catch (...) { m_out_dim = ECIF_ND; } #endif in_file.close(); //---Check that dat was ok. if ( m_out_dim == ECIF_ND ) { theUI->errMsg(0, "Error! Incorrect data in CAD-inputfile: ", CAD_filename); delete in; return false; } //---Ok, process Cad data and create suitable renderer bool rc = theModel->processCadFileData(); if (rc == false) { theUI->errMsg(0, "Error! Cad file data not correct!"); return false; } //---Ok. Create renderer createRenderer(m_out_dim); //---Update data and activate GUI menus. updateUI(); delete in; return true; }
void LFileDialog::on_line_bin_textChanged(){ updateUI(); }
BGDialog::BGDialog(QWidget *parent, const KSharedConfigPtr &_config) : BGDialog_UI(parent), m_readOnly(false) { m_pGlobals = new KGlobalBackgroundSettings(_config); m_pDirs = KGlobal::dirs(); m_previewUpdates = true; m_numScreens = QApplication::desktop()->numScreens(); QString multiHead = getenv("KDE_MULTIHEAD"); if (multiHead.toLower() == "true") m_numScreens = 1; m_screen = QApplication::desktop()->screenNumber(this); if (m_screen >= (int)m_numScreens) m_screen = m_numScreens - 1; getEScreen(); m_copyAllScreens = true; if (m_numScreens < 2) { m_comboScreen->hide(); m_buttonIdentifyScreens->hide(); m_screen = 0; m_eScreen = 0; } connect(m_buttonIdentifyScreens, SIGNAL(clicked()), SLOT(slotIdentifyScreens())); // preview monitor m_pMonitorArrangement = new BGMonitorArrangement(m_screenArrangement); m_pMonitorArrangement->setObjectName("monitor arrangement"); connect(m_pMonitorArrangement, SIGNAL(imageDropped(QString)), SLOT(slotImageDropped(QString))); if (m_numScreens > 1) { connect(m_comboScreen, SIGNAL(activated(int)), SLOT(slotSelectScreen(int))); } // background image settings QIcon iconSet = KIcon(QLatin1String("document-open")); QPixmap pixMap = iconSet.pixmap( style()->pixelMetric(QStyle::PM_SmallIconSize), QIcon::Normal); m_urlWallpaperButton->setIcon(iconSet); m_urlWallpaperButton->setFixedSize(pixMap.width() + 8, pixMap.height() + 8); m_urlWallpaperButton->setToolTip(i18n("Open file dialog")); connect(m_buttonGroupBackground, SIGNAL(clicked(int)), SLOT(slotWallpaperTypeChanged(int))); connect(m_urlWallpaperBox, SIGNAL(activated(int)), SLOT(slotWallpaper(int))); connect(m_urlWallpaperButton, SIGNAL(clicked()), SLOT(slotWallpaperSelection())); connect(m_comboWallpaperPos, SIGNAL(activated(int)), SLOT(slotWallpaperPos(int))); connect(m_buttonSetupWallpapers, SIGNAL(clicked()), SLOT(slotSetupMulti())); // set up the background colour stuff connect(m_colorPrimary, SIGNAL(changed(QColor)), SLOT(slotPrimaryColor(QColor))); connect(m_colorSecondary, SIGNAL(changed(QColor)), SLOT(slotSecondaryColor(QColor))); connect(m_comboPattern, SIGNAL(activated(int)), SLOT(slotPattern(int))); // blend connect(m_comboBlend, SIGNAL(activated(int)), SLOT(slotBlendMode(int))); connect(m_sliderBlend, SIGNAL(valueChanged(int)), SLOT(slotBlendBalance(int))); connect(m_cbBlendReverse, SIGNAL(toggled(bool)), SLOT(slotBlendReverse(bool))); // advanced options connect(m_buttonAdvanced, SIGNAL(clicked()), SLOT(slotAdvanced())); connect(m_buttonGetNew, SIGNAL(clicked()), SLOT(slotGetNewStuff())); // renderers if (m_numScreens > 1) { // Setup the merged-screen renderer KBackgroundRenderer *r = new KBackgroundRenderer(0, false, _config); m_renderer.insert(0, r); connect(r, SIGNAL(imageDone(int)), SLOT(slotPreviewDone(int))); // Setup the common-screen renderer r = new KBackgroundRenderer(0, true, _config); m_renderer.insert(1, r); connect(r, SIGNAL(imageDone(int)), SLOT(slotPreviewDone(int))); // Setup the remaining renderers for each screen for (unsigned j = 0; j < m_numScreens; ++j) { r = new KBackgroundRenderer(j, true, _config); m_renderer.insert(j + 2, r); connect(r, SIGNAL(imageDone(int)), SLOT(slotPreviewDone(int))); } } else { // set up the common desktop renderer KBackgroundRenderer *r = new KBackgroundRenderer(0, false, _config); m_renderer.insert(0, r); connect(r, SIGNAL(imageDone(int)), SLOT(slotPreviewDone(int))); } // Random or InOrder m_slideShowRandom = eRenderer()->multiWallpaperMode(); if (m_slideShowRandom == KBackgroundSettings::NoMultiRandom) m_slideShowRandom = KBackgroundSettings::Random; if (m_slideShowRandom == KBackgroundSettings::NoMulti) m_slideShowRandom = KBackgroundSettings::InOrder; // Wallpaper Position m_wallpaperPos = eRenderer()->wallpaperMode(); if (m_wallpaperPos == KBackgroundSettings::NoWallpaper) m_wallpaperPos = KBackgroundSettings::Centred; // Default if (KGlobal::dirs()->isRestrictedResource("wallpaper")) { m_urlWallpaperButton->hide(); m_buttonSetupWallpapers->hide(); m_radioSlideShow->hide(); } initUI(); updateUI(); connect(qApp->desktop(), SIGNAL(resized(int)), SLOT(desktopResized())); // RANDR support }
void KarbonGradientEditWidget::setStops(const QGradientStops &stops) { m_stops = stops; updateUI(); }
void Test::test() { // sendHearbeat(false, MAV_STATE_STANDBY); // battery updateUI(); sendSystemStatus(100, 12.4); updateUI(); sendHomePosition( getRadians(59, 57, 11.44), // 59�'11.44"N getRadians(30, 18, 51.69), // 30�'51.69"E 0); updateUI(); sendCurrentPosition( getRadians(59, 57, 11.44), // 59�'11.44"N getRadians(30, 18, 51.69), // 30�'51.69"E 200); updateUI(); sendVfrHud( 10, // ground speed 10 m/s 180, // heading south (180 deg) 70, // 70% throttle 2); // climb rate 2 m/s down updateUI(); sendEkfStatusReport(0.9); updateUI(); // Base parameters sendParameter("WPNAV_SPEED", 500); sendParameter("WPNAV_SPEED_UP", 250); sendParameter("WPNAV_SPEED_DN", 150); sendParameter("RTL_ALT", 1500); sendParameter("RTL_ALT_FINAL", 0); sendParameter("LAND_SPEED", 50); sendParameter("BATT_CAPACITY", 5000); sendParameter("FS_BATT_MAH", 1000); sendParameter("FS_BATT_VOLTAGE", 13); updateUI(); //sendHearbeat(true); /* sendCurrentPosition( getRadians(59, 57, 37.56), // 59�'37.56"N getRadians(30, 18, 47.24), // 30�'47.24"E 10); */ // sendHearbeat(true, MAV_STATE_CRITICAL); sendStatusText(MAV_SEVERITY_CRITICAL, "Some very very very long status text."); updateUI(); sendStatusText(MAV_SEVERITY_CRITICAL, "TEST"); updateUI(); sendChannels(1100, 1500); updateUI(); sendHearbeat(true, MAV_STATE_ACTIVE); }
void PinList::on_AddButton_clicked() { auto & pin = m_Sequence.add({2, false, 0}); updateUI(); }
uint8_t DIA_encoding::isAlive( void ) { updateUI(); return 1; }
void QgsDwgImportDialog::on_leLayerGroup_textChanged( const QString &text ) { Q_UNUSED( text ); updateUI(); }
void QgsDwgImportDialog::mDatabaseFileWidget_textChanged( const QString &filename ) { QgsSettings s; s.setValue( QStringLiteral( "/DwgImport/lastDirDatabase" ), QFileInfo( filename ).canonicalPath() ); updateUI(); }
//------------------------------------------------------------------------------ //! void DFPolygonEditor::updateSelection() { updateUI(); if( _renderable.isValid() ) _renderable->update(); }
MainWindow::MainWindow(AudioPlayer &player, QWidget *parent) : QMainWindow(parent), statusBar_(this), player_(player), cursorFollowsPlayback_(false), saveTabs_(false) { setupUi(this); // Not saving a pointer to this QActionGroup *playbackOrderGroup = new QActionGroup(this); playbackOrderGroup->addAction(defaultAction); playbackOrderGroup->addAction(randomAction); playbackOrderGroup->addAction(repeatTrackAction); playbackOrderGroup->addAction(repeatPlaylistAction); installEventFilter(this); player.setMainWindow(this); QObject::connect(&player_, SIGNAL(playbackOrderChanged(PlaybackOrder)), this, SLOT(playbackOrderChanged(PlaybackOrder))); QObject::connect(&player_, SIGNAL(audioStateChanged(AudioState)), this, SLOT(slotAudioStateChanged(AudioState))); QObject::connect(&player_, SIGNAL(trackPlaying(PTrack)), this, SLOT(updateUI(PTrack))); playbackOrderChanged(player.playbackOrder()); QObject::connect(&player_, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); seekSlider_ = new SeekSlider(player_, this); volumeSlider_ = new QSlider(this); volumeSlider_->setOrientation(Qt::Horizontal); volumeSlider_->setMaximum(100); volumeSlider_->setMinimum(0); volumeSlider_->setValue(player_.volume() * 100); volumeSlider_->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); QObject::connect(volumeSlider_, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int))); mainToolBar->addWidget(seekSlider_); mainToolBar->addWidget(volumeSlider_); trayIcon_ = new QSystemTrayIcon(this); setTrayIcon(false); connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); trayIcon_->show(); setStatusBar(&statusBar_); QObject::connect(&statusBar_, SIGNAL(statusBarDoubleClicked()), this, SLOT(statusBarDoubleClicked())); lyricsDock_ = new QDockWidget("Lyrics", this); // Not setting an object name because we don't want save its state // since Qt doesn't restore it correctly // lyricsDock_->setObjectName("LyricsDock"); lyricsWidget_ = new QPlainTextEdit(lyricsDock_); // lyricsWidget_->setObjectName("LyricsWidget"); lyricsWidget_->setReadOnly(true); lyricsDock_->setWidget(lyricsWidget_); QObject::connect(lyricsDock_, SIGNAL(visibilityChanged(bool)), this, SLOT(dockVisibilityChanged(bool))); // playlistTabs->setTabsClosable(true); QObject::connect(playlistTabs, SIGNAL(tabCloseRequested(int)), this, SLOT(removePlaylistTab(int))); QObject::connect(playlistTabs, SIGNAL(newTabRequested()), this, SLOT(newTabRequested())); QObject::connect(menu_File, SIGNAL(aboutToShow()), this, SLOT(menuFileAboutToShow())); setWindowIcon(QIcon(":/icon/logo22.png")); instance = this; console_ = new ConsoleWindow(this); QObject::connect(console_, SIGNAL(visibilityChanged(bool)), this, SLOT(consoleVisibilityChanged(bool))); readSettings(); config_.set("mainwindow.save_tabs", QVariant(saveTabs_)); QObject::connect(&config_, SIGNAL(keySet(QString, QVariant)), this, SLOT(configChanged(QString, QVariant))); setShortcuts(); }
void RS_Engine::transform() { //qDebug("transform"); if( block->transform() == 0 ) updateUI(); }
void KarbonGradientEditWidget::setStopIndex(int index) { m_stopIndex = index; updateUI(); }
void RS_Engine::doShake2() { units.removeFullLines(); updateUI(); start(); }
void KarbonGradientEditWidget::setSpread(QGradient::Spread spread) { m_spread = spread; updateUI(); }
void RS_Engine::moveRight() { //qDebug("move right"); if( block->right() == 0 ) updateUI(); }
void KarbonGradientEditWidget::setType(QGradient::Type type) { m_type = type; updateUI(); }
void Client::updateStatus(Json::Value& msg, Ime::EditSession* session) { // We need to handle ordering of some types of the requests. // For example, setCompositionCursor() should happen after setCompositionCursor(). // set sel keys before update candidates const auto& setSelKeysVal = msg["setSelKeys"]; if (setSelKeysVal.isString()) { // keys used to select candidates std::wstring selKeys = utf8ToUtf16(setSelKeysVal.asCString()); textService_->setSelKeys(selKeys); } // show message bool endComposition = false; const auto& showMessageVal = msg["showMessage"]; if (showMessageVal.isObject()) { const Json::Value& message = showMessageVal["message"]; const Json::Value& duration = showMessageVal["duration"]; if (message.isString() && duration.isInt()) { if (!textService_->isComposing()) { textService_->startComposition(session->context()); endComposition = true; } textService_->showMessage(session, utf8ToUtf16(message.asCString()), duration.asInt()); } } if (session != nullptr) { // if an edit session is available // handle candidate list const auto& showCandidatesVal = msg["showCandidates"]; if (showCandidatesVal.isBool()) { if (showCandidatesVal.asBool()) { // start composition if we are not composing. // this is required to get correctly position the candidate window if (!textService_->isComposing()) { textService_->startComposition(session->context()); } textService_->showCandidates(session); } else { textService_->hideCandidates(); } } const auto& candidateListVal = msg["candidateList"]; if (candidateListVal.isArray()) { // handle candidates // FIXME: directly access private member is dirty!!! vector<wstring>& candidates = textService_->candidates_; candidates.clear(); for (auto cand_it = candidateListVal.begin(); cand_it != candidateListVal.end(); ++cand_it) { wstring cand = utf8ToUtf16(cand_it->asCString()); candidates.push_back(cand); } textService_->updateCandidates(session); if (!showCandidatesVal.asBool()) { textService_->hideCandidates(); } } const auto& candidateCursorVal = msg["candidateCursor"]; if (candidateCursorVal.isInt()) { if (textService_->candidateWindow_ != nullptr) { textService_->candidateWindow_->setCurrentSel(candidateCursorVal.asInt()); textService_->refreshCandidates(); } } // handle comosition and commit strings const auto& commitStringVal = msg["commitString"]; if (commitStringVal.isString()) { std::wstring commitString = utf8ToUtf16(commitStringVal.asCString()); if (!commitString.empty()) { if (!textService_->isComposing()) { textService_->startComposition(session->context()); } textService_->setCompositionString(session, commitString.c_str(), commitString.length()); // FIXME: update the position of candidate and message window when the composition string is changed. if (textService_->candidateWindow_ != nullptr) { textService_->updateCandidatesWindow(session); } if (textService_->messageWindow_ != nullptr) { textService_->updateMessageWindow(session); } textService_->endComposition(session->context()); } } const auto& compositionStringVal = msg["compositionString"]; bool emptyComposition = false; bool hasCompositionString = false; std::wstring compositionString; if (compositionStringVal.isString()) { // composition buffer compositionString = utf8ToUtf16(compositionStringVal.asCString()); hasCompositionString = true; if (compositionString.empty()) { emptyComposition = true; if (textService_->isComposing() && !textService_->showingCandidates()) { // when the composition buffer is empty and we are not showing the candidate list, end composition. textService_->setCompositionString(session, L"", 0); endComposition = true; } } else { if (!textService_->isComposing()) { textService_->startComposition(session->context()); } textService_->setCompositionString(session, compositionString.c_str(), compositionString.length()); } // FIXME: update the position of candidate and message window when the composition string is changed. if (textService_->candidateWindow_ != nullptr) { textService_->updateCandidatesWindow(session); } if (textService_->messageWindow_ != nullptr) { textService_->updateMessageWindow(session); } } const auto& compositionCursorVal = msg["compositionCursor"]; if (compositionCursorVal.isInt()) { // composition cursor if (!emptyComposition) { int compositionCursor = compositionCursorVal.asInt(); if (!textService_->isComposing()) { textService_->startComposition(session->context()); } // NOTE: // This fixes PIME bug #166: incorrect handling of UTF-16 surrogate pairs. // The TSF API unfortunately treat a UTF-16 surrogate pair as two characters while // they actually represent one unicode character only. To workaround this TSF bug, // we get the composition string, and try to move the cursor twice when a UTF-16 // surrogate pair is found. if(!hasCompositionString) compositionString = textService_->compositionString(session); int fixedCursorPos = 0; for (int i = 0; i < compositionCursor; ++i) { ++fixedCursorPos; if (IS_HIGH_SURROGATE(compositionString[i])) // this is the first part of a UTF16 surrogate pair (Windows uses UTF16-LE) ++fixedCursorPos; } textService_->setCompositionCursor(session, fixedCursorPos); } } if (endComposition) { textService_->endComposition(session->context()); } } // language buttons const auto& addButtonVal = msg["addButton"]; if (addButtonVal.isArray()) { for (auto btn_it = addButtonVal.begin(); btn_it != addButtonVal.end(); ++btn_it) { const Json::Value& btn = *btn_it; // FIXME: when to clear the id <=> button map?? Ime::ComPtr<PIME::LangBarButton> langBtn{ PIME::LangBarButton::fromJson(textService_, btn), false }; if (langBtn != nullptr) { buttons_.emplace(langBtn->id(), langBtn); // insert into the map textService_->addButton(langBtn); } } } const auto& removeButtonVal = msg["removeButton"]; if (removeButtonVal.isArray()) { // FIXME: handle windows-mode-icon for (auto btn_it = removeButtonVal.begin(); btn_it != removeButtonVal.end(); ++btn_it) { if (btn_it->isString()) { string id = btn_it->asString(); auto map_it = buttons_.find(id); if (map_it != buttons_.end()) { textService_->removeButton(map_it->second); buttons_.erase(map_it); // remove from the map } } } } const auto& changeButtonVal = msg["changeButton"]; if (changeButtonVal.isArray()) { // FIXME: handle windows-mode-icon for (auto btn_it = changeButtonVal.begin(); btn_it != changeButtonVal.end(); ++btn_it) { const Json::Value& btn = *btn_it; if (btn.isObject()) { string id = btn["id"].asString(); auto map_it = buttons_.find(id); if (map_it != buttons_.end()) { map_it->second->updateFromJson(btn); } } } } // preserved keys const auto& addPreservedKeyVal = msg["addPreservedKey"]; if (addPreservedKeyVal.isArray()) { // preserved keys for (auto key_it = addPreservedKeyVal.begin(); key_it != addPreservedKeyVal.end(); ++key_it) { const Json::Value& key = *key_it; if (key.isObject()) { std::wstring guidStr = utf8ToUtf16(key["guid"].asCString()); CLSID guid = { 0 }; CLSIDFromString(guidStr.c_str(), &guid); UINT keyCode = key["keyCode"].asUInt(); UINT modifiers = key["modifiers"].asUInt(); textService_->addPreservedKey(keyCode, modifiers, guid); } } } const auto& removePreservedKeyVal = msg["removePreservedKey"]; if (removePreservedKeyVal.isArray()) { for (auto key_it = removePreservedKeyVal.begin(); key_it != removePreservedKeyVal.end(); ++key_it) { if (key_it->isString()) { std::wstring guidStr = utf8ToUtf16(key_it->asCString()); CLSID guid = { 0 }; CLSIDFromString(guidStr.c_str(), &guid); textService_->removePreservedKey(guid); } } } // keyboard status const auto& openKeyboardVal = msg["openKeyboard"]; if (openKeyboardVal.isBool()) { textService_->setKeyboardOpen(openKeyboardVal.asBool()); } // other configurations const auto& customizeUIVal = msg["customizeUI"]; if (customizeUIVal.isObject()) { // customize the UI updateUI(customizeUIVal); } // hide message const auto& hideMessageVal = msg["hideMessage"]; if (hideMessageVal.isBool()) { textService_->hideMessage(); } }
void ToolOptionWidget::onToolChanged( ToolType ) { updateUI(); }