diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-04-14 06:44:29 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-04-14 06:58:56 -0700 |
commit | d8e11439ad27063b0dad05b2f8f0f4cd7f3e7de1 (patch) | |
tree | 22fae2f6ee0915afe9075ab6558882ded736ca1b | |
parent | fc0e307f00ceb50771d1c7a1489c7b65721f4143 (diff) | |
download | subsurface-d8e11439ad27063b0dad05b2f8f0f4cd7f3e7de1.tar.gz |
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>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | qt-gui.cpp | 5 | ||||
-rw-r--r-- | qt-ui/common.h | 20 | ||||
-rw-r--r-- | qt-ui/divetripmodel.cpp | 12 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 1 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 10 | ||||
-rw-r--r-- | qt-ui/models.cpp | 19 |
7 files changed, 21 insertions, 48 deletions
@@ -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 diff --git a/qt-gui.cpp b/qt-gui.cpp index 1621317c2..745457763 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -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()); diff --git a/qt-ui/common.h b/qt-ui/common.h deleted file mode 100644 index 6e00c80ed..000000000 --- a/qt-ui/common.h +++ /dev/null @@ -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 diff --git a/qt-ui/divetripmodel.cpp b/qt-ui/divetripmodel.cpp index 0a2944d8b..5082494a0 100644 --- a/qt-ui/divetripmodel.cpp +++ b/qt-ui/divetripmodel.cpp @@ -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(); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 72d8dfebc..53926cb25 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -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" diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index d1cde044a..577b7fb67 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -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; diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index a341c0c70..64fa6bac3 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -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; |