Qt4: put and get message history

This commit is contained in:
Pasi Kallinen
2017-10-10 22:55:30 +03:00
parent 4dff3a707e
commit 2fcf1ad139
6 changed files with 53 additions and 1 deletions

View File

@@ -605,6 +605,30 @@ void NetHackQtBind::qt_outrip(winid wid, int how, time_t when)
window->UseRIP(how, when);
}
char * NetHackQtBind::qt_getmsghistory(BOOLEAN_P init)
{
NetHackQtMessageWindow* window = main->GetMessageWindow();
if (window)
return (char *)window->GetStr(init);
return NULL;
}
void NetHackQtBind::qt_putmsghistory(const char *msg, BOOLEAN_P is_restoring)
{
NetHackQtMessageWindow* window = main->GetMessageWindow();
//raw_printf("msg='%s'", msg);
if (window && msg)
window->PutStr(ATR_NONE, QString::fromLatin1(msg));
}
void NetHackQtBind::qt_putmsghistory(const std::string& msg, BOOLEAN_P is_restoring)
{
NetHackQtMessageWindow* window = main->GetMessageWindow();
if (window)
window->PutStr(ATR_NONE, QString::fromLatin1(msg.c_str(), msg.size()));
}
bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
{
// Ignore Alt-key navigation to menubar, it's annoying when you
@@ -728,7 +752,8 @@ struct window_procs Qt_procs = {
#endif
genl_preference_update,
genl_getmsghistory, genl_putmsghistory,
nethack_qt4::NetHackQtBind::qt_getmsghistory,
nethack_qt4::NetHackQtBind::qt_putmsghistory,
genl_status_init,
genl_status_finish, genl_status_enablefield,
#ifdef STATUS_HILITES