Skip to content

Commit

Permalink
Add a translation file for the GUI, mark (un)translatable content pro…
Browse files Browse the repository at this point in the history
…perly (#196)
  • Loading branch information
lighterowl authored Feb 28, 2020
1 parent ebb88d2 commit 96ac323
Show file tree
Hide file tree
Showing 6 changed files with 1,096 additions and 92 deletions.
6 changes: 4 additions & 2 deletions tsMuxerGUI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()

find_package(Qt5 COMPONENTS Widgets Multimedia REQUIRED)
find_package(Qt5 COMPONENTS Widgets Multimedia LinguistTools REQUIRED)

set(tsmuxer_gui_sources
main.cpp
Expand All @@ -21,7 +21,9 @@ set(tsmuxer_gui_sources
images.qrc
)

add_executable(tsMuxerGUI ${tsmuxer_gui_sources})
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} translations/tsmuxergui_en.ts)

add_executable(tsMuxerGUI ${tsmuxer_gui_sources} ${QM_FILES})
target_link_libraries(tsMuxerGUI Qt5::Widgets Qt5::Multimedia)

if (WIN32)
Expand Down
13 changes: 7 additions & 6 deletions tsMuxerGUI/muxForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ void MuxForm::prepare(const QString &label)

void MuxForm::onProgressChanged()
{
ui->progressLabel->setText(QString("Progress: ") + QString::number(ui->progressBar->value() / 10.0, 'f', 1) + '%');
ui->progressLabel->setText(QObject::tr("Progress: ") + QString::number(ui->progressBar->value() / 10.0, 'f', 1) +
'%');
}

void MuxForm::setProgress(int value) { ui->progressBar->setValue(value); }
Expand All @@ -58,7 +59,7 @@ void MuxForm::addStdErrLine(const QString &line)
if (errCnt >= MAX_ERRORS_CNT)
{
ui->stderrText->append("---------------------------------------");
ui->stderrText->append("Too many errors! tsMuxeR is terminated.");
ui->stderrText->append(QObject::tr("Too many errors! tsMuxeR is terminated."));
onAbort();
}
QTextCursor c = ui->stderrText->textCursor();
Expand All @@ -71,9 +72,9 @@ void MuxForm::muxFinished(int exitCode, const QString &)
if (muxProcess && ui->abortBtn->isEnabled())
{
if (exitCode == 0)
setWindowTitle("tsMuxeR successfully finished");
setWindowTitle(QObject::tr("tsMuxeR successfully finished"));
else
setWindowTitle("tsMuxeR finished with error code " + QString::number(exitCode));
setWindowTitle(QObject::tr("tsMuxeR finished with error code %1").arg(exitCode));
ui->muxLabel->setText(windowTitle() + '.');
ui->abortBtn->setEnabled(false);
ui->okBtn->setEnabled(true);
Expand All @@ -86,10 +87,10 @@ void MuxForm::onAbort()
return;
ui->abortBtn->setEnabled(false);
ui->okBtn->setEnabled(true);
setWindowTitle("terminating tsMuxeR...");
setWindowTitle(QObject::tr("terminating tsMuxeR..."));
muxProcess->kill();
muxProcess->waitForFinished();
setWindowTitle("tsMuxeR is terminated");
setWindowTitle(QObject::tr("tsMuxeR is terminated"));
muxProcess = nullptr;
}

Expand Down
Loading

0 comments on commit 96ac323

Please sign in to comment.