mirror of
				https://github.com/OTCv8/otclientv8.git
				synced 2025-10-31 10:56:24 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			888 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			888 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
| -- TODO: find another hotkey for this. Ctrl+Z will be reserved to undo on textedits.
 | |
| HOTKEY = 'Ctrl+Z'
 | |
| 
 | |
| bugReportWindow = nil
 | |
| bugTextEdit = nil
 | |
| 
 | |
| function init()
 | |
|   g_ui.importStyle('bugreport')
 | |
| 
 | |
|   bugReportWindow = g_ui.createWidget('BugReportWindow', rootWidget)
 | |
|   bugReportWindow:hide()
 | |
| 
 | |
|   bugTextEdit = bugReportWindow:getChildById('bugTextEdit')
 | |
| 
 | |
|   g_keyboard.bindKeyDown(HOTKEY, show, modules.game_interface.getRootPanel())
 | |
| end
 | |
| 
 | |
| function terminate()
 | |
|   g_keyboard.unbindKeyDown(HOTKEY, modules.game_interface.getRootPanel())
 | |
|   bugReportWindow:destroy()
 | |
| end
 | |
| 
 | |
| function doReport()
 | |
|   g_game.reportBug(bugTextEdit:getText())
 | |
|   bugReportWindow:hide()
 | |
|   modules.game_textmessage.displayGameMessage(tr('Bug report sent.'))
 | |
| end
 | |
| 
 | |
| function show()
 | |
|   if g_game.isOnline() then
 | |
|     bugTextEdit:setText('')
 | |
|     bugReportWindow:show()
 | |
|     bugReportWindow:raise()
 | |
|     bugReportWindow:focus()
 | |
|   end
 | |
| end
 | 
