From d6d108dd3483c2eeaec8b272aba6a272c7bd5d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 16 Jul 2011 18:10:08 +0200 Subject: [PATCH] Qt plugin fixes for windows, renamed interface to df_interface in Gui. --- library/Core.cpp | 4 ++-- library/include/dfhack/modules/Gui.h | 4 ++-- library/modules/Gui.cpp | 12 ++++++------ plugins/CMakeLists.txt | 19 +++++++++++-------- plugins/qtplug/CMakeLists.txt | 2 +- plugins/qtplug/blankslade.cpp | 6 +++--- plugins/qtplug/qtplug.cpp | 3 ++- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index 78fb8d637..ad7e4986b 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -390,10 +390,10 @@ int Core::SDL_Event(SDL::Event* ev, int orig_return) { hotkey_states[idx] = 1; Gui * g = getGui(); - if(g->hotkeys && g->interface && g->menu_state) + if(g->hotkeys && g->df_interface && g->df_menu_state) { t_viewscreen * ws = g->GetCurrentScreen(); - if(ws->getClassName() == "viewscreen_dwarfmodest" && *g->menu_state == 0x23) + if(ws->getClassName() == "viewscreen_dwarfmodest" && *g->df_menu_state == 0x23) return orig_return; else { diff --git a/library/include/dfhack/modules/Gui.h b/library/include/dfhack/modules/Gui.h index e11e046c0..49bb050be 100644 --- a/library/include/dfhack/modules/Gui.h +++ b/library/include/dfhack/modules/Gui.h @@ -114,11 +114,11 @@ namespace DFHack * Gui screens */ /// handle to the interface object - t_interface * interface; + t_interface * df_interface; /// Get the current top-level view-screen t_viewscreen * GetCurrentScreen(); /// The DF menu state (designation menu ect) - uint32_t * menu_state; + uint32_t * df_menu_state; /* * Hotkeys (DF's zoom locations) diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 1a29e5d43..c934adfba 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -86,21 +86,21 @@ Gui::Gui() // Setting up menu state try { - menu_state = (uint32_t *) OG_Gui->getAddress("current_menu_state"); + df_menu_state = (uint32_t *) OG_Gui->getAddress("current_menu_state"); } catch(Error::All &) { - menu_state = 0; + df_menu_state = 0; }; // Setting up the view screen stuff try { - interface = (t_interface *) OG_Gui->getAddress ("interface"); + df_interface = (t_interface *) OG_Gui->getAddress ("interface"); } catch(exception &) { - interface = 0; + df_interface = 0; }; OffsetGroup * OG_Position; @@ -140,9 +140,9 @@ bool Gui::Finish() t_viewscreen * Gui::GetCurrentScreen() { - if(!interface) + if(!df_interface) return 0; - t_viewscreen * ws = &interface->view; + t_viewscreen * ws = &df_interface->view; while(ws) { if(ws->child) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 72d0be03a..2d956b35c 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -96,20 +96,16 @@ ENDMACRO(DFHACK_PLUGIN) #endmacro() #RECURSE_DIRS() -IF(UNIX) + +OPTION(BUILD_QTPLUG "Build the experimental Qt plugin." OFF) +if(BUILD_QTPLUG) add_subdirectory (qtplug) -ENDIF() +endif() -DFHACK_PLUGIN(reveal reveal.cpp) OPTION(BUILD_KITTENS "Build the kittens plugin." OFF) if(BUILD_KITTENS) DFHACK_PLUGIN(kittens kittens.cpp) endif() -DFHACK_PLUGIN(prospector prospector.cpp) -DFHACK_PLUGIN(cleanmap cleanmap.cpp) -DFHACK_PLUGIN(weather weather.cpp) -DFHACK_PLUGIN(vdig vdig.cpp) -DFHACK_PLUGIN(colonies colonies.cpp) IF(UNIX) OPTION(BUILD_KILL_GAME "Build the kill gmae plugin." OFF) @@ -117,3 +113,10 @@ IF(UNIX) DFHACK_PLUGIN(die die.cpp) endif() endif() + +DFHACK_PLUGIN(reveal reveal.cpp) +DFHACK_PLUGIN(prospector prospector.cpp) +DFHACK_PLUGIN(cleanmap cleanmap.cpp) +DFHACK_PLUGIN(weather weather.cpp) +DFHACK_PLUGIN(vdig vdig.cpp) +DFHACK_PLUGIN(colonies colonies.cpp) diff --git a/plugins/qtplug/CMakeLists.txt b/plugins/qtplug/CMakeLists.txt index 38be38bb5..029cea769 100644 --- a/plugins/qtplug/CMakeLists.txt +++ b/plugins/qtplug/CMakeLists.txt @@ -12,7 +12,7 @@ if(QT4_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND) set ( qtplug_SRCS qtplug.cpp blankslade.cpp - glwidget.cpp + #glwidget.cpp ) SET ( qtplug_UI diff --git a/plugins/qtplug/blankslade.cpp b/plugins/qtplug/blankslade.cpp index 73c49b5b4..e9ccc1dc7 100644 --- a/plugins/qtplug/blankslade.cpp +++ b/plugins/qtplug/blankslade.cpp @@ -6,13 +6,13 @@ #include "blankslade.h" #include #include -#include "glwidget.h" +//#include "glwidget.h" blankslade::blankslade(QWidget *parent): QMainWindow(parent) { ui.setupUi(this); - GLWidget * glw = new GLWidget(); - ui.gridding->addWidget(glw); + //GLWidget * glw = new GLWidget(); + //ui.gridding->addWidget(glw); connect(ui.actionOpen,SIGNAL(triggered(bool)),this,SLOT(slotOpen(bool))); connect(ui.actionQuit,SIGNAL(triggered(bool)),this,SLOT(slotQuit(bool))); connect(ui.actionSave,SIGNAL(triggered(bool)),this,SLOT(slotSave(bool))); diff --git a/plugins/qtplug/qtplug.cpp b/plugins/qtplug/qtplug.cpp index 8b7ace6bf..2fa24a200 100644 --- a/plugins/qtplug/qtplug.cpp +++ b/plugins/qtplug/qtplug.cpp @@ -60,7 +60,8 @@ DFhackCExport command_result runqt (Core * c, vector & parameters) static int runnable(void *) { - QApplication app(0, 0); + int zero = 0; + QApplication app(zero, 0); blankslade appGui; appGui.show(); int ret = app.exec();