|
From: <cn...@us...> - 2020-11-02 01:42:01
|
Revision: 1091
http://sourceforge.net/p/seq/svn/1091
Author: cn187
Date: 2020-11-02 01:41:58 +0000 (Mon, 02 Nov 2020)
Log Message:
-----------
Replace compatibility/deprecated functions with Qt4 equivalents
Modified Paths:
--------------
showeq/branches/pre_6_0_beta/src/gdbmconv.cpp
showeq/branches/pre_6_0_beta/src/group.cpp
showeq/branches/pre_6_0_beta/src/guild.cpp
showeq/branches/pre_6_0_beta/src/guildlist.cpp
showeq/branches/pre_6_0_beta/src/guildshell.cpp
showeq/branches/pre_6_0_beta/src/interface.cpp
showeq/branches/pre_6_0_beta/src/logger.cpp
showeq/branches/pre_6_0_beta/src/main.cpp
showeq/branches/pre_6_0_beta/src/map.cpp
showeq/branches/pre_6_0_beta/src/mapcore.cpp
showeq/branches/pre_6_0_beta/src/mapicon.cpp
showeq/branches/pre_6_0_beta/src/messagefilter.cpp
showeq/branches/pre_6_0_beta/src/messagefilterdialog.cpp
showeq/branches/pre_6_0_beta/src/messages.cpp
showeq/branches/pre_6_0_beta/src/messageshell.cpp
showeq/branches/pre_6_0_beta/src/messagewindow.cpp
showeq/branches/pre_6_0_beta/src/packetinfo.h
Modified: showeq/branches/pre_6_0_beta/src/gdbmconv.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/gdbmconv.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/gdbmconv.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -75,7 +75,7 @@
dbName += ".dbm";
// attempt to open the database for write
- if ((dbf = gdbm_open((char*)(const char*)dbName, 0, GDBM_WRCREAT, 0644, 0))
+ if ((dbf = gdbm_open(dbName.toAscii().data(), 0, GDBM_WRCREAT, 0644, 0))
!= NULL)
{
// if successful, then attempt to insert or replace data under key
@@ -83,10 +83,10 @@
{
case 0:
case 1:
- success = true;
- break;
+ success = true;
+ break;
default:
- displayGDBMError("Insert: gdbm_store", (const char*)dbName);
+ displayGDBMError("Insert: gdbm_store", dbName.toAscii().data());
}
// close the database
@@ -95,8 +95,8 @@
else
{
// display GDBM Error
- displayGDBMError("Insert: gdbm_open", (const char*)dbName);
-
+ displayGDBMError("Insert: gdbm_open", dbName.toAscii().data());
+
// attempt to diagnose the open for write failure
diagFileWriteFail(dbName);
}
@@ -116,7 +116,7 @@
dbName += ".dbm";
// attempt to open the database for write
- if ((dbf = gdbm_open((char*)(const char*)dbName, 0, GDBM_WRITER, 0644, 0))
+ if ((dbf = gdbm_open(dbName.toAscii().data(), 0, GDBM_WRITER, 0644, 0))
!= NULL)
{
// if successful, then attempt to insert or replace data under key
@@ -123,7 +123,7 @@
if (gdbm_delete(dbf, key_) == 0)
success = true;
else
- displayGDBMError("Delete: gdbm_delete", (const char*)dbName);
+ displayGDBMError("Delete: gdbm_delete", dbName.toAscii().data());
// close the database
gdbm_close(dbf);
@@ -131,8 +131,8 @@
else
{
// display GDBM Error
- displayGDBMError("Delete: gdbm_open", (const char*)dbName);
-
+ displayGDBMError("Delete: gdbm_open", dbName.toAscii().data());
+
// attempt to diagnose the open for write failure
diagFileWriteFail(dbName);
}
@@ -153,7 +153,7 @@
dbName += ".dbm";
// attempt to open the database for read
- if ((dbf = gdbm_open((char*)(const char*)dbName, 0, GDBM_READER,
+ if ((dbf = gdbm_open(dbName.toAscii().data(), 0, GDBM_READER,
0644, 0)) != NULL)
{
// attempt to retrieve the entry from the database
@@ -188,7 +188,7 @@
dbName += ".dbm";
// attmpet to open the database for read
- if ((dbf = gdbm_open((char*)(const char*)dbName, 0, GDBM_READER,
+ if ((dbf = gdbm_open(dbName.toAscii().data(), 0, GDBM_READER,
0644, 0)) != NULL)
{
// attempt to retrieve the entry from the database
@@ -208,7 +208,7 @@
else
{
// display the notice (this isn't necessarily bad)
- displayGDBMError("GetEntry: gdbm_open", (const char*)dbName, "Notice");
+ displayGDBMError("GetEntry: gdbm_open", dbName.toAscii().data(), "Notice");
// attempt to diagnose the open for read failure
diagFileReadFail(dbName);
@@ -227,7 +227,7 @@
dbName += ".dbm";
// attempt to open the database for write
- if ((dbf = gdbm_open((char*)(const char*)dbName, 0, GDBM_WRITER, 0644, 0))
+ if ((dbf = gdbm_open(dbName.toAscii().data(), 0, GDBM_WRITER, 0644, 0))
!= NULL)
{
// if successful, then attempt to insert or replace data under key
@@ -234,7 +234,7 @@
if (gdbm_reorganize(dbf) == 0)
success = true;
else
- displayGDBMError("Reorganize: gdbm_reorganize", (const char*)dbName);
+ displayGDBMError("Reorganize: gdbm_reorganize", dbName.toAscii().data());
// close the database
gdbm_close(dbf);
@@ -242,7 +242,7 @@
else
{
// display GDBM Error
- displayGDBMError("Reorganize: gdbm_open", (const char*)dbName);
+ displayGDBMError("Reorganize: gdbm_open", dbName.toAscii().data());
// attempt to diagnose the open for write failure
diagFileWriteFail(dbName);
@@ -311,13 +311,13 @@
dbName += ".dbm";
// open the specified DB file for reading
- m_dbf = gdbm_open((char*)(const char*)dbName, 0, GDBM_READER,
+ m_dbf = gdbm_open(dbName.toAscii().data(), 0, GDBM_READER,
0644, 0);
// if failed, then nothing to read
if (m_dbf == NULL)
{
- displayGDBMError("GetFirstKey: gdbm_open", (const char*)dbName);
+ displayGDBMError("GetFirstKey: gdbm_open", dbName.toAscii().data());
// attempt to diagnose the open for read failure
diagFileReadFail(dbName);
Modified: showeq/branches/pre_6_0_beta/src/group.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/group.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/group.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -30,15 +30,16 @@
#include <QTextStream>
-GroupMgr::GroupMgr(SpawnShell* spawnShell,
- Player* player,
- QObject* parent, const char* name)
- : QObject( parent, name),
+GroupMgr::GroupMgr(SpawnShell* spawnShell,
+ Player* player,
+ QObject* parent, const char* name)
+ : QObject(parent),
m_spawnShell(spawnShell),
m_player(player),
m_memberCount(0),
m_membersInZoneCount(0)
{
+ setObjectName(name);
for (int i=0; i<MAX_GROUP_MEMBERS; i++)
{
m_members[i] = new GroupMember();
@@ -156,7 +157,7 @@
for(uint32_t i = 0; i < MAX_GROUP_MEMBERS; i++)
{
if(!m_members[i]->m_name.isEmpty())
- seqDebug("GroupMgr::groupUpdate '%s'", m_members[i]->m_name.latin1());
+ seqDebug("GroupMgr::groupUpdate '%s'", m_members[i]->m_name.toLatin1().data());
}
#endif
}
@@ -197,7 +198,7 @@
const groupDisbandStruct* gmem = (const groupDisbandStruct*)data;
// If we're disbanding, reset counters and clear member slots
- if(!strcmp(gmem->membername, m_player->name()))
+ if(!strcmp(gmem->membername, m_player->name().toAscii().data()))
{
m_memberCount = 0;
m_membersInZoneCount = 0;
Modified: showeq/branches/pre_6_0_beta/src/guild.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/guild.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/guild.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -35,8 +35,9 @@
#include <QTextStream>
GuildMgr::GuildMgr(QString fn, QObject* parent, const char* name)
- : QObject(parent, name)
+ : QObject(parent)
{
+ setObjectName(name);
guildsFileName = fn;
readGuildList();
@@ -66,7 +67,7 @@
if (guildsfile.exists()) {
if (!guildsfile.remove()) {
seqWarn("GuildMgr: Could not remove old %s, unable to replace with server data!",
- guildsFileName.latin1());
+ guildsFileName.toLatin1().data());
return;
}
}
@@ -73,7 +74,7 @@
if(!guildsfile.open(QIODevice::WriteOnly))
seqWarn("GuildMgr: Could not open %s for writing, unable to replace with server data!",
- guildsFileName.latin1());
+ guildsFileName.toLatin1().data());
QDataStream guildDataStream(&guildsfile);
@@ -122,9 +123,9 @@
{
char szGuildName[64] = {0};
- strcpy(szGuildName, it->second.latin1());
+ strcpy(szGuildName, it->second.toLatin1().data());
//seqDebug("GuildMgr::writeGuildList - add guild '%s' (%d)", szGuildName, it->first);
- guildDataStream.writeRawBytes(szGuildName, sizeof(szGuildName));
+ guildDataStream.writeRawData(szGuildName, sizeof(szGuildName));
}
guildsfile.close();
@@ -142,7 +143,7 @@
{
char szGuildName[64] = {0};
- guildsfile.readBlock(szGuildName, sizeof(szGuildName));
+ guildsfile.read(szGuildName, sizeof(szGuildName));
//seqDebug("GuildMgr::readGuildList - read guild '%s'", szGuildName);
m_guildMap.push_back(QString::fromUtf8(szGuildName));
}
@@ -151,7 +152,7 @@
seqInfo("GuildMgr: Guildsfile loaded");
}
else
- seqWarn("GuildMgr: Could not load guildsfile, %s", (const char*)guildsFileName);
+ seqWarn("GuildMgr: Could not load guildsfile, %s", guildsFileName.toAscii().data());
}
void GuildMgr::guildList2text(QString fn)
@@ -162,7 +163,7 @@
if (guildsfile.exists()) {
if (!guildsfile.remove()) {
seqWarn("GuildMgr: Could not remove old %s, unable to process request!",
- fn.latin1());
+ fn.toLatin1().data());
return;
}
}
@@ -169,7 +170,7 @@
if (!guildsfile.open(QIODevice::WriteOnly)) {
seqWarn("GuildMgr: Could not open %s for writing, unable to process request!",
- fn.latin1());
+ fn.toLatin1().data());
return;
}
@@ -187,10 +188,10 @@
void GuildMgr::listGuildInfo()
{
- for (unsigned int i = 0; i < m_guildMap.size(); i++)
+ for (unsigned int i = 0; i < m_guildMap.size(); i++)
{
if (!m_guildMap[i].isNull())
- seqInfo("%d\t%s", i, (const char*)m_guildMap[i]);
+ seqInfo("%d\t%s", i, m_guildMap[i].toAscii().data());
}
}
Modified: showeq/branches/pre_6_0_beta/src/guildlist.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/guildlist.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/guildlist.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -165,11 +165,12 @@
m_showAlts = pSEQPrefs->getPrefBool("ShowAlts", preferenceName(), true);
QBoxLayout* vLayout = new QVBoxLayout(boxLayout());
- QHBoxLayout* hLayout= new QHBoxLayout(vLayout);
+ QHBoxLayout* hLayout= new QHBoxLayout();
+ vLayout->addLayout(hLayout);
// Guild Name
m_guildName = new QLabel("Guild", this);
- m_guildName->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::SingleLine);
+ m_guildName->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
m_guildName->setFrameShape(LineEditPanel);
m_guildName->setFrameShadow(Sunken);
m_guildName->setMinimumWidth(50);
@@ -179,7 +180,7 @@
// Guild Totals
m_guildTotals = new QLabel("", this);
- m_guildTotals->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::SingleLine);
+ m_guildTotals->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
m_guildTotals->setFrameShape(LineEditPanel);
m_guildTotals->setFrameShadow(Sunken);
m_guildTotals->setMinimumWidth(30);
@@ -443,7 +444,7 @@
bool ok = false;
// get a new font
newFont = QFontDialog::getFont(&ok, font(),
- this, caption() + " Font");
+ this, windowTitle() + " Font");
// if the user entered a font and clicked ok, set the windows font
@@ -455,15 +456,14 @@
{
bool ok = false;
- QString captionText =
- QInputDialog::getText("ShowEQ Guild List Window Caption",
- "Enter caption for the Guild List Window:",
- QLineEdit::Normal, caption(),
- &ok, this);
-
+ QString captionText =
+ QInputDialog::getText(this, "ShowEQ Guild List Window Caption",
+ "Enter caption for the Guild List Window:",
+ QLineEdit::Normal, windowTitle());
+
// if the user entered a caption and clicked ok, set the windows caption
if (ok)
- setCaption(captionText);
+ setWindowTitle(captionText);
}
void GuildListWindow::clear(void)
Modified: showeq/branches/pre_6_0_beta/src/guildshell.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/guildshell.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/guildshell.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -173,10 +173,11 @@
//----------------------------------------------------------------------
// GuildShell implementation
GuildShell::GuildShell(ZoneMgr* zoneMgr, QObject* parent, const char* name)
- : QObject(parent, name),
+ : QObject(parent),
m_maxNameLength(0),
m_zoneMgr(zoneMgr)
{
+ setObjectName(name);
}
GuildShell::~GuildShell()
@@ -203,13 +204,13 @@
QString format("%1 %2 %3 %4%5%6%7 %8 %9");
QString dateFormat("ddd MMM dd hh:mm:ss yyyy");
-
+
// calculate the maximum class name width
- size_t maxClassNameLength = 0;
+ int maxClassNameLength = 0;
for (uint8_t i = 1; i <= PLAYER_CLASSES; i++)
if (classString(i).length() > maxClassNameLength)
maxClassNameLength = classString(i).length();
-
+
out << "Guild has " << m_members.count() << " members: " << endl;
int nameFieldWidth = - m_maxNameLength;
@@ -291,7 +292,7 @@
// insert the new member into the dictionary
m_members.insert(member->name(), member);
-
+
// check for new longest member name
if (member->name().length() > m_maxNameLength)
m_maxNameLength = member->name().length();
Modified: showeq/branches/pre_6_0_beta/src/interface.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/interface.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/interface.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -103,7 +103,7 @@
/* The main interface widget */
EQInterface::EQInterface(DataLocationMgr* dlm,
QWidget * parent, const char *name)
- : Q3MainWindow (parent, name),
+ : Q3MainWindow (parent),
m_player(0),
m_dataLocationMgr(dlm),
m_mapMgr(0),
@@ -147,13 +147,17 @@
m_messageFilterDialog(0),
m_guildListWindow(0)
{
+ setObjectName(name);
+
// disable the dock menu
setDockMenuEnabled(false);
-
- setCentralWidget(new QWidget(this, "filler"));
-
- setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum, false));
+ setCentralWidget(new QWidget(this));
+
+ QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ sizePolicy.setHeightForWidth(false);
+ setSizePolicy(sizePolicy);
+
for (int l = 0; l < maxNumMaps; l++)
m_map[l] = 0;
@@ -219,8 +223,8 @@
fileInfo2 = m_dataLocationMgr->findExistingFile(".", fileName2);
- m_packet = new EQPacket(fileInfo.absFilePath(),
- fileInfo2.absFilePath(),
+ m_packet = new EQPacket(fileInfo.absoluteFilePath(),
+ fileInfo2.absoluteFilePath(),
pSEQPrefs->getPrefInt("ArqSeqGiveUp", section, 512),
pSEQPrefs->getPrefString("Device", section, "eth0"),
pSEQPrefs->getPrefString("IP", section,
@@ -253,7 +257,7 @@
fileInfo = m_dataLocationMgr->findExistingFile(".", fileName);
- m_spells = new Spells(fileInfo.absFilePath());
+ m_spells = new Spells(fileInfo.absoluteFilePath());
// Create the EQStr storage
m_eqStrings = new EQStr();
@@ -267,7 +271,7 @@
fileInfo = m_dataLocationMgr->findWriteFile("tmp", fileName);
- m_guildmgr = new GuildMgr(fileInfo.absFilePath(),
+ m_guildmgr = new GuildMgr(fileInfo.absoluteFilePath(),
this, "guildmgr");
// Create our player object
@@ -515,7 +519,7 @@
// QMenuBar
// The first call to menuBar() makes it exist
- menuBar()->setSeparator(QMenuBar::InWindowsStyle);
+ menuBar()->addSeparator();
// File Menu
QMenu* pFileMenu = new QMenu("&File");
@@ -1050,7 +1054,10 @@
tmpAction->setChecked(showeq_params->walkpathrecord);
subMenu = new QMenu("Walk Path Length");
- QSpinBox* walkPathLengthSpinBox = new QSpinBox(0, 8192, 1, subMenu);
+ QSpinBox* walkPathLengthSpinBox = new QSpinBox(subMenu);
+ walkPathLengthSpinBox->setMinimum(0);
+ walkPathLengthSpinBox->setMaximum(8192);
+ walkPathLengthSpinBox->setSingleStep(1);
walkPathLengthSpinBox->setValue(showeq_params->walkpathlength);
connect(walkPathLengthSpinBox, SIGNAL(valueChanged(int)), this,
SLOT(set_opt_WalkPathLength(int)));
@@ -1084,7 +1091,10 @@
pSaveStateMenu->addSeparator();
subMenu = new QMenu("Spawn Save Frequency (s)");
- QSpinBox* saveFrequencySpinBox = new QSpinBox(1, 320, 1, subMenu);
+ QSpinBox* saveFrequencySpinBox = new QSpinBox(subMenu);
+ saveFrequencySpinBox->setMinimum(1);
+ saveFrequencySpinBox->setMaximum(320);
+ saveFrequencySpinBox->setSingleStep(1);
saveFrequencySpinBox->setValue(showeq_params->saveSpawnsFrequency / 1000);
connect(saveFrequencySpinBox, SIGNAL(valueChanged(int)), this,
SLOT(set_opt_save_SpawnFrequency(int)));
@@ -1237,7 +1247,10 @@
// Advanced menu
subMenu = new QMenu("Advanced");
QMenu* subSubMenu = new QMenu("Arq Seq Give Up");
- QSpinBox* arqSeqGiveUpSpinBox = new QSpinBox(32, 1024, 8, subSubMenu);
+ QSpinBox* arqSeqGiveUpSpinBox = new QSpinBox(subSubMenu);
+ arqSeqGiveUpSpinBox->setMinimum(32);
+ arqSeqGiveUpSpinBox->setMaximum(1024);
+ arqSeqGiveUpSpinBox->setSingleStep(8);
arqSeqGiveUpSpinBox->setValue(m_packet->arqSeqGiveUp());
connect(arqSeqGiveUpSpinBox, SIGNAL(valueChanged(int)),
this, SLOT(set_net_arq_giveup(int)));
@@ -1258,7 +1271,11 @@
// Character -> Level
m_charLevelMenu = new QMenu("Choose &Level");
m_charMenu->addMenu(m_charLevelMenu);
- m_levelSpinBox = new QSpinBox(1, 100, 1, this, "m_levelSpinBox");
+ m_levelSpinBox = new QSpinBox(this);
+ m_levelSpinBox->setObjectName("m_levelSpinBox");
+ m_levelSpinBox->setMinimum(1);
+ m_levelSpinBox->setMaximum(115);
+ m_levelSpinBox->setSingleStep(1);
QWidgetAction* levelSpinBoxAction = new QWidgetAction(m_charLevelMenu);
levelSpinBoxAction->setDefaultWidget(m_levelSpinBox);
m_charLevelMenu->addAction( levelSpinBoxAction );
@@ -1559,7 +1576,7 @@
SLOT(enableAllShowUserFilters()));
m_terminalShowUserFilterMenu->addAction("&Disable All", this,
SLOT(disableAllShowUserFilters()));
- m_terminalShowUserFilterMenu->insertSeparator(-1);
+ m_terminalShowUserFilterMenu->addSeparator();
m_terminalHideUserFilterMenu = new QMenu("User Message Filter - &Hide");
m_terminalMenu->addMenu(m_terminalHideUserFilterMenu);
@@ -1794,49 +1811,58 @@
int sts_widget_count = 0; // total number of widgets visible on status bar
//Status widget
- m_stsbarStatus = new QLabel(statusBar(), "Status");
+ m_stsbarStatus = new QLabel(statusBar());
+ m_stsbarStatus->setObjectName("Status");
m_stsbarStatus->setMinimumWidth(80);
m_stsbarStatus->setText(QString("ShowEQ %1").arg(VERSION));
statusBar()->addWidget(m_stsbarStatus, 8);
//Zone widget
- m_stsbarZone = new QLabel(statusBar(), "Zone");
+ m_stsbarZone = new QLabel(statusBar());
+ m_stsbarZone->setObjectName("Zone");
m_stsbarZone->setText("Zone: [unknown]");
statusBar()->addWidget(m_stsbarZone, 2);
//Mobs widget
- m_stsbarSpawns = new QLabel(statusBar(), "Mobs");
+ m_stsbarSpawns = new QLabel(statusBar());
+ m_stsbarSpawns->setObjectName("Mobs");
m_stsbarSpawns->setText("Mobs:");
statusBar()->addWidget(m_stsbarSpawns, 1);
//Exp widget
- m_stsbarExp = new QLabel(statusBar(), "Exp");
+ m_stsbarExp = new QLabel(statusBar());
+ m_stsbarExp->setObjectName("Exp");
m_stsbarExp->setText("Exp [unknown]");
statusBar()->addWidget(m_stsbarExp, 2);
//ExpAA widget
- m_stsbarExpAA = new QLabel(statusBar(), "ExpAA");
+ m_stsbarExpAA = new QLabel(statusBar());
+ m_stsbarExpAA->setObjectName("ExpAA");
m_stsbarExpAA->setText("ExpAA [unknown]");
statusBar()->addWidget(m_stsbarExpAA, 2);
-
+
//Pkt widget
- m_stsbarPkt = new QLabel(statusBar(), "Pkt");
+ m_stsbarPkt = new QLabel(statusBar());
+ m_stsbarPkt->setObjectName("Pkt");
m_stsbarPkt->setText("Pkt 0");
statusBar()->addWidget(m_stsbarPkt, 1);
//EQTime widget
- m_stsbarEQTime = new QLabel(statusBar(), "EQTime");
+ m_stsbarEQTime = new QLabel(statusBar());
+ m_stsbarEQTime->setObjectName("EQTime");
m_stsbarEQTime->setText("EQTime");
statusBar()->addWidget(m_stsbarEQTime, 1);
// Run Speed widget
- m_stsbarSpeed = new QLabel(statusBar(), "Speed");
+ m_stsbarSpeed = new QLabel(statusBar());
+ m_stsbarSpeed->setObjectName("Speed");
m_stsbarSpeed->setText("Run Speed:");
statusBar()->addWidget(m_stsbarSpeed, 1);
// ZEM code
// Zone Exp Mult widget
- m_stsbarZEM = new QLabel(statusBar(), "ZEM");
+ m_stsbarZEM = new QLabel(statusBar());
+ m_stsbarZEM->setObjectName("ZEM");
m_stsbarZEM->setText("ZEM: [unknown]");
statusBar()->addWidget(m_stsbarZEM, 1);
@@ -2443,10 +2469,8 @@
}
show();
- QShortcut *toggle_view_status_bar_shortcut = new QShortcut(
- Qt::CTRL+Qt::ALT+Qt::Key_S, this, SLOT(toggle_view_statusbar()));
- QShortcut *toggle_view_menubar_shortcut = new QShortcut(
- Qt::CTRL+Qt::ALT+Qt::Key_T, this, SLOT(toggle_view_menubar()));
+ new QShortcut(Qt::CTRL+Qt::ALT+Qt::Key_S, this, SLOT(toggle_view_statusbar()));
+ new QShortcut(Qt::CTRL+Qt::ALT+Qt::Key_T, this, SLOT(toggle_view_menubar()));
// load in the docking preferences if any have been saved
QString dockPrefs = pSEQPrefs->getPrefString("DockingInfo", section,
@@ -2461,7 +2485,7 @@
// TODO: Add % replacement values and a signal to update, for ip address currently
// TODO: being monitored.
- Q3MainWindow::setCaption(pSEQPrefs->getPrefString("Caption", section,
+ Q3MainWindow::setWindowTitle(pSEQPrefs->getPrefString("Caption", section,
"ShowEQ - Main (ctrl+alt+t to toggle menubar)"));
// load the format strings for display
@@ -2961,15 +2985,15 @@
if (widget != 0)
{
bool ok = false;
- QString caption =
- QInputDialog::getText("ShowEQ " + window + "Caption",
- "Enter caption for the " + window + ":",
- QLineEdit::Normal, widget->caption(),
- &ok, this);
+ QString caption =
+ QInputDialog::getText(this, "ShowEQ " + window + "Caption",
+ "Enter caption for the " + window + ":",
+ QLineEdit::Normal, widget->windowTitle(),
+ &ok);
// if the user entered a caption and clicked ok, set the windows caption
if (ok)
- widget->setCaption(caption);
+ widget->setWindowTitle(caption);
}
}
@@ -3107,7 +3131,7 @@
QString newFormatFile =
QFileDialog::getOpenFileName(this, "Select Format File",
- fileInfo.absFilePath(), "*.txt");
+ fileInfo.absoluteFilePath(), "*.txt");
// if the newFormatFile name is not empty, then the user selected a file
if (!newFormatFile.isEmpty())
@@ -3129,7 +3153,7 @@
QString newSpellsFile =
QFileDialog::getOpenFileName(this, "Select Spells File",
- fileInfo.absFilePath(), "*.txt");
+ fileInfo.absoluteFilePath(), "*.txt");
// if the newFormatFile name is not empty, then the user selected a file
if (!newSpellsFile.isEmpty())
@@ -3312,9 +3336,9 @@
void EQInterface::setCaption(const QString& text)
{
- Q3MainWindow::setCaption(text);
+ Q3MainWindow::setWindowTitle(text);
- pSEQPrefs->setPrefString("Caption", "Interface", caption());
+ pSEQPrefs->setPrefString("Caption", "Interface", windowTitle());
}
@@ -3328,7 +3352,7 @@
formatFileName);
// load the strings
- m_eqStrings->load(fileInfo.absFilePath());
+ m_eqStrings->load(fileInfo.absoluteFilePath());
}
void
@@ -3425,11 +3449,11 @@
"/usr/bin/esdplay " PKGDATADIR "/spawn.wav &");
bool ok = false;
- QString command =
- QInputDialog::getText("ShowEQ " + prettyName + "Command",
- "Enter command line to use for " + prettyName + "'s:",
- QLineEdit::Normal, value,
- &ok, this);
+ QString command =
+ QInputDialog::getText(this, "ShowEQ " + prettyName + "Command",
+ "Enter command line to use for " + prettyName + "'s:",
+ QLineEdit::Normal, value,
+ &ok);
if (ok)
pSEQPrefs->setPrefString(property, "Filters", command);
@@ -3449,7 +3473,7 @@
// dump the spawns
m_spawnShell->dumpSpawns(tSpawn, out);
- seqInfo((const char*)outText);
+ seqInfo(outText.toAscii().data());
}
void EQInterface::listDrops (void)
@@ -3465,7 +3489,7 @@
// dump the drops
m_spawnShell->dumpSpawns(tDrop, out);
- seqInfo((const char*)outText);
+ seqInfo(outText.toAscii().data());
}
void EQInterface::listMapInfo(void)
@@ -3489,7 +3513,7 @@
m_map[i]->dumpInfo(out);
}
- seqInfo((const char*)outText);
+ seqInfo(outText.toAscii().data());
}
void EQInterface::listInterfaceInfo(void)
@@ -3509,7 +3533,7 @@
out << "-----------------------" << endl;
- seqInfo((const char*)outText);
+ seqInfo(outText.toAscii().data());
}
void EQInterface::listGroup(void)
@@ -3525,7 +3549,7 @@
// dump the drops
m_groupMgr->dumpInfo(out);
- seqInfo((const char*)outText);
+ seqInfo(outText.toAscii().data());
}
@@ -3542,7 +3566,7 @@
// dump the drops
m_guildShell->dumpMembers(out);
- seqInfo((const char*)outText);
+ seqInfo(outText.toAscii().data());
}
void EQInterface::dumpSpawns (void)
@@ -3557,7 +3581,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
// open the output data stream
- QFile file(logFileInfo.absFilePath());
+ QFile file(logFileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
@@ -3577,7 +3601,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
// open the output data stream
- QFile file(logFileInfo.absFilePath());
+ QFile file(logFileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
@@ -3598,7 +3622,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
// open the output data stream
- QFile file(logFileInfo.absFilePath());
+ QFile file(logFileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
@@ -3622,7 +3646,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
- emit guildList2text(logFileInfo.absFilePath());
+ emit guildList2text(logFileInfo.absoluteFilePath());
}
void EQInterface::dumpSpellBook(void)
@@ -3638,13 +3662,13 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
// open the output data stream
- QFile file(logFileInfo.absFilePath());
+ QFile file(logFileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
QString txt;
seqInfo("Dumping Spell Book to '%s'\n",
- (const char*)file.name().utf8());
+ file.fileName().toUtf8().data());
out << "Spellbook of " << m_player->name() << " a level "
<< m_player->level() << " " << m_player->raceString()
<< " " << m_player->classString()
@@ -3665,17 +3689,17 @@
if (spell)
{
- txt.sprintf("%.3d %.2d %.2d %#4.04x %02d\t%s",
- i, ((i / 8) + 1), ((i % 8) + 1),
- spellid, spell->level(playerClass),
- spell->name().latin1());
+ txt.sprintf("%.3d %.2d %.2d %#4.04x %02d\t%s",
+ i, ((i / 8) + 1), ((i % 8) + 1),
+ spellid, spell->level(playerClass),
+ spell->name().toLatin1().data());
}
else
{
- txt.sprintf("%.3d %.2d %.2d %#4.04x \t%s",
- i, ((i / 8) + 1), ((i % 8) + 1),
- spellid,
- spell_name(spellid).latin1());
+ txt.sprintf("%.3d %.2d %.2d %#4.04x \t%s",
+ i, ((i / 8) + 1), ((i % 8) + 1),
+ spellid,
+ spell_name(spellid).toLatin1().data());
}
out << txt << endl;
@@ -3694,7 +3718,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
// open the output data stream
- QFile file(logFileInfo.absFilePath());
+ QFile file(logFileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
@@ -3714,7 +3738,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
// open the output data stream
- QFile file(logFileInfo.absFilePath());
+ QFile file(logFileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
@@ -3725,8 +3749,8 @@
void
EQInterface::launch_editor_filters(void)
{
- EditorWindow * ew = new EditorWindow(m_filterMgr->filterFile());
- ew->setCaption(m_filterMgr->filterFile());
+ EditorWindow * ew = new EditorWindow(m_filterMgr->filterFile().toAscii().data());
+ ew->setWindowTitle(m_filterMgr->filterFile());
ew->show();
}
@@ -3733,8 +3757,8 @@
void
EQInterface::launch_editor_zoneFilters(void)
{
- EditorWindow * ew = new EditorWindow(m_filterMgr->zoneFilterFile());
- ew->setCaption(m_filterMgr->zoneFilterFile());
+ EditorWindow * ew = new EditorWindow(m_filterMgr->zoneFilterFile().toAscii().data());
+ ew->setWindowTitle(m_filterMgr->zoneFilterFile());
ew->show();
}
@@ -4283,36 +4307,36 @@
QString& opCodeList)
{
bool ok = false;
- QString newMonitorOpCode_List =
- QInputDialog::getText(title,
- "A list of OpCodes seperated by commas...\n"
- "\n"
- "Each Opcode has 4 arguments, only one of which is actually necessary...\n"
- "They are:\n"
- "OpCode: 16-bit HEX value of the OpCode\n"
- " (REQUIRED - No Default)\n"
- "\n"
- "Alias: Name used when displaying the Opcode\n"
- " (DEFAULT: Monitored OpCode)\n"
- "\n"
- "Direction: 1 = Client ---> Server\n"
- " 2 = Client <--- Server\n"
- " 3 = Client <--> Server (BOTH)\n"
- " (DEFAULT: 3)\n"
- "\n"
- "Show known 1 = Show if OpCode is marked as known.\n"
- " 0 = Ignore if OpCode is known.\n"
- " (DEFAULT: 0)\n"
- "\n"
- "The way which you include the arguments in the list of OpCodes is:\n"
- "adding a ':' inbetween arguments and a ',' after the last OpCode\n"
- "argument.\n"
- "\n"
- "(i.e. 7F21:Mana Changed:3:1, 7E21:Unknown Spell Event(OUT):1,\n"
- " 7E21:Unknown Spell Event(IN):2 )\n",
- QLineEdit::Normal,
- opCodeList,
- &ok, this);
+ QString newMonitorOpCode_List =
+ QInputDialog::getText(this, title,
+ "A list of OpCodes seperated by commas...\n"
+ "\n"
+ "Each Opcode has 4 arguments, only one of which is actually necessary...\n"
+ "They are:\n"
+ "OpCode: 16-bit HEX value of the OpCode\n"
+ " (REQUIRED - No Default)\n"
+ "\n"
+ "Alias: Name used when displaying the Opcode\n"
+ " (DEFAULT: Monitored OpCode)\n"
+ "\n"
+ "Direction: 1 = Client ---> Server\n"
+ " 2 = Client <--- Server\n"
+ " 3 = Client <--> Server (BOTH)\n"
+ " (DEFAULT: 3)\n"
+ "\n"
+ "Show known 1 = Show if OpCode is marked as known.\n"
+ " 0 = Ignore if OpCode is known.\n"
+ " (DEFAULT: 0)\n"
+ "\n"
+ "The way which you include the arguments in the list of OpCodes is:\n"
+ "adding a ':' inbetween arguments and a ',' after the last OpCode\n"
+ "argument.\n"
+ "\n"
+ "(i.e. 7F21:Mana Changed:3:1, 7E21:Unknown Spell Event(OUT):1,\n"
+ " 7E21:Unknown Spell Event(IN):2 )\n",
+ QLineEdit::Normal,
+ opCodeList,
+ &ok);
if (ok)
opCodeList = newMonitorOpCode_List;
@@ -4336,10 +4360,9 @@
// set the list of monitored opcodes
pSEQPrefs->setPrefString("OpCodeList", section, opCodeList);
-
- seqInfo("OpCode monitoring is now ENABLED...\nUsing list:\t%s",
- (const char*)opCodeList);
+
+ seqInfo("OpCode monitoring is now ENABLED...\nUsing list:\t%s", opCodeList.toAscii().data());
}
}
else
@@ -4359,16 +4382,15 @@
{
QString section = "OpCodeMonitoring";
QString opCodeList = pSEQPrefs->getPrefString("OpCodeList", section, "");
- bool ok = getMonitorOpCodeList("ShowEQ - Reload OpCode Monitor",
- opCodeList);
+ bool ok = getMonitorOpCodeList("ShowEQ - Reload OpCode Monitor", opCodeList);
if (ok && m_opcodeMonitorLog)
{
m_opcodeMonitorLog->init(opCodeList);
-
- seqInfo("The monitored OpCode list has been reloaded...\nUsing list:\t%s",
- (const char*)opCodeList);
-
+
+ seqInfo("The monitored OpCode list has been reloaded...\nUsing list:\t%s",
+ opCodeList.toAscii().data());
+
// set the list of monitored opcodes
pSEQPrefs->setPrefString("OpCodeList", section, opCodeList);
}
@@ -4417,7 +4439,7 @@
logFile =
QFileDialog::getSaveFileName(this, "ShowEQ - OpCode Log File",
- logFileInfo.absFilePath(), "*.log");
+ logFileInfo.absoluteFilePath(), "*.log");
// set log filename
if (!logFile.isEmpty())
@@ -4890,15 +4912,15 @@
// construct a message for the status message display
QString string("");
if (spawn != 0)
- string.sprintf("%d: %s:%d (%d/%d) Pos:", // "%d/%d/%d (%d) %s %s Item:%s",
- item->id(),
- (const char*)item->name().utf8(),
- spawn->level(), spawn->HP(),
- spawn->maxHP());
+ string.sprintf("%d: %s:%d (%d/%d) Pos:", // "%d/%d/%d (%d) %s %s Item:%s",
+ item->id(),
+ item->name().toUtf8().data(),
+ spawn->level(), spawn->HP(),
+ spawn->maxHP());
else
- string.sprintf("%d: %s: Pos:", // "%d/%d/%d (%d) %s %s Item:%s",
- item->id(),
- (const char*)item->name().utf8());
+ string.sprintf("%d: %s: Pos:", // "%d/%d/%d (%d) %s %s Item:%s",
+ item->id(),
+ item->name().toUtf8().data());
if (showeq_params->retarded_coords)
string += QString::number(item->y()) + "/"
@@ -4955,13 +4977,11 @@
void EQInterface::saveSelectedSpawnPath(void)
{
QString fileName;
- fileName.sprintf("%s_mobpath.map",
- (const char*)m_zoneMgr->shortZoneName());
+ fileName.sprintf("%s_mobpath.map", m_zoneMgr->shortZoneName().toAscii().data());
- QFileInfo fileInfo = m_dataLocationMgr->findWriteFile("maps", fileName,
- false);
+ QFileInfo fileInfo = m_dataLocationMgr->findWriteFile("maps", fileName, false);
- QFile mobPathFile(fileInfo.absFilePath());
+ QFile mobPathFile(fileInfo.absoluteFilePath());
if (mobPathFile.open(QIODevice::Append | QIODevice::WriteOnly))
{
QTextStream out(&mobPathFile);
@@ -4968,7 +4988,7 @@
// append the selected spawns path to the end
saveSpawnPath(out, m_selectedSpawn);
- seqInfo("Finished appending '%s'!\n", (const char*)fileName);
+ seqInfo("Finished appending '%s'!\n", fileName.toAscii().data());
}
}
@@ -4975,13 +4995,11 @@
void EQInterface::saveSpawnPaths(void)
{
QString fileName;
- fileName.sprintf("%s_mobpath.map",
- (const char*)m_zoneMgr->shortZoneName());
+ fileName.sprintf("%s_mobpath.map", m_zoneMgr->shortZoneName().toAscii().data());
- QFileInfo fileInfo = m_dataLocationMgr->findWriteFile("maps", fileName,
- false);
+ QFileInfo fileInfo = m_dataLocationMgr->findWriteFile("maps", fileName, false);
- QFile mobPathFile(fileInfo.absFilePath());
+ QFile mobPathFile(fileInfo.absoluteFilePath());
if (mobPathFile.open(QIODevice::Truncate | QIODevice::WriteOnly))
{
QTextStream out(&mobPathFile);
@@ -5005,7 +5023,7 @@
saveSpawnPath(out, it.value());
}
- seqInfo("Finished writing '%s'!\n", (const char*)fileName);
+ seqInfo("Finished writing '%s'!\n", fileName.toAscii().data());
}
}
@@ -5063,12 +5081,12 @@
{
QStringList iplst;
for( int l = 0; l < 5; l++)
- iplst += ipstr[l];
+ iplst += ipstr[l];
bool ok = false;
- QString address =
- QInputDialog::getItem("ShowEQ - EQ Client IP Address",
- "Enter IP address of EQ client",
- iplst, 0, TRUE, &ok, this );
+ QString address =
+ QInputDialog::getItem(this, "ShowEQ - EQ Client IP Address",
+ "Enter IP address of EQ client",
+ iplst, 0, TRUE, &ok);
if (ok)
{
for (int i = 4; i > 0; i--)
@@ -5085,19 +5103,18 @@
void EQInterface::set_net_client_MAC_address()
{
QStringList maclst;
- for( int l = 0; l < 5; l++)
+ for( int l = 0; l < 5; l++)
maclst += macstr[l];
bool ok = false;
- QString address =
- QInputDialog::getItem("ShowEQ - EQ Client MAC Address",
- "Enter MAC address of EQ client",
- maclst, 0, TRUE, &ok, this );
+ QString address =
+ QInputDialog::getItem(this, "ShowEQ - EQ Client MAC Address",
+ "Enter MAC address of EQ client",
+ maclst, 0, TRUE, &ok);
if (ok)
{
if (address.length() != 17)
{
- seqWarn("Invalid MAC Address (%s)! Ignoring!",
- (const char*)address);
+ seqWarn("Invalid MAC Address (%s)! Ignoring!", address.toAscii().data());
return;
}
for (int i = 4; i > 0; i--)
@@ -5114,11 +5131,11 @@
void EQInterface::set_net_device()
{
bool ok = false;
- QString dev =
- QInputDialog::getText("ShowEQ - Device",
- "Enter the device to sniff for EQ Packets:",
- QLineEdit::Normal, m_packet->device(),
- &ok, this);
+ QString dev =
+ QInputDialog::getText(this, "ShowEQ - Device",
+ "Enter the device to sniff for EQ Packets:",
+ QLineEdit::Normal, m_packet->device(),
+ &ok);
if (ok)
{
@@ -5677,20 +5694,20 @@
}
m_map[i] = new MapFrame(m_filterMgr,
- m_mapMgr,
- m_player,
- m_spawnShell,
- m_zoneMgr,
- m_spawnMonitor,
- mapPrefName,
- mapCaption,
- mapName,
- 0);
+ m_mapMgr,
+ m_player,
+ m_spawnShell,
+ m_zoneMgr,
+ m_spawnMonitor,
+ mapPrefName,
+ mapCaption,
+ mapName.toAscii().data(),
+ 0);
- setDockEnabled(m_map[i],
- pSEQPrefs->getPrefBool(QString("Dockable") + mapPrefName,
- "Interface", true));
+ setDockEnabled(m_map[i],
+ pSEQPrefs->getPrefBool(QString("Dockable") + mapPrefName,
+ "Interface", true));
Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock", m_map[i]->preferenceName(),
Qt::DockLeft);
@@ -5746,8 +5763,8 @@
caption += QString::number(winNum);
m_messageWindow[i] = new MessageWindow(m_messages, m_messageFilters,
- prefName, caption,
- 0, name);
+ prefName, caption,
+ 0, name.toAscii().data());
setDockEnabled(m_messageWindow[i],
pSEQPrefs->getPrefBool(QString("Dockable") + prefName,
@@ -6165,7 +6182,7 @@
"filtered_spawns.log");
m_filteredSpawnLog = new FilteredSpawnLog(m_dateTimeMgr, m_filterMgr,
- logFileInfo.absFilePath());
+ logFileInfo.absoluteFilePath());
connect(m_spawnShell, SIGNAL(addItem(const Item*)),
m_filteredSpawnLog, SLOT(addItem(const Item*)));
@@ -6187,7 +6204,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
- logFile = logFileInfo.absFilePath();
+ logFile = logFileInfo.absoluteFilePath();
// create the spawn logger
m_spawnLogger = new SpawnLog(m_dateTimeMgr, logFile);
@@ -6231,7 +6248,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
m_globalLog = new PacketLog(*m_packet,
- logFileInfo.absFilePath(),
+ logFileInfo.absoluteFilePath(),
this, "GlobalLog");
connect(m_packet, SIGNAL(newPacket(const EQUDPIPPacketFormat&)),
@@ -6250,7 +6267,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
m_worldLog = new PacketStreamLog(*m_packet,
- logFileInfo.absFilePath(),
+ logFileInfo.absoluteFilePath(),
this, "WorldLog");
m_worldLog->setRaw(pSEQPrefs->getPrefBool("LogRawPackets", "PacketLogging",
@@ -6274,7 +6291,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
m_zoneLog = new PacketStreamLog(*m_packet,
- logFileInfo.absFilePath(),
+ logFileInfo.absoluteFilePath(),
this, "ZoneLog");
m_zoneLog->setRaw(pSEQPrefs->getPrefBool("LogRawPackets", "PacketLogging",
@@ -6300,7 +6317,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
m_bazaarLog = new BazaarLog(*m_packet,
- logFileInfo.absFilePath(),
+ logFileInfo.absoluteFilePath(),
this,
*m_spawnShell,
"BazaarLog");
@@ -6322,7 +6339,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
- logFile = logFileInfo.absFilePath();
+ logFile = logFileInfo.absoluteFilePath();
m_unknownZoneLog = new UnknownPacketLog(*m_packet,
logFile,
@@ -6350,7 +6367,7 @@
QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
- logFile = logFileInfo.absFilePath();
+ logFile = logFileInfo.absoluteFilePath();
m_opcodeMonitorLog = new OPCodeMonitorPacketLog(*m_packet,
logFile,
@@ -6370,7 +6387,7 @@
QMenu* menu = window->menu();
if (menu)
{
- menu->setTitle(window->caption());
+ menu->setTitle(window->windowTitle());
// insert the windows menu into the window menu
QAction* menuAction = m_windowMenu->addMenu(menu);
Modified: showeq/branches/pre_6_0_beta/src/logger.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/logger.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/logger.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -31,15 +31,17 @@
#include "logger.h"
SEQLogger::SEQLogger(FILE *fp, QObject* parent, const char* name)
- : QObject(parent, name)
+ : QObject(parent)
{
+ setObjectName(name);
m_fp = fp;
m_errOpen = false;
}
SEQLogger::SEQLogger(const QString& fname, QObject* parent, const char* name)
- : QObject(parent, name)
+ : QObject(parent)
{
+ setObjectName(name);
m_fp = NULL;
m_filename = fname;
m_errOpen = false;
@@ -49,33 +51,33 @@
{
if (m_fp)
return true;
-
- m_fp = fopen((const char*)m_filename,"a");
-
+
+ m_fp = fopen(m_filename.toAscii().data(),"a");
+
if (!m_fp)
- {
+ {
if (!m_errOpen)
{
::fprintf(stderr, "Error opening %s: %s (will keep trying)\n",
- (const char*)m_filename, strerror(errno));
+ m_filename.toAscii().data(), strerror(errno));
m_errOpen = true;
}
-
+
return false;
}
-
+
m_errOpen = false;
- if (!m_file.open(QIODevice::Append | QIODevice::WriteOnly, m_fp))
+ if (!m_file.open(m_fp, QIODevice::Append | QIODevice::WriteOnly))
return false;
-
+
m_out.setDevice(&m_file);
-
+
return true;
}
void SEQLogger::flush()
-{
+{
m_file.flush();
}
@@ -84,14 +86,14 @@
{
va_list args;
int count;
-
+
if (!m_fp)
return 0;
-
+
va_start(args, fmt);
count = vfprintf(m_fp, fmt, args);
va_end(args);
-
+
return count;
}
Modified: showeq/branches/pre_6_0_beta/src/main.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/main.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/main.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -226,7 +226,7 @@
exit(-1);
}
- QString configFileDef = configFileDefInfo.absFilePath();
+ QString configFileDef = configFileDefInfo.absoluteFilePath();
QFileInfo configFileInfo = dataLocMgr.findWriteFile(".", "showeq.xml",
true, true);
@@ -234,10 +234,10 @@
// deal with funky border case since we may be running setuid
QString configFile;
if (configFileInfo.dir() != QDir::root())
- configFile = configFileInfo.absFilePath();
+ configFile = configFileInfo.absoluteFilePath();
else
- configFile = QFileInfo(dataLocMgr.userDataDir(".").absPath(),
- "showeq.xml").absFilePath();
+ configFile = QFileInfo(dataLocMgr.userDataDir(".").absolutePath(),
+ "showeq.xml").absoluteFilePath();
// scan command line arguments for a specified config file
int i = 1;
@@ -250,7 +250,7 @@
}
/* NOTE: See preferencefile.cpp for info on how to use prefrences class */
- printf("Using config file '%s'\n", (const char*)configFile);
+ printf("Using config file '%s'\n", configFile.toAscii().data());
pSEQPrefs = new XMLPreferences(configFileDef, configFile);
showeq_params = new ShowEQParams;
@@ -290,7 +290,7 @@
showeq_params->restorePlayerState = false;
showeq_params->restoreZoneState = false;
showeq_params->restoreSpawns = false;
- showeq_params->saveRestoreBaseFilename = dataLocMgr.findWriteFile("tmp", pSEQPrefs->getPrefString("BaseFilename", section, "last")).absFilePath();
+ showeq_params->saveRestoreBaseFilename = dataLocMgr.findWriteFile("tmp", pSEQPrefs->getPrefString("BaseFilename", section, "last")).absoluteFilePath();
showeq_params->filterZoneDataLog = 0;
/* Parse the commandline for commandline parameters */
Modified: showeq/branches/pre_6_0_beta/src/map.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/map.cpp 2020-11-02 01:41:45 UTC (rev 1090)
+++ showeq/branches/pre_6_0_beta/src/map.cpp 2020-11-02 01:41:58 UTC (rev 1091)
@@ -98,19 +98,22 @@
//----------------------------------------------------------------------
// CLineDlg
CLineDlg::CLineDlg(QWidget *parent, QString name, MapMgr *mapMgr)
- : QDialog(parent, name, FALSE)
+ : QDialog(parent)
{
+ setObjectName(name);
#ifdef DEBUGMAP
qDebug ("CLineDlg()");
#endif /* DEBUGMAP */
-
+
QFont labelFont;
labelFont.setBold(true);
QBoxLayout *topLayout = new QVBoxLayout(this);
- QBoxLayout *row2Layout = new QHBoxLayout(topLayout);
- QBoxLayout *row1Layout = new QHBoxLayout(topLayout);
-
+ QBoxLayout *row2Layout = new QHBoxLayout();
+ QBoxLayout *row1Layout = new QHBoxLayout();
+ topLayout->addLayout(row2Layout);
+ topLayout->addLayout(row1Layout);
+
QLabel *colorLabel = new QLabel ("Color", this);
colorLabel->setFont(labelFont);
colorLabel->setFixedHeight(colorLabel->sizeHint().height());
@@ -117,29 +120,31 @@
colorLabel->setFixedWidth(colorLabel->sizeHint().width()+10);
colorLabel->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
row1Layout->addWidget(colorLabel);
-
- m_LineColor = new QComboBox(FALSE, this, "LineColor");
- m_LineColor->insertItem("gray");
- m_LineColor->insertItem("darkBlue");
- m_LineColor->insertItem("darkGreen");
- m_LineColor->insertItem("darkCyan");
- m_LineColor->insertItem("darkRed");
- m_LineColor->insertItem("darkMagenta");
- m_LineColor->insertItem("darkGray");
- m_LineColor->insertItem("white");
- m_LineColor->insertItem("blue");
- m_LineColor->insertItem("green");
- m_LineColor->insertItem("cyan");
- m_LineColor->insertItem("red");
- m_LineColor->insertItem("magenta");
- m_LineColor->insertItem("yellow");
- m_LineColor->insertItem("white");
-
+
+ m_LineColor = new QComboBox(this);
+ m_LineColor->setEditable(false);
+ m_LineColor->setObjectName("LineColor");
+ m_LineColor->insertItem(m_LineColor->count(), "gray");
+ m_LineColor->insertItem(m_LineColor->count(), "darkBlue");
+ m_LineColor->insertItem(m_LineColor->count(), "darkGreen");
+ m_LineColor->insertItem(m_LineColor->count(), "darkCyan");
+ m_LineColor->insertItem(m_LineColor->count(), "darkRed");
+ m_LineColor->insertItem(m_LineColor->count(), "darkMagenta");
+ m_LineColor->insertItem(m_LineColor->count(), "darkGray");
+ m_LineColor->insertItem(m_LineColor->count(), "white");
+ m_LineColor->insertItem(m_LineColor->count(), "blue");
+ m_LineColor->insertItem(m_LineColor->count(), "green");
+ m_LineColor->insertItem(m_LineColor->count(), "cyan");
+ m_LineColor->insertItem(m_LineColor->count(), "red");
+ m_LineColor->insertItem(m_LineColor->count(), "magenta");
+ m_LineColor->insertItem(m_LineColor->count(), "yellow");
+ m_LineColor->insertItem(m_LineColor->count(), "white");
+
m_LineColor->setFont(labelFont);
m_LineColor->setFixedHeight(m_LineColor->sizeHint().height());
m_LineColor->setFixedWidth(m_LineColor->sizeHint().width());
row1Layout->addWidget(m_LineColor, 0, Qt::AlignLeft);
-
+
m_ColorPreview = new QFrame(this);
m_ColorPreview->setFrameStyle(QFrame::Box|QFrame::Raised);
m_ColorPreview->setFixedWidth(50);
@@ -146,11 +151,11 @@
m_ColorPreview->setFixedHeight(m_LineColor->sizeHint().height());
m_ColorPreview->setPalette(QPalette(QColor(Qt::gray)));
row1Layout->addWidget(m_ColorPreview);
-
+
// Hook on when a color changes
connect(m_LineColor, SIGNAL(activated(const QString &)), mapMgr, SLOT(setLineColor(const QString &)));
connect(m_LineColor, SIGNAL(activated(const QString &)), SLOT(changeColor(const QString &)));
-
+
QLabel *nameLabel = new QLabel ("Name", this);
nameLabel->setFont(labelFont);
nameLabel->setFixedHeight(nameLabel->sizeHint().height());
@@ -158,27 +163,28 @@
nameLabel->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
row2Layout->addWidget(nameLabel);
- m_LineName = new QLineEdit(this, "LineName");
+ m_LineName = new QLineEdit(this);
+ m_LineName->setObjectName("LineName");
m_LineName->setFont(labelFont);
m_LineName->setFixedHeight(m_LineName->sizeHint().height());
m_LineName->setFixedWidth(150);
row2Layout->addWidget(m_LineName);
-
+
// Hook on when the line name changes
connect(m_LineName, SIGNAL(textChanged(const QString &)), mapMgr, SLOT(setLineName(const QString &)));
-
+
QPushButton *ok = new QPushButton("OK", this);
ok->setFixedWidth(30);
ok->setFixedHeight(30);
topLayout->addWidget(ok, 0, Qt::AlignCenter);
-
+
// Hook on pressing the OK button
connect(ok, SIGNAL(clicked()), SLOT(accept()));
-
+
for (int i=0; i < m_LineColor->count(); i++)
{
- if (m_LineColor->text(i) == mapMgr->curLineColor())
- m_LineColor->setCurrentItem(i);
+ if (m_LineColor->itemText(i) == mapMgr->curLineColor())
+ m_LineColor->setCurrentIndex(i);
}
m_LineName->setText(mapMgr->curLineName());
@@ -206,7 +212,7 @@
setFrameStyle( QFrame::Plain | QFrame::Box );
setLineWidth( 1 );
setAlignment( Qt::AlignLeft | Qt::AlignTop );
- polish();
+ ensurePolished();
setText( "" );
adjustSize();
}
@@ -255,12 +261,13 @@
MapMgr::MapMgr(const DataLocationMgr* dataLocMgr,
SpawnShell* spawnShell, Player* player, ZoneMgr* zoneMgr,
QWidget* dialogParent, QObject* parent, const char* name)
- : QObject(parent, name),
+ : QObject(parent),
m_dataLocMgr(dataLocMgr),
m_spawnShell(spawnShell),
m_player(player),
m_dialogParent(dialogParent)
{
+ setObjectName(name);
m_dlgLineProps = NULL;
// get the preferences
@@ -342,8 +349,8 @@
void MapMgr::zoneEnd(const QString& shortZoneName, const QString& longZoneName)
{
#ifdef DEBUGMAP
- qDebug ("zoneEnd(%s, %s)",
- (const char*)longZoneName, (const char*)shortZoneName);
+ qDebug ("zoneEnd(%s, %s)",
+ longZoneName.toAscii().data(), shortZoneName.toAscii().data());
#endif /* DEBUGMAP */
// atttempt to load the new map
@@ -369,18 +376,19 @@
if (fileInfo.exists())
{
// load the map if it's not already loaded
- if (fileInfo.absFilePath() != m_mapData.fileName())
- loadFileMap(fileInfo.absFilePath());
+ if (fileInfo.absoluteFilePath() != m_mapData.fileName())
+ loadFileMap(fileInfo.absoluteFilePath());
}
else
{
- seqInfo("No Map found for zone '%s'!", (const char*)shortZoneName);
+ seqInfo("No Map found for zone '%s'!", shortZoneName.toAscii().data());
seqInfo(" Checked for all variants of '%s.map', '%s.txt', and '%s_1.txt'",
- (const char*)shortZoneName,
- (const char*)shortZoneName, (const char*)shortZoneName);
+ shortZoneName.toAscii().data(),
+ shortZoneName.toAscii().data(),
+ shortZoneName.toAscii().data());
seqInfo(" in directories '%s' and '%s'!",
- (const char*)m_dataLocMgr->userDataDir("maps").absPath(),
- (const char*)m_dataLocMgr->pkgDataDir("maps").absPath());
+ m_dataLocMgr->userDataDir("maps").absolutePath().toAscii().data(),
+ m_dataLocMgr->pkgDataDir("maps").absolutePath().toAscii().data());
}
}
@@ -393,7 +401,7 @@
QString fileName = m_mapData.fileName();
if (fileName.isEmpty())
- fileName = m_dataLocMgr->findExistingFile("maps", fileName).absFilePath();
+ fileName = m_dataLocMgr->findExistingFile("maps", fileName).absoluteFilePath();
// create a file dialog the defaults to the currently open map
fileName = QFileDialog::getOpenFileName(m_dialogParent, "Load Map", fileName,
@@ -402,7 +410,7 @@
if (fileName.isEmpty ())
return;
- seqInfo("Attempting to load map: %s", (const char*)fileName);
+ seqInfo("Attempting to load map: %s", fileName.toAscii().data());
// load the map
loadFileMap(fileName, false, true);
@@ -417,7 +425,7 @@
QString fileName = m_mapData.fileName();
if (fileName.isEmpty())
- fileName = m_dataLocMgr->findExistingFile("maps", fileName).absFilePath();
+ fileName = m_dataLocMgr->findExistingFile("maps", fileName).absoluteFilePath();
// create a file dialog the defaults to the currently open map
fileName = QFileDialog::getOpenFileName(m_dialogParent, "Import Map", fileName,
@@ -426,7 +434,7 @@
if (fileName.isEmpty ())
return;
- seqInfo("Attempting to import map: %s", (const char*)fileName);
+ seqInfo("Attempting to import map: %s", fileName.toAscii().data());
// load the map
loadFileMap(fileName, true, true);
@@ -496,7 +504,7 @@
fileInfo = m_dataLocMgr->findWriteFile("maps", fileInfo.baseName() + ".map",
false);
- m_mapData.saveMap(fileInfo.absFilePath());
+ m_mapData.saveMap(fileInfo.absoluteFilePath());
}
void MapMgr::saveSOEMap ()
@@ -509,7 +517,7 @@
fileInfo = m_dataLocMgr->findWriteFile("maps", fileInfo.baseName() + "_2.txt",
false);
- m_mapData.saveSOEMap(fileInfo.absFilePath());
+ m_mapData.saveSOEMap(fileInfo.absoluteFilePath());
}
void MapMgr::addItem(const Item* item)
@@ -584,10 +592,10 @@
{
// ZBTEMP: Should create a real dialog to enter location info
bool ok;
- QString name = QInputDialog::getText("Location Name",
+ QString name = QInputDialog::getText(parent, "Location Name",
"Please enter a location name",
QLineEdit::Normal,
- QString::null, &ok, parent);
+ QString::null, &ok);
// if the user clicked ok, and actually gave a name, add it
if (ok && !name.isEmpty())
@@ -731,7 +739,7 @@
QString preferenceName = m_map->preferenceName();
// set the caption to be the preference name of the map
- setCaption(preferenceName);
+ setWindowTitle(preferenceName);
QMenu* subMenu;
QMenu* subSubMenu;
@@ -1000,7 +1008,10 @@
addAction("Edit Map Icons...", m_map, SLOT(showMapIconDialog()));
subMenu = new QMenu("Draw Size");
- m_drawSizeSpinBox = new QSpinBox(1, 6, 1, subMenu);
+ m_drawSizeSpinBox = new QSpinBox(subMenu);
+ m_drawSizeSpinBox->setMinimum(1);
+ m_drawSizeSpinBox->setMaximum(6);
+ m_drawSizeSpinBox->setSingleStep(1);
m_drawSizeSpinBox->setValue(m_mapIcons->drawSize());
connect(m_drawSizeSpinBox, SIGNAL(valueChanged(int)),
m_mapIcons, SLOT(setDrawSize(int)));
@@ -1014,7 +1025,11 @@
QHBoxLayout* tmpHBoxLayout = new QHBoxLayout(tmpHBox);
tmpHBoxLayout->setContentsMargins(1, 1, 1, 1);
m_fovSpinBoxLabel = new QLabel("Distance:", tmpHBox);
- m_fovSpinBox = new QSpinBox(20, 1200, 20, tmpHBox, "FOV");
+ m_fovSpinBox = new QSpinBox(tmpHBox);
+ m_fovSpinBox->setObjectName("FOV");
+ m_fovSpinBox->setMinimum(20);
+ m_fovSpinBox->setMaximum(1200);
+ m_fovSpinBox->setSingleStep(20);
tmpHBoxLayout->addWidget(m_fovSpinBoxLabel);
tmpHBoxLayout->addWidget(m_fovSpinBox);
m_fovSpinBox->setValue(m_mapIcons->fovDistance());
@@ -1114,7 +1129,10 @@
m_action_FOV = addMenu(subMenu);
subMenu = new QMenu("Default Zoom");
- m_zoomDefaultSpinBox = new QSpinBox(1, 32, 1, subMenu);
+ m_zoomDefaultSpinBox = new QSpinBox(subMenu);
+ m_zoomDefaultSpinBox->setMinimum(1);
+ m_zoomDefaultSpinBox->setMaximum(32);
+ m_zoomDefaultSpinBox->setSingleStep(1);
m_zoomDefaultSpinBox->setValue(m_mapIcons->drawSize());
connect(m_zoomDefaultSpinBox, SIGNAL(valueChanged(int)),
m_map, SLOT(setZoomDefault(int)));
@@ -1244,7 +1262,7 @@
int fovDistance = m_mapIcons->fovDistance();
m_fovSpinBox->setRange(newFOVDistMin, newFOVDistMax);
- m_fovSpinBox->setLineStep(newFOVDistInc);
+ m_fovSpinBox->setSingleStep(newFOVDistInc);
m_fovSpinBox->setValue(fovDistance);
m_action_FOVDistanceBased->setChecked(fovMode == tFOVDistanceBased);
@@ -1521,7 +1539,7 @@
uint32_t runtimeFilterFlagMask,
QWidget * parent,
const char *name)
- : QWidget (parent, name),
+ : QWidget (parent),
m_preferenceName(preferenceName),
m_param(mapMgr->mapData()),
m_mapMgr(mapMgr),
@@ -1535,6 +1553,8 @@
m_zoneMgr(zoneMgr),
m_spawnMonitor(spawnMonitor)
{
+
+ setObjectName(name);
#ifdef DEBUGMAP
qDebug ("Map()");
#endif /* DEBUGMAP */
@@ -1573,7 +1593,7 @@
tmpPrefString = "Caption";
tmpDefault = QString("ShowEQ - ") + prefString;
- setCaption(pSEQPrefs->getPrefString(tmpPrefString, prefString, tmpDefault));
+ setWindowTitle(pSEQPrefs->getPrefString(tmpPrefString, prefString, tmpDefault));
tmpPrefString = "CacheChanges";
m_cacheChanges = pSEQPrefs->getPrefBool(tmpPrefString, prefString, true);
@@ -1777,7 +1797,7 @@
m_param.setScreenSize(size());
// Setup offscreen image
- m_offscreen.resize(m_param.screenLength());
+ m_offscreen = QPixmap(m_param.screenLength());
// m_offscreen.setOptimization(m_param.pixmapOptimizationMethod());
m_mapTip = new MapLabel( this );
@@ -1807,9 +1827,9 @@
connect (m_spawnShell,SIGNAL(changeItem(const Item*, uint32_t)),
this, SLOT(changeItem(const Item*, uint32_t)));
- m_timer->start(1000/m_frameRate, false);
+ m_timer->start(1000/m_frameRate);
-#ifdef DEBUG
+#ifdef DEBUG
if (m_showDebugInfo)
m_time.start();
#endif
@@ -2339,7 +2359,7 @@
emit frameRateChanged(m_frameRate);
if (m_timer->isActive())
- m_timer->changeInterval(1000/m_frameRate);
+ m_timer->setInterval(1000/m_frameRate);
}
}
@@ -2887,7 +2907,7 @@
void Map::dumpInfo(QTextStream& out)
{
out << "[" << preferenceName() << "]" << endl;
- out << "Caption: " << caption() << endl;
+ out << "Caption: " << windowTitle() << endl;
out << "AnimateSpawnMovement: " << m_animate << endl;
out << "VelocityLines: " << m_showVelocityLines << endl;
out << "SpawnDepthFilter: " << m_showVelocityLines << endl;
@@ -2990,9 +3010,9 @@
if (!m_mapIconDialog)
{
// first create the dialog
- m_mapIconDialog = new MapIconDialog(this, caption() + " Icon Dialog",
- false);
-
+ m_mapIconDialog = new MapIconDialog(this,
+ QString(windowTitle() + " Icon Dialog").toAscii().data(), false);
+
// then pass it this objects map icons object
m_mapIconDialog->setMapIcons(m_mapIcons);
}
@@ -3008,7 +3028,7 @@
#endif /* DEBUGMAP */
m_param.setScreenSize(qs->size());
- m_offscreen.resize(m_param.screenLength());
+ m_offscreen = QPixmap(m_param.screenLength());
reAdjust();
@@ -3021,7 +3041,7 @@
reAdjust();
// then, repaint the map
- repaint(mapRect(), FALSE);
+ repaint(mapRect());
}
void Map::refreshMap(void)
@...
[truncated message content] |