Commit d7e7b037 authored by Tomas Mecir's avatar Tomas Mecir

more porting from qt3 - all Q3* classes are now gone

parent 5c9399d2
......@@ -65,7 +65,7 @@ void CMapCmdElementDelete::redo()
continue;
}
for (CMapPluginBase *plugin = manager->getPluginList()->first(); plugin!=0; plugin = manager->getPluginList()->next())
for (CMapPluginBase *plugin : manager->getPluginList())
plugin->beforeElementDeleted(element);
deleteElement(properties->group(*it),m_delOpsite);
......@@ -86,10 +86,8 @@ void CMapCmdElementDelete::undo()
CMapElement *elm = createElement(group);
elm->loadProperties(group);
for (CMapPluginBase *plugin = manager->getPluginList()->first(); plugin!=0; plugin = manager->getPluginList()->next())
{
for (CMapPluginBase *plugin : manager->getPluginList())
plugin->afterElementUndeleted(elm);
}
}
}
......
......@@ -31,7 +31,6 @@
#include <QQueue>
#include <qtimer.h>
#include <Q3PtrList>
#include "cmapzone.h"
#include "cmappath.h"
......@@ -150,6 +149,9 @@ CMapManager::~CMapManager()
if (commandHistory)
delete commandHistory;
qDeleteAll(m_fileFilter);
m_fileFilter.clear();
kDebug() << "CMapManager::~CMapManager() end";
}
......@@ -184,7 +186,7 @@ void CMapManager::createProfileConfigPanes ()
{
/*KPageDialog *dlg = */(KPageDialog *) cDialogList::self()->getDialog ("profile-prefs");
for (CMapPluginBase *plugin = getPluginList()->first(); plugin!=0; plugin = getPluginList()->next())
for (CMapPluginBase *plugin : pluginList)
plugin->createProfileConfigPanes();
}
......@@ -219,14 +221,14 @@ void CMapManager::createGlobalConfigPanes ()
colorlayout->addWidget (mapColor);
speedwalklayout->addWidget (mapSpeedwalk);
for (CMapPluginBase *plugin = getPluginList()->first(); plugin!=0; plugin = getPluginList()->next())
for (CMapPluginBase *plugin : pluginList)
plugin->createGlobalConfigPanes();
}
QList<CMapPropertiesPaneBase *> CMapManager::createPropertyPanes(elementTyp type,CMapElement *element,QWidget *parent)
{
QList<CMapPropertiesPaneBase *> res;
for (CMapPluginBase *plugin = getPluginList()->first(); plugin!=0; plugin = getPluginList()->next())
for (CMapPluginBase *plugin : pluginList)
res.append(plugin->createPropertyPanes(type, element, parent));
return res;
}
......@@ -235,8 +237,6 @@ QList<CMapPropertiesPaneBase *> CMapManager::createPropertyPanes(elementTyp type
/** This will setup the import/export file filters */
void CMapManager::initFileFilters()
{
m_fileFilter.setAutoDelete(true);
m_fileFilter.append(new CMapFileFilterXML(this));
}
......@@ -246,9 +246,7 @@ void CMapManager::initFileFilters()
void CMapManager::initPlugins()
{
int pluginCount = 0;
toolList.setAutoDelete(false);
toolList.clear();
pluginList.setAutoDelete(false);
pluginList.clear();
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.
......@@ -257,7 +255,7 @@ void CMapManager::initPlugins()
plugin = new CMapPluginStandard (activeView);
pluginList.append (plugin);
for (plugin = pluginList.first(); plugin!=0; plugin = pluginList.next())
for (CMapPluginBase *plugin : pluginList)
{
kDebug() << "Tools in plugin : " << plugin->getToolList()->count();
foreach (CMapToolBase *tool, *plugin->getToolList())
......@@ -273,9 +271,8 @@ void CMapManager::initPlugins()
kDebug() << "Finished loading " << pluginCount << " plugins\n";
kDebug() << "Finished loading " << toolList.count() << " tools\n";
if (toolList.count() > 0)
if (!toolList.isEmpty())
{
currentTool = toolList.first();
currentTool->setChecked(true);
}
......@@ -294,9 +291,9 @@ void CMapManager::initPlugins()
}
/** Used to get a list of the plugins */
Q3PtrList<CMapPluginBase> *CMapManager::getPluginList()
QLinkedList<CMapPluginBase *> CMapManager::getPluginList()
{
return &pluginList;
return pluginList;
}
/** Used to get a pointer to the map data */
......@@ -531,10 +528,8 @@ void CMapManager::eraseMap(void)
if (activeView) activeView->setLevel(NULL);
for (CMapPluginBase *plugin = getPluginList()->first(); plugin!=0; plugin = getPluginList()->next())
{
for (CMapPluginBase *plugin : pluginList)
plugin->mapErased();
}
loginRoom = NULL;
currentRoom = NULL;
......@@ -623,10 +618,8 @@ void CMapManager::createNewMap()
if (activeView->getCurrentlyViewedLevel()==NULL)
activeView->showPosition(loginRoom,true);
for (CMapPluginBase *plugin = getPluginList()->first(); plugin!=0; plugin = getPluginList()->next())
{
for (CMapPluginBase *plugin : pluginList)
plugin->newMapCreated();
}
activeView->changed();
}
......@@ -1022,10 +1015,8 @@ void CMapManager::changedElement(CMapElement *element)
return;
if (!activeView) return;
for (CMapPluginBase *plugin = getPluginList()->first();plugin!=0; plugin= getPluginList()->next())
{
for (CMapPluginBase *plugin : pluginList)
plugin->elementChanged(element);
}
activeView->changedElement(element);
}
......@@ -1194,10 +1185,8 @@ void CMapManager::readOptions()
activeView->readOptions();
for (CMapPluginBase *plugin = getPluginList()->first(); plugin!=0; plugin = getPluginList()->next())
{
for (CMapPluginBase *plugin : pluginList)
plugin->loadConfigOptions();
}
}
/** Used to write the map options */
......@@ -1257,10 +1246,8 @@ void CMapManager::saveGlobalConfig()
gs->setColor ("mapper-color-Edit", mapData->editColor);
gs->setColor ("mapper-color-Current", mapData->currentColor);
for (CMapPluginBase *plugin = getPluginList()->first(); plugin!=0; plugin = getPluginList()->next())
{
for (CMapPluginBase *plugin : pluginList)
plugin->saveConfigOptions();
}
gs->setBool ("mapper-speedwalk-abort-active", mapData->speedwalkAbortActive);
gs->setInt ("mapper-speedwalk-abort-limit", mapData->speedwalkAbortLimit);
......@@ -1688,7 +1675,7 @@ void CMapManager::redrawAllViews(void)
CMapFileFilterBase *CMapManager::nativeFilter(bool isLoad)
{
for (CMapFileFilterBase *filter = m_fileFilter.first();filter!=0;filter=m_fileFilter.next())
for (CMapFileFilterBase *filter : m_fileFilter)
{
if (isLoad && (!filter->supportLoad())) continue;
if ((!isLoad) && (!filter->supportSave())) continue;
......
......@@ -24,7 +24,7 @@
#include <qcolor.h>
#include <qpoint.h>
#include <qobject.h>
#include <q3ptrlist.h>
#include <QLinkedList>
#include <qworkspace.h>
#include <QStringList>
#include <qcursor.h>
......@@ -91,7 +91,7 @@ public:
void eventStringHandler (QString event, int, QString &par1, const QString &);
/** Used to get a list of the plugins */
Q3PtrList<CMapPluginBase> *getPluginList();
QLinkedList<CMapPluginBase *> getPluginList();
/**
* Used to create a new view of the map
* actually returns a CMapView*, dynamic_cast if necessary
......@@ -298,7 +298,7 @@ private:
private:
/** A list of import/export filters */
Q3PtrList<CMapFileFilterBase> m_fileFilter;
QLinkedList<CMapFileFilterBase *> m_fileFilter;
/** If this is true then commands are added to the history, otherwise they are not */
bool m_commandsActive;
/** The filter used to proces mud input/output */
......@@ -312,7 +312,7 @@ private:
/** The current tool */
CMapToolBase *currentTool;
/** A list of all loaded tools */
Q3PtrList<CMapToolBase> toolList;
QLinkedList<CMapToolBase *> toolList;
/** The undo/redo history */
KUndoStack *commandHistory;
/** Points the command history currently being used */
......@@ -330,7 +330,7 @@ private:
/** A pointer to the map data */
CMapData *mapData;
/** A list of all the plugins */
Q3PtrList<CMapPluginBase> pluginList;
QLinkedList<CMapPluginBase *> pluginList;
/** pointer to the speedwalk status indicaor */
DlgSpeedwalkProgress *speedwalkProgressDlg;
......
......@@ -24,8 +24,7 @@
#include <kconfiggroup.h>
#include <qregion.h>
//Added by qt3to4:
#include <Q3PointArray>
#include <QPolygon>
#include <math.h>
#include <stdlib.h>
......@@ -144,7 +143,7 @@ void CMapPath::setCords(void)
void CMapPath::drawArrow(directionTyp dir,QPainter *p,QPoint end)
{
int x1=0,x2=0,y1=0,y2=0;
Q3PointArray cords(3);
QPolygon cords(3);
switch (dir)
{
......
......@@ -320,7 +320,7 @@ void CMapWidget::showContexMenu(QMouseEvent *e)
void CMapWidget::popupMenu(CMapElement *element,QMenu *menu,QPoint pos)
{
if (element) {
for (CMapPluginBase *plugin = mapManager->getPluginList()->first();plugin!=0;plugin = mapManager->getPluginList()->next())
for (CMapPluginBase *plugin : mapManager->getPluginList())
plugin->beforeOpenElementMenu(element);
}
menu->popup(mapToGlobal(pos));
......
......@@ -111,10 +111,8 @@ int CMapFileFilterXML::saveData(const QString &filename)
QString CMapFileFilterXML::saveXMLFile()
{
for (CMapPluginBase *plugin = m_mapManager->getPluginList()->first(); plugin!=0; plugin = m_mapManager->getPluginList()->next())
{
plugin->saveAboutToStart();
}
for (CMapPluginBase *plugin : m_mapManager->getPluginList())
plugin->saveAboutToStart();
// Create XML Document and add root node
QDomDocument doc ("kmudmap");
......@@ -305,10 +303,8 @@ int CMapFileFilterXML::loadXMLData(const QByteArray & buffer)
return -1;
}
for (CMapPluginBase *plugin = m_mapManager->getPluginList()->first(); plugin!=0; plugin = m_mapManager->getPluginList()->next())
{
plugin->loadAboutToStart();
}
for (CMapPluginBase *plugin : m_mapManager->getPluginList())
plugin->loadAboutToStart();
QDomElement docElem = doc.documentElement();
......@@ -640,7 +636,7 @@ void CMapFileFilterXML::savePluginPropertiesForElement(CMapElement *element,QDom
QDomElement pluginsNode = doc->createElement ("plugins");
for (CMapPluginBase *plugin = m_mapManager->getPluginList()->first(); plugin!=0; plugin = m_mapManager->getPluginList()->next())
for (CMapPluginBase *plugin : m_mapManager->getPluginList())
{
QDomElement pNode = doc->createElement(plugin->name());
KMemConfig pluginProperties;
......@@ -676,7 +672,7 @@ void CMapFileFilterXML::loadPluginPropertiesForElement(CMapElement *element,QDom
if (!e.isNull() )
{
for (CMapPluginBase *plugin = m_mapManager->getPluginList()->first(); plugin!=0; plugin = m_mapManager->getPluginList()->next())
for (CMapPluginBase *plugin : m_mapManager->getPluginList())
{
if (plugin->name()==e.tagName())
{
......
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