* ControlChanges:

- getChangeAuthor() and getChangeDate(): converted to unicode.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15279 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-08 10:32:33 +00:00
parent 5eec8f015e
commit c8e5745e20
7 changed files with 36 additions and 27 deletions

View File

@ -21,6 +21,8 @@
#include "lyxfind.h" #include "lyxfind.h"
#include "support/lyxtime.h" #include "support/lyxtime.h"
using lyx::docstring;
using std::string; using std::string;
namespace lyx { namespace lyx {
@ -46,29 +48,32 @@ bool ControlChanges::changed()
} }
string const ControlChanges::getChangeDate() docstring const ControlChanges::getChangeDate()
{ {
Change c(kernel().bufferview()->getCurrentChange()); Change c(kernel().bufferview()->getCurrentChange());
if (c.type == Change::UNCHANGED || !c.changetime) if (c.type == Change::UNCHANGED || !c.changetime)
return string(); return docstring();
return formatted_time(c.changetime); // FIXME UNICODE
return lyx::from_utf8(formatted_time(c.changetime));
} }
string const ControlChanges::getChangeAuthor() docstring const ControlChanges::getChangeAuthor()
{ {
Change c(kernel().bufferview()->getCurrentChange()); Change c(kernel().bufferview()->getCurrentChange());
if (c.type == Change::UNCHANGED) if (c.type == Change::UNCHANGED)
return string(); return docstring();
Author const & a(kernel().buffer().params().authors().get(c.author)); Author const & a(kernel().buffer().params().authors().get(c.author));
string author(a.name()); // FIXME UNICODE in Author class
docstring author(lyx::from_utf8(a.name()));
if (!a.email().empty()) { if (!a.email().empty()) {
author += " ("; author += " (";
author += a.email() + ")"; author += lyx::from_utf8(a.email());
author += ")";
} }
return author; return author;

View File

@ -14,6 +14,8 @@
#include "Dialog.h" #include "Dialog.h"
#include "support/docstring.h"
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
@ -42,10 +44,10 @@ public:
bool changed(); bool changed();
/// return date of change /// return date of change
std::string const getChangeDate(); lyx::docstring const getChangeDate();
/// return author of change /// return author of change
std::string const getChangeAuthor(); lyx::docstring const getChangeAuthor();
/// accept the current merge /// accept the current merge
bool accept(); bool accept();

View File

@ -102,17 +102,18 @@ void GChanges::onNext()
void GChanges::promptChange() void GChanges::promptChange()
{ {
string const header = lyx::to_utf8(_("Accept highlighted change?")); docstring const header = _("Accept highlighted change?");
string author = controller().getChangeAuthor(); docstring author = controller().getChangeAuthor();
string date = controller().getChangeDate(); docstring date = controller().getChangeDate();
if(author.empty()) if(author.empty())
author = lyx::to_utf8(_("unknown author")); author = _("unknown author");
if(date.empty()) if(date.empty())
date = lyx::to_utf8(_("unknown date")); date = _("unknown date");
messagelabel_->set_markup("<big><b>" + header + // FIXME UNICODE in set_markup():
"</b></big>\n\nChanged by <b>" + author messagelabel_->set_markup("<big><b>" + lyx::to_utf8(header) +
+ "</b> on <b>" + date + "</b>"); "</b></big>\n\nChanged by <b>" + lyx::to_utf8(author)
+ "</b> on <b>" + lyx::to_utf8(date) + "</b>");
acceptbutton_->set_sensitive(true && !readOnly()); acceptbutton_->set_sensitive(true && !readOnly());
rejectbutton_->set_sensitive(true && !readOnly()); rejectbutton_->set_sensitive(true && !readOnly());

View File

@ -51,8 +51,8 @@ void QChanges::build_dialog()
void QChanges::update_contents() void QChanges::update_contents()
{ {
docstring text; docstring text;
docstring author = lyx::from_utf8(controller().getChangeAuthor()); docstring author = controller().getChangeAuthor();
docstring date = lyx::from_utf8(controller().getChangeDate()); docstring date = controller().getChangeDate();
if (!author.empty()) if (!author.empty())
text += bformat(_("Change by %1$s\n\n"), author); text += bformat(_("Change by %1$s\n\n"), author);

View File

@ -59,8 +59,8 @@ void QChanges::next()
controller().find(); controller().find();
docstring text; docstring text;
docstring author = lyx::from_utf8(controller().getChangeAuthor()); docstring author = controller().getChangeAuthor();
docstring date = lyx::from_utf8(controller().getChangeDate()); docstring date = controller().getChangeDate();
if (!author.empty()) if (!author.empty())
text += bformat(_("Change by %1$s\n\n"), author); text += bformat(_("Change by %1$s\n\n"), author);

View File

@ -183,13 +183,13 @@ void QLPainter::image(int x, int y, int w, int h,
} }
void QLPainter::text(int x, int y, docstring const & s, LyXFont const & f) int QLPainter::text(int x, int y, docstring const & s, LyXFont const & f)
{ {
return text(x, y, reinterpret_cast<char_type const *>(s.data()), s.length(), f); return text(x, y, reinterpret_cast<char_type const *>(s.data()), s.length(), f);
} }
void QLPainter::text(int x, int y, char_type c, LyXFont const & f) int QLPainter::text(int x, int y, char_type c, LyXFont const & f)
{ {
char_type s[2] = { c, char_type('\0') }; char_type s[2] = { c, char_type('\0') };
return text(x, y, s, 1, f); return text(x, y, s, 1, f);
@ -222,7 +222,7 @@ int QLPainter::smallCapsText(int x, int y,
} }
void QLPainter::text(int x, int y, char_type const * s, size_t ls, int QLPainter::text(int x, int y, char_type const * s, size_t ls,
LyXFont const & f) LyXFont const & f)
{ {
#if 0 #if 0
@ -260,6 +260,7 @@ void QLPainter::text(int x, int y, char_type const * s, size_t ls,
underline(f, x, y, textwidth); underline(f, x, y, textwidth);
} }
return textwidth;
} }

View File

@ -103,18 +103,18 @@ public:
lyx::graphics::Image const & image); lyx::graphics::Image const & image);
/// draw a string at position x, y (y is the baseline) /// draw a string at position x, y (y is the baseline)
virtual void text(int x, int y, virtual int text(int x, int y,
lyx::docstring const & str, LyXFont const & f); lyx::docstring const & str, LyXFont const & f);
/** Draw a string at position x, y (y is the baseline) /** Draw a string at position x, y (y is the baseline)
* This is just for fast drawing * This is just for fast drawing
*/ */
virtual void text(int x, int y, virtual int text(int x, int y,
lyx::char_type const * str, size_t l, lyx::char_type const * str, size_t l,
LyXFont const & f); LyXFont const & f);
/// draw a char at position x, y (y is the baseline) /// draw a char at position x, y (y is the baseline)
virtual void text(int x, int y, virtual int text(int x, int y,
lyx::char_type c, LyXFont const & f); lyx::char_type c, LyXFont const & f);
/// draw a pixmap from the image cache /// draw a pixmap from the image cache