|
From: <cn...@us...> - 2020-10-25 17:59:49
|
Revision: 1065
http://sourceforge.net/p/seq/svn/1065
Author: cn187
Date: 2020-10-25 17:59:46 +0000 (Sun, 25 Oct 2020)
Log Message:
-----------
Replace Q3PtrDict with QHash
Modified Paths:
--------------
showeq/branches/pre_6_0_beta/src/guildlist.cpp
showeq/branches/pre_6_0_beta/src/guildlist.h
showeq/branches/pre_6_0_beta/src/interface.cpp
showeq/branches/pre_6_0_beta/src/interface.h
showeq/branches/pre_6_0_beta/src/packetinfo.h
showeq/branches/pre_6_0_beta/src/packetstream.cpp
showeq/branches/pre_6_0_beta/src/packetstream.h
showeq/branches/pre_6_0_beta/src/spawnlist.cpp
showeq/branches/pre_6_0_beta/src/spawnlist.h
showeq/branches/pre_6_0_beta/src/spawnlist2.cpp
showeq/branches/pre_6_0_beta/src/spawnlist2.h
Modified: showeq/branches/pre_6_0_beta/src/guildlist.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/guildlist.cpp 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/guildlist.cpp 2020-10-25 17:59:46 UTC (rev 1065)
@@ -150,13 +150,11 @@
QWidget* parent, const char* name)
: SEQWindow("GuildList", "ShowEQ - Guild Member List", parent, name),
m_player(player),
- m_guildShell(guildShell),
- m_guildListItemDict(709),
+ m_guildShell(guildShell),
+ m_guildListItemDict(),
m_menu(0),
m_membersOn(0)
{
- m_guildListItemDict.setAutoDelete(false);
-
// get whether to show offline guildmates or not
m_showOffline = pSEQPrefs->getPrefBool("ShowOffline", preferenceName(),
false);
@@ -309,7 +307,7 @@
void GuildListWindow::updated(const GuildMember* member)
{
- GuildListItem* memberItem = m_guildListItemDict.find((void*)member);
+ GuildListItem* memberItem = m_guildListItemDict.value((void*)member, nullptr);
if (memberItem)
{
@@ -340,10 +338,7 @@
if (bRemove)
{
// remove the item from the item dictionary
- m_guildListItemDict.remove((void*)member);
-
- // delete the item
- delete memberItem;
+ delete m_guildListItemDict.take((void*)member);
}
else
{
@@ -477,6 +472,7 @@
m_membersOn = 0;
// clear out the guild list item dictionary
+ qDeleteAll(m_guildListItemDict);
m_guildListItemDict.clear();
// clear the guild list contents
Modified: showeq/branches/pre_6_0_beta/src/guildlist.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/guildlist.h 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/guildlist.h 2020-10-25 17:59:46 UTC (rev 1065)
@@ -34,7 +34,7 @@
#include "seqlistview.h"
#include <Q3ListView>
-#include <Q3PtrDict>
+#include <QHash>
#include <QString>
#include <QLabel>
#include <QMenu>
@@ -128,7 +128,7 @@
QLabel* m_guildName;
QLabel* m_guildTotals;
SEQListView* m_guildList;
- Q3PtrDict<GuildListItem> m_guildListItemDict;
+ QHash<void*, GuildListItem*> m_guildListItemDict;
QMenu* m_menu;
QAction* m_action_guildList_Cols[tGuildListColMaxCols];
Modified: showeq/branches/pre_6_0_beta/src/interface.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/interface.cpp 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/interface.cpp 2020-10-25 17:59:46 UTC (rev 1065)
@@ -141,7 +141,7 @@
m_unknownZoneLog(0),
m_opcodeMonitorLog(0),
m_selectedSpawn(0),
- m_windowsMenus(11),
+ m_windowsMenus(),
m_compass(0),
m_expWindow(0),
m_combatWindow(0),
@@ -152,10 +152,6 @@
// disable the dock menu
setDockMenuEnabled(false);
- // make sure the windows menus list doesn't autodelete, because its
- // contents will be deleted by the respective owners.
- m_windowsMenus.setAutoDelete(false);
-
setCentralWidget(new QWidget(this, "filler"));
setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum, false));
@@ -6371,7 +6367,7 @@
void EQInterface::removeWindowMenu(SEQWindow* window)
{
// find the windows menu id
- QAction* menuAction = m_windowsMenus.find((void*)window);
+ QAction* menuAction = m_windowsMenus.value((void*)window, nullptr);
// if the window had a menu, then remove it
if (menuAction)
@@ -6379,7 +6375,7 @@
m_windowMenu->removeAction(menuAction);
// remove the item from the list
- m_windowsMenus.remove(window);
+ delete m_windowsMenus.take(window);
}
}
Modified: showeq/branches/pre_6_0_beta/src/interface.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/interface.h 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/interface.h 2020-10-25 17:59:46 UTC (rev 1065)
@@ -42,7 +42,6 @@
#include <Q3TabDialog>
#include <QSpinBox>
#include <QHash>
-#include <Q3PtrDict>
#include <Q3TextStream>
#include "everquest.h"
#include "spawnlist.h"
@@ -411,7 +410,7 @@
QMenu* m_terminalShowUserFilterMenu;
QMenu* m_terminalHideUserFilterMenu;
QMenu* m_windowMenu;
- Q3PtrDict<QAction> m_windowsMenus;
+ QHash<void*, QAction*> m_windowsMenus;
QMenu* m_filterZoneDataMenu;
CompassFrame* m_compass;
Modified: showeq/branches/pre_6_0_beta/src/packetinfo.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/packetinfo.h 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/packetinfo.h 2020-10-25 17:59:46 UTC (rev 1065)
@@ -28,7 +28,6 @@
#include <cstdint>
#include <QObject>
-#include <Q3PtrDict>
#include <Q3PtrList>
#include <QHash>
#include <QByteArray>
Modified: showeq/branches/pre_6_0_beta/src/packetstream.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/packetstream.cpp 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/packetstream.cpp 2020-10-25 17:59:46 UTC (rev 1065)
@@ -79,7 +79,7 @@
QObject* parent, const char* name)
: QObject(parent, name),
m_opcodeDB(opcodeDB),
- m_dispatchers(61), // prime number that should be plenty large
+ m_dispatchers(),
m_streamid(streamid),
m_dir(dir),
m_packetCount(0),
@@ -96,7 +96,6 @@
m_decodeKey(0),
m_validKey(true)
{
- m_dispatchers.setAutoDelete(true);
}
////////////////////////////////////////////////////
@@ -104,6 +103,8 @@
EQPacketStream::~EQPacketStream()
{
reset();
+ qDeleteAll(m_dispatchers);
+ m_dispatchers.clear();
}
////////////////////////////////////////////////////
@@ -151,7 +152,7 @@
}
// attempt to find an existing dispatch
- EQPacketDispatch* dispatch = m_dispatchers.find((void*)payload);
+ EQPacketDispatch* dispatch = m_dispatchers.value((void*)payload, nullptr);
// if no existing dispatch was found, create one
if (!dispatch)
@@ -438,7 +439,7 @@
#endif
// find the dispather for the payload
- dispatch = m_dispatchers.find((void*)payload);
+ dispatch = m_dispatchers.value((void*)payload, nullptr);
// if found, dispatch
if (dispatch)
Modified: showeq/branches/pre_6_0_beta/src/packetstream.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/packetstream.h 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/packetstream.h 2020-10-25 17:59:46 UTC (rev 1065)
@@ -25,6 +25,7 @@
#define _PACKETSTREAM_H_
#include <QObject>
+#include <QHash>
#include <map>
#include "packetcommon.h"
@@ -134,7 +135,7 @@
EQPacketOPCodeDB& m_opcodeDB;
- Q3PtrDict<EQPacketDispatch> m_dispatchers;
+ QHash<void*, EQPacketDispatch*> m_dispatchers;
EQStreamID m_streamid;
uint8_t m_dir;
int m_packetCount;
Modified: showeq/branches/pre_6_0_beta/src/spawnlist.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/spawnlist.cpp 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/spawnlist.cpp 2020-10-25 17:59:46 UTC (rev 1065)
@@ -394,7 +394,7 @@
if (cat->isFiltered(filterStr, level))
{
// retrieve the list item associated with the category
- catlitem = m_categoryListItems.find((void*)cat);
+ catlitem = m_categoryListItems.value((void*)cat, nullptr);
// We have a good category, add spawn as it's child
j = new SpawnListItem(catlitem);
@@ -498,7 +498,7 @@
for (cat = catUpdateList.first(); cat != 0; cat = catUpdateList.next())
{
// retrieve the category list item
- SpawnListItem* catlitem = m_categoryListItems.find((void*)cat);
+ SpawnListItem* catlitem = m_categoryListItems.value((void*)cat, nullptr);
// update the list items title
catlitem->updateTitle(cat->name());
@@ -763,7 +763,7 @@
void SpawnList::delCategory(const Category* cat)
{
// retrieve the list item associated with the category
- SpawnListItem* litem = m_categoryListItems.find((void*)cat);
+ SpawnListItem* litem = m_categoryListItems.value((void*)cat, nullptr);
// if there's a list item associated with this category, clean it out
if (litem != NULL)
@@ -789,10 +789,7 @@
}
// remove the item from the category list
- m_categoryListItems.remove((void*)cat);
-
- // delete the list item
- delete litem;
+ delete m_categoryListItems.take((void*)cat);
}
}
@@ -799,6 +796,7 @@
void SpawnList::clearedCategories(void)
{
// clear out the list of category list items
+ qDeleteAll(m_categoryListItems);
m_categoryListItems.clear();
// clear out the list
@@ -855,13 +853,14 @@
if (slitem->parent() == NULL)
{
cat = NULL;
- Q3PtrDictIterator<SpawnListItem> it(m_categoryListItems);
-
- for (it.toFirst(); it.current() != NULL; ++it)
+ QHash<void*, SpawnListItem*>::iterator it;
+
+ for (it = m_categoryListItems.begin();
+ it != m_categoryListItems.end() && *it != NULL; ++it)
{
- if (slitem == it.current())
+ if (slitem == *it)
{
- cat = (const Category*)it.currentKey();
+ cat = (const Category*)it.key();
break;
}
}
@@ -896,7 +895,7 @@
ItemConstIterator it(itemMap);
const Item* item;
SpawnListItem* litem;
- SpawnListItem* catlitem = m_categoryListItems.find((void*)cat);
+ SpawnListItem* catlitem = m_categoryListItems.value((void*)cat, nullptr);
// iterate over all spawn types
for (uint8_t i = 0; i < (sizeof(types) / sizeof(spawnItemType)); i++)
@@ -1002,7 +1001,7 @@
if (cat->isFiltered(filterStr, level))
{
// retrieve the category list item
- catlitem = m_categoryListItems.find((void*)cat);
+ catlitem = m_categoryListItems.value((void*)cat, nullptr);
// yes, add it
litem = new SpawnListItem(catlitem);
@@ -1022,7 +1021,7 @@
// update the counts
for(cat = cit.toFirst(); cat != NULL; cat = ++cit)
{
- catlitem = m_categoryListItems.find((void*)cat);
+ catlitem = m_categoryListItems.value((void*)cat, nullptr);
catlitem->updateTitle(cat->name());
}
}
@@ -1141,12 +1140,13 @@
// find that in m_categoryList
if (j)
{
- Q3PtrDictIterator<SpawnListItem> it(m_categoryListItems);
-
- for (it.toFirst(); it.current() != NULL; ++it)
+ QHash<void*, SpawnListItem*>::iterator it;
+
+ for (it = m_categoryListItems.begin();
+ it != m_categoryListItems.end() && *it != NULL; ++it)
{
- if (j == it.current())
- return (const Category*)it.currentKey();
+ if (j == *it)
+ return (const Category*)it.key();
}
}
}
Modified: showeq/branches/pre_6_0_beta/src/spawnlist.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/spawnlist.h 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/spawnlist.h 2020-10-25 17:59:46 UTC (rev 1065)
@@ -46,7 +46,7 @@
#include <Q3ValueList>
#include <Q3ListView>
-#include <Q3PtrDict>
+#include <QHash>
#include <Q3TextStream>
#include <QMenu>
@@ -142,7 +142,7 @@
SpawnShell* m_spawnShell;
// category pointer used as keys to look up the associated SpawnListItem
- Q3PtrDict<SpawnListItem> m_categoryListItems;
+ QHash<void*, SpawnListItem*> m_categoryListItems;
SpawnListMenu* m_menu;
Modified: showeq/branches/pre_6_0_beta/src/spawnlist2.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/spawnlist2.cpp 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/spawnlist2.cpp 2020-10-25 17:59:46 UTC (rev 1065)
@@ -47,11 +47,9 @@
m_currentCategory(NULL),
m_selectedItem(NULL),
m_menu(NULL),
- m_spawnListItemDict(709),
+ m_spawnListItemDict(),
m_immediateUpdate(true)
{
- m_spawnListItemDict.setAutoDelete(false);
-
// get whether to keep the list sorted or not
m_keepSorted = pSEQPrefs->getPrefBool("KeepSorted", preferenceName(), false);
@@ -198,7 +196,7 @@
SpawnListItem* SpawnListWindow2::find(const Item* item)
{
- return m_spawnListItemDict.find((void*)item);
+ return m_spawnListItemDict.value((void*)item, nullptr);
}
QString SpawnListWindow2::filterString(const Item* item)
@@ -272,10 +270,8 @@
// delete the list item
if (litem != NULL)
{
- m_spawnListItemDict.remove((void*)item);
+ delete m_spawnListItemDict.take((void*)item);
- delete litem;
-
updateCount();
}
@@ -326,9 +322,7 @@
// delete the item (if it already existed)
if (litem != NULL)
{
- m_spawnListItemDict.remove((void*)item);
-
- delete litem;
+ delete m_spawnListItemDict.take((void*)item);
// update the displayed count
updateCount();
@@ -344,9 +338,7 @@
// delete the item (if it already existed)
if (litem != NULL)
{
- m_spawnListItemDict.remove((void*)item);
-
- delete litem;
+ delete m_spawnListItemDict.take((void*)item);
// update the displayed count
updateCount();
@@ -420,6 +412,7 @@
void SpawnListWindow2::clear(void)
{
// clear out the spawn list item dictionary
+ qDeleteAll(m_spawnListItemDict);
m_spawnListItemDict.clear();
// clear the spawn list contents
@@ -631,9 +624,7 @@
// delete the item (if it already existed)
if (litem != NULL)
{
- m_spawnListItemDict.remove((void*)item);
-
- delete litem;
+ delete m_spawnListItemDict.take((void*)item);
}
// nothing more to do for this item
@@ -651,9 +642,7 @@
// delete the item (if it already existed)
if (litem != NULL)
{
- m_spawnListItemDict.remove((void*)item);
-
- delete litem;
+ delete m_spawnListItemDict.take((void*)item);
}
// nothing more to do for this item
Modified: showeq/branches/pre_6_0_beta/src/spawnlist2.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/spawnlist2.h 2020-10-25 17:24:10 UTC (rev 1064)
+++ showeq/branches/pre_6_0_beta/src/spawnlist2.h 2020-10-25 17:59:46 UTC (rev 1065)
@@ -23,7 +23,7 @@
#ifndef SPAWNLIST2_H
#define SPAWNLIST2_H
-#include <Q3PtrDict>
+#include <QHash>
#include <QMenu>
#include "seqwindow.h"
@@ -132,8 +132,8 @@
QLineEdit* m_totalSpawns;
// index dictionary for retrieving SpawnListItems by Item
- Q3PtrDict<SpawnListItem> m_spawnListItemDict;
-
+ QHash<void*, SpawnListItem*> m_spawnListItemDict;
+
// timer used
QTimer* m_timer;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|