diff options
Diffstat (limited to 'tools/qvfb')
-rw-r--r-- | tools/qvfb/main.cpp | 13 | ||||
-rw-r--r-- | tools/qvfb/qvfb.cpp | 56 | ||||
-rw-r--r-- | tools/qvfb/qvfb.pro | 2 | ||||
-rw-r--r-- | tools/qvfb/qvfbratedlg.cpp | 10 | ||||
-rw-r--r-- | tools/qvfb/translations/translations.pro | 34 |
5 files changed, 47 insertions, 68 deletions
diff --git a/tools/qvfb/main.cpp b/tools/qvfb/main.cpp index d96b255..28aa7d4 100644 --- a/tools/qvfb/main.cpp +++ b/tools/qvfb/main.cpp @@ -43,6 +43,9 @@ #include <QApplication> #include <QRegExp> +#include <QLibraryInfo> +#include <QLocale> +#include <QTranslator> #include <stdlib.h> #include <stdio.h> #include <signal.h> @@ -73,6 +76,16 @@ int runQVfb( int argc, char *argv[] ) QApplication app( argc, argv ); + QTranslator translator; + QTranslator qtTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("qvfb_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + } + int width = 0; int height = 0; int depth = -32; // default, but overridable by skin diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp index bc9e529..a3b1964 100644 --- a/tools/qvfb/qvfb.cpp +++ b/tools/qvfb/qvfb.cpp @@ -398,47 +398,47 @@ void QVFb::createMenu(T *menu) QMenu* QVFb::createFileMenu() { - QMenu *file = new QMenu( "File", this ); - file->addAction( "Configure...", this, SLOT(configure()), 0 ); + QMenu *file = new QMenu( tr("&File"), this ); + file->addAction( tr("&Configure..."), this, SLOT(configure()), QKeySequence::Preferences ); file->addSeparator(); - file->addAction( "&Save image...", this, SLOT(saveImage()), 0 ); - file->addAction( "&Animation...", this, SLOT(toggleAnimation()), 0 ); + file->addAction( tr("&Save image..."), this, SLOT(saveImage()), QKeySequence::Save ); + file->addAction( tr("&Animation..."), this, SLOT(toggleAnimation()), 0 ); file->addSeparator(); - file->addAction( "&Quit", qApp, SLOT(quit()) ); + file->addAction( tr("&Quit"), qApp, SLOT(quit()), QKeySequence::Quit ); return file; } QMenu* QVFb::createViewMenu() { - viewMenu = new QMenu( "View", this ); - cursorAction = viewMenu->addAction( "Show &Cursor", this, + viewMenu = new QMenu( tr("&View"), this ); + cursorAction = viewMenu->addAction( tr("Show &Cursor"), this, SLOT(toggleCursor()) ); cursorAction->setCheckable(true); if ( view ) enableCursor(true); - viewMenu->addAction( "&Refresh Rate...", this, SLOT(changeRate()) ); + viewMenu->addAction( tr("&Refresh Rate..."), this, SLOT(changeRate()) ); viewMenu->addSeparator(); - viewMenu->addAction( "No rotation", this, SLOT(setRot0()) ); - viewMenu->addAction( "90\260 rotation", this, SLOT(setRot90()) ); - viewMenu->addAction( "180\260 rotation", this, SLOT(setRot180()) ); - viewMenu->addAction( "270\260 rotation", this, SLOT(setRot270()) ); + viewMenu->addAction( tr("&No rotation"), this, SLOT(setRot0()) ); + viewMenu->addAction( tr("&90\260 rotation"), this, SLOT(setRot90()) ); + viewMenu->addAction( tr("1&80\260 rotation"), this, SLOT(setRot180()) ); + viewMenu->addAction( tr("2&70\260 rotation"), this, SLOT(setRot270()) ); viewMenu->addSeparator(); - viewMenu->addAction( "Zoom scale &0.5", this, SLOT(setZoomHalf()) ); - viewMenu->addAction( "Zoom scale 0.75", this, SLOT(setZoom075()) ); - viewMenu->addAction( "Zoom scale &1", this, SLOT(setZoom1()) ); - viewMenu->addAction( "Zoom scale &2", this, SLOT(setZoom2()) ); - viewMenu->addAction( "Zoom scale &3", this, SLOT(setZoom3()) ); - viewMenu->addAction( "Zoom scale &4", this, SLOT(setZoom4()) ); + viewMenu->addAction( tr("Zoom scale &0.5"), this, SLOT(setZoomHalf()) ); + viewMenu->addAction( tr("Zoom scale 0.7&5"), this, SLOT(setZoom075()) ); + viewMenu->addAction( tr("Zoom scale &1"), this, SLOT(setZoom1()) ); + viewMenu->addAction( tr("Zoom scale &2"), this, SLOT(setZoom2()) ); + viewMenu->addAction( tr("Zoom scale &3"), this, SLOT(setZoom3()) ); + viewMenu->addAction( tr("Zoom scale &4"), this, SLOT(setZoom4()) ); viewMenu->addSeparator(); - viewMenu->addAction( "Zoom scale...", this, SLOT(setZoom()) ); + viewMenu->addAction( tr("Zoom &scale..."), this, SLOT(setZoom()) ); return viewMenu; } QMenu* QVFb::createHelpMenu() { - QMenu *help = new QMenu( "Help", this ); - help->addAction("About...", this, SLOT(about())); + QMenu *help = new QMenu( tr("&Help"), this ); + help->addAction(tr("&About..."), this, SLOT(about())); return help; } @@ -525,17 +525,17 @@ void QVFb::setZoom4() void QVFb::saveImage() { QImage img = view->image(); - QString filename = QFileDialog::getSaveFileName(this, "Save Main Screen image", "snapshot.png", "Portable Network Graphics (*.png)"); + QString filename = QFileDialog::getSaveFileName(this, tr("Save Main Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)")); if (!filename.isEmpty()){ if(!img.save(filename,"PNG")) - QMessageBox::critical(this, "Save Main Screen Image", "Save failed. Check that you have permission to write to the target directory."); + QMessageBox::critical(this, tr("Save Main Screen Image"), tr("Save failed. Check that you have permission to write to the target directory.")); } if (secondaryView) { QImage img = view->image(); - QString filename = QFileDialog::getSaveFileName(this, "Save Second Screen image", "snapshot.png", "Portable Network Graphics (*.png)"); + QString filename = QFileDialog::getSaveFileName(this, tr("Save Second Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)")); if (!filename.isEmpty()) { if(!img.save(filename,"PNG")) - QMessageBox::critical(this, "Save Second Screen Image", "Save failed. Check that you have permission to write to the target directory."); + QMessageBox::critical(this, tr("Save Second Screen Image"), tr("Save failed. Check that you have permission to write to the target directory.")); } } } @@ -577,7 +577,7 @@ void QVFb::setRate(int i) void QVFb::about() { - QMessageBox::about(this, "About QVFB", + QMessageBox::about(this, tr("About QVFB"), tr( "<h2>The Qt for Embedded Linux Virtual X11 Framebuffer</h2>" "<p>This application runs under Qt for X11, emulating a simple framebuffer, " "which the Qt for Embedded Linux server and clients can attach to just as if " @@ -586,7 +586,7 @@ void QVFb::about() "Linux applications under X11 without having to switch to a virtual console. " "This means you can comfortably use your other development tools such " "as GUI profilers and debuggers." - ); + )); } void QVFb::findSkins(const QString ¤tSkin) @@ -1038,7 +1038,7 @@ void AnimationSaveWidget::convertToMpeg(QString filename) // ### can't use QProcess, not in Qt 2.3 // ### but it's certainly in Qt 4! use it? - // Execute the ppmtompeg command as a seperate process to do the encoding + // Execute the ppmtompeg command as a separate process to do the encoding pid_t pid = ::fork(); if ( !pid ) { // Child process diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index dde7e8d..c101d00 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -35,7 +35,7 @@ SOURCES = qvfb.cpp \ ../../src/gui/embedded/qlock.cpp \ ../../src/gui/embedded/qwssignalhandler.cpp -include($$QT_SOURCE_TREE/tools/shared/deviceskin/deviceskin.pri) +include(../shared/deviceskin/deviceskin.pri) contains(QT_CONFIG, opengl) { QT += opengl diff --git a/tools/qvfb/qvfbratedlg.cpp b/tools/qvfb/qvfbratedlg.cpp index e491bdf..a0cbb2f 100644 --- a/tools/qvfb/qvfbratedlg.cpp +++ b/tools/qvfb/qvfbratedlg.cpp @@ -55,7 +55,7 @@ QVFbRateDialog::QVFbRateDialog(int rate, QWidget *parent) QVBoxLayout *tl = new QVBoxLayout(this); tl->setMargin(5); - QLabel *label = new QLabel("Target frame rate:", this); + QLabel *label = new QLabel(tr("Target frame rate:"), this); tl->addWidget(label); QHBoxLayout *hl = new QHBoxLayout(); @@ -67,15 +67,15 @@ QVFbRateDialog::QVFbRateDialog(int rate, QWidget *parent) rateSlider->setValue(rate); hl->addWidget(rateSlider); connect(rateSlider, SIGNAL(valueChanged(int)), this, SLOT(rateChanged(int))); - rateLabel = new QLabel(QString("%1fps").arg(rate), this); + rateLabel = new QLabel(tr("%1fps").arg(rate), this); hl->addWidget(rateLabel); hl = new QHBoxLayout(); tl->addItem(hl); - QPushButton *pb = new QPushButton("OK", this); + QPushButton *pb = new QPushButton(tr("OK"), this); connect(pb, SIGNAL(clicked()), this, SLOT(ok())); hl->addWidget(pb); - pb = new QPushButton("Cancel", this); + pb = new QPushButton(tr("Cancel"), this); connect(pb, SIGNAL(clicked()), this, SLOT(cancel())); hl->addWidget(pb); } @@ -84,7 +84,7 @@ void QVFbRateDialog::rateChanged(int r) { if (rateSlider->value() != r) rateSlider->setValue(r); - rateLabel->setText(QString("%1fps").arg(r)); + rateLabel->setText(tr("%1fps").arg(r)); emit updateRate(r); } diff --git a/tools/qvfb/translations/translations.pro b/tools/qvfb/translations/translations.pro deleted file mode 100644 index ef42063..0000000 --- a/tools/qvfb/translations/translations.pro +++ /dev/null @@ -1,34 +0,0 @@ -# Include those manually as they do not contain any directory specification - -FORMS = ../config.ui -HEADERS = ../qvfb.h \ - ../qvfbview.h \ - ../qvfbratedlg.h \ - ../qanimationwriter.h \ - ../gammaview.h \ - ../qvfbprotocol.h \ - ../qvfbshmem.h \ - ../qvfbmmap.h \ - ../../../src/gui/embedded/qvfbhdr.h \ - ../../../src/gui/embedded/qlock_p.h \ - ../../../src/gui/embedded/qwssignalhandler_p.h \ - ../../shared/deviceskin/deviceskin.h - -SOURCES = ../qvfb.cpp \ - ../qvfbview.cpp \ - ../qvfbratedlg.cpp \ - ../main.cpp \ - ../qanimationwriter.cpp \ - ../qvfbprotocol.cpp \ - ../qvfbshmem.cpp \ - ../qvfbmmap.cpp \ - ../../../src/gui/embedded/qlock.cpp \ - ../../../src/gui/embedded/qwssignalhandler.cpp \ - ../../shared/deviceskin/deviceskin.cpp - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/qvfb_pl.ts \ - $$TR_DIR/qvfb_ru.ts \ - $$TR_DIR/qvfb_zh_CN.ts \ - $$TR_DIR/qvfb_zh_TW.ts |