#include <modelosps.h>
Inheritance diagram for Genps_thread:

Public Member Functions | |
| Genps_thread (QString, QString, QProgressDialog *) | |
| void | run () |
| Invoca al programa Acrobat Reader en un servidor virtual XVfb. | |
Data Fields | |
| QString | m_pdfname |
| QString | m_tempname |
| QProgressDialog * | m_progressdia |
Definition at line 42 of file modelosps.h.
| Genps_thread::Genps_thread | ( | QString | pdfnamepar, | |
| QString | tempnamepar, | |||
| QProgressDialog * | dialpar | |||
| ) |
| pdfnamepar | ||
| tempnamepar | ||
| dialpar |
Definition at line 211 of file modelosps.cpp.
References _depura(), m_pdfname, m_progressdia, and m_tempname.
00211 { 00212 _depura("Genps_thread::Genps_thread", 0); 00213 m_pdfname = pdfnamepar; 00214 m_tempname = tempnamepar; 00215 m_progressdia = dialpar; 00216 _depura("END Genps_thread::Genps_thread", 0); 00217 }
| void Genps_thread::run | ( | ) |
Invoca al programa Acrobat Reader en un servidor virtual XVfb.
Lo borro para asegurarme de que Acrobat no me pregunte "overwrite?".
Escribo la serie de macros que me interactuaran con Acrobat Reader, esto es: situar el ratón en la ventana, pulsar ctrl+P, seleccionar "imprimir a fichero", escribir el nombre del fichero y darle a imprimir. m_output << "Delay 10\n";
This sleeps are necessary to wait for Acrobat Reader to be started.
Aquí escribo el nombre del fichero donde quiero que imprima.
Con este comando busco el servidor Xvfb que corra en el display :5.0 y lo mato.
Definition at line 223 of file modelosps.cpp.
References _depura(), m_pdfname, and m_tempname.
00223 { 00224 _depura("Genps_thread::run", 0); 00225 QTextStream m_output; 00226 QString command; 00228 command = "rm -f " + m_tempname; 00229 system(command.toAscii().constData()); 00230 // cout << "Llamando a XVfb...\n"; 00231 system("Xvfb :5.0 -ac -fbdir /tmp -screen 0 800x600x8 &"); 00232 system("xmodmap -display :5.0 /usr/X11R6/lib/X11/xmodmap.std"); 00233 // cout << "XVfb iniciado...\n"; 00234 // cout << "Iniciando acrobat reader...\n"; 00235 command = "acroread -display :5.0 -geometry 800x600+0+0 -tempFile +useFrontEndProgram " + m_pdfname + " &"; 00236 system(command.toAscii().constData()); 00237 // cout << "Acrobat reader iniciado...\n"; 00238 00239 QString macrofilename = QString(getenv("HOME")) + "/.bulmages/macrotmp"; 00240 QFile macro(macrofilename); 00241 00246 00248 for (int i = 1; i < 11; i++) { 00249 sleep(1); 00250 //QCoreApplication::postEvent(m_progressdia, new QCustomEvent(sleep10)); 00251 // cout << i << "\n"; 00252 } // end for 00253 00254 macro.open(QIODevice::WriteOnly); 00255 m_output.setDevice(¯o); 00256 m_output << "MotionNotify 400 300\n"; 00257 m_output << "KeyStrPress Control_L\n"; 00258 m_output << "KeyStrPress p\n"; 00259 m_output << "KeyStrRelease p\n"; 00260 m_output << "KeyStrRelease Control_L\n"; 00261 macro.close(); 00262 command = "xmacroplay :5.0 < " + macrofilename; 00263 system(command.toAscii().constData()); 00264 00265 sleep(1); 00266 //QCoreApplication::postEvent(m_progressdia, new QCustomEvent(sleep3)); 00267 00268 macro.open(QIODevice::WriteOnly); 00269 m_output.setDevice(¯o); 00270 m_output << "KeyStrPress Tab\n"; 00271 m_output << "KeyStrRelease Tab\n"; 00272 m_output << "KeyStrPress Down\n"; 00273 m_output << "KeyStrRelease Down\n"; 00274 m_output << "KeyStrPress space\n"; 00275 m_output << "KeyStrRelease space\n"; 00277 m_output << "String "<< m_tempname+"\n"; 00278 m_output << "KeyStrPress Return\n"; 00279 m_output << "KeyStrRelease Return\n"; 00280 macro.close(); 00281 command = "xmacroplay :5.0 < " + macrofilename; 00282 system(command.toAscii().constData()); 00283 00284 sleep(3); 00285 //QCoreApplication::postEvent(m_progressdia, new QCustomEvent(sleep3)); 00286 00287 macro.open(QIODevice::WriteOnly); 00288 m_output.setDevice(¯o); 00289 m_output << "KeyStrPress Control_L\n"; 00290 m_output << "KeyStrPress q\n"; 00291 m_output << "KeyStrRelease q\n"; 00292 m_output << "KeyStrRelease Control_L\n"; 00293 macro.close(); 00294 command = "xmacroplay :5.0 < " + macrofilename; 00295 system(command.toAscii().constData()); 00296 00298 command = "kill $(ps aux|grep 'Xvfb :5.0'|grep -v grep|awk '{print $2}')"; 00299 system(command.toAscii().constData()); 00300 // cout << "Se acabo!!\n"; 00301 _depura("END Genps_thread::run", 0); 00302 }
| QString Genps_thread::m_pdfname |
| QString Genps_thread::m_tempname |
1.5.1