main() { short output; long count,max_count; error_count=0; resync(); do { while((input_a() & 3)==sequence[seq_index]) ; seq_index=(seq_index+1)&3; if ((input_a() & 3)!=sequence[seq_index]) resync(); else { if(error_count==0) output_low(pin_a2); else --error_count; max_count=input_b()>>2; count++; if(count>max_count) { output=!output; output_bit(pin_a3,output); count=0; } } } while (true); }
static int gif_read_header(AVFormatContext *s) { GIFDemuxContext *gdc = s->priv_data; AVIOContext *pb = s->pb; AVStream *st; int width, height, ret; if ((ret = resync(pb)) < 0) return ret; gdc->delay = gdc->default_delay; width = avio_rl16(pb); height = avio_rl16(pb); if (width == 0 || height == 0) return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); /* GIF format operates with time in "hundredths of second", * therefore timebase is 1/100 */ avpriv_set_pts_info(st, 64, 1, 100); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_GIF; st->codec->width = width; st->codec->height = height; /* jump to start because gif decoder needs header data too */ if (avio_seek(pb, 0, SEEK_SET) != 0) return AVERROR(EIO); return 0; }
void CFileSystem::addDir(const CString& dir, const CString& wildcard, bool forceRecursive) { #ifndef NO_BOOST boost::recursive_mutex::scoped_lock lock(*m_preventChange); #endif if (server == 0) return; // Format the directory. CString newDir(dir); if (newDir[newDir.length() - 1] == '/' || newDir[newDir.length() - 1] == '\\') CFileSystem::fixPathSeparators(&newDir); else { newDir << fSep; CFileSystem::fixPathSeparators(&newDir); } // Add the directory to the directory list. CString ndir = CString() << server->getServerPath() << newDir << wildcard; if (vecSearch<CString>(dirList, ndir) != -1) // Already exists? Resync. resync(); else { dirList.push_back(ndir); // Load up the files in the directory. loadAllDirectories(ndir, (forceRecursive ? true : server->getSettings()->getBool("nofoldersconfig", false))); } }
displayPort_t *max7456DisplayPortInit(const vcdProfile_t *vcdProfile) { displayInit(&max7456DisplayPort, &max7456VTable); #ifdef USE_OSD_SLAVE max7456Init(max7456Config(), vcdProfile, false); #else max7456Init(max7456Config(), vcdProfile, systemConfig()->cpu_overclock); #endif resync(&max7456DisplayPort); return &max7456DisplayPort; }
void mpeg_ts_reader_c::read_headers() { try { size_t size_to_probe = std::min(m_size, static_cast<uint64_t>(TS_PIDS_DETECT_SIZE)); auto probe_buffer = memory_c::alloc(size_to_probe); m_detected_packet_size = detect_packet_size(m_in.get(), size_to_probe); m_in->setFilePointer(0); mxverb(3, boost::format("mpeg_ts: Starting to build PID list. (packet size: %1%)\n") % m_detected_packet_size); mpeg_ts_track_ptr PAT(new mpeg_ts_track_c(*this)); PAT->type = PAT_TYPE; tracks.push_back(PAT); unsigned char buf[TS_MAX_PACKET_SIZE]; // maximum TS packet size + 1 bool done = m_in->eof(); while (!done) { if (m_in->read(buf, m_detected_packet_size) != static_cast<unsigned int>(m_detected_packet_size)) break; if (buf[0] != 0x47) { if (resync(m_in->getFilePointer() - m_detected_packet_size)) continue; break; } parse_packet(buf); done = PAT_found && PMT_found && (0 == es_to_process); done |= m_in->eof() || (m_in->getFilePointer() >= TS_PIDS_DETECT_SIZE); } } catch (...) { } mxverb(3, boost::format("mpeg_ts: Detection done on %1% bytes\n") % m_in->getFilePointer()); m_in->setFilePointer(0, seek_beginning); // rewind file for later remux for (auto &track : tracks) { track->pes_payload->remove(track->pes_payload->get_size()); track->processed = false; track->data_ready = false; track->pes_payload_size = 0; // track->timecode_offset = -1; } parse_clip_info_file(); process_chapter_entries(); show_demuxer_info(); }
OverlayEditorScene::OverlayEditorScene(const OverlaySettings &srcos, QObject *p) : QGraphicsScene(p), os(srcos) { tsColor = Settings::Talking; uiZoom = 2; if (g.ocIntercept) uiSize = g.ocIntercept->uiHeight; else uiSize = 1080.f; qgiGroup = new OverlayGroup(); qgiGroup->setAcceptHoverEvents(true); qgiGroup->setPos(0.0f, 0.0f); addItem(qgiGroup); qgpiMuted = new QGraphicsPixmapItem(qgiGroup); qgpiMuted->hide(); qgpiAvatar = new QGraphicsPixmapItem(qgiGroup); qgpiAvatar->hide(); qgpiName = new QGraphicsPixmapItem(qgiGroup); qgpiName->hide(); qgpiChannel = new QGraphicsPixmapItem(qgiGroup); qgpiChannel->hide(); qgpiBox = new QGraphicsPathItem(qgiGroup); qgpiBox->hide(); qgpiSelected = NULL; qgriSelected = new QGraphicsRectItem; qgriSelected->hide(); qgriSelected->setFlag(QGraphicsItem::ItemIgnoresParentOpacity, true); qgriSelected->setOpacity(1.0f); qgriSelected->setBrush(Qt::NoBrush); qgriSelected->setPen(QPen(Qt::black, 4.0f)); qgriSelected->setZValue(5.0f); addItem(qgriSelected); qgpiChannel->setZValue(2.0f); qgpiName->setZValue(1.0f); qgpiMuted->setZValue(3.0f); qgpiBox->setZValue(-1.0f); resync(); }
int main(int argc, char *argv[], char *environ[]) { pid_t pid; int masterfd; struct winsize terminal_size; int i; terminal_size.ws_row = 80; terminal_size.ws_col = 25; terminal_size.ws_xpixel = 0; terminal_size.ws_ypixel = 0; pid = forkpty(&masterfd, NULL, NULL, &terminal_size); if (pid == 0) { /* child */ char *args[] = { "/bin/sh", NULL }; char *env[] = { NULL }; #if 0 execve("/bin/bash", args, env); #endif #if 1 process_cmds(); #endif _exit(1); } resync(masterfd); #if 1 for (i = 0; i < 10; i++) { usleep(100); kill(pid, SIGINT); } #endif #if 0 usleep(1000); #endif resync(masterfd); return 0; }
void Content::buttonClicked (Button* buttonThatWasClicked) { //[UserbuttonClicked_Pre] //[/UserbuttonClicked_Pre] if (buttonThatWasClicked == textButton) { //[UserButtonCode_textButton] -- add your button handler code here.. resync(); //[/UserButtonCode_textButton] } //[UserbuttonClicked_Post] //[/UserbuttonClicked_Post] }
/** parse_statement parse a statement. * * @param p_function_id : function in which this statement is executed. */ void cx_parser::parse_statement(cx_symtab_node *p_function_id) { insert_line_marker(); switch (token) { case tc_identifier: parse_declarations_or_assignment(p_function_id); break; // not a type but a cv-qualifier case tc_CONST: get_token_append(); parse_constant_declaration(p_function_id); break; //case tcEnum: //get_token_append(); // parse_enum_header(p_function_id); //break; case tc_DO: parse_DO(p_function_id); break; case tc_WHILE: parse_WHILE(p_function_id); break; case tc_IF: parse_IF(p_function_id); break; case tc_FOR: parse_FOR(p_function_id); break; case tc_SWITCH: parse_SWITCH(p_function_id); break; //case tc_CASE: //case tc_DEFAULT:parse_case_label(p_function_id); // break; case tc_BREAK: get_token_append(); break; case tc_left_bracket: parse_compound(p_function_id); break; case tc_RETURN: parse_RETURN(p_function_id); break; case tc_pound: get_token(); parse_execute_directive(p_function_id); break; default: break; } if (token != tc_end_of_file) { resync(tokenlist_statement_follow, tokenlist_statement_start); } }
static void * periodic_syncer_thread (void *ign) { DEBUG ("Period Syncer Thread started!\n"); while (1) { pthread_rwlock_rdlock (&partners_lock); for (GList *iter = partners; iter; iter = iter->next) { sync_partner *sp = iter->data; resync (sp); } pthread_rwlock_unlock (&partners_lock); sleep (30); } return NULL; }
void TimerManager::loadDataFromFile(Common::SeekableReadStream &file, int version) { const uint32 loadTime = _isPaused ? _pauseStart : _system->getMillis(); if (version <= 7) { _nextRun = 0; for (int i = 0; i < 32; ++i) { uint8 enabled = file.readByte(); int32 countdown = file.readSint32BE(); uint32 nextRun = file.readUint32BE(); Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(i)); if (timer != _timers.end()) { timer->enabled = enabled; timer->countdown = countdown; if (nextRun) { timer->nextRun = nextRun + loadTime; timer->lastUpdate = timer->nextRun - countdown * _vm->tickLength(); } else { timer->nextRun = loadTime; timer->lastUpdate = loadTime - countdown * _vm->tickLength(); } } else { warning("Loading timer data for non existing timer %d", i); } } } else { int entries = file.readByte(); for (int i = 0; i < entries; ++i) { uint8 id = file.readByte(); Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id)); if (timer != _timers.end()) { timer->enabled = file.readByte(); timer->countdown = file.readSint32BE(); timer->lastUpdate = file.readSint32BE(); } else { warning("Loading timer data for non existing timer %d", id); file.seek(7, SEEK_CUR); } } resync(); } }
SWD::SWD(unsigned int frequency) : errors(0) { tdiv2 = 1000000 / (frequency / 2); std::cout << "tdiv2: " << tdiv2 << std::endl; if (wiringPiSetup() == -1) { throw std::runtime_error("Could not initialize wiringPi."); } // We are doing realtime bitbanging - this might help a little bit piHiPri(99); pinMode(SWDAT, OUTPUT); digitalWrite(SWDAT, 0); pinMode(SWCLK, OUTPUT); digitalWrite(SWCLK, 0); reset(); resync(); }
void ofApp::onMessage(ofxLibwebsockets::Event & e){ cout << "message: " << e.message <<endl; vector<string> msg = ofSplitString( e.message , " "); if (msg[0] == "/time"){ remoteTime = ofToInt(msg[1]); if( abs( localTime-remoteTime ) > 10 ){ resync(remoteTime); } } else if (msg[0] == "/trigger"){ twinkle->triggerPulse(ofToInt(msg[1])); } else if (msg[0] =="/welcome"){ socket.send("/imHost"); switchScene(ofToInt(msg[1])); } else if (msg[0] == "/sceneChange" ){ switchScene(ofToInt(msg[1])); } else if(msg[0] == "/home"){ noPlace->addHome(msg[1]); } }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ if(key>48 && key< 58){ /* int scene = key-48; socket.send("/setScene "+ ofToString(scene)); */ } else{ switch(key){ case('r'): resync(remoteTime); break; case('p'): socket.send("/ping"); break; case('t'): try{ twinkle->triggerPulse(ofRandom(0,2000)); } catch(...){ } case('d'): bDebug = !bDebug; break; case(' '): currentScene++; socket.send("/setScene " + ofToString(currentScene) ); break; default: break; } } }
int main(void) { /* This compiles from stdin to stdout. */ voice1=malloc(8); v1s=8; v1c=0; if(!voice1) { fprintf(stderr,"Out of memory.\n"); return EXIT_FAILURE; } voice2=malloc(8); v2s=8; v2c=0; if(!voice2) { free(voice1); fprintf(stderr,"Out of memory.\n"); return EXIT_FAILURE; } while((c=getchar())!=EOF) { cc=0; while(c=='-'||c=='+') { if(c=='-') cc--; if(c=='+') cc++; if(cc==-9||cc==9) break; c=getchar(); } if(cc) { if(curvoice==1) { if(v1s-v1c<3) {v1s*=2; tp=realloc(voice1,v1s); if(!tp) break; voice1=tp;} voice1[v1c++]=abs(cc)+'0'; voice1[v1c++]=cc>0?'+':'-'; } else { if(v2s-v2c<3) {v2s*=2; tp=realloc(voice2,v2s); if(!tp) break; voice2=tp;} voice2[v2c++]=abs(cc)+'0'; voice2[v2c++]=cc>0?'+':'-'; } } if(c=='>') { if(curvoice!=1) resync(1); curvoice=2; /* voice1's stack is 'lefter' than voice2's */ } if(c=='<') { if(curvoice!=2) resync(2); curvoice=1; /* voice1's stack is 'lefter' than voice2's */ } if(c==',') { resync(curvoice); /* leaves at least 2 chars breathing room */ if(curvoice==1) {voice1[v1c++]='#'; voice1[v1c++]='?';} else {voice2[v2c++]='#'; voice2[v2c++]='?';} } if(c=='.') { resync(curvoice); if(curvoice==1) {voice1[v1c++]='!'; voice2[v2c++]='^';} else {voice2[v2c++]='!'; voice1[v1c++]='v';} curvoice=3-curvoice; } if(c=='[') { loopstack[lsp++]=curvoice; if(lsp==120) { fprintf(stderr,"Loops too deeply nested.\n"); free(voice1); free(voice2); return EXIT_FAILURE; } resync(curvoice); if(curvoice==1) {voice1[v1c++]='('; voice2[v2c++]='.';} else {voice2[v2c++]='('; voice1[v1c++]='.';} } if(c==']') { resync(loopstack[--lsp]); if(curvoice==1) {voice1[v1c++]=')'; voice2[v2c++]='.';} else {voice2[v2c++]=')'; voice1[v1c++]='.';} } } if(c!=EOF) { fprintf(stderr,"Out of memory.\n"); free(voice1); free(voice2); return EXIT_FAILURE; } resync(curvoice); /* make both voices the same length */ voice1[v1c]=0; voice2[v2c]=0; printf("%s\n%s\n",voice1,voice2); free(voice1); free(voice2); return EXIT_SUCCESS; }
RESP_TYPE CDVAPController::getResponse(unsigned char *buffer, unsigned int& length) { int ret = m_serial.read(buffer, DVAP_HEADER_LENGTH); if (ret == 0) return RT_TIMEOUT; if (ret != int(DVAP_HEADER_LENGTH)) return RT_ERROR; length = buffer[0U] + (buffer[1U] & 0x1FU) * 256U; // Check for silliness if (length > 50U) { resync(); return RT_TIMEOUT; } unsigned int offset = DVAP_HEADER_LENGTH; while (offset < length) { int ret = m_serial.read(buffer + offset, length - offset); if (ret < 0) return RT_ERROR; if (ret > 0) offset += ret; if (ret == 0) Sleep(5UL); } // CUtils::dump(wxT("Received"), buffer, length); if (::memcmp(buffer, DVAP_STATUS, 4U) == 0) return RT_STATE; else if (::memcmp(buffer, DVAP_GMSK_DATA, 2U) == 0) return RT_GMSK_DATA; else if (::memcmp(buffer, DVAP_HEADER, 2U) == 0) return RT_HEADER; else if (::memcmp(buffer, DVAP_RESP_HEADER, 2U) == 0) return RT_HEADER_ACK; else if (::memcmp(buffer, DVAP_RESP_PTT, 4U) == 0) return RT_PTT; else if (::memcmp(buffer, DVAP_ACK, DVAP_ACK_LEN) == 0) return RT_ACK; else if (::memcmp(buffer, DVAP_FM_DATA, 2U) == 0) return RT_FM_DATA; else if (::memcmp(buffer, DVAP_RESP_START, DVAP_RESP_START_LEN) == 0) return RT_START; else if (::memcmp(buffer, DVAP_RESP_STOP, DVAP_RESP_STOP_LEN) == 0) return RT_STOP; else if (::memcmp(buffer, DVAP_RESP_NAME, 4U) == 0) return RT_NAME; else if (::memcmp(buffer + 1U, DVAP_RESP_SERIAL + 1U, 3U) == 0) return RT_SERIAL; else if (::memcmp(buffer, DVAP_RESP_FIRMWARE, 5U) == 0) return RT_FIRMWARE; else if (::memcmp(buffer, DVAP_RESP_FREQUENCY, 4U) == 0) return RT_FREQUENCY; else if (::memcmp(buffer, DVAP_RESP_FREQLIMITS, 4U) == 0) return RT_FREQLIMITS; else if (::memcmp(buffer, DVAP_RESP_MODULATION, DVAP_RESP_MODULATION_LEN) == 0) return RT_MODULATION; else if (::memcmp(buffer, DVAP_RESP_MODE, DVAP_RESP_MODE_LEN) == 0) return RT_MODE; else if (::memcmp(buffer, DVAP_RESP_POWER, 4U) == 0) return RT_POWER; else if (::memcmp(buffer, DVAP_RESP_SQUELCH, 4U) == 0) return RT_SQUELCH; else { resync(); return RT_TIMEOUT; } }
static int gif_read_packet(AVFormatContext *s, AVPacket *pkt) { GIFDemuxContext *gdc = s->priv_data; AVIOContext *pb = s->pb; int packed_fields, block_label, ct_size, keyframe, frame_parsed = 0, ret; int64_t frame_start = avio_tell(pb), frame_end; unsigned char buf[6]; if ((ret = avio_read(pb, buf, 6)) == 6) { keyframe = memcmp(buf, gif87a_sig, 6) == 0 || memcmp(buf, gif89a_sig, 6) == 0; } else if (ret < 0) { return ret; } else { keyframe = 0; } if (keyframe) { parse_keyframe: /* skip 2 bytes of width and 2 of height */ if ((ret = avio_skip(pb, 4)) < 0) return ret; packed_fields = avio_r8(pb); /* skip 1 byte of Background Color Index and 1 byte of Pixel Aspect Ratio */ if ((ret = avio_skip(pb, 2)) < 0) return ret; /* global color table presence */ if (packed_fields & 0x80) { ct_size = 3 * (1 << ((packed_fields & 0x07) + 1)); if ((ret = avio_skip(pb, ct_size)) < 0) return ret; } } else { avio_seek(pb, -ret, SEEK_CUR); ret = AVERROR_EOF; } while (GIF_TRAILER != (block_label = avio_r8(pb)) && !avio_feof(pb)) { if (block_label == GIF_EXTENSION_INTRODUCER) { if ((ret = gif_read_ext (s)) < 0 ) goto resync; } else if (block_label == GIF_IMAGE_SEPARATOR) { /* skip to last byte of Image Descriptor header */ if ((ret = avio_skip(pb, 8)) < 0) return ret; packed_fields = avio_r8(pb); /* local color table presence */ if (packed_fields & 0x80) { ct_size = 3 * (1 << ((packed_fields & 0x07) + 1)); if ((ret = avio_skip(pb, ct_size)) < 0) return ret; } /* read LZW Minimum Code Size */ if (avio_r8(pb) < 1) { av_log(s, AV_LOG_ERROR, "lzw minimum code size must be >= 1\n"); goto resync; } if ((ret = gif_skip_subblocks(pb)) < 0) goto resync; frame_end = avio_tell(pb); if (avio_seek(pb, frame_start, SEEK_SET) != frame_start) return AVERROR(EIO); ret = av_get_packet(pb, pkt, frame_end - frame_start); if (ret < 0) return ret; if (keyframe) pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 0; pkt->duration = gdc->delay; /* Graphic Control Extension's scope is single frame. * Remove its influence. */ gdc->delay = gdc->default_delay; frame_parsed = 1; break; } else { av_log(s, AV_LOG_ERROR, "invalid block label\n"); resync: if (!keyframe) avio_seek(pb, frame_start, SEEK_SET); if ((ret = resync(pb)) < 0) return ret; frame_start = avio_tell(pb) - 6; keyframe = 1; goto parse_keyframe; } } if ((ret >= 0 && !frame_parsed) || ret == AVERROR_EOF) { /* This might happen when there is no image block * between extension blocks and GIF_TRAILER or EOF */ if (!gdc->ignore_loop && (block_label == GIF_TRAILER || avio_feof(pb)) && (gdc->total_iter < 0 || ++gdc->iter_count < gdc->total_iter)) return avio_seek(pb, 0, SEEK_SET); return AVERROR_EOF; } else return ret; }
/* local.$oplog.main is of the form: { ts: ..., op: <optype>, ns: ..., o: <obj> , o2: <extraobj>, b: <boolflag> } ... see logOp() comments. @param alreadyLocked caller already put us in write lock if true */ void ReplSource::sync_pullOpLog_applyOperation(BSONObj& op, bool alreadyLocked) { if( logLevel >= 6 ) // op.tostring is expensive so doing this check explicitly log(6) << "processing op: " << op << endl; if( op.getStringField("op")[0] == 'n' ) return; char clientName[MaxDatabaseNameLen]; const char *ns = op.getStringField("ns"); nsToDatabase(ns, clientName); if ( *ns == '.' ) { problem() << "skipping bad op in oplog: " << op.toString() << endl; return; } else if ( *ns == 0 ) { /*if( op.getStringField("op")[0] != 'n' )*/ { problem() << "halting replication, bad op in oplog:\n " << op.toString() << endl; replAllDead = "bad object in oplog"; throw SyncException(); } //ns = "local.system.x"; //nsToDatabase(ns, clientName); } if ( !only.empty() && only != clientName ) return; if( cmdLine.pretouch && !alreadyLocked/*doesn't make sense if in write lock already*/ ) { if( cmdLine.pretouch > 1 ) { /* note: this is bad - should be put in ReplSource. but this is first test... */ static int countdown; assert( countdown >= 0 ); if( countdown > 0 ) { countdown--; // was pretouched on a prev pass } else { const int m = 4; if( tp.get() == 0 ) { int nthr = min(8, cmdLine.pretouch); nthr = max(nthr, 1); tp.reset( new ThreadPool(nthr) ); } vector<BSONObj> v; oplogReader.peek(v, cmdLine.pretouch); unsigned a = 0; while( 1 ) { if( a >= v.size() ) break; unsigned b = a + m - 1; // v[a..b] if( b >= v.size() ) b = v.size() - 1; tp->schedule(pretouchN, v, a, b); DEV cout << "pretouch task: " << a << ".." << b << endl; a += m; } // we do one too... pretouchOperation(op); tp->join(); countdown = v.size(); } } else { pretouchOperation(op); } } scoped_ptr<writelock> lk( alreadyLocked ? 0 : new writelock() ); if ( replAllDead ) { // hmmm why is this check here and not at top of this function? does it get set between top and here? log() << "replAllDead, throwing SyncException: " << replAllDead << endl; throw SyncException(); } Client::Context ctx( ns ); ctx.getClient()->curop()->reset(); bool empty = ctx.db()->isEmpty(); bool incompleteClone = incompleteCloneDbs.count( clientName ) != 0; if( logLevel >= 6 ) log(6) << "ns: " << ns << ", justCreated: " << ctx.justCreated() << ", empty: " << empty << ", incompleteClone: " << incompleteClone << endl; // always apply admin command command // this is a bit hacky -- the semantics of replication/commands aren't well specified if ( strcmp( clientName, "admin" ) == 0 && *op.getStringField( "op" ) == 'c' ) { applyOperation( op ); return; } if ( ctx.justCreated() || empty || incompleteClone ) { // we must add to incomplete list now that setClient has been called incompleteCloneDbs.insert( clientName ); if ( nClonedThisPass ) { /* we only clone one database per pass, even if a lot need done. This helps us avoid overflowing the master's transaction log by doing too much work before going back to read more transactions. (Imagine a scenario of slave startup where we try to clone 100 databases in one pass.) */ addDbNextPass.insert( clientName ); } else { if ( incompleteClone ) { log() << "An earlier initial clone of '" << clientName << "' did not complete, now resyncing." << endl; } save(); Client::Context ctx(ns); nClonedThisPass++; resync(ctx.db()->name); addDbNextPass.erase(clientName); incompleteCloneDbs.erase( clientName ); } save(); } else { applyOperation( op ); addDbNextPass.erase( clientName ); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { pDetectorProgress = NULL; mLogAllXmlRpcOutput = false; mDbUpdated = false; // mSyncRequests tracks how many sync requests have been made // in order to know when to re-enable the widgets mSyncRequests = 0; // mSyncPosition is used to iterate through the backend list, // so we only sync one repository at a time, rather than flinging // requests at all of them at once. mSyncPosition = 0; mUploading = false; QSettings settings("Entomologist"); pManager = new QNetworkAccessManager(); connect(pManager, SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &)), this, SLOT(handleSslErrors(QNetworkReply *, const QList<QSslError> &))); ui->setupUi(this); QToolBar *toolBar = new QToolBar("Main Toolbar"); toolBar->setObjectName("Main ToolBar"); toolBar->setIconSize(QSize(32,32)); refreshButton = toolBar->addAction(style()->standardIcon(QStyle::SP_BrowserReload), ""); refreshButton->setToolTip("Resync all trackers"); uploadButton = toolBar->addAction(style()->standardIcon(QStyle::SP_ArrowUp), ""); uploadButton->setToolTip("Upload changes"); changelogButton = toolBar->addAction(style()->standardIcon(QStyle::SP_FileDialogInfoView), ""); changelogButton->setToolTip("Show changelog"); toolBar->setMovable(false); addToolBar(Qt::TopToolBarArea, toolBar); setupTrayIcon(); // Setup the "Show" menu and "Work Offline" ui->actionMy_Bugs->setChecked(settings.value("show-my-bugs", true).toBool()); ui->actionMy_Reports->setChecked(settings.value("show-my-reports", true).toBool()); ui->actionMy_CCs->setChecked(settings.value("show-my-ccs", true).toBool()); ui->actionMonitored_Components->setChecked(settings.value("show-my-monitored", true).toBool()); ui->action_Work_Offline->setChecked(settings.value("work-offline", false).toBool()); // Set the default network status pStatusIcon = new QLabel(); pStatusIcon->setPixmap(QPixmap(":/online")); pStatusMessage = new QLabel(""); ui->statusBar->addPermanentWidget(pStatusMessage); ui->statusBar->addPermanentWidget(pStatusIcon); // We use a spinner animation to show that we're doing things pSpinnerMovie = new QMovie(this); pSpinnerMovie->setFileName(":/spinner"); pSpinnerMovie->setScaledSize(QSize(48,48)); ui->spinnerLabel->setMovie(pSpinnerMovie); ui->spinnerLabel->hide(); ui->syncingLabel->hide(); // Set up the resync timer pUpdateTimer = new QTimer(this); connect(pUpdateTimer, SIGNAL(timeout()), this, SLOT(resync())); setTimer(); // Keyboard shortcuts for search bar focus / upload changes. QShortcut* searchFocus; QShortcut* uploadChange; QShortcut *logXmlRpc; searchFocus = new QShortcut(QKeySequence(Qt::META + Qt::Key_Space),this); searchFocus->setContext(Qt::ApplicationShortcut); connect(searchFocus,SIGNAL(activated()),this,SLOT(searchFocusTriggered())); uploadChange = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S),this); uploadChange->setContext(Qt::ApplicationShortcut); connect(uploadChange,SIGNAL(activated()),this,SLOT(upload())); logXmlRpc = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_0), this); logXmlRpc->setContext(Qt::ApplicationShortcut); connect(logXmlRpc, SIGNAL(activated()), this, SLOT(toggleXmlRpcLogging())); // Menu actions connect(ui->action_Add_Tracker, SIGNAL(triggered()), this, SLOT(addTrackerTriggered())); connect(ui->action_Refresh_Tracker,SIGNAL(triggered()), this, SLOT(resync())); connect(ui->actionShow_ToDo_List, SIGNAL(triggered()), this, SLOT(showTodoList())); connect(ui->action_About, SIGNAL(triggered()), this, SLOT(aboutTriggered())); connect(ui->action_Web_Site, SIGNAL(triggered()), this, SLOT(websiteTriggered())); connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefsTriggered())); connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(quitEvent())); connect(ui->actionMy_Bugs, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionMy_CCs, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionMy_Reports, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionMonitored_Components, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionEdit_Monitored_Components, SIGNAL(triggered()), this, SLOT(showEditMonitoredComponents())); connect(ui->action_Work_Offline, SIGNAL(triggered()), this, SLOT(workOfflineTriggered())); // Set up the search button connect(changelogButton, SIGNAL(triggered()), this, SLOT(changelogTriggered())); connect(ui->trackerTab, SIGNAL(showMenu(int)), this, SLOT(showMenu(int))); ui->trackerTab->removeTab(0); ui->trackerTab->removeTab(0); // And finally set up the various other widgets connect(refreshButton, SIGNAL(triggered()), this, SLOT(resync())); connect(uploadButton, SIGNAL(triggered()), this, SLOT(upload())); restoreGeometry(settings.value("window-geometry").toByteArray()); // Set the network status bar and check for updates if possible if (isOnline()) if (settings.value("update-check", true).toBool() == true) checkForUpdates(); setupDB(); toggleButtons(); // Now we need the todo list widget pToDoDock = new QDockWidget(tr("ToDo List"), this); pToDoDock->setObjectName("ToDoDock"); pToDoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); pToDoListWidget = new ToDoListWidget(pToDoDock); pToDoDock->setWidget(pToDoListWidget); addDockWidget(Qt::LeftDockWidgetArea, pToDoDock); pToDoDock->hide(); restoreState(settings.value("entomologist-state").toByteArray()); connect(pToDoDock, SIGNAL(visibilityChanged(bool)), this, SLOT(dockVisibilityChanged(bool))); if (pToDoDock->isVisible()) ui->actionShow_ToDo_List->setText("Hide ToDo List"); else ui->actionShow_ToDo_List->setText("Show ToDo List"); pSearchTab = new SearchTab(this); connect(pSearchTab, SIGNAL(openSearchedBug(QString,QString)), this, SLOT(openSearchedBug(QString,QString))); loadTrackers(); ui->trackerTab->addTab(pSearchTab, QIcon(":/search"), "Search"); if ((settings.value("startup-sync", false).toBool() == true) || (mDbUpdated)) syncNextTracker(); }
/** \brief Update the parameter \f$ Q \f$ */ inline void updateQ(const CMatrix<D,D>& Qnew) {Q_ += Qnew; resync();}
/** \brief Set the parameter \f$ Q \f$ */ inline void Q(const CMatrix<D,D>& Qnew) {Q_ = Qnew; resync();}
static int history_put(jitterbuf *jb, long ts, long now, long ms) { long delay = now - (ts - jb->info.resync_offset); long threshold = 2 * jb->info.jitter + jb->conf.resync_threshold; long kicked; /* check if a resync has been requested, or is needed */ if (jb->force_resync) { resync(jb, ts, now); delay = 0; } /* don't add special/negative times to history */ if (ts <= 0) return 0; /* check for drastic change in delay */ if (jb->conf.resync_threshold != -1) { if (abs(delay - jb->info.last_delay) > threshold) { jb->info.cnt_delay_discont++; if (jb->info.cnt_delay_discont > 3) { resync(jb, ts, now); delay = 0; } else { jb_dbg("Semiresyncing!\n"); return -1; } } else { jb->info.last_delay = delay; jb->info.cnt_delay_discont = 0; } } kicked = jb->history[jb->hist_ptr % JB_HISTORY_SZ]; jb->history[(jb->hist_ptr++) % JB_HISTORY_SZ] = delay; /* optimization; the max/min buffers don't need to be recalculated, if this packet's * entry doesn't change them. This happens if this packet is not involved, _and_ any packet * that got kicked out of the history is also not involved * We do a number of comparisons, but it's probably still worthwhile, because it will usually * succeed, and should be a lot faster than going through all 500 packets in history */ if (!jb->hist_maxbuf_valid) return 0; /* don't do this until we've filled history * (reduces some edge cases below) */ if (jb->hist_ptr < JB_HISTORY_SZ) goto invalidate; /* if the new delay would go into min */ if (delay < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1]) goto invalidate; /* or max.. */ if (delay > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1]) goto invalidate; /* or the kicked delay would be in min */ if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1]) goto invalidate; if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1]) goto invalidate; /* if we got here, we don't need to invalidate, 'cause this delay didn't * affect things */ return 0; /* end optimization */ invalidate: jb->hist_maxbuf_valid = 0; return 0; }
void CEngine::parseEvent() { print_debug(DEBUG_ANALYZER, "in parseEvent()"); if (event.movementBlocker) { // notify renderer to remove all the unnecessary line drawn commandQueue.dequeue(); toggle_renderer_reaction(); return; } if (event.name != "") { print_debug(DEBUG_ANALYZER, "Converting Room Name to ascii format"); latinToAscii( event.name); last_name = event.name; } if (event.desc != "") { print_debug(DEBUG_ANALYZER, "Converting Description to ascii format"); latinToAscii( event.desc ); last_desc = event.desc; } if (event.exits != "") { last_exits = event.exits; } if (event.terrain != -1) { last_terrain = event.terrain; } setMgoto( false ); /* if we get a new room data incoming, mgoto has to go away */ print_debug(DEBUG_ANALYZER, "Entering the main part of the function"); print_debug(DEBUG_ANALYZER, "ANALYZER Event. \r\nNAME %s\r\nDESC %s\r\nEXITS %s\r\nBLIND %i, MOVEMENT %i SCOUT %i", (const char *) event.name, (const char *) event.desc, (const char *) event.exits /*(const char *) event.prompt*/, event.blind, event.movement, event.scout); if (event.scout) { print_debug(DEBUG_ANALYZER, "SCOUT flag is set. Dropping event"); return; } if (event.name.indexOf("It is pitch black...") == 0) { print_debug(DEBUG_ANALYZER, "NO light BLIND set"); event.blind = true; } if (event.name == "" && event.movement == true) { print_debug(DEBUG_ANALYZER, "NAME is empty and Movement is true. Assuming BLIND"); event.blind = true; } if (event.name == "" && event.blind == false) { print_debug(DEBUG_ANALYZER, "EMPTY name and no blind set. Assuming addedroom-data update incoming."); if (addedroom) { addedroom->setTerrain(last_terrain); resetAddedRoomVar(); toggle_renderer_reaction(); } return; } if (event.movement == true) { last_movement = event.dir; if (event.dir =="") { tryAllDirs(); // command's queue is useless then, no? commandQueue.clear(); } else { tryDir(); } } else { if (event.name != "") tryLook(); } swap(); if (stacker.amount() == 0) resync(); print_debug(DEBUG_ANALYZER, "Done. Sending an event to the Renderer"); toggle_renderer_reaction(); }
/** * Decode and convert the jpeg image into @pixfmt@ image * * Note: components will be automaticaly allocated if no memory is attached. */ int tinyjpeg_decode(struct jdec_private *priv, int pixfmt, unsigned char* py,unsigned char* pu, unsigned char* pv) { unsigned int x, y, xstride_by_mcu, ystride_by_mcu; unsigned int bytes_per_blocklines[3], bytes_per_mcu[3]; decode_MCU_fct decode_MCU; const decode_MCU_fct *decode_mcu_table; const convert_colorspace_fct *colorspace_array_conv; convert_colorspace_fct convert_to_pixfmt; if (setjmp(priv->jump_state)) return -1; /* To keep gcc happy initialize some array */ bytes_per_mcu[1] = 0; bytes_per_mcu[2] = 0; bytes_per_blocklines[1] = 0; bytes_per_blocklines[2] = 0; decode_mcu_table = decode_mcu_3comp_table; colorspace_array_conv = convert_colorspace_yuv420p; if (priv->components[0] == NULL) priv->components[0] = py; if (priv->components[1] == NULL) priv->components[1] = pu; if (priv->components[2] == NULL) priv->components[2] = pv; bytes_per_blocklines[0] = priv->width; bytes_per_blocklines[1] = priv->width/4; bytes_per_blocklines[2] = priv->width/4; bytes_per_mcu[0] = 8; bytes_per_mcu[1] = 4; bytes_per_mcu[2] = 4; xstride_by_mcu = ystride_by_mcu = 8; if ((priv->component_infos[cY].Hfactor | priv->component_infos[cY].Vfactor) == 1) { decode_MCU = decode_mcu_table[0]; convert_to_pixfmt = colorspace_array_conv[0]; //trace("Use decode 1x1 sampling\n"); } else if (priv->component_infos[cY].Hfactor == 1) { decode_MCU = decode_mcu_table[1]; convert_to_pixfmt = colorspace_array_conv[1]; ystride_by_mcu = 16; // trace("Use decode 1x2 sampling (not supported)\n"); } else if (priv->component_infos[cY].Vfactor == 2) { decode_MCU = decode_mcu_table[3]; convert_to_pixfmt = colorspace_array_conv[3]; xstride_by_mcu = 16; ystride_by_mcu = 16; // trace("Use decode 2x2 sampling\n"); } else { decode_MCU = decode_mcu_table[2]; convert_to_pixfmt = colorspace_array_conv[2]; xstride_by_mcu = 16; //trace("Use decode 2x1 sampling\n"); } resync(priv); /* Don't forget to that block can be either 8 or 16 lines */ bytes_per_blocklines[0] *= ystride_by_mcu; bytes_per_blocklines[1] *= ystride_by_mcu; bytes_per_blocklines[2] *= ystride_by_mcu; bytes_per_mcu[0] *= xstride_by_mcu/8; bytes_per_mcu[1] *= xstride_by_mcu/8; bytes_per_mcu[2] *= xstride_by_mcu/8; /* Just the decode the image by macroblock (size is 8x8, 8x16, or 16x16) */ for (y=0; y < priv->height/ystride_by_mcu; y++) { //trace("Decoding row %d\n", y); priv->plane[0] = priv->components[0] + (y * bytes_per_blocklines[0]); priv->plane[1] = priv->components[1] + (y * bytes_per_blocklines[1]); priv->plane[2] = priv->components[2] + (y * bytes_per_blocklines[2]); for (x=0; x < priv->width; x+=xstride_by_mcu) { decode_MCU(priv); convert_to_pixfmt(priv); priv->plane[0] += bytes_per_mcu[0]; priv->plane[1] += bytes_per_mcu[1]; priv->plane[2] += bytes_per_mcu[2]; if (priv->restarts_to_go>0) { priv->restarts_to_go--; if (priv->restarts_to_go == 0) { priv->stream -= (priv->nbits_in_reservoir/8); resync(priv); if (find_next_rst_marker(priv) < 0) return -1; } } } } /*trace("Input file size: %d\n", priv->stream_length+2); trace("Input bytes actually read: %d\n", priv->stream - priv->stream_begin + 2);*/ return 0; }
int main (int argc, char **argv) { Q330 q330; Q330_ADDR addr; init(argc, argv, &q330); switch (q330.cmd.code) { case Q330_CMD_REBOOT: boot(&q330); break; case Q330_CMD_SAVE: save(&q330); break; case Q330_CMD_SAVEBOOT: save(&q330); sleep(5); boot(&q330); break; case Q330_CMD_RESYNC: resync(&q330); break; case Q330_CMD_GPS_ON: gpsON(&q330); break; case Q330_CMD_GPS_OFF: gpsOFF(&q330); break; case Q330_CMD_GPS_COLD: gpsColdStart(&q330); break; case Q330_CMD_GPS_CNF: gpsCnf(&q330); break; case Q330_CMD_GPS_ID: gpsId(&q330); break; case Q330_CMD_CAL_START: calStart(&q330); break; case Q330_CMD_CAL_STOP: calStop(&q330); break; case Q330_CMD_IFCONFIG: ifconfig(&q330); break; case Q330_CMD_STATUS: status(&q330); break; case Q330_CMD_FIX: fix(&q330); break; case Q330_CMD_GLOB: glob(&q330); break; case Q330_CMD_SC: sc(&q330); break; case Q330_CMD_PULSE: pulse(&q330); break; case Q330_CMD_AMASS: amass(&q330); break; case Q330_CMD_DCP: dcp(&q330); break; case Q330_CMD_SPP: spp(&q330); break; case Q330_CMD_MAN: man(&q330); break; case Q330_CMD_CO: checkout(&q330); break; default: fprintf(stderr, "ERROR: command '%s' is unsupported\n", q330.cmd.name); break; } if (q330.qdp != NULL) qdpDeregister(q330.qdp, TRUE); }
void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) { QGraphicsScene::contextMenuEvent(e); if (e->isAccepted()) return; if (! e->widget()) return; QGraphicsPixmapItem *item = childAt(e->scenePos()); QMenu qm(e->widget()); QMenu *qmLayout = qm.addMenu(tr("Layout preset")); QAction *qaLayoutLargeAvatar = qmLayout->addAction(tr("Large square avatar")); QAction *qaLayoutText = qmLayout->addAction(tr("Avatar and Name")); QMenu *qmTrans = qm.addMenu(tr("User Opacity")); QActionGroup *qagUser = new QActionGroup(&qm); QAction *userOpacity[8]; for (int i=0;i<8;++i) { qreal o = (i + 1) / 8.0; userOpacity[i] = new QAction(tr("%1%").arg(o * 100.0f, 0, 'f', 1), qagUser); userOpacity[i]->setCheckable(true); userOpacity[i]->setData(o); if (qFuzzyCompare(qgiGroup->opacity(), o)) userOpacity[i]->setChecked(true); qmTrans->addAction(userOpacity[i]); } QAction *color = NULL; QAction *fontAction = NULL; QAction *objectOpacity[8]; for (int i=0;i<8;++i) objectOpacity[i] = NULL; QAction *boxpen[4] = { NULL, NULL, NULL, NULL}; QAction *boxpad[4] = { NULL, NULL, NULL, NULL}; QAction *boxpencolor = NULL; QAction *boxfillcolor = NULL; QAction *align[6]; for (int i=0;i<6;++i) align[i] = NULL; if (item) { qm.addSeparator(); QMenu *qmObjTrans = qm.addMenu(tr("Object Opacity")); QActionGroup *qagObject = new QActionGroup(&qm); for (int i=0;i<8;++i) { qreal o = i + 1 / 8.0; objectOpacity[i] = new QAction(tr("%1%").arg(o * 100.0f, 0, 'f', 1), qagObject); objectOpacity[i]->setCheckable(true); objectOpacity[i]->setData(o); if (qFuzzyCompare(item->opacity(), o)) objectOpacity[i]->setChecked(true); qmObjTrans->addAction(objectOpacity[i]); } QMenu *qmObjAlign = qm.addMenu(tr("Alignment")); Qt::Alignment a; if (item == qgpiAvatar) a = os.qaAvatar; else if (item == qgpiChannel) a = os.qaChannel; else if (item == qgpiMuted) a = os.qaMutedDeafened; else a = os.qaUserName; align[0] = qmObjAlign->addAction(tr("Left")); align[0]->setCheckable(true); align[0]->setData(Qt::AlignLeft); if (a & Qt::AlignLeft) align[0]->setChecked(true); align[1] = qmObjAlign->addAction(tr("Center")); align[1]->setCheckable(true); align[1]->setData(Qt::AlignHCenter); if (a & Qt::AlignHCenter) align[1]->setChecked(true); align[2] = qmObjAlign->addAction(tr("Right")); align[2]->setCheckable(true); align[2]->setData(Qt::AlignRight); if (a & Qt::AlignRight) align[2]->setChecked(true); qmObjAlign->addSeparator(); align[3] = qmObjAlign->addAction(tr("Top")); align[3]->setCheckable(true); align[3]->setData(Qt::AlignTop); if (a & Qt::AlignTop) align[3]->setChecked(true); align[4] = qmObjAlign->addAction(tr("Center")); align[4]->setCheckable(true); align[4]->setData(Qt::AlignVCenter); if (a & Qt::AlignVCenter) align[4]->setChecked(true); align[5] = qmObjAlign->addAction(tr("Bottom")); align[5]->setCheckable(true); align[5]->setData(Qt::AlignBottom); if (a & Qt::AlignBottom) align[5]->setChecked(true); if ((item != qgpiAvatar) && (item != qgpiMuted)) { color = qm.addAction(tr("Color...")); fontAction = qm.addAction(tr("Font...")); } } if (qgpiBox->isVisible()) { qm.addSeparator(); QMenu *qmBox = qm.addMenu(tr("Bounding box")); QMenu *qmPen = qmBox->addMenu(tr("Pen width")); QMenu *qmPad = qmBox->addMenu(tr("Padding")); boxpencolor = qmBox->addAction(tr("Pen color")); boxfillcolor = qmBox->addAction(tr("Fill color")); QActionGroup *qagPen = new QActionGroup(qmPen); QActionGroup *qagPad = new QActionGroup(qmPad); for (int i=0;i<4;++i) { qreal v = (i) ? powf(2.0f, static_cast<float>(-10 + i)) : 0.0f; boxpen[i] = new QAction(QString::number(i), qagPen); boxpen[i]->setData(v); boxpen[i]->setCheckable(true); if (qFuzzyCompare(os.fBoxPenWidth, v)) boxpen[i]->setChecked(true); qmPen->addAction(boxpen[i]); boxpad[i] = new QAction(QString::number(i), qagPad); boxpad[i]->setData(v); boxpad[i]->setCheckable(true); if (qFuzzyCompare(os.fBoxPad, v)) boxpad[i]->setChecked(true); qmPad->addAction(boxpad[i]); } } QAction *act = qm.exec(e->screenPos()); if (! act) return; for (int i=0;i<8;++i) { if (userOpacity[i] == act) { float o = static_cast<float>(act->data().toReal()); os.fUser[tsColor] = o; qgiGroup->setOpacity(o); } } for (int i=0;i<8;++i) { if (objectOpacity[i] == act) { qreal o = act->data().toReal(); if (item == qgpiMuted) os.fMutedDeafened = o; else if (item == qgpiAvatar) os.fAvatar = o; else if (item == qgpiChannel) os.fChannel = o; else if (item == qgpiName) os.fUserName = o; item->setOpacity(o); } } for (int i=0;i<4;++i) { if (boxpen[i] == act) { os.fBoxPenWidth = act->data().toReal(); moveBox(); } else if (boxpad[i] == act) { os.fBoxPad = act->data().toReal(); moveBox(); } } for (int i=0;i<6;++i) { if (align[i] == act) { Qt::Alignment *aptr; if (item == qgpiAvatar) aptr = & os.qaAvatar; else if (item == qgpiChannel) aptr = & os.qaChannel; else if (item == qgpiMuted) aptr = & os.qaMutedDeafened; else aptr = & os.qaUserName; Qt::Alignment a = static_cast<Qt::Alignment>(act->data().toInt()); if (a & Qt::AlignHorizontal_Mask) { *aptr = (*aptr & ~Qt::AlignHorizontal_Mask) | a; } else { *aptr = (*aptr & ~Qt::AlignVertical_Mask) | a; } updateSelected(); } } if (act == boxpencolor) { QColor qc = QColorDialog::getColor(os.qcBoxPen, e->widget(), tr("Pick pen color"), QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel); if (! qc.isValid()) return; os.qcBoxPen = qc; moveBox(); } else if (act == boxfillcolor) { QColor qc = QColorDialog::getColor(os.qcBoxFill, e->widget(), tr("Pick fill color"), QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel); if (! qc.isValid()) return; os.qcBoxFill = qc; moveBox(); } else if (act == color) { QColor *col = NULL; if (item == qgpiChannel) col = & os.qcChannel; else if (item == qgpiName) col = & os.qcUserName[tsColor]; if (! col) return; QColor qc = QColorDialog::getColor(*col, e->widget(), tr("Pick color"), QColorDialog::DontUseNativeDialog); if (! qc.isValid()) return; qc.setAlpha(255); if (qc == *col) return; *col = qc; updateSelected(); } else if (act == fontAction) { QFont *fontptr = (item == qgpiChannel) ? &os.qfChannel : &os.qfUserName; qgpiSelected = NULL; qgriSelected->hide(); // QFontDialog doesn't really like graphics view. At all. QFontDialog qfd; qfd.setOptions(QFontDialog::DontUseNativeDialog); qfd.setCurrentFont(*fontptr); qfd.setWindowTitle(tr("Pick font")); int ret; if (g.ocIntercept) { QGraphicsProxyWidget *qgpw = new QGraphicsProxyWidget(NULL, Qt::Window); qgpw->setWidget(&qfd); addItem(qgpw); qgpw->setZValue(3.0f); qgpw->setPanelModality(QGraphicsItem::PanelModal); qgpw->setPos(- qgpw->boundingRect().width() / 2.0f, - qgpw->boundingRect().height() / 2.0f); qgpw->show(); ret = qfd.exec(); qgpw->hide(); qgpw->setWidget(NULL); delete qgpw; } else { Qt::WindowFlags wf = g.mw->windowFlags(); if (wf.testFlag(Qt::WindowStaysOnTopHint)) qfd.setWindowFlags(qfd.windowFlags() | Qt::WindowStaysOnTopHint); ret = qfd.exec(); } if (! ret) return; *fontptr = qfd.selectedFont(); resync(); } else if (act == qaLayoutLargeAvatar) { os.setPreset(OverlaySettings::LargeSquareAvatar); resync(); } else if (act == qaLayoutText) { os.setPreset(OverlaySettings::AvatarAndName); resync(); } }
displayPort_t *displayPortMspInit(void) { displayInit(&mspDisplayPort, &mspDisplayPortVTable); resync(&mspDisplayPort); return &mspDisplayPort; }
virtual void query(CF::Properties& configProperties) throw (CF::UnknownProperties, CORBA::SystemException) { resync(); ExecutableDevice_impl::query(configProperties); }