Qt Port update.

Thiago Macieira thiago at macieira.org
Sat Apr 13 17:34:27 PDT 2013


On sábado, 13 de abril de 2013 14.25.24, Dirk Hohndel wrote:
> bool MainWindow::askSaveChanges()
> {
>         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);
> 
> 
> This is one of the rare situations where the stream syntax (with the
> trailing .arg() ) is kinda useful and elegant.
> 
> Thiago, is there a way to maintain that useful feature and still use
> gettext?

Oh yeah.

#undef _
#define _(String) QString::fromUtf8(gettext(String))

The _ macro comes from glib/gi18n.h

We should probably make it Q_ for now, until the porting is completed.

Also:
inline QString Q_(const char *str)
{
    return QString::fromUtf8(gettext(str));
}

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130413/466a8462/attachment.sig>


More information about the subsurface mailing list