Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit bc33b87f authored by Tomas Mecir's avatar Tomas Mecir

Mapper updates

- Don't link against a plugin, this doesn't seem to work anymore, and is a bad practice anyway.
- Merge mapper plugins into the base code, we don't really need these to be separate plug-ins
- Fix some crashes
parent 5def190b
add_subdirectory( plugins )
include_directories( ${CMAKE_SOURCE_DIR}/libs ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
add_definitions (-DQT3_SUPPORT)
......@@ -51,6 +49,22 @@ set(kmuddymapper_PART_SRCS
dialogs/dlgmapspeedwalk.cpp
dialogs/dlgmapdirections.cpp
filefilters/cmapfilefilterxml.cpp
plugins/standard/cmapcmdmoveelements.cpp
plugins/standard/cmapcmdnotes.cpp
plugins/standard/cmappluginstandard.cpp
plugins/standard/tools/cmaptoolselect.cpp
plugins/standard/tools/cmaptoolroom.cpp
plugins/standard/tools/cmaptoolpath.cpp
plugins/standard/tools/cmaptooltext.cpp
plugins/standard/tools/cmaptooleraser.cpp
plugins/standard/propertyPanes/cmapnotespane.cpp
plugins/speedwalk/cmappluginspeedwalk.cpp
plugins/speedwalk/cmapcmdspeedwalkadd.cpp
plugins/speedwalk/cmapcmdspeedwalkremove.cpp
plugins/speedwalk/dlgmapspeedwalkcontainter.cpp
plugins/speedwalk/dlgmapspeedwalklist.cpp
)
kde4_add_ui_files (kmuddymapper_PART_SRCS
......@@ -62,6 +76,9 @@ kde4_add_ui_files (kmuddymapper_PART_SRCS
dialogs/dlgmappathpropertiesbase.ui
dialogs/dlgspeedwalkprogressbase.ui
dialogs/dlgmapdirectionsbase.ui
plugins/speedwalk/dlgmapspeedwalklistbase.ui
)
kde4_add_plugin(kmuddymapper ${kmuddymapper_PART_SRCS})
......@@ -77,4 +94,5 @@ install( FILES kmuddymapper.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES kmuddymapperpart.rc DESTINATION ${DATA_INSTALL_DIR}/kmuddy )
install( FILES kmuddymapperplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
install( FILES kmud_grid.png kmud_create.png kmud_follow.png DESTINATION ${DATA_INSTALL_DIR}/kmuddy/toolbar )
install( FILES plugins/standard/tools/kmud_select.png plugins/standard/tools/kmud_room.png plugins/standard/tools/kmud_text.png plugins/standard/tools/kmud_path.png plugins/standard/tools/kmud_eraser.png DESTINATION ${DATA_INSTALL_DIR}/kmuddy/toolbar )
......@@ -253,6 +253,9 @@ void CMapManager::initFileFilters()
m_fileFilter.append(new CMapFileFilterXML(this));
}
#include "plugins/standard/cmappluginstandard.h"
#include "plugins/speedwalk/cmappluginspeedwalk.h"
/** Used to create the plugins */
void CMapManager::initPlugins()
{
......@@ -261,45 +264,26 @@ void CMapManager::initPlugins()
toolList.clear();
pluginList.setAutoDelete(false);
pluginList.clear();
kDebug() << "Loading Plugins...\n";
KService::List offers = KServiceTypeTrader::self()->query("KMuddy/Mapper/Plugin");
kDebug() << "got " << offers.count() << " offers for plugins\n";
CMapPluginBase* plugin;
for (unsigned int i = 0; i < (unsigned int) offers.count(); ++i)
kDebug() << "Loading Static Plugins...\n";
// These used to be plug-ins, but now I'm linking them in statically, and just pretend that they are plug-ins.
// This is because linking to the mapper part is causing issues.
CMapPluginBase *plugin;
plugin = new CMapPluginStandard (activeView);
pluginList.append (plugin);
plugin = new CMapPluginSpeedwalk (activeView);
pluginList.append (plugin);
for (plugin = pluginList.first(); plugin!=0; plugin = pluginList.next())
{
kDebug() << "Processing offer "
<< (i+1)
<< ": \"" << offers[i]->name()
<< "\" (" << offers[i]->library() << ")\n";
KPluginFactory *factory = KPluginLoader (*offers[i]).factory();
if (!factory) {
kWarning() << "Obtaining factory failed!";
continue;
}
plugin = factory->create<CMapPluginBase> (activeView);
if (!plugin)
kDebug() << "Tools in plugin : " << plugin->getToolList()->count();
foreach (CMapToolBase *tool, *plugin->getToolList())
{
kWarning() << "Plugin creation failed!";
toolList.append(tool);
}
else
{
pluginList.append(plugin);
kDebug() << "Tools in plugin : " << plugin->getToolList()->count();
foreach (CMapToolBase *tool, *plugin->getToolList())
{
toolList.append(tool);
}
// getActiveView()->insertChildClient(plugin);
pluginCount++;
}
pluginCount++;
}
kDebug() << "Finished loading " << pluginCount << " plugins\n";
......
......@@ -22,7 +22,7 @@
#include "cmapmanager.h"
#include "cmapview.h"
CMapPluginBase::CMapPluginBase(QObject *parent) : KXMLGUIClient((CMapView *)parent)
CMapPluginBase::CMapPluginBase(QObject *parent)
{
mapManager = (dynamic_cast<CMapView *>(parent))->getManager();
}
......
......@@ -36,7 +36,7 @@ class KMemConfig;
/**This is the base class for mapper plugins
*@author Kmud Developer Team
*/
class KMUDDY_EXPORT CMapPluginBase : public QObject, public KXMLGUIClient
class KMUDDY_EXPORT CMapPluginBase : public QObject
{
Q_OBJECT
public:
......
......@@ -6,11 +6,17 @@
<Action name = "viewLowerLevel"/>
</Menu>
<Menu name="Window"><Text>&amp;Window</Text>
<Action name = "viewSpeedwalkList"/>
</Menu>
</MenuBar>
<StatusBar/>
<ToolBar fullWidth="false" name="tools" position="left"><Text>Tools</Text>
<Action name = "toolsGrid"/>
<Action name="toolsGrid"/>
<Action name="toolsSelect"/>
<Action name="toolsRoom"/>
<Action name="toolsPath"/>
<Action name="toolsText"/>
<Action name="toolsEraser"/>
<Separator/>
<Action name = "editUndo"/>
<Action name = "editRedo"/>
......@@ -35,6 +41,7 @@
<Action name = "roomCurrentPos"/>
<Action name = "roomLoginPoint"/>
<Action name = "roomWalkTo"/>
<Action name = "roomAddToSpeedwalk"/>
<Separator/>
<Action name = "roomDelete"/>
<Separator/>
......
add_subdirectory( standard )
add_subdirectory( speedwalk )
include_directories( ${CMAKE_SOURCE_DIR}/libs ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
add_definitions (-DQT3_SUPPORT)
add_definitions (-DQT3_SUPPORT_WARNINGS)
########### next target ###############
set(kmuddymapper_speedwalk_PART_SRCS
cmappluginspeedwalk.cpp
cmapcmdspeedwalkadd.cpp
cmapcmdspeedwalkremove.cpp
dlgmapspeedwalkcontainter.cpp
dlgmapspeedwalklist.cpp )
kde4_add_ui_files(kmuddymapper_speedwalk_PART_SRCS dlgmapspeedwalklistbase.ui )
kde4_add_plugin(kmuddymapper_speedwalk WITH_PREFIX ${kmuddymapper_speedwalk_PART_SRCS})
target_link_libraries(kmuddymapper_speedwalk ${KDE4_KDECORE_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KDE3SUPPORT_LIBS} kmuddymapper kmuddycore)
install(TARGETS kmuddymapper_speedwalk DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kmuddymapper_speedwalk.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES kmuddymapper_speedwalk.rc DESTINATION ${DATA_INSTALL_DIR}/kmuddy )
......@@ -35,24 +35,17 @@
#include "cglobalsettings.h"
#include <kpluginfactory.h>
#include <kpluginloader.h>
K_PLUGIN_FACTORY (KMuddyMapperSpeedwalkFactory, registerPlugin<CMapPluginSpeedwalk>();)
K_EXPORT_PLUGIN (KMuddyMapperSpeedwalkFactory("kmuddymapper"))
CMapPluginSpeedwalk::CMapPluginSpeedwalk(QObject *parent, const QVariantList &) : CMapPluginBase(parent)
CMapPluginSpeedwalk::CMapPluginSpeedwalk(QObject *parent) : CMapPluginBase(parent)
{
setXMLFile (KStandardDirs::locate("appdata", "kmuddymapper_speedwalk.rc"));
CMapView *view = dynamic_cast<CMapView *>(parent);
m_showAction = new KAction (this);
m_showAction->setText (i18n("Show Speedwalk List"));
connect (m_showAction, SIGNAL (triggered()), this, SLOT(slotViewSpeedwalkList()));
actionCollection()->addAction("viewSpeedwalkList", m_showAction);
view->actionCollection()->addAction("viewSpeedwalkList", m_showAction);
m_addAction = new KAction (this);
m_addAction->setText (i18n("&Add to speed walk list"));
connect (m_addAction, SIGNAL (triggered()), this, SLOT(slotRoomAddToSpeedwalk()));
actionCollection()->addAction("roomAddToSpeedwalk", m_addAction);
view->actionCollection()->addAction("roomAddToSpeedwalk", m_addAction);
m_speedwalkList = NULL;
......
......@@ -36,7 +36,7 @@ class CMapPluginSpeedwalk : public CMapPluginBase
{
Q_OBJECT
public:
CMapPluginSpeedwalk(QObject *parent, const QVariantList &);
CMapPluginSpeedwalk(QObject *parent);
~CMapPluginSpeedwalk();
/** This is called before a element menu is openend */
......
[Desktop Entry]
Type=Service
Comment=The speedwalk list plugin for the kmuddy mapper
Comment[bs]=Lista servisa za kratice za Kmuddy Mapper
Comment[de]=Das Modul Wegeskriptliste für Kmuddy-Mapper
Comment[es]=Complemento de lista de speedwalk para el mapeador de KMuddy
Comment[et]=KMuddy tasemelooja kiirliikumise plugin
Comment[fr]=Le module externe de liste de déplacements automatiques pour l'éditeur de niveaux de KMuddy
Comment[gl]=O complemento de lista de camiñar rapidamente para o editor de mapas de KMuddy.
Comment[hu]=Mozgójárdalista bővítmény a KMuddy térképkészítőhöz
Comment[km]=កម្មវិធី​ជំនួយ​បញ្ជី​ speedwalk សម្រាប់​កម្មវិធី​ផ្គូផ្គង kmuddy
Comment[nl]=De plug-in voor de speedwalk-lijst van de Kmuddy-mapper
Comment[pl]=Wtyczka listy szybkiego chodzenia dla mapowania kmuddy
Comment[pt]=O 'plugin' de listas do Speedwalk para o mapeador do KMuddy
Comment[pt_BR]=O plugin de listas do Speedwalk para o mapeador do KMuddy
Comment[sv]=Insticksprogrammet för snabbgenomgång av listor för Kmuddy-karthantering
Comment[uk]=Додаток списку проходження до засобу роботи з картами KMuddy
Comment[x-test]=xxThe speedwalk list plugin for the kmuddy mapperxx
Name=Speedwalk
Name[bs]=Speedwalk
Name[de]=Wegeskript
Name[es]=Speedwalk
Name[et]=Kiirliikumine
Name[fr]=Déplacements automatiques (Speedwalking)
Name[gl]=Camiñar rapidamente
Name[hu]=Mozgójárda
Name[km]=Speedwalk
Name[nl]=Speedwalk
Name[pl]=Szybkie chodzenie
Name[pt]=Speedwalk
Name[pt_BR]=Speedwalk
Name[sv]=Snabbgenomgång
Name[uk]=Проходження
Name[x-test]=xxSpeedwalkxx
ServiceTypes=KMuddy/Mapper/Plugin
X-KDE-Library=libkmuddymapper_speedwalk
X-KMuddy-Mapper-Plugin-Name=Kmuddy Mapper Speedwalk Plugin
X-KMuddy-Mapper-Plugin-Version=1.0
X-KMuddy-Mapper-Plugin-Author=John-Paul Stanford
X-KMuddy-Mapper-Plugin-Email=kmud-devel@kmud.de
X-KMuddy-Mapper-Plugin-URL=http://www.kmud.de
X-KMuddy-Mapper-Plugin-Description=The speedwalk list plugin for the kmuddy mapper
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartplugin library="libkmuddymapper_speedwalk" version="1.0">
<MenuBar>
<Menu name="Window"><Text>&amp;Window</Text>
<Action name = "viewSpeedwalkList"/>
</Menu>
</MenuBar>
<Menu name = "room_popup">
<Action name = "roomAddToSpeedwalk"/>
</Menu>
</kpartplugin>
include_directories( ${CMAKE_SOURCE_DIR}/libs ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
add_definitions (-DQT3_SUPPORT)
add_definitions (-DQT3_SUPPORT_WARNINGS)
########### next target ###############
set(kmuddymapper_standard_PART_SRCS
cmapcmdmoveelements.cpp
cmapcmdnotes.cpp
cmappluginstandard.cpp
tools/cmaptoolselect.cpp
tools/cmaptoolroom.cpp
tools/cmaptoolpath.cpp
tools/cmaptooltext.cpp
tools/cmaptooleraser.cpp
propertyPanes/cmapnotespane.cpp )
kde4_add_plugin(kmuddymapper_standard WITH_PREFIX ${kmuddymapper_standard_PART_SRCS})
target_link_libraries(kmuddymapper_standard ${KDE4_KDECORE_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KDE3SUPPORT_LIBS} kmuddymapper )
install(TARGETS kmuddymapper_standard DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kmuddymapper_standard.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES kmuddymapper_standard.rc DESTINATION ${DATA_INSTALL_DIR}/kmuddy )
install( FILES tools/kmud_select.png tools/kmud_room.png tools/kmud_text.png tools/kmud_path.png tools/kmud_eraser.png DESTINATION ${DATA_INSTALL_DIR}/kmuddy/toolbar )
......@@ -38,19 +38,14 @@
#include <klocale.h>
#include <kstandarddirs.h>
#include <kactioncollection.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>
K_PLUGIN_FACTORY (KMuddyMapperStandardFactory, registerPlugin<CMapPluginStandard>();)
K_EXPORT_PLUGIN (KMuddyMapperStandardFactory("kmuddymapper"))
CMapPluginStandard::CMapPluginStandard(QObject *parent, const QVariantList &) : CMapPluginBase(parent)
CMapPluginStandard::CMapPluginStandard(QObject *parent) : CMapPluginBase(parent)
{
CMapManager *manager = (dynamic_cast<CMapView *>(parent))->getManager();
CMapView *view = dynamic_cast<CMapView *>(parent);
CMapManager *manager = view->getManager();
kDebug() << "CMapPluginStandard::CMapPluginStandard";
kDebug() << "CMapPluginStandard::CMapPluginStandard Create Tools";
KActionCollection *acol = actionCollection();
KActionCollection *acol = view->actionCollection();
kDebug() << "Plugin collection is "<<acol;
// Create and Add the tools to the tools list
......@@ -66,8 +61,6 @@ CMapPluginStandard::CMapPluginStandard(QObject *parent, const QVariantList &) :
acol->action("toolsRoom")->setEnabled(true);
acol->action("toolsSelect")->setEnabled(true);
acol->action("toolsText")->setEnabled(true);
setXMLFile (KStandardDirs::locate("appdata", "kmuddymapper_standard.rc"), true);
}
CMapPluginStandard::~CMapPluginStandard()
......@@ -88,11 +81,13 @@ QList<CMapPropertiesPaneBase *> CMapPluginStandard::createPropertyPanes(elementT
/** This is called when the character or mud profiles change */
void CMapPluginStandard::profileChanged(void)
{
/*
actionCollection()->action("toolsEraser")->setEnabled(true);
actionCollection()->action("toolsPath")->setEnabled(true);
actionCollection()->action("toolsRoom")->setEnabled(true);
actionCollection()->action("toolsSelect")->setEnabled(true);
actionCollection()->action("toolsText")->setEnabled(true);
*/
}
/**
......
......@@ -34,7 +34,7 @@ class CMapPluginStandard : public CMapPluginBase
{
Q_OBJECT
public:
CMapPluginStandard(QObject *, const QVariantList &);
CMapPluginStandard(QObject *);
~CMapPluginStandard();
virtual QList<CMapPropertiesPaneBase *> createPropertyPanes(elementTyp type,CMapElement *element,QWidget *parent);
......
[Desktop Entry]
Type=Service
Comment=The standard mapper tools and views
Comment[bs]=Standardni alati mapiranja i pogledi
Comment[de]=Die Standard-Mapperwerkzeuge und Ansichten
Comment[es]=Vistas y herramientas del mapeador estándar
Comment[et]=Standardsed tasemelooja tööriistad ja vaated
Comment[fr]=Les afficheurs et éditeurs standards de niveaux
Comment[gl]=As ferramentas e vistas estándar do editor de mapas.
Comment[hu]=A standard térképkészítő eszközök és nézetek
Comment[km]=ទិដ្ឋភាព និង​ឧបករណ៍​កម្មវិធី​ផ្គូផ្គង​ស្តង់ដារ
Comment[nl]=De hulpmiddelen van de standaard mapper en weergaven
Comment[pl]=Standardowe narzędzia mapowania i widoków
Comment[pt]=As ferramentas e vistas normais do mapeador
Comment[pt_BR]=As ferramentas e visualizações normais do mapeador
Comment[sv]=De vanliga kartverktygen och vyerna
Comment[uk]=Стандартні засоби і панелі перегляду карт
Comment[x-test]=xxThe standard mapper tools and viewsxx
Name=Standard
Name[bs]=Standardno
Name[cs]=Standardní
Name[de]=Standard
Name[es]=Estándar
Name[et]=Standardne
Name[fi]=Tavallinen
Name[fr]=Standard
Name[ga]=Caighdeánach
Name[gl]=Estándar
Name[hu]=Standard
Name[km]=ស្តង់ដារ
Name[mr]=प्रमाणित
Name[nds]=Standard
Name[nl]=Standaard
Name[pl]=Standard
Name[pt]=Normal
Name[pt_BR]=Padrão
Name[sk]=Štandardné
Name[sv]=Standard
Name[tr]=Standart
Name[ug]=ئۆلچەملىك
Name[uk]=Стандарт
Name[x-test]=xxStandardxx
Comment=The standard mapper tools and views
Comment[bs]=Standardni alati mapiranja i pogledi
Comment[de]=Die Standard-Mapperwerkzeuge und Ansichten
Comment[es]=Vistas y herramientas del mapeador estándar
Comment[et]=Standardsed tasemelooja tööriistad ja vaated
Comment[fr]=Les afficheurs et éditeurs standards de niveaux
Comment[gl]=As ferramentas e vistas estándar do editor de mapas.
Comment[hu]=A standard térképkészítő eszközök és nézetek
Comment[km]=ទិដ្ឋភាព និង​ឧបករណ៍​កម្មវិធី​ផ្គូផ្គង​ស្តង់ដារ
Comment[nl]=De hulpmiddelen van de standaard mapper en weergaven
Comment[pl]=Standardowe narzędzia mapowania i widoków
Comment[pt]=As ferramentas e vistas normais do mapeador
Comment[pt_BR]=As ferramentas e visualizações normais do mapeador
Comment[sv]=De vanliga kartverktygen och vyerna
Comment[uk]=Стандартні засоби і панелі перегляду карт
Comment[x-test]=xxThe standard mapper tools and viewsxx
ServiceTypes=KMuddy/Mapper/Plugin
X-KDE-Library=libkmuddymapper_standard
X-Kmuddy-Mapper-Plugin-Name=Kmud Mapper Standard Tools Plugin
X-Kmuddy-Mapper-Plugin-Version=1.0
X-Kmuddy-Mapper-Plugin-Author=John-Paul Stanford
X-Kmuddy-Mapper-Plugin-Email=jp@stanwood.org.uk
X-Kmuddy-Mapper-Plugin-URL=http://www.kmud.de
X-Kmuddy-Mapper-Plugin-Description=This is a select tool for the auto mapper of Kmud.
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartplugin library="libkmuddymapper_standard" version="1.0">
<ToolBar name="tools">
<Action name="toolsSelect"/>
<Action name="toolsRoom"/>
<Action name="toolsPath"/>
<Action name="toolsText"/>
<Action name="toolsEraser"/>
<Separator/>
</ToolBar>
</kpartplugin>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment