void QMplayer::play(QStringList const& args) { showScreen(QMplayer::ScreenPlay); process = new QProcess(this); connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); process->setProcessChannelMode(QProcess::ForwardedChannels); process->start("mplayer", args, QIODevice::ReadWrite); if(!process->waitForStarted(5000)) { delete(process); process = NULL; if(QMessageBox::question(this, tr("qmplayer"), tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { showScreen(QMplayer::ScreenDownload); if(installMplayer()) { QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully")); play(args); return; } QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer")); showScreen(QMplayer::ScreenInit); } return; } }
void QMplayer::backClicked() { if(screen == QMplayer::ScreenInit) { close(); } else if(screen == QMplayer::ScreenPlay) { showScreen(QMplayer::ScreenFullscreen); } else if(screen == QMplayer::ScreenStopped) { process->write("q"); process->waitForFinished(4000); delete(process); process = NULL; playerStopped(); } else if(screen == QMplayer::ScreenConnect) { showScreen(QMplayer::ScreenInit); } else if(screen == QMplayer::ScreenTube) { close(); } else if(screen == ScreenEncodingInProgress) { process->terminate(); } else { abort = true; } }
void QMplayer::playerStopped() { if (mpgui) showScreen(QMplayer::ScreenInit); else if (tube && !ufinished) showScreen(QMplayer::ScreenTube); else close(); }
void QMplayer::play(QStringList & args) { showScreen(QMplayer::ScreenPlay); if(useBluetooth < 0) { QFile f("/etc/asound.conf"); if(f.exists() && f.open(QIODevice::ReadOnly | QIODevice::Text)) { QByteArray text = f.readAll(); f.close(); useBluetooth = ((text.indexOf("pcm.bluetooth") >= 0) && QMessageBox::question(this, tr("qmplayer"), tr("Use bluetooth headset?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes); } } if(useBluetooth > 0) { args.insert(0, "alsa:device=bluetooth"); args.insert(0, "-ao"); } PLAY: process = new QProcess(this); connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); process->setProcessChannelMode(QProcess::ForwardedChannels); process->start("mplayer", args, QIODevice::ReadWrite); if(!process->waitForStarted(5000)) { delete(process); process = NULL; if(QMessageBox::question(this, tr("qmplayer"), tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { showScreen(QMplayer::ScreenDownload); if(installMplayer()) { QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully")); goto PLAY; } QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer")); showScreen(QMplayer::ScreenInit); } return; } }
void GameLogic::Main()const{ if(!eng_) return; eng_->Init(); showScreen(); int res=0; while(running_&&!res){ Keys key=eng_->getKey(); std::cout<<"Dispatching event..."<<std::endl; res=screen_->DispatchKey(key); std::cout<<"Drawing screen..."<<std::endl; showScreen(); } eng_->Stop(); };
void QX::pauseApp() { if(process == NULL) { #ifdef QTOPIA // Fix key mapping in case that QX crashed //QDeviceButtonManager::instance().factoryResetButtons(); QDeviceButtonManager &mgr = QDeviceButtonManager::instance(); if(mgr.buttons().count() > 0) { origSrq = mgr.buttons().at(0)->pressedAction(); QtopiaServiceRequest req("TaskManager", "multitask()"); mgr.remapPressedAction(0, req); } #endif return; } appRunScr->pixmap = QPixmap::grabWindow(QApplication::desktop()->winId()); system(QString("kill -STOP %1").arg(process->pid()).toAscii()); if(xprocess) { system(QString("kill -STOP %1").arg(xprocess->pid()).toAscii()); } showScreen(QX::ScreenPaused); }
void writeMemory(Cpu_t *cpu,uint16_t wordAddress, uint16_t value) { uint16_t * p; p=(uint16_t * )Memory_u8; p[wordAddress]=value; if(wordAddress==SCREENADDRESS) showScreen(cpu); }
void OSDDll::showPicture(CString filename,int destx,int desty) { #ifdef MOCK return; #endif TRACE("\nShow button file:"+filename+"\n"); if (singleFlag==true) return ; singleFlag=true; FILE* f = fopen(filename,"rb"); if (NULL == f) return ; int width=640; int heigth=480; int sizeImg=width*heigth; int sizeAll=sizeImg+1078; BYTE* pAllData = (BYTE*)malloc(sizeAll); BYTE* pImgData = (BYTE*)malloc(sizeImg); int count = fread(pAllData,sizeof(char),sizeAll,f); for (int i=0; i<sizeImg; i++) { pImgData[i]=pAllData[1078+i]; } showScreen(destx,desty,width,heigth,pImgData); free(pAllData); free(pImgData); fclose(f); singleFlag=false; }
BOOL OSDDll::initialDevice(CString text,int left,int top,CString pcolor,CString bcolor,int psize,CString pfont,int wi,int hi,bool han) { TRACE("\nOSD show text:%s",text); #ifdef MOCK return true; #endif if (singleFlag==true) return 1; singleFlag=true; //int width=500; //int heigth=300; int width=680; int heigth=200; BYTE* p=(BYTE*)malloc(width*heigth); int r=FormatAndDraw(text,width,heigth,p,pcolor,bcolor,psize,pfont,wi,hi,han); if (r<0) { //Error in format and draw singleFlag=false; return false; } showScreen(left,top,width,heigth,p); free(p); singleFlag=false; return true; }
void App::acceptCall() { showScreen(3); if (_sipComponent) DaleDFB::comaCallComponent(_sipComponent, BSM_CALL_ACCEPT, NULL); }
NeoControl::NeoControl(QWidget *parent, Qt::WFlags f) : QWidget(parent) { #ifdef QTOPIA this->setWindowState(Qt::WindowMaximized); #else Q_UNUSED(f); #endif bQvga = new QPushButton(tr("Switch to QVGA"), this); connect(bQvga, SIGNAL(clicked()), this, SLOT(qvgaClicked())); bBack = new QPushButton(this); connect(bBack, SIGNAL(clicked()), this, SLOT(backClicked())); bNext = new QPushButton(tr("Next"), this); connect(bNext, SIGNAL(clicked()), this, SLOT(nextClicked())); bSave = new QPushButton(tr("Save"), this); connect(bSave, SIGNAL(clicked()), this, SLOT(saveClicked())); chkDeepSleep = new QCheckBox(tr("Deep sleep"), this); connect(chkDeepSleep, SIGNAL(stateChanged(int)), this, SLOT(deepSleepStateChanged(int))); chkMux = new QCheckBox(tr("Multiplexing"), this); connect(chkMux, SIGNAL(stateChanged(int)), this, SLOT(muxStateChanged(int))); chkFso = new QCheckBox(tr("Use FSO (freesmartphone.org)"), this); connect(chkFso, SIGNAL(stateChanged(int)), this, SLOT(fsoStateChanged(int))); label = new QLabel(this); lineEdit = new QLineEdit(this); label4 = new QLabel(this); label5 = new QLabel(this); slider4 = new MixerSlider(this); slider5 = new MixerSlider(this); buttonLayout = new QHBoxLayout(); buttonLayout->setAlignment(Qt::AlignBottom); buttonLayout->addWidget(bBack); buttonLayout->addWidget(bNext); layout = new QVBoxLayout(this); layout->addWidget(bQvga); layout->addWidget(label); layout->addWidget(label4); layout->addWidget(slider4); layout->addWidget(label5); layout->addWidget(slider5); layout->addWidget(bSave); layout->addWidget(lineEdit); layout->addWidget(chkDeepSleep); layout->addWidget(chkMux); layout->addWidget(chkFso); layout->addLayout(buttonLayout); showScreen(NeoControl::ScreenInit); }
void QMplayer::mousePressEvent(QMouseEvent *event) { Q_UNUSED(event); if(screen == QMplayer::ScreenFullscreen) { showScreen(QMplayer::ScreenPlay); } }
QX::QX(QWidget *parent, Qt::WFlags f) : QWidget(parent) { Q_UNUSED(f); BuildMenu(); favouritesAction->setChecked(true); lineEdit = new QLineEdit("terminal.sh", this); bOk = new QPushButton(this); bOk->setMinimumWidth(100); bOk->setText("Run"); connect(bOk, SIGNAL(clicked()), this, SLOT(okClicked())); lw = new QListWidget(this); connect(lw, SIGNAL(clicked(QModelIndex)), this, SLOT(listClicked())); lAppname = new QLabel(this); bResume = new QPushButton(this); bTerminate = new QPushButton(this); lAppname->setVisible(false); lAppname->setAlignment(Qt::AlignCenter); bResume->setVisible(false); bTerminate->setVisible(false); connect(bResume, SIGNAL(clicked()), this, SLOT(resumeClicked())); connect(bTerminate, SIGNAL(clicked()), this, SLOT(terminateClicked())); //------------------------------------------ grid=new QGridLayout(this); grid->addWidget(lineEdit,0,0); grid->addWidget(bOk,0,1); grid->addWidget(lw,1,0,1,2); grid->addWidget(lAppname,2,0,1,2); grid->addWidget(bResume,3,0,1,2); grid->addWidget(bTerminate,4,0,1,2); LoadFavourites(); scanner = new DesktopScanner(); FillApps(favouritesAction->isChecked()); //========================================== appRunScr = new AppRunningScreen(); process = NULL; xprocess = NULL; screen = QX::ScreenMain; #if QTOPIA powerConstraint = QtopiaApplication::Disable; // Start the "QX" service that handles application switching. new QxService(this); #endif showScreen(QX::ScreenMain); }
void QX::resumeApp() { if(xprocess) { system(QString("kill -CONT %1").arg(xprocess->pid()).toAscii()); } system(QString("kill -CONT %1").arg(process->pid()).toAscii()); showScreen(QX::ScreenRunning); }
void App::hangupCall() { showScreen(0); _status->addMessage("Call terminated."); _call->setStatus(Call::Ended); if (_sipComponent) DaleDFB::comaCallComponent(_sipComponent, BSM_CALL_HANGUP, NULL); }
void QMplayer::removeFlv() { #ifdef QTOPIA if(QMessageBox::question(this, tr("qmplayer"), tr("You are about to remove all FLV videos from directory %1. Are you sure?").arg(ubasedir), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { abort = false; showScreen(QMplayer::ScreenCmd); QString rtitle = tr("Removing FLV files from %1").arg(ubasedir); label->setText(rtitle); progress->setMaximum(100); progress->setValue(0); QDir dir(ubasedir); QFileInfoList list = dir.entryInfoList(QDir::AllEntries, QDir::Name); progress->setMaximum(list.count()); for(int i = 0; i < list.count(); i++) { progress->setValue(i+1); if (abort) break; QFileInfo fi = list.at(i); if(!fi.isFile()) { continue; } QString fileName = fi.fileName(); if(fileName.endsWith(".flv", Qt::CaseInsensitive)) { QString fullfname = ubasedir + "/" + fileName; label->setText(rtitle + "\n" + fileName); QFile::remove(fullfname); } } showScreen(QMplayer::ScreenInit); if (!abort) QMessageBox::information(this, tr("qmplayer"), tr("FLV videos has been removed")); else QMessageBox::critical(this, tr("qmplayer"), tr("Operation aborted")); } #endif }
void showTitleScreen( SDL_Surface *video ) { SDL_Surface *title; title = IMG_Load( "res/title.png" ); showScreen( video, title ); SDL_FreeSurface( title ); SDL_Rect rect; rect.x = 0; rect.y = 0; rect.w = XRES; rect.h = YRES; SDL_FillRect( video, &rect, SDL_MapRGB( video->format, 0, 0, 0 ) ); title = IMG_Load( "res/history.png" ); showScreen( video, title ); SDL_FreeSurface( title ); }
QMplayer::QMplayer(QWidget *parent, Qt::WFlags f) : QWidget(parent) { #ifdef QTOPIA this->setWindowState(Qt::WindowMaximized); #else Q_UNUSED(f); #endif lw = new QListWidget(this); int h = lw->fontMetrics().height(); lw->setIconSize(QSize(h, h)); scanItem = new QListWidgetItem(tr("Scan"), lw); scanItem->setSelected(true); settingsItem = new QListWidgetItem(tr("Sharing"), lw); bOk = new QPushButton(this); connect(bOk, SIGNAL(clicked()), this, SLOT(okClicked())); bBack = new QPushButton(this); connect(bBack, SIGNAL(clicked()), this, SLOT(backClicked())); bUp = new QPushButton(this); connect(bUp, SIGNAL(clicked()), this, SLOT(upClicked())); bDown = new QPushButton(this); connect(bDown, SIGNAL(clicked()), this, SLOT(downClicked())); label = new QLabel(this); lineEdit = new QLineEdit(this); progress = new QProgressBar(this); buttonLayout = new QHBoxLayout(); buttonLayout->setAlignment(Qt::AlignBottom); buttonLayout->addWidget(bOk); buttonLayout->addWidget(bBack); buttonLayout->addWidget(bUp); buttonLayout->addWidget(bDown); layout = new QVBoxLayout(this); layout->addWidget(lw); layout->addWidget(label); layout->addWidget(lineEdit); layout->addWidget(progress); layout->addLayout(buttonLayout); maxScanLevel = 0; fbset = false; delTmpFiles = -1; process = NULL; tcpServer = NULL; showScreen(QMplayer::ScreenInit); }
void QMplayer::scan() { showScreen(QMplayer::ScreenScan); delItems(lw); abort = false; progress->setMinimum(0); progress->setMaximum(0x7fffffff); scan_files: #ifdef Q_WS_WIN scanDir("c:\\", 0, maxScanLevel, 0, 0x1fffffff, false); #else // For the first time scan /home/root/Documents and dont scan other dirs if // something found there. if(maxScanLevel > 0 || !scanDir(QDir::homePath() + "/" + "Documents", 0, 2, 0, 0x1fffffff, true) || !scanDir("/media/card/Documents", 0, 2, 0, 0x2fffffff, true)) { scanDir("/", 0, 0, 0, 0x1fffffff, true); scanDir("/mnt", 0, maxScanLevel + 1, 0, 0x2fffffff, false); scanDir("/media", 0, maxScanLevel + 1, 0, 0x3fffffff, false); scanDir(QDir::homePath(), 0, maxScanLevel, 0, 0x4fffffff, true); scanDir(QDir::homePath() + "/" + "Documents", 0, 2, 0, 0x5fffffff, true); scanDir("/media/card/Documents", 0, 2, 0, 0x5fffffff, true); scanDir("/root", 0, maxScanLevel, 0, 0x6fffffff, true); } #endif maxScanLevel++; scanItem->setText(tr("Scan more")); if(lw->count() <= NUM_MENU_ITEMS && !abort && QMessageBox::question(this, "qmplayer", tr("No media files found, scan more?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { goto scan_files; } showScreen(QMplayer::ScreenInit); }
void Weather::screenReady(WeatherScreen *ws) { if (m_firstRun && m_screens.size() && ws == m_screens[m_cur_screen]) { m_firstRun = false; showScreen(ws); m_nextpage_Timer->start((int)(1000 * m_nextpageInterval)); } disconnect(ws, SIGNAL(screenReady(WeatherScreen *)), this, SLOT(screenReady(WeatherScreen *))); }
void Weather::cursorLeft() { WeatherScreen *ws = prevScreen(); if (ws && ws->canShowScreen()) { hideScreen(); showScreen(ws); if (!m_paused) m_nextpage_Timer->start((int)(1000 * m_nextpageInterval)); } }
void QMplayer::sTimerEvent() { showScreen(QMplayer::ScreenTube); bool uok = youtubeDl(); if (!uok) { if(QMessageBox::question(this, tr("qmplayer"), tr("Program youtube-dl is necessary for downloading videos from Youtube. Do you want to install it now?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { if (installYoutubeDl()) { showScreen(QMplayer::ScreenTube); uok = youtubeDl(); } else QMessageBox::critical(this, tr("qmplayer"), tr("Installation of youtube-dl has failed")); } } if (!uok) close(); }
void QX::processFinished(int exitCode, QProcess::ExitStatus exitStatus) { Q_UNUSED(exitCode); Q_UNUSED(exitStatus); delete(process); process = NULL; stopX(); appRunScr->pixmap = QPixmap(); #ifdef QTOPIA powerConstraint = QtopiaApplication::Enable; #endif showScreen(QX::ScreenMain); }
void NeoControl::nextClicked() { switch(screen) { case ScreenInit: showScreen(ScreenRtc); break; case ScreenRtc: showScreen(ScreenMixer); break; case ScreenMixer: showScreen(ScreenModem); break; case ScreenModem: showScreen(ScreenSysfs); break; case ScreenSysfs: showScreen(ScreenDisplay); break; case ScreenDisplay: break; } }
void Weather::nextpage_timeout() { WeatherScreen *nxt = nextScreen(); if (nxt && nxt->canShowScreen()) { hideScreen(); showScreen(nxt); } else LOG(VB_GENERAL, LOG_ERR, "Next screen not ready"); m_nextpage_Timer->start((int)(1000 * m_nextpageInterval)); }
void QMplayer::processFinished(int exitCode, QProcess::ExitStatus exitStatus) { Q_UNUSED(exitCode); Q_UNUSED(exitStatus); if(screen == ScreenEncodingInProgress) { delete(process); process = NULL; showScreen(ScreenInit); return; } playerStopped(); }
void NeoControl::backClicked() { switch(screen) { case ScreenInit: close(); break; case ScreenRtc: showScreen(ScreenInit); break; case ScreenMixer: showScreen(ScreenRtc); break; case ScreenModem: showScreen(ScreenMixer); break; case ScreenSysfs: showScreen(ScreenModem); break; case ScreenDisplay: showScreen(ScreenSysfs); break; } }
void screen_controller::showPrev() { printf("screen_controller::showPrev()\n"); //printf("mCurrentScreen++\n"); if ( mCurrentScreen == mScreens.begin() ) mCurrentScreen = mScreens.end(); mCurrentScreen--; clear(display); if ( mCurrentScreen->first == "empty" ) showPrev(); else showScreen(mCurrentScreen->first); }
void QMplayer::removeYoutubeDl() { #ifdef QTOPIA if(QMessageBox::question(this, tr("qmplayer"), tr("You are about to remove youtube-dl. Are you sure?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { bool res = runCmd("rm /usr/bin/youtube-dl", 10); showScreen(QMplayer::ScreenInit); if (res) QMessageBox::information(this, tr("qmplayer"), tr("youtube-dl has been removed")); else QMessageBox::critical(this, tr("qmplayer"), tr("Can't remove youtube-dl")); } #endif }
void QMplayer::removeMplayer() { #ifdef QTOPIA if(QMessageBox::question(this, tr("qmplayer"), tr("You are about to remove mplayer. Are you sure?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { bool res = runCmd("rm /usr/bin/mplayer", 10) && runCmd("rm /home/root/.mplayer/config", 10); runCmd("apt-get remove mplayer"); showScreen(QMplayer::ScreenInit); if (res) QMessageBox::information(this, tr("qmplayer"), tr("mplayer has been removed")); else QMessageBox::critical(this, tr("qmplayer"), tr("Can't remove mplayer")); } #endif }