23 #include <tools/worldinfo_viewer/worldinfo_viewer.h>
24 #include <tools/worldinfo_viewer/backend_thread.h>
25 #include <worldinfo_utils/data_container.h>
26 #include <utils/system/hostinfo.h>
27 #include <utils/time/clock.h>
28 #include <config/sqlite.h>
33 using namespace fawkes;
35 int main(
int argc,
char** argv)
50 addr = config->
get_string(
"/worldinfo/multicast_addr");
51 port = config->
get_uint(
"/worldinfo/udp_port");
52 key = config->
get_string(
"/worldinfo/encryption_key");
53 iv = config->
get_string(
"/worldinfo/encryption_iv");
58 e.
append(
"Could not get required configuration data for world info viewer");
69 key.c_str(), iv.c_str() );
71 backend_thread->
start();
75 Gtk::Main kit(argc, argv);
76 #ifdef GLIBMM_EXCEPTIONS_ENABLED
77 Glib::RefPtr<Gtk::Builder> builder =
78 Gtk::Builder::create_from_file( RESDIR
"/guis/worldinfo_viewer/"
79 "worldinfo_viewer.ui" );
81 std::auto_ptr<Gtk::BuilderError> error;
82 Glib::RefPtr<Gtk::Builder> builder =
83 Gtk::Builder::create_from_file(RESDIR
"/guis/worldinfo_viewer/worldinfo_viewer.ui", error);
92 kit.run( viewer.get_window() );
94 catch (std::exception
const& e)
96 std::cerr <<
"Error: " << e.what() << std::endl;
100 backend_thread->
join();
101 delete backend_thread;
103 delete data_container;
Data container to store and exchange worldinfo data.
const char * short_name()
Get short hostname (up to first dot).
Main class of the WorldInfoViewer application.
static Clock * instance()
Clock initializer.
virtual void load(const char *name, const char *defaults_name, const char *tag=NULL)=0
Load configuration.
Configuration storage using SQLite.
This is supposed to be the central clock in Fawkes.
static void init_main()
Initialize Thread wrapper instance for main thread.
Glib::Dispatcher & new_gamestate_data()
Access the dispatcher that is emitted whenever new game state data has arrived.
void gamestate_changed()
Call this method whenever the game state changes.
Base class for exceptions in Fawkes.
static void destroy_main()
Destroy main thread wrapper instance.
static void finalize()
Finalize.
void cancel()
Cancel a thread.
void print_trace()
Prints trace to stderr.
void join()
Join the thread.
virtual unsigned int get_uint(const char *path)=0
Get value from configuration which is of type unsigned int.
Interface for configuration handling.
The backend thread of the worldinfo viewer application.
void append(const char *format,...)
Append messages to the message list.
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.
void start(bool wait=true)
Call this method to start the thread.