@@ -138,44 +138,44 @@ MainWindow::~MainWindow()
138138
139139void MainWindow::getFrontFile ()
140140{
141- getFilename (ui->frontLineEdit , " front file" );
141+ getFilename (ui->frontLineEdit , tr ( " front file" ) );
142142}
143143
144144void MainWindow::getBackFile ()
145145{
146- getFilename (ui->backLineEdit , " back file" );
146+ getFilename (ui->backLineEdit , tr ( " back file" ) );
147147}
148148
149149void MainWindow::getOutlineFile ()
150150{
151- getFilename (ui->outlineLineEdit , " outline file" );
151+ getFilename (ui->outlineLineEdit , tr ( " outline file" ) );
152152}
153153
154154void MainWindow::getDrillFile ()
155155{
156- getFilename (ui->drillLineEdit , " drill file" );
156+ getFilename (ui->drillLineEdit , tr ( " drill file" ) );
157157}
158158
159159void MainWindow::getPreambleFile ()
160160{
161- getFilename (ui->preambleLineEdit , " preamble file" );
161+ getFilename (ui->preambleLineEdit , tr ( " preamble file" ) );
162162}
163163
164164void MainWindow::getPreambletextFile ()
165165{
166- getFilename (ui->preambletextLineEdit , " preamble text file" );
166+ getFilename (ui->preambletextLineEdit , tr ( " preamble text file" ) );
167167}
168168
169169void MainWindow::getPostambleFile ()
170170{
171- getFilename (ui->postambleLineEdit , " postamble file" );
171+ getFilename (ui->postambleLineEdit , tr ( " postamble file" ) );
172172}
173173
174174void MainWindow::getFilename (QLineEdit *saveTo, const QString name)
175175{
176176 QString filename;
177177
178- filename = QFileDialog::getOpenFileName (this , " Select the" + name, lastDir );
178+ filename = QFileDialog::getOpenFileName (this , tr ( " Select the" ) + name, lastDir );
179179 if ( !filename.isEmpty () )
180180 saveTo->setText ( filename );
181181}
@@ -184,7 +184,7 @@ void MainWindow::getOutputDirectory()
184184{
185185 QString dirname;
186186
187- dirname = QFileDialog::getExistingDirectory (this , " Select the output directory" , lastDir );
187+ dirname = QFileDialog::getExistingDirectory (this , tr ( " Select the output directory" ) , lastDir );
188188 if ( !dirname.isEmpty () )
189189 ui->outputDirLineEdit ->setText ( dirname );
190190}
@@ -315,7 +315,7 @@ void MainWindow::startPcb2gcode()
315315 connect (killClosePushButton, SIGNAL (clicked ()), this , SLOT (killCloseButtonClicked ()));
316316
317317 outputTextEdit = pcb2gcodeOutputWindow->getPlainTextEdit ();
318- outputTextEdit->appendPlainText (QString (" Starting " ) + PCB2GCODE_EXECUTABLE + ' ' + arguments.join (' ' )) ;
318+ outputTextEdit->appendPlainText (QString (tr ( " Starting " ) ) + PCB2GCODE_EXECUTABLE + ' ' + arguments.join (' ' )) ;
319319
320320 pcb2gcodeProcess.setWorkingDirectory (ui->outputDirLineEdit ->text ());
321321 pcb2gcodeProcess.start (PCB2GCODE_EXECUTABLE, arguments, QProcess::ReadOnly);
@@ -333,55 +333,55 @@ void MainWindow::pcb2gcodeError(QProcess::ProcessError error)
333333 if (pcb2gcodeKilled)
334334 {
335335 pcb2gcodeKilled = false ;
336- outputTextEdit->appendHtml (" <font color=\" Red\" >"
337- " pcb2gcode has been killed.</font>" );
336+ outputTextEdit->appendHtml (tr ( " <font color=\" Red\" >"
337+ " pcb2gcode has been killed.</font>" ) );
338338 }
339339 else
340340 switch (error)
341341 {
342342 case QProcess::FailedToStart:
343- outputTextEdit->appendHtml (" <font color=\" Red\" >"
344- " pcb2gcode failed to start. "
345- " Either the pcb2gcode is missing, "
346- " or you may have insufficient permissions "
347- " to invoke the program.</font>" );
343+ outputTextEdit->appendHtml (tr ( " <font color=\" Red\" >"
344+ " pcb2gcode failed to start. "
345+ " Either the pcb2gcode is missing, "
346+ " or you may have insufficient permissions "
347+ " to invoke the program.</font>" ) );
348348 break ;
349349
350350 case QProcess::Crashed:
351- outputTextEdit->appendHtml (" <font color=\" Red\" >"
352- " pcb2gcode unexpectedly crashed. "
353- " Please report this error to the project manager."
354- " </font>" );
351+ outputTextEdit->appendHtml (tr ( " <font color=\" Red\" >"
352+ " pcb2gcode unexpectedly crashed. "
353+ " Please report this error to the project manager."
354+ " </font>" ) );
355355 break ;
356356
357357 case QProcess::ReadError:
358- outputTextEdit->appendHtml (" <font color=\" Red\" >"
359- " An error occured while reading from pcb2gcode."
360- " Please report this error to the project manager."
361- " </font>" );
358+ outputTextEdit->appendHtml (tr ( " <font color=\" Red\" >"
359+ " An error occured while reading from pcb2gcode."
360+ " Please report this error to the project manager."
361+ " </font>" ) );
362362 break ;
363363
364364 default :
365- outputTextEdit->appendHtml (" <font color=\" Red\" >"
366- " Unspecified error while trying to run pcb2gcode."
367- " Please report this error to the project manager."
368- " </font>" );
365+ outputTextEdit->appendHtml (tr ( " <font color=\" Red\" >"
366+ " Unspecified error while trying to run pcb2gcode."
367+ " Please report this error to the project manager."
368+ " </font>" ) );
369369 }
370370
371371 pcb2gcodeStopped ();
372372}
373373
374374void MainWindow::pcb2gcodeStopped ()
375375{
376- killClosePushButton->setText (" Close window" );
376+ killClosePushButton->setText (tr ( " Close window" ) );
377377}
378378
379379void MainWindow::changeKillCloseButtonText (QProcess::ProcessState state)
380380{
381381 if ( state == QProcess::NotRunning )
382- killClosePushButton->setText (" Close window" );
382+ killClosePushButton->setText (tr ( " Close window" ) );
383383 else
384- killClosePushButton->setText (" Kill " PCB2GCODE_COMMAND_NAME);
384+ killClosePushButton->setText (tr ( " Kill " PCB2GCODE_COMMAND_NAME) );
385385}
386386
387387void MainWindow::killCloseButtonClicked ()
@@ -408,27 +408,27 @@ void MainWindow::menu_aboutpcb2gcode()
408408 QProcess pcb2gcodeVersionProcess (this );
409409 QByteArray version;
410410
411- msgBox.setWindowTitle (" About pcb2gcode" );
411+ msgBox.setWindowTitle (tr ( " About pcb2gcode" ) );
412412 msgBox.setTextFormat (Qt::RichText);
413- msgBox.setText ( QString (about_pcb2gcode_str).arg (" (retrieving version...)" ) );
413+ msgBox.setText ( QString (tr ( about_pcb2gcode_str)) .arg (tr ( " (retrieving version...)" ) ) );
414414 msgBox.show ();
415415
416416 pcb2gcodeVersionProcess.start (PCB2GCODE_EXECUTABLE, QStringList (" --version" ), QProcess::ReadWrite);
417417 pcb2gcodeVersionProcess.waitForReadyRead (5000 );
418418 version = pcb2gcodeVersionProcess.readAllStandardOutput ();
419419
420420 if ( version.isEmpty () )
421- msgBox.setText ( QString (about_pcb2gcode_str).arg (" (<font color=\" Red\" >can't run" PCB2GCODE_EXECUTABLE " </font>)" ) );
421+ msgBox.setText ( QString (tr ( about_pcb2gcode_str)) .arg (tr ( " (<font color=\" Red\" >can't run" PCB2GCODE_EXECUTABLE " </font>)" ) ) );
422422 else
423- msgBox.setText ( QString (about_pcb2gcode_str).arg (QString (version)) );
423+ msgBox.setText ( QString (tr ( about_pcb2gcode_str) ).arg (QString (version)) );
424424
425425 msgBox.exec ();
426426}
427427
428428void MainWindow::menu_aboutpcb2gcodeGUI ()
429429{
430430 QMessageBox msgBox (this );
431- msgBox.setWindowTitle (" About pcb2gcodeGUI" );
431+ msgBox.setWindowTitle (tr ( " About pcb2gcodeGUI" ) );
432432 msgBox.setTextFormat (Qt::RichText);
433433 msgBox.setText ( QString (about_pcb2gcodegui_str).arg (PCB2GCODE_GUI_VERSION) );
434434 msgBox.exec ();
@@ -443,10 +443,10 @@ void MainWindow::askAndLoadConfFile()
443443{
444444 QString filename;
445445
446- filename = QFileDialog::getOpenFileName (this , " Select a configuration file" , lastDir );
446+ filename = QFileDialog::getOpenFileName (this , tr ( " Select a configuration file" ) , lastDir );
447447 if ( !filename.isEmpty () )
448448 if ( !loadConfFile (filename) )
449- QMessageBox::information (this , " Error" , " The selected file can't be opened" );
449+ QMessageBox::information (this , tr ( " Error" ), tr ( " The selected file can't be opened" ) );
450450}
451451
452452bool MainWindow::loadConfFile (const QString filename)
@@ -483,7 +483,7 @@ bool MainWindow::loadConfFile(const QString filename)
483483 result = args[i].setValue (key, value);
484484
485485 if (result == false )
486- QMessageBox::information (this , " Error" , " Invalid parameter in configuration file: key=" + key + " value=" + value);
486+ QMessageBox::information (this , tr ( " Error" ), tr ( " Invalid parameter in configuration file: key=" ) + key + tr ( " value=" ) + value);
487487 }
488488 }
489489 changeMetricImperialValues = true ;
@@ -497,7 +497,7 @@ void MainWindow::askAndSaveConfFile()
497497{
498498 QString filename;
499499
500- filename = QFileDialog::getSaveFileName (this , " Save configuration file" , lastDir);
500+ filename = QFileDialog::getSaveFileName (this , tr ( " Save configuration file" ) , lastDir);
501501 if ( !filename.isEmpty () )
502502 saveConfFile (filename);
503503}
@@ -529,7 +529,7 @@ void MainWindow::saveConfFile(const QString filename)
529529 }
530530 else
531531 {
532- QMessageBox::information (this , " Error" , " Can't save the file " + filename);
532+ QMessageBox::information (this , tr ( " Error" ), tr ( " Can't save the file " ) + filename);
533533 }
534534}
535535
@@ -538,28 +538,28 @@ void MainWindow::saveDefaultConfFile()
538538 QString appDataLocation = QStandardPaths::writableLocation (QStandardPaths::DataLocation);
539539
540540 if ( appDataLocation.isEmpty () )
541- QMessageBox::information (this , " Error" , " Can't retrieve standard folder location" );
541+ QMessageBox::information (this , tr ( " Error" ), tr ( " Can't retrieve standard folder location" ) );
542542 else
543543 if ( QDir ().mkpath (appDataLocation) )
544544 saveConfFile (appDataLocation + default_config_filename);
545545 else
546- QMessageBox::information (this , " Error" , " Can't create path " + appDataLocation);
546+ QMessageBox::information (this , tr ( " Error" ), tr ( " Can't create path " ) + appDataLocation);
547547}
548548
549549void MainWindow::resetDefaultConfFile ()
550550{
551551 QString appDataLocation;
552552
553- if ( QMessageBox::question (this , " Reset default configuration" ,
554- " Are you sure you want to reset the default configuration?" ,
553+ if ( QMessageBox::question (this , tr ( " Reset default configuration" ) ,
554+ tr ( " Are you sure you want to reset the default configuration?" ) ,
555555 QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes )
556556 {
557557 appDataLocation = QStandardPaths::writableLocation (QStandardPaths::DataLocation);
558558 if ( appDataLocation.isEmpty () )
559- QMessageBox::information (this , " Error" , " Can't retrieve standard folder location" );
559+ QMessageBox::information (this , tr ( " Error" ), tr ( " Can't retrieve standard folder location" ) );
560560 else
561561 if ( !QFile::remove (appDataLocation + default_config_filename) )
562- QMessageBox::information (this , " Error" , " Can't delete default configuration file "
562+ QMessageBox::information (this , tr ( " Error" ), tr ( " Can't delete default configuration file " )
563563 + appDataLocation + default_config_filename);
564564 }
565565}
@@ -570,7 +570,7 @@ void MainWindow::loadDefaultConfFile()
570570
571571 appDataLocation = QStandardPaths::writableLocation (QStandardPaths::DataLocation);
572572 if ( appDataLocation.isEmpty () )
573- QMessageBox::information (this , " Error" , " Can't retrieve standard folder location" );
573+ QMessageBox::information (this , tr ( " Error" ), tr ( " Can't retrieve standard folder location" ) );
574574 else
575575 loadConfFile (appDataLocation + default_config_filename);
576576}
0 commit comments