2012-08-26 11:10:48 +02:00
|
|
|
-- TODO: find another hotkey for this. Ctrl+Z will be reserved to undo on textedits.
|
2012-07-24 07:30:08 +02:00
|
|
|
HOTKEY = 'Ctrl+Z'
|
2012-05-01 15:06:38 +02:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
bugReportWindow = nil
|
|
|
|
bugTextEdit = nil
|
2012-05-01 15:06:38 +02:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function init()
|
2012-06-26 00:13:30 +02:00
|
|
|
g_ui.importStyle('bugreport.otui')
|
2012-05-01 15:06:38 +02:00
|
|
|
|
2012-06-26 00:13:30 +02:00
|
|
|
bugReportWindow = g_ui.createWidget('BugReportWindow', rootWidget)
|
2012-05-01 15:06:38 +02:00
|
|
|
bugReportWindow:hide()
|
|
|
|
|
|
|
|
bugTextEdit = bugReportWindow:getChildById('bugTextEdit')
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
g_keyboard.bindKeyDown(HOTKEY, show)
|
2012-05-01 15:06:38 +02:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function terminate()
|
2012-06-26 00:13:30 +02:00
|
|
|
g_keyboard.unbindKeyDown(HOTKEY)
|
2012-05-01 15:06:38 +02:00
|
|
|
bugReportWindow:destroy()
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function doReport()
|
2012-05-01 15:06:38 +02:00
|
|
|
g_game.reportBug(bugTextEdit:getText())
|
|
|
|
bugReportWindow:hide()
|
2012-07-26 11:12:20 +02:00
|
|
|
modules.game_textmessage.displayGameMessage(tr('Bug report sent.'))
|
2012-05-01 15:06:38 +02:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function show()
|
2012-08-26 11:10:48 +02:00
|
|
|
if g_game.isOnline() then
|
|
|
|
bugTextEdit:setText('')
|
|
|
|
bugReportWindow:show()
|
|
|
|
bugReportWindow:raise()
|
|
|
|
bugReportWindow:focus()
|
|
|
|
end
|
2012-05-01 15:06:38 +02:00
|
|
|
end
|