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 # Transifex merge the translations
update-po-files: 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 push -s
tx pull -af tx pull -af

View file

@ -25,7 +25,6 @@
#include "version.h" #include "version.h"
#include "libdivecomputer.h" #include "libdivecomputer.h"
#include "qt-ui/mainwindow.h" #include "qt-ui/mainwindow.h"
#include "qt-ui/common.h"
#include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixdata.h> #include <gdk-pixbuf/gdk-pixdata.h>
@ -1785,7 +1784,7 @@ void MainWindow::setCurrentFileName(const QString &fileName)
if (fileName == m_currentFileName) return; if (fileName == m_currentFileName) return;
m_currentFileName = fileName; m_currentFileName = fileName;
QString title = Qtr_("Subsurface"); QString title = tr("Subsurface");
if (!m_currentFileName.isEmpty()) { if (!m_currentFileName.isEmpty()) {
QFileInfo fileInfo(m_currentFileName); QFileInfo fileInfo(m_currentFileName);
title += " - " + fileInfo.fileName(); title += " - " + fileInfo.fileName();
@ -1798,7 +1797,7 @@ void MainWindow::on_actionOpen_triggered()
QString defaultFileName = QString::fromUtf8(prefs.default_filename); QString defaultFileName = QString::fromUtf8(prefs.default_filename);
QFileInfo fileInfo(defaultFileName); QFileInfo fileInfo(defaultFileName);
QFileDialog dialog(this, Qtr_("Open File"), fileInfo.path()); QFileDialog dialog(this, tr("Open File"), fileInfo.path());
dialog.setFileMode(QFileDialog::ExistingFile); dialog.setFileMode(QFileDialog::ExistingFile);
dialog.selectFile(defaultFileName); dialog.selectFile(defaultFileName);
dialog.setNameFilters(fileNameFilters()); 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 * classes for the dive trip list in Subsurface
*/ */
#include "common.h"
#include "divetripmodel.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 (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
if (section == DIVE_NUMBER) { if (section == DIVE_NUMBER) {
return Qtr_("Dive number"); return tr("Dive number");
} else if (section == DIVE_DATE_TIME) { } else if (section == DIVE_DATE_TIME) {
return Qtr_("Date"); return tr("Date");
} else if (section == DIVE_DURATION) { } else if (section == DIVE_DURATION) {
return Qtr_("Duration"); return tr("Duration");
} else if (section == DIVE_DEPTH) { } else if (section == DIVE_DEPTH) {
return Qtr_("Depth"); return tr("Depth");
} else if (section == DIVE_LOCATION) { } else if (section == DIVE_LOCATION) {
return Qtr_("Location"); return tr("Location");
} }
} }
return QVariant(); return QVariant();

View file

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

View file

@ -3,8 +3,6 @@
* *
* classes for the main UI window in Subsurface * classes for the main UI window in Subsurface
*/ */
#include "common.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
@ -60,7 +58,7 @@ void MainWindow::on_actionNew_triggered()
void MainWindow::on_actionOpen_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()){ if (filename.isEmpty()){
return; return;
} }
@ -290,10 +288,10 @@ QString MainWindow::filter()
bool MainWindow::askSaveChanges() bool MainWindow::askSaveChanges()
{ {
QString message = ! existing_filename ? Qtr_("You have unsaved changes\nWould you like to save those before closing the datafile?") QString message = ! existing_filename ? tr("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); : 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. // WARNING: Port.
// file_save(NULL,NULL); // file_save(NULL,NULL);
return true; return true;

View file

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