Freeciv-3.2: /fast/freeciv/nightly/S3_2/client/gui-qt/luaconsole.cpp Source File

Freeciv-3.2

Loading...
Searching...
No Matches
luaconsole.cpp
Go to the documentation of this file.
1/*****************************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*****************************************************************************/
13#ifdef HAVE_CONFIG_H
14#include <fc_config.h>
15#endif
16
17// Qt
18#include <QFileDialog>
19#include <QString>
20
21// utility
22#include "shared.h"
23
24// common
25#include "featured_text.h"
26
27// client/luascript
28#include "script_client.h"
29
30// gui-qt
31#include "fc_client.h"
32#include "luaconsole.h"
33#include "qtg_cxxside.h"
34
35 QString qlua_filename;
36
37/*************************************************************************/
40 void luaconsole_dialog_popup(bool raise)
41{
42 // Lua output is in chat
43}
44
45/*************************************************************************/
48 bool luaconsole_dialog_is_open(void)
49{
50 return true;
51}
52
53/*************************************************************************/
56 void real_luaconsole_dialog_update(void)
57{
58}
59
60/*************************************************************************/
64 void real_luaconsole_append(const char *astring,
65 const struct text_tag_list *tags)
66{
67 qtg_real_output_window_append(astring, tags, 0);
68}
69
70/*************************************************************************/
73 void qload_lua_script()
74{
75 QString str;
76
77 str = QString(_("Lua scripts")) + QString(" (*.lua)");
78 qlua_filename = QFileDialog::getOpenFileName(gui()->central_wdg,
79 _("Load lua script"),
80 QDir::homePath(), str);
81 if (!qlua_filename.isEmpty()) {
82 script_client_do_file(qlua_filename.toUtf8().constData());
83 }
84}
85
86/*************************************************************************/
89 void qreload_lua_script()
90{
91 if (!qlua_filename.isEmpty()) {
92 script_client_do_file(qlua_filename.toUtf8().constData());
93 }
94}
str
#define str
Definition astring.c:76
qtg_real_output_window_append
void qtg_real_output_window_append(const char *astring, const struct text_tag_list *tags, int conn_id)
Definition chatline.cpp:738
incite_cost
char * incite_cost
Definition comments.c:74
fc_client.h
_
#define _(String)
Definition fcintl.h:67
featured_text.h
luaconsole.h
qlua_filename
QString qlua_filename
Definition luaconsole.cpp:35
luaconsole_dialog_is_open
bool luaconsole_dialog_is_open(void)
Definition luaconsole.cpp:48
qload_lua_script
void qload_lua_script()
Definition luaconsole.cpp:73
real_luaconsole_append
void real_luaconsole_append(const char *astring, const struct text_tag_list *tags)
Definition luaconsole.cpp:64
real_luaconsole_dialog_update
void real_luaconsole_dialog_update(void)
Definition luaconsole.cpp:56
luaconsole_dialog_popup
void luaconsole_dialog_popup(bool raise)
Definition luaconsole.cpp:40
qreload_lua_script
void qreload_lua_script()
Definition luaconsole.cpp:89
gui
static mpgui * gui
Definition mpgui_qt.cpp:52
qtg_cxxside.h
script_client_do_file
bool script_client_do_file(const char *filename)
Definition script_client.c:89
script_client.h
shared.h
astring
Definition astring.h:36