tools/qvfb/qvfb.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   396     menu->addMenu( createHelpMenu() );
   396     menu->addMenu( createHelpMenu() );
   397 }
   397 }
   398 
   398 
   399 QMenu* QVFb::createFileMenu()
   399 QMenu* QVFb::createFileMenu()
   400 {
   400 {
   401     QMenu *file = new QMenu( "File", this );
   401     QMenu *file = new QMenu( tr("&File"), this );
   402     file->addAction( "Configure...", this, SLOT(configure()), 0 );
   402     file->addAction( tr("&Configure..."), this, SLOT(configure()), QKeySequence::Preferences );
   403     file->addSeparator();
   403     file->addSeparator();
   404     file->addAction( "&Save image...", this, SLOT(saveImage()), 0 );
   404     file->addAction( tr("&Save image..."), this, SLOT(saveImage()), QKeySequence::Save );
   405     file->addAction( "&Animation...", this, SLOT(toggleAnimation()), 0 );
   405     file->addAction( tr("&Animation..."), this, SLOT(toggleAnimation()), 0 );
   406     file->addSeparator();
   406     file->addSeparator();
   407     file->addAction( "&Quit", qApp, SLOT(quit()) );
   407     file->addAction( tr("&Quit"), qApp, SLOT(quit()), QKeySequence::Quit );
   408     return file;
   408     return file;
   409 }
   409 }
   410 
   410 
   411 QMenu* QVFb::createViewMenu()
   411 QMenu* QVFb::createViewMenu()
   412 {
   412 {
   413     viewMenu = new QMenu( "View", this );
   413     viewMenu = new QMenu( tr("&View"), this );
   414     cursorAction = viewMenu->addAction( "Show &Cursor", this,
   414     cursorAction = viewMenu->addAction( tr("Show &Cursor"), this,
   415                                         SLOT(toggleCursor()) );
   415                                         SLOT(toggleCursor()) );
   416     cursorAction->setCheckable(true);
   416     cursorAction->setCheckable(true);
   417     if ( view )
   417     if ( view )
   418 	enableCursor(true);
   418 	enableCursor(true);
   419     viewMenu->addAction( "&Refresh Rate...", this, SLOT(changeRate()) );
   419     viewMenu->addAction( tr("&Refresh Rate..."), this, SLOT(changeRate()) );
   420     viewMenu->addSeparator();
   420     viewMenu->addSeparator();
   421     viewMenu->addAction( "No rotation", this, SLOT(setRot0()) );
   421     viewMenu->addAction( tr("&No rotation"), this, SLOT(setRot0()) );
   422     viewMenu->addAction( "90\260 rotation", this, SLOT(setRot90()) );
   422     viewMenu->addAction( tr("&90\260 rotation"), this, SLOT(setRot90()) );
   423     viewMenu->addAction( "180\260 rotation", this, SLOT(setRot180()) );
   423     viewMenu->addAction( tr("1&80\260 rotation"), this, SLOT(setRot180()) );
   424     viewMenu->addAction( "270\260 rotation", this, SLOT(setRot270()) );
   424     viewMenu->addAction( tr("2&70\260 rotation"), this, SLOT(setRot270()) );
   425     viewMenu->addSeparator();
   425     viewMenu->addSeparator();
   426     viewMenu->addAction( "Zoom scale &0.5", this, SLOT(setZoomHalf()) );
   426     viewMenu->addAction( tr("Zoom scale &0.5"), this, SLOT(setZoomHalf()) );
   427     viewMenu->addAction( "Zoom scale 0.75", this, SLOT(setZoom075()) );
   427     viewMenu->addAction( tr("Zoom scale 0.7&5"), this, SLOT(setZoom075()) );
   428     viewMenu->addAction( "Zoom scale &1", this, SLOT(setZoom1()) );
   428     viewMenu->addAction( tr("Zoom scale &1"), this, SLOT(setZoom1()) );
   429     viewMenu->addAction( "Zoom scale &2", this, SLOT(setZoom2()) );
   429     viewMenu->addAction( tr("Zoom scale &2"), this, SLOT(setZoom2()) );
   430     viewMenu->addAction( "Zoom scale &3", this, SLOT(setZoom3()) );
   430     viewMenu->addAction( tr("Zoom scale &3"), this, SLOT(setZoom3()) );
   431     viewMenu->addAction( "Zoom scale &4", this, SLOT(setZoom4()) );
   431     viewMenu->addAction( tr("Zoom scale &4"), this, SLOT(setZoom4()) );
   432     viewMenu->addSeparator();
   432     viewMenu->addSeparator();
   433     viewMenu->addAction( "Zoom scale...", this, SLOT(setZoom()) );
   433     viewMenu->addAction( tr("Zoom &scale..."), this, SLOT(setZoom()) );
   434     return viewMenu;
   434     return viewMenu;
   435 }
   435 }
   436 
   436 
   437 
   437 
   438 QMenu* QVFb::createHelpMenu()
   438 QMenu* QVFb::createHelpMenu()
   439 {
   439 {
   440     QMenu *help = new QMenu( "Help", this );
   440     QMenu *help = new QMenu( tr("&Help"), this );
   441     help->addAction("About...", this, SLOT(about()));
   441     help->addAction(tr("&About..."), this, SLOT(about()));
   442     return help;
   442     return help;
   443 }
   443 }
   444 
   444 
   445 void QVFb::setZoom(double z)
   445 void QVFb::setZoom(double z)
   446 {
   446 {
   523 }
   523 }
   524 
   524 
   525 void QVFb::saveImage()
   525 void QVFb::saveImage()
   526 {
   526 {
   527     QImage img = view->image();
   527     QImage img = view->image();
   528     QString filename = QFileDialog::getSaveFileName(this, "Save Main Screen image", "snapshot.png", "Portable Network Graphics (*.png)");
   528     QString filename = QFileDialog::getSaveFileName(this, tr("Save Main Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)"));
   529     if (!filename.isEmpty()){
   529     if (!filename.isEmpty()){
   530         if(!img.save(filename,"PNG"))
   530         if(!img.save(filename,"PNG"))
   531                 QMessageBox::critical(this, "Save Main Screen Image", "Save failed. Check that you have permission to write to the target directory.");
   531                 QMessageBox::critical(this, tr("Save Main Screen Image"), tr("Save failed. Check that you have permission to write to the target directory."));
   532     }
   532     }
   533     if (secondaryView) {
   533     if (secondaryView) {
   534         QImage img = view->image();
   534         QImage img = view->image();
   535         QString filename = QFileDialog::getSaveFileName(this, "Save Second Screen image", "snapshot.png", "Portable Network Graphics (*.png)");
   535         QString filename = QFileDialog::getSaveFileName(this, tr("Save Second Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)"));
   536         if (!filename.isEmpty()) {
   536         if (!filename.isEmpty()) {
   537             if(!img.save(filename,"PNG"))
   537             if(!img.save(filename,"PNG"))
   538                 QMessageBox::critical(this, "Save Second Screen Image", "Save failed. Check that you have permission to write to the target directory.");
   538                 QMessageBox::critical(this, tr("Save Second Screen Image"), tr("Save failed. Check that you have permission to write to the target directory."));
   539         }
   539         }
   540     }
   540     }
   541 }
   541 }
   542 
   542 
   543 void QVFb::toggleAnimation()
   543 void QVFb::toggleAnimation()
   575 }
   575 }
   576 
   576 
   577 
   577 
   578 void QVFb::about()
   578 void QVFb::about()
   579 {
   579 {
   580     QMessageBox::about(this, "About QVFB",
   580     QMessageBox::about(this, tr("About QVFB"), tr(
   581 	"<h2>The Qt for Embedded Linux Virtual X11 Framebuffer</h2>"
   581 	"<h2>The Qt for Embedded Linux Virtual X11 Framebuffer</h2>"
   582 	"<p>This application runs under Qt for X11, emulating a simple framebuffer, "
   582 	"<p>This application runs under Qt for X11, emulating a simple framebuffer, "
   583 	"which the Qt for Embedded Linux server and clients can attach to just as if "
   583 	"which the Qt for Embedded Linux server and clients can attach to just as if "
   584 	"it was a hardware Linux framebuffer. "
   584 	"it was a hardware Linux framebuffer. "
   585 	"<p>With the aid of this development tool, you can develop Qt for Embedded  "
   585 	"<p>With the aid of this development tool, you can develop Qt for Embedded  "
   586 	"Linux applications under X11 without having to switch to a virtual console. "
   586 	"Linux applications under X11 without having to switch to a virtual console. "
   587 	"This means you can comfortably use your other development tools such "
   587 	"This means you can comfortably use your other development tools such "
   588 	"as GUI profilers and debuggers."
   588 	"as GUI profilers and debuggers."
   589     );
   589     ));
   590 }
   590 }
   591 
   591 
   592 void QVFb::findSkins(const QString &currentSkin)
   592 void QVFb::findSkins(const QString &currentSkin)
   593 {
   593 {
   594     skinnames.clear();
   594     skinnames.clear();