Undoing the last Qtr_ hack

The Qtr_ hack isn't needed as in commit 720fc15b2dcd ("Introduce
QApplication") had already made sure that we are using gettext.

I didn't revert the two commits as I wanted to keep the added header
comments and fix the tooling in the Makefile as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-04-14 06:44:29 -07:00
parent fc0e307f00
commit d8e11439ad
7 changed files with 21 additions and 48 deletions

View file

@ -305,7 +305,7 @@ $(INFOPLIST): $(INFOPLISTINPUT)
# Transifex merge the translations
update-po-files:
xgettext -o po/subsurface-new.pot -s -k_ -kN_ -kQtr_ --keyword=C_:1c,2 --add-comments="++GETTEXT" *.c qt-ui/*.cpp
xgettext -o po/subsurface-new.pot -s -k_ -kN_ -ktr --keyword=C_:1c,2 --add-comments="++GETTEXT" *.c qt-ui/*.cpp
tx push -s
tx pull -af

View file

@ -25,7 +25,6 @@
#include "version.h"
#include "libdivecomputer.h"
#include "qt-ui/mainwindow.h"
#include "qt-ui/common.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixdata.h>
@ -1785,7 +1784,7 @@ void MainWindow::setCurrentFileName(const QString &fileName)
if (fileName == m_currentFileName) return;
m_currentFileName = fileName;
QString title = Qtr_("Subsurface");
QString title = tr("Subsurface");
if (!m_currentFileName.isEmpty()) {
QFileInfo fileInfo(m_currentFileName);
title += " - " + fileInfo.fileName();
@ -1798,7 +1797,7 @@ void MainWindow::on_actionOpen_triggered()
QString defaultFileName = QString::fromUtf8(prefs.default_filename);
QFileInfo fileInfo(defaultFileName);
QFileDialog dialog(this, Qtr_("Open File"), fileInfo.path());
QFileDialog dialog(this, tr("Open File"), fileInfo.path());
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.selectFile(defaultFileName);
dialog.setNameFilters(fileNameFilters());

View file

@ -1,20 +0,0 @@
/*
* common.h
*
* shared by all Qt/C++ code
*
*/
#ifndef COMMON_H
#define COMMON_H
#include <glib/gi18n.h>
#include <QString>
/* use this instead of tr() for translated string literals */
inline QString Qtr_(const char *str)
{
return QString::fromUtf8(gettext(str));
}
#endif

View file

@ -3,8 +3,6 @@
*
* classes for the dive trip list in Subsurface
*/
#include "common.h"
#include "divetripmodel.h"
@ -70,15 +68,15 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
if (section == DIVE_NUMBER) {
return Qtr_("Dive number");
return tr("Dive number");
} else if (section == DIVE_DATE_TIME) {
return Qtr_("Date");
return tr("Date");
} else if (section == DIVE_DURATION) {
return Qtr_("Duration");
return tr("Duration");
} else if (section == DIVE_DEPTH) {
return Qtr_("Depth");
return tr("Depth");
} else if (section == DIVE_LOCATION) {
return Qtr_("Location");
return tr("Location");
}
}
return QVariant();

View file

@ -4,7 +4,6 @@
* classes for the "notebook" area of the main window of Subsurface
*
*/
#include "common.h"
#include "maintab.h"
#include "ui_maintab.h"
#include "addcylinderdialog.h"

View file

@ -3,8 +3,6 @@
*
* classes for the main UI window in Subsurface
*/
#include "common.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
@ -60,7 +58,7 @@ void MainWindow::on_actionNew_triggered()
void MainWindow::on_actionOpen_triggered()
{
QString filename = QFileDialog::getOpenFileName(this, Qtr_("Open File"), QDir::homePath(), filter());
QString filename = QFileDialog::getOpenFileName(this, tr("Open File"), QDir::homePath(), filter());
if (filename.isEmpty()){
return;
}
@ -290,10 +288,10 @@ QString MainWindow::filter()
bool MainWindow::askSaveChanges()
{
QString message = ! existing_filename ? Qtr_("You have unsaved changes\nWould you like to save those before closing the datafile?")
: Qtr_("You have unsaved changes to file: %1 \nWould you like to save those before closing the datafile?").arg(existing_filename);
QString message = ! existing_filename ? tr("You have unsaved changes\nWould you like to save those before closing the datafile?")
: tr("You have unsaved changes to file: %1 \nWould you like to save those before closing the datafile?").arg(existing_filename);
if (QMessageBox::question(this, Qtr_("Save Changes?"), message) == QMessageBox::Ok){
if (QMessageBox::question(this, tr("Save Changes?"), message) == QMessageBox::Ok){
// WARNING: Port.
// file_save(NULL,NULL);
return true;

View file

@ -4,7 +4,6 @@
* classes for the equipment models of Subsurface
*
*/
#include "common.h"
#include "models.h"
#include "../dive.h"
@ -22,25 +21,25 @@ QVariant CylindersModel::headerData(int section, Qt::Orientation orientation, in
if (role == Qt::DisplayRole) {
switch(section) {
case TYPE:
ret = Qtr_("Type");
ret = tr("Type");
break;
case SIZE:
ret = Qtr_("Size");
ret = tr("Size");
break;
case MAXPRESS:
ret = Qtr_("MaxPress");
ret = tr("MaxPress");
break;
case START:
ret = Qtr_("Start");
ret = tr("Start");
break;
case END:
ret = Qtr_("End");
ret = tr("End");
break;
case O2:
ret = Qtr_("O2%");
ret = tr("O2%");
break;
case HE:
ret = Qtr_("He%");
ret = tr("He%");
break;
}
}
@ -164,10 +163,10 @@ QVariant WeightModel::headerData(int section, Qt::Orientation orientation, int r
switch(section){
case TYPE:
ret = Qtr_("Type");
ret = tr("Type");
break;
case WEIGHT:
ret = Qtr_("Weight");
ret = tr("Weight");
break;
}
return ret;