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 716bc1fe authored by Tomas Mecir's avatar Tomas Mecir

This plug-in doesn't work, let's get rid of it.

parent 9c97d384
......@@ -59,12 +59,6 @@ set(kmuddymapper_PART_SRCS
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
......@@ -76,9 +70,6 @@ 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})
......
......@@ -232,17 +232,6 @@ QList<CMapPropertiesPaneBase *> CMapManager::createPropertyPanes(elementTyp type
return res;
}
/** This method tells the plugins that the mapper wants to add a room to the speedwalk list
* @param room The room to add to the speedwalk list
*/
void CMapManager::addSpeedwalkRoom(CMapRoom *room)
{
for (CMapPluginBase *plugin=getPluginList()->first();plugin!=0; plugin=getPluginList()->next())
{
plugin->addSpeedwalkRoom(room);
}
}
/** This will setup the import/export file filters */
void CMapManager::initFileFilters()
......@@ -253,7 +242,6 @@ void CMapManager::initFileFilters()
}
#include "plugins/standard/cmappluginstandard.h"
#include "plugins/speedwalk/cmappluginspeedwalk.h"
/** Used to create the plugins */
void CMapManager::initPlugins()
......@@ -269,8 +257,6 @@ void CMapManager::initPlugins()
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())
{
......
......@@ -257,11 +257,6 @@ public:
/** Used to repaint all the views */
void redrawAllViews(void);
/** This method tells the plugins that the mapper wants to add a room to the speedwalk list
* @param room The room to add to the speedwalk list
*/
void addSpeedwalkRoom(CMapRoom *room);
/** This method is used to find a element from a list of properties
* @param properties The list of proerties
* @return The element if it's found otherwise NULL */
......
......@@ -68,9 +68,6 @@ public:
virtual void saveConfigOptions(void);
virtual void loadConfigOptions(void);
virtual void mapErased(void);
/** Request that a room be added to the speedwalk list
* @param room The room to be added */
virtual void addSpeedwalkRoom(CMapRoom *) { };
/** This is called when the character or mud profiles change */
virtual void profileChanged(void) { };
/** This method is called when profile data changes */
......
/***************************************************************************
cmapcmdspeedwalkadd.cpp
-------------------
begin : Thu Mar 14 2002
copyright : (C) 2002 by Kmud Developer Team
email : kmud-devel@kmud.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "cmapcmdspeedwalkadd.h"
#include "cmappluginspeedwalk.h"
#include "../../cmapmanager.h"
#include "../../cmaproom.h"
#include "../../cmaplevel.h"
#include <klocale.h>
CMapCmdSpeedwalkAdd::CMapCmdSpeedwalkAdd(CMapPluginSpeedwalk *plugin,CMapRoom *room) : CMapCommand (i18n("Add Room to speedwalk list"))
{
m_plugin = plugin;
m_levelID = room->getLevel()->getLevelID();
m_roomID = room->getRoomID();
}
CMapCmdSpeedwalkAdd::~CMapCmdSpeedwalkAdd()
{
}
void CMapCmdSpeedwalkAdd::redo()
{
CMapLevel *level = m_plugin->getManager()->findLevel(m_levelID);
if (!level) return;
CMapRoom *room = level->findRoom(m_roomID);
if (!room) return;
m_plugin->addSpeedwalkRoomNoCmd(room);
}
void CMapCmdSpeedwalkAdd::undo()
{
CMapLevel *level = m_plugin->getManager()->findLevel(m_levelID);
if (!level) return;
CMapRoom *room = level->findRoom(m_roomID);
if (!room) return;
m_plugin->delSpeedwalkRoomNoCmd(room);
}
/***************************************************************************
cmapcmdspeedwalkadd.h
-------------------
begin : Thu Mar 14 2002
copyright : (C) 2002 by Kmud Developer Team
email : kmud-devel@kmud.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CMAPCMDSPEEDWALKADD_H
#define CMAPCMDSPEEDWALKADD_H
#include "../../cmapcommand.h"
class CMapRoom;
class CMapManager;
class CMapPluginSpeedwalk;
/**
*@author Kmud Developer Team
*/
class CMapCmdSpeedwalkAdd : public CMapCommand
{
public:
CMapCmdSpeedwalkAdd(CMapPluginSpeedwalk *plugin,CMapRoom *room);
~CMapCmdSpeedwalkAdd();
virtual void redo();
virtual void undo();
private:
int m_roomID;
int m_levelID;
CMapPluginSpeedwalk *m_plugin;
};
#endif
/***************************************************************************
cmapcmdspeedwalkremove.cpp
-------------------
begin : Thu Mar 14 2002
copyright : (C) 2002 by Kmud Developer Team
email : kmud-devel@kmud.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "cmapcmdspeedwalkremove.h"
#include "cmappluginspeedwalk.h"
#include "../../cmapmanager.h"
#include "../../cmaproom.h"
#include "../../cmaplevel.h"
#include <klocale.h>
CMapCmdSpeedwalkRemove::CMapCmdSpeedwalkRemove(CMapPluginSpeedwalk *plugin) : CMapCommand (i18n("Remove Room(s) from speedwalk list"))
{
m_plugin = plugin;
m_levelList.clear();
m_roomList.clear();
}
CMapCmdSpeedwalkRemove::~CMapCmdSpeedwalkRemove()
{
}
void CMapCmdSpeedwalkRemove::addRoom(CMapRoom *room)
{
m_levelList.append(room->getLevel()->getLevelID());
m_roomList.append(room->getRoomID());
}
void CMapCmdSpeedwalkRemove::redo()
{
for (unsigned int i=0;i<m_levelList.count();i++)
{
CMapLevel *level = m_plugin->getManager()->findLevel(*m_levelList.at(i));
if (!level) continue;
CMapRoom *room = level->findRoom(*m_roomList.at(i));
if (!room) continue;
m_plugin->delSpeedwalkRoomNoCmd(room,false);
}
m_plugin->updateSpeedwalkList();
}
void CMapCmdSpeedwalkRemove::undo()
{
for (unsigned int i=0;i<m_levelList.count();i++)
{
CMapLevel *level = m_plugin->getManager()->findLevel(*m_levelList.at(i));
if (!level) continue;
CMapRoom *room = level->findRoom(*m_roomList.at(i));
if (!room) continue;
m_plugin->addSpeedwalkRoomNoCmd(room,false);
}
m_plugin->updateSpeedwalkList();
}
/***************************************************************************
cmapcmdspeedwalkremove.h
-------------------
begin : Thu Mar 14 2002
copyright : (C) 2002 by Kmud Developer Team
email : kmud-devel@kmud.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CMAPCMDSPEEDWALKREMOVE_H
#define CMAPCMDSPEEDWALKREMOVE_H
#include "../../cmapcommand.h"
#include <q3valuelist.h>
class CMapRoom;
class CMapManager;
class CMapPluginSpeedwalk;
/**
*@author Kmud Developer Team
*/
class CMapCmdSpeedwalkRemove : public CMapCommand
{
public:
CMapCmdSpeedwalkRemove(CMapPluginSpeedwalk *plugin);
~CMapCmdSpeedwalkRemove();
virtual void redo();
virtual void undo();
void addRoom(CMapRoom *room);
private:
Q3ValueList<int> m_levelList;
Q3ValueList<int> m_roomList;
CMapPluginSpeedwalk *m_plugin;
};
#endif
/***************************************************************************
cmappluginspeedwalk.cpp
-------------------
begin : Mon Aug 6 2001
copyright : (C) 2001 by Kmud Developer Team
email : kmud-devel@kmud.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "cmappluginspeedwalk.h"
#include <qicon.h>
#include <kstandarddirs.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <klocale.h>
#include "dlgmapspeedwalkcontainter.h"
#include "dlgmapspeedwalklist.h"
#include "cmapcmdspeedwalkadd.h"
#include "cmapcmdspeedwalkremove.h"
#include "../../cmapmanager.h"
#include "../../cmaproom.h"
#include "../../cmapview.h"
#include "cglobalsettings.h"
CMapPluginSpeedwalk::CMapPluginSpeedwalk(QObject *parent) : CMapPluginBase(parent)
{
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()));
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()));
view->actionCollection()->addAction("roomAddToSpeedwalk", m_addAction);
m_speedwalkList = NULL;
m_showAction->setEnabled(true);
}
CMapPluginSpeedwalk::~CMapPluginSpeedwalk()
{
}
void CMapPluginSpeedwalk::saveConfigOptions(void)
{
cGlobalSettings *gs = cGlobalSettings::self();
gs->setInt ("mapper-speedwalk-catogrize", m_speedwalkCatogrize);
}
void CMapPluginSpeedwalk::loadConfigOptions(void)
{
cGlobalSettings *gs = cGlobalSettings::self();
m_speedwalkCatogrize = gs->getInt ("mapper-speedwalk-catogrize");
}
int CMapPluginSpeedwalk::getSpeedwalkCatogrize()
{
return m_speedwalkCatogrize;
}
void CMapPluginSpeedwalk::setSpeedwalkCatogrize(int catogry)
{
m_speedwalkCatogrize = catogry;
}
void CMapPluginSpeedwalk::showSpeedwalkList()
{
if (!m_speedwalkList)
{
m_speedwalkList = new DlgMapSpeedwalkContainter(this);
m_speedwalkList->show();
}
}
void CMapPluginSpeedwalk::hideSpeedwalkList()
{
if (m_speedwalkList)
{
delete m_speedwalkList;
m_speedwalkList=NULL;
}
}
/** Used to add a room to the speed walk list */
void CMapPluginSpeedwalk::addSpeedwalkRoom(CMapRoom *room)
{
CMapCmdSpeedwalkAdd *cmd = new CMapCmdSpeedwalkAdd(this,room);
mapManager->addCommand(cmd);
}
/** Used to delete a room from the speed walk list. */
void CMapPluginSpeedwalk::delSpeedwalkRoom(CMapRoom *room)
{
CMapCmdSpeedwalkRemove *cmd = new CMapCmdSpeedwalkRemove(this);
cmd->addRoom(room);
mapManager->addCommand(cmd);
}
/** Used to add a room to the speed walk list */
void CMapPluginSpeedwalk::addSpeedwalkRoomNoCmd(CMapRoom *room,bool update)
{
if (!m_speedwalkRoomList.contains(room))
{
m_speedwalkRoomList.append(room);
}
if (m_speedwalkList && update)
{
m_speedwalkList->getSpeedwalkList()->updateSpeedwalkList(room);
}
}
/** This is called when the character or mud profiles change */
void CMapPluginSpeedwalk::profileChanged(void)
{
m_showAction->setEnabled(true);
}
/** This method is called to recreate the speedwalk list */
void CMapPluginSpeedwalk::updateSpeedwalkList()
{
if (m_speedwalkList)
{
m_speedwalkList->getSpeedwalkList()->updateSpeedwalkList();
}
}
/** Used to delete a room from the speed walk list. */
void CMapPluginSpeedwalk::delSpeedwalkRoomNoCmd(CMapRoom *room,bool update)
{
m_speedwalkRoomList.remove(room);
if (m_speedwalkList && update)
m_speedwalkList->getSpeedwalkList()->updateSpeedwalkList();
}
/** Used to add the room under the point to the speedwalk list */
void CMapPluginSpeedwalk::slotRoomAddToSpeedwalk()
{
addSpeedwalkRoom((CMapRoom *)mapManager->getActiveView()->getSelectedElement());
}
void CMapPluginSpeedwalk::slotViewSpeedwalkList()
{
showSpeedwalkList();
}
/** This is called before a element menu is openend */
void CMapPluginSpeedwalk::beforeOpenElementMenu(CMapElement *element)
{
m_addAction->setEnabled(!m_speedwalkRoomList.contains((CMapRoom*)element));
}
/** This is called before a element is deleted */
void CMapPluginSpeedwalk::beforeElementDeleted(CMapElement *element)
{
if (element->getElementType()==ROOM)
{
delSpeedwalkRoom((CMapRoom *)element);
}
}
/** This is called when a element is changed */
void CMapPluginSpeedwalk::elementChanged(CMapElement *element)
{
if (element->getElementType()==ZONE)
{
if (m_speedwalkList)
{
CMapZone *zone = (CMapZone *)element;
foreach (CMapRoom *room, m_speedwalkRoomList)
{
if (room->getZone()==zone)
{
m_speedwalkList->getSpeedwalkList()->updateSpeedwalkList();
break;
}
}
}
}
if (element->getElementType()==ROOM)
{
if (m_speedwalkList)
{
if (m_speedwalkRoomList.contains((CMapRoom *)element))
m_speedwalkList->getSpeedwalkList()->updateSpeedwalkList((CMapRoom *)element);
}
}
}
void CMapPluginSpeedwalk::mapErased(void)
{
m_speedwalkRoomList.clear();
if (m_speedwalkList)
{
m_speedwalkList->getSpeedwalkList()->updateSpeedwalkList();
}
}
/** This method is used to get a list of new properties for a element
* It will usally be called when saving map data to file
* @param element The element being saved
* @param properties When method exits this should contain the new properties
*/
void CMapPluginSpeedwalk::saveElementProperties(CMapElement *element,KMemConfig *properties)
{
if (element->getElementType()==ROOM)
{
if (m_speedwalkRoomList.contains((CMapRoom *)element))
{
properties->group("Properties").writeEntry("SpeedwalkRoom","Yes");
}
}
}
/** This method is used to update an element with the properties load from a file
* It will usally be called when loading map data to file
* @param element The element being loaded
* @param properties The properties being loaded from the file
*/
void CMapPluginSpeedwalk::loadElementProperties(CMapElement *element,KMemConfig *properties)
{
if (element->getElementType()==ROOM && properties->group("Properties").hasKey("SpeedwalkRoom"))
{
addSpeedwalkRoomNoCmd((CMapRoom *)element);
}
}
/***************************************************************************
cmappluginspeedwalk.h
-------------------
begin : Mon Aug 6 2001
copyright : (C) 2001 by Kmud Developer Team
email : kmud-devel@kmud.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CMAPPLUGINSPEEDWALK_H
#define CMAPPLUGINSPEEDWALK_H
#include "../../cmappluginbase.h"
#include <QList>
class CMapManager;
class CMapRoom;
class CMapElement;
class DlgMapSpeedwalkContainter;
/**This plugin provides the speedwalk list
*@author Kmud Developer Team
*/
class CMapPluginSpeedwalk : public CMapPluginBase
{
Q_OBJECT
public:
CMapPluginSpeedwalk(QObject *parent);
~CMapPluginSpeedwalk();
/** This is called before a element menu is openend */
virtual void beforeOpenElementMenu(CMapElement *element);
/** This is called before a element is deleted */
virtual void beforeElementDeleted(CMapElement *element);
/** This is called when a element is changed */
virtual void elementChanged(CMapElement *element);
/** Used to hide the speedwalk list */
void hideSpeedwalkList();
/** Used to display the speedwalk list
* actually returns DlgMapSpeedwalkList*, dynamic_cast if necessary
*/
void showSpeedwalkList();
int getSpeedwalkCatogrize();
void setSpeedwalkCatogrize(int catogry);
void saveConfigOptions(void);
void loadConfigOptions(void);
virtual void mapErased(void);
/** Used to add a room to the speed walk list */
void addSpeedwalkRoom(CMapRoom *room);
/** Used to delete a room from the speed walk list. */
void delSpeedwalkRoom(CMapRoom *room);
/** Used to add a room to the speed walk list */
void addSpeedwalkRoomNoCmd(CMapRoom *room,bool update = true);
/** Used to delete a room from the speed walk list. */
void delSpeedwalkRoomNoCmd(CMapRoom *room,bool update = true);
/** This method is called to recreate the speedwalk list */
void updateSpeedwalkList();
/** This is called when the character or mud profiles change */
void profileChanged(void);
/** This method is used to get a list of new properties for a element
* It will usally be called when saving map data to file
* @param element The element being saved
* @param properties When method exits this should contain the new properties
*/
void saveElementProperties(CMapElement *element,KMemConfig *properties);
/** This method is used to update an element with the properties load from a file
* It will usally be called when loading map data to file
* @param element The element being loaded
* @param properties The properties being loaded from the file
*/
void loadElementProperties(CMapElement *element,KMemConfig *properties);
QList<CMapRoom *> *getSpeedwalkRoomList() { return &m_speedwalkRoomList; }
private:
/** Used to store a list of rooms in the speedwalk list */
QList<CMapRoom *> m_speedwalkRoomList;
/** Used to say what catogery is being used to display the speed walk list */
int m_speedwalkCatogrize;
/** The speedwalk list dialog */
DlgMapSpeedwalkContainter *m_speedwalkList;
/** This action is used to add a room to the speedwalk list */
KAction *m_addAction;
/** This action is used to show the speedwalk list */
KAction *m_showAction;
private slots:
void slotViewSpeedwalkList();
void slotRoomAddToSpeedwalk();
};