|
From: <cn...@us...> - 2020-11-08 21:58:03
|
Revision: 1097
http://sourceforge.net/p/seq/svn/1097
Author: cn187
Date: 2020-11-08 21:58:00 +0000 (Sun, 08 Nov 2020)
Log Message:
-----------
Replace Q3MainWindow/Q3DockArea/Q3DockWindow with QMainWindow/QDockWidget
Modified Paths:
--------------
showeq/branches/pre_6_0_beta/src/combatlog.cpp
showeq/branches/pre_6_0_beta/src/experiencelog.cpp
showeq/branches/pre_6_0_beta/src/guildlist.cpp
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/seqwindow.cpp
showeq/branches/pre_6_0_beta/src/seqwindow.h
Modified: showeq/branches/pre_6_0_beta/src/combatlog.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/combatlog.cpp 2020-11-08 21:57:35 UTC (rev 1096)
+++ showeq/branches/pre_6_0_beta/src/combatlog.cpp 2020-11-08 21:58:00 UTC (rev 1097)
@@ -255,6 +255,10 @@
m_dDPS(0.0),
m_dDPSLast(0.0)
{
+
+ if (!name)
+ setObjectName("Combat");
+
/* Hopefully this is only called once to set up the window,
so this is a good place to initialize some things which
otherwise won't be. */
Modified: showeq/branches/pre_6_0_beta/src/experiencelog.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/experiencelog.cpp 2020-11-08 21:57:35 UTC (rev 1096)
+++ showeq/branches/pre_6_0_beta/src/experiencelog.cpp 2020-11-08 21:58:00 UTC (rev 1097)
@@ -167,6 +167,9 @@
m_group(groupMgr),
m_zoneMgr(zoneMgr)
{
+ if (!name)
+ setObjectName("Experience");
+
/* Hopefully this is only called once to set up the window,
so this is a good place to initialize some things which
otherwise won't be. */
Modified: showeq/branches/pre_6_0_beta/src/guildlist.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/guildlist.cpp 2020-11-08 21:57:35 UTC (rev 1096)
+++ showeq/branches/pre_6_0_beta/src/guildlist.cpp 2020-11-08 21:58:00 UTC (rev 1097)
@@ -163,8 +163,8 @@
// Guild Name
m_guildName = new QLabel("Guild", this);
m_guildName->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
- m_guildName->setFrameShape(LineEditPanel);
- m_guildName->setFrameShadow(Sunken);
+ m_guildName->setFrameShape(QFrame::StyledPanel);
+ m_guildName->setFrameShadow(QFrame::Sunken);
m_guildName->setMinimumWidth(50);
m_guildName->setMaximumWidth(300);
hLayout->addWidget(m_guildName, 1, Qt::AlignLeft);
@@ -173,8 +173,8 @@
// Guild Totals
m_guildTotals = new QLabel("", this);
m_guildTotals->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
- m_guildTotals->setFrameShape(LineEditPanel);
- m_guildTotals->setFrameShadow(Sunken);
+ m_guildTotals->setFrameShape(QFrame::StyledPanel);
+ m_guildTotals->setFrameShadow(QFrame::Sunken);
m_guildTotals->setMinimumWidth(30);
m_guildTotals->setMaximumWidth(120);
hLayout->addWidget(m_guildTotals, 0, Qt::AlignRight);
Modified: showeq/branches/pre_6_0_beta/src/interface.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/interface.cpp 2020-11-08 21:57:35 UTC (rev 1096)
+++ showeq/branches/pre_6_0_beta/src/interface.cpp 2020-11-08 21:58:00 UTC (rev 1097)
@@ -88,7 +88,6 @@
#include <QInputDialog>
#include <QFontDialog>
#include <QColorDialog>
-#include <Q3DockArea>
#include <QWindowsStyle>
#include <QPlastiqueStyle>
#include <QMotifStyle>
@@ -96,6 +95,7 @@
#include <QCleanlooksStyle>
#include <QMenu>
#include <QWidgetAction>
+#include <QDesktopWidget>
// this define is used to diagnose the order with which zone packets are rcvd
#define ZONE_ORDER_DIAG
@@ -103,7 +103,7 @@
/* The main interface widget */
EQInterface::EQInterface(DataLocationMgr* dlm,
QWidget * parent, const char *name)
- : Q3MainWindow (parent, nullptr, Qt::WType_TopLevel),
+ : QMainWindow (parent),
m_player(0),
m_dataLocationMgr(dlm),
m_mapMgr(0),
@@ -148,12 +148,10 @@
m_guildListWindow(0)
{
setObjectName(name);
+ setWindowFlags(Qt::WType_TopLevel);
- // disable the dock menu
- setDockMenuEnabled(false);
+ setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks);
- setCentralWidget(new QWidget(this));
-
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
sizePolicy.setHeightForWidth(false);
setSizePolicy(sizePolicy);
@@ -361,51 +359,47 @@
// Initialize the experience window;
m_expWindow = new ExperienceWindow(m_dataLocationMgr, m_player, m_groupMgr,
- m_zoneMgr);
- setDockEnabled(m_expWindow,
- pSEQPrefs->getPrefBool("DockableExperienceWindow",
- section, false));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_expWindow->preferenceName(),
- Qt::DockUnmanaged);
- addDockWindow(m_expWindow, edge, false);
- m_expWindow->undock();
+ m_zoneMgr, this);
+ setDockEnabled(m_expWindow,
+ pSEQPrefs->getPrefBool("DockableExperienceWindow", section, false));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_expWindow->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_expWindow);
+ m_expWindow->setFloating(true);
- m_expWindow->restoreSize();
-
- // move window to new position
- if (pSEQPrefs->getPrefBool("UseWindowPos", section, true))
- m_expWindow->restorePosition();
-
if (pSEQPrefs->getPrefBool("ShowExpWindow", section, false))
+ {
m_expWindow->show();
+ insertWindowMenu(m_expWindow);
+ }
+ else
+ {
+ m_expWindow->hide();
+ removeWindowMenu(m_expWindow);
+ }
- // insert its menu into the window menu
- insertWindowMenu(m_expWindow);
+
// Initialize the combat window
- m_combatWindow = new CombatWindow(m_player);
- setDockEnabled(m_combatWindow,
- pSEQPrefs->getPrefBool("DockableCombatWindow",
- section, false));
- edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_combatWindow->preferenceName(),
- Qt::DockUnmanaged);
- addDockWindow(m_combatWindow, edge, false);
- m_combatWindow->undock();
+ m_combatWindow = new CombatWindow(m_player, this);
+ setDockEnabled(m_combatWindow,
+ pSEQPrefs->getPrefBool("DockableCombatWindow", section, false));
+ edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_combatWindow->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_combatWindow);
+ m_combatWindow->setFloating(true);
- m_combatWindow->restoreSize();
-
- // move window to new position
- if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
- m_combatWindow->restorePosition();
-
if (pSEQPrefs->getPrefBool("ShowCombatWindow", section, false))
+ {
m_combatWindow->show();
+ insertWindowMenu(m_combatWindow);
+ }
+ else
+ {
+ m_combatWindow->hide();
+ removeWindowMenu(m_combatWindow);
+ }
- // insert its menu into the window menu
- insertWindowMenu(m_combatWindow);
-
/////////////////
// Main widgets
// Make a VBox to use as central widget
@@ -500,7 +494,7 @@
//
// Create the Spawn List listview (always exists, just hidden if not specified)
//
- m_isSpawnPointListDocked = pSEQPrefs->getPrefBool("DockedSpawnPointList", section, false);
+ m_isSpawnPointListDocked = pSEQPrefs->getPrefBool("DockedSpawnPointList", section, true);
if (pSEQPrefs->getPrefBool("ShowSpawnPointList", section, false))
showSpawnPointList();
@@ -2449,13 +2443,10 @@
m_combatWindow, SLOT(savePrefs(void)));
}
-
+
//
// Geometry Configuration
//
-
- QSize s;
- QPoint p;
// interface components
@@ -2462,34 +2453,45 @@
// set mainwindow Geometry
section = "Interface";
- s = pSEQPrefs->getPrefSize("WindowSize", section, size());
- resize(s);
- if (pSEQPrefs->getPrefBool("UseWindowPos", section, true))
+
+ // The way window/dock state was saved with Qt3 won't work with Qt4+, so
+ // we use the Qt-provided functions instead. Unforunately, that means the
+ // size/position preferences saved in the Qt3 version won't be usable, and
+ // the users will have to redo their window/dock size/placement.
+ QString dockPrefsState = pSEQPrefs->getPrefString("DockingInfoState",
+ section, QString());
+ QString dockPrefsGeometry = pSEQPrefs->getPrefString("DockingInfoGeometry",
+ section, QString());
+
+ bool usePos = pSEQPrefs->getPrefBool("UseWindowPos", section, true);
+ if (usePos)
{
- p = pSEQPrefs->getPrefPoint("WindowPos", section, pos());
- move(p);
+ if (!restoreGeometry(QByteArray::fromBase64(dockPrefsGeometry.toAscii())))
+ seqWarn("Could not restore dock/window geometry. Rearrange windows "
+ "as desired and then re-save preferences");
+ else
+ // work around QTBUG-46620
+ if (isMaximized())
+ setGeometry(QApplication::desktop()->availableGeometry(this));
+
+ if (!restoreState(QByteArray::fromBase64(dockPrefsState.toAscii())))
+ seqWarn("Could not restore dock/window state. Rearrange windows as"
+ " desired and then re-save prefrences");
}
- show();
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,
- QString());
- if (!dockPrefs.isEmpty())
- {
- QTextStream ts(&dockPrefs, QIODevice::ReadOnly);
- ts >> *this;
- }
-
// Set main window title
// TODO: Add % replacement values and a signal to update, for ip address currently
// TODO: being monitored.
- Q3MainWindow::setWindowTitle(pSEQPrefs->getPrefString("Caption", section,
- "ShowEQ - Main (ctrl+alt+t to toggle menubar)"));
+ QMainWindow::setWindowTitle(pSEQPrefs->getPrefString("Caption", section,
+ "ShowEQ - Main (ctrl+alt+t to toggle menubar)"));
+ show();
+
+
// load the format strings for display
loadFormatStrings();
@@ -2772,13 +2774,9 @@
// attempt to undock the window
if (widget)
{
- if (docked)
- widget->dock();
- else
- {
- widget->undock();
+ widget->setFloating(!docked);
+ if (!docked)
widget->activateWindow();
- }
// make the widget update it's geometry
widget->updateGeometry();
@@ -3301,52 +3299,32 @@
EQInterface::savePrefs(void)
{
seqDebug("==> EQInterface::savePrefs()");
-
- if( isVisible() )
+
+ QString section = "Interface";
+ bool savePos = pSEQPrefs->getPrefBool("SavePosition", section, true);
+
+ if( isVisible() && savePos)
{
seqDebug("\tisVisible()");
- QString section;
- QString interfaceSection = "Interface";
- QString tempStr;
- QString dockPrefs;
- QTextStream ts(&dockPrefs, QIODevice::WriteOnly);
+ QString dockPrefsState = saveState().toBase64();
+ pSEQPrefs->setPrefString("DockingInfoState", section, dockPrefsState);
- ts << *this;
+ QString dockPrefsGeometry = saveGeometry().toBase64();
+ pSEQPrefs->setPrefString("DockingInfoGeometry", section, dockPrefsGeometry);
- pSEQPrefs->setPrefString("DockingInfo", interfaceSection, dockPrefs);
-
// send savePrefs signal out
emit saveAllPrefs();
-
- section = "Interface";
- if (pSEQPrefs->getPrefBool("SavePosition", interfaceSection, true))
- {
- pSEQPrefs->setPrefPoint("WindowPos", section,
- topLevelWidget()->pos());
- pSEQPrefs->setPrefSize("WindowSize", section,
- topLevelWidget()->size());
- }
-
+
// save prefs to file
pSEQPrefs->save();
}
} // end savePrefs
-void EQInterface::saveDockAreaPrefs(Q3DockArea* a, Qt::ToolBarDock edge)
-{
- QList<Q3DockWindow*> l = a->dockWindowList();
- for (QList<Q3DockWindow*>::iterator dw = l.begin(); dw != l.end(); ++dw)
- {
- if ((*dw)->inherits("SEQWindow"))
- pSEQPrefs->setPrefInt("Dock", ((SEQWindow*)(*dw))->preferenceName(), edge);
- }
-}
-
void EQInterface::setCaption(const QString& text)
{
- Q3MainWindow::setWindowTitle(text);
+ QMainWindow::setWindowTitle(text);
pSEQPrefs->setPrefString("Caption", "Interface", windowTitle());
}
@@ -3529,9 +3507,14 @@
void EQInterface::listInterfaceInfo(void)
{
#ifdef DEBUG
- qDebug ("listMapInfo()");
+ qDebug ("listInterfaceInfo()");
#endif /* DEBUG */
+ //FIXME - writing directly from the main interface no longer works with QT4.
+ //it may be possible to extract the info from saveState and saveGeometry, or
+ //it may be necessary to enumerate each window and get the layout
+ //info individually
+
QString outText;
// open the output data stream
@@ -3539,10 +3522,10 @@
out << "Map window layout info:" << endl;
out << "-----------------------" << endl;
- out << *this;
+ //FIXME out << *this;
+ out << "FIXME" << endl;
out << "-----------------------" << endl;
-
seqInfo(outText.toAscii().data());
}
@@ -3992,9 +3975,15 @@
void EQInterface::toggle_view_ExpWindow ()
{
if (!m_expWindow->isVisible())
+ {
m_expWindow->show();
+ insertWindowMenu(m_expWindow);
+ }
else
+ {
m_expWindow->hide();
+ removeWindowMenu(m_expWindow);
+ }
pSEQPrefs->setPrefBool("ShowExpWindow", "Interface",
m_expWindow->isVisible());
@@ -4003,9 +3992,15 @@
void EQInterface::toggle_view_CombatWindow (void)
{
if (!m_combatWindow->isVisible())
+ {
m_combatWindow->show();
+ insertWindowMenu(m_combatWindow);
+ }
else
+ {
m_combatWindow->hide();
+ removeWindowMenu(m_combatWindow);
+ }
pSEQPrefs->setPrefBool("ShowCombatWindow", "Interface",
m_combatWindow->isVisible());
@@ -5719,34 +5714,26 @@
pSEQPrefs->getPrefBool(QString("Dockable") + mapPrefName,
"Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock", m_map[i]->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_map[i], mapName, edge, true);
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_map[i]->preferenceName(), Qt::RightDockWidgetArea);
+ addDockWidget(edge, m_map[i]);
if (!m_isMapDocked[i])
- m_map[i]->undock();
+ m_map[i]->setFloating(!m_isMapDocked[i]);
- connect(this, SIGNAL(saveAllPrefs(void)),
- m_map[i], SLOT(savePrefs()));
- connect(this, SIGNAL(restoreFonts(void)),
- m_map[i], SLOT(restoreFont(void)));
-
+ connect(this, SIGNAL(saveAllPrefs(void)), m_map[i], SLOT(savePrefs()));
+ connect(this, SIGNAL(restoreFonts(void)), m_map[i], SLOT(restoreFont(void)));
+
// Get the map...
Map* map = m_map[i]->map();
-
+
// supply the Map slots with signals from EQInterface
- connect (this, SIGNAL(selectSpawn(const Item*)),
- map, SLOT(selectSpawn(const Item*)));
-
+ connect (this, SIGNAL(selectSpawn(const Item*)),
+ map, SLOT(selectSpawn(const Item*)));
+
// supply EQInterface slots with signals from Map
connect (map, SIGNAL(spawnSelected(const Item*)),
- this, SLOT(spawnSelected(const Item*)));
+ this, SLOT(spawnSelected(const Item*)));
- m_map[i]->restoreSize();
-
- // restore it's position if necessary and practical
- if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
- m_map[i]->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_map[i]);
}
@@ -5779,24 +5766,16 @@
setDockEnabled(m_messageWindow[i],
pSEQPrefs->getPrefBool(QString("Dockable") + prefName,
"Interface", false));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_messageWindow[i]->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_messageWindow[i], edge, false);
- if (!m_isMessageWindowDocked[i])
- m_messageWindow[i]->undock();
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_messageWindow[i]->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_messageWindow[i]);
+ m_messageWindow[i]->setFloating(!m_isMessageWindowDocked[i]);
connect(this, SIGNAL(saveAllPrefs(void)),
m_messageWindow[i], SLOT(savePrefs(void)));
connect(this, SIGNAL(restoreFonts(void)),
m_messageWindow[i], SLOT(restoreFont(void)));
-
- m_messageWindow[i]->restoreSize();
- // restore it's position if necessary and practical
- if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
- m_messageWindow[i]->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_messageWindow[i]);
}
@@ -5818,22 +5797,11 @@
pSEQPrefs->getPrefBool("DockableSpawnList",
"Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_spawnList->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_spawnList, edge, false);
- if (m_isSpawnListDocked)
- m_spawnList->undock();
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_spawnList->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_spawnList);
+ m_spawnList->setFloating(!m_isSpawnListDocked);
- // restore the size of the spawn list
- m_spawnList->restoreSize();
-
- // only do this move stuff iff the spawn list isn't docked
- // and the user set the option to do so.
- if (!m_isSpawnListDocked &&
- pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0))
- m_spawnList->restorePosition();
-
// connections from spawn list to interface
connect (m_spawnList->spawnList(), SIGNAL(spawnSelected(const Item*)),
this, SLOT(spawnSelected(const Item*)));
@@ -5866,22 +5834,11 @@
setDockEnabled(m_spawnList2,
pSEQPrefs->getPrefBool("DockableSpawnList2",
"Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_spawnList2->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_spawnList2, edge, false);
- if (!m_isSpawnList2Docked)
- m_spawnList2->undock();
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_spawnList2->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_spawnList2);
+ m_spawnList2->setFloating(!m_isSpawnList2Docked);
- // restore the size of the spawn list
- m_spawnList2->restoreSize();
-
- // only do this move stuff iff the spawn list isn't docked
- // and the user set the option to do so.
- if (!m_isSpawnList2Docked &&
- pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0))
- m_spawnList2->restorePosition();
-
// connections from spawn list to interface
connect (m_spawnList2, SIGNAL(spawnSelected(const Item*)),
this, SLOT(spawnSelected(const Item*)));
@@ -5908,36 +5865,22 @@
// if it doesn't exist, create it.
if (m_spawnPointList == 0)
{
- m_spawnPointList = new SpawnPointWindow(m_spawnMonitor,
- 0, "spawnlist");
- setDockEnabled(m_spawnPointList,
- pSEQPrefs->getPrefBool("DockableSpawnPointList",
- "Interface", true));
- Qt::ToolBarDock edge =
- (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_spawnPointList->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_spawnPointList, edge, false);
- if (!m_isSpawnPointListDocked)
- m_spawnPointList->undock();
+ m_spawnPointList = new SpawnPointWindow(m_spawnMonitor, 0, "spawnlist");
+ setDockEnabled(m_spawnPointList,
+ pSEQPrefs->getPrefBool("DockableSpawnPointList", "Interface", true));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_spawnPointList->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_spawnPointList);
+ m_spawnPointList->setFloating(!m_isSpawnPointListDocked);
- // restore the size of the spawn list
- m_spawnPointList->restoreSize();
+ // connections from interface to spawn list
+ connect(this, SIGNAL(saveAllPrefs(void)),
+ m_spawnPointList, SLOT(savePrefs(void)));
+ connect(this, SIGNAL(restoreFonts(void)),
+ m_spawnPointList, SLOT(restoreFont(void)));
- // only do this move stuff iff the spawn list isn't docked
- // and the user set the option to do so.
- if (!m_isSpawnPointListDocked &&
- pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0))
- m_spawnPointList->restorePosition();
-
- // connections from interface to spawn list
- connect(this, SIGNAL(saveAllPrefs(void)),
- m_spawnPointList, SLOT(savePrefs(void)));
- connect(this, SIGNAL(restoreFonts(void)),
- m_spawnPointList, SLOT(restoreFont(void)));
-
- // insert its menu into the window menu
- insertWindowMenu(m_spawnPointList);
+ // insert its menu into the window menu
+ insertWindowMenu(m_spawnPointList);
}
// make sure it's visible
@@ -5951,31 +5894,17 @@
if (m_statList == 0)
{
m_statList = new StatListWindow(m_player, 0, "stats");
- setDockEnabled(m_statList,
- pSEQPrefs->getPrefBool("DockablePlayerStats",
- "Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_statList->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_statList, edge, false);
- if (!m_isStatListDocked)
- m_statList->undock();
+ setDockEnabled(m_statList, pSEQPrefs->getPrefBool("DockablePlayerStats",
+ "Interface", true));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_statList->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_statList);
+ m_statList->setFloating(!m_isStatListDocked);
// connect stat list slots to interface signals
- connect(this, SIGNAL(saveAllPrefs(void)),
- m_statList, SLOT(savePrefs(void)));
- connect(this, SIGNAL(restoreFonts(void)),
- m_statList, SLOT(restoreFont(void)));
+ connect(this, SIGNAL(saveAllPrefs(void)), m_statList, SLOT(savePrefs(void)));
+ connect(this, SIGNAL(restoreFonts(void)), m_statList, SLOT(restoreFont(void)));
- // restore the size of the spawn list
- m_statList->restoreSize();
-
- // only do this move stuff iff the spawn list isn't docked
- // and the user set the option to do so.
- if (!m_isStatListDocked &&
- pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0))
- m_statList->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_statList);
}
@@ -5991,31 +5920,17 @@
if (m_skillList == 0)
{
m_skillList = new SkillListWindow(m_player, 0, "skills");
- setDockEnabled(m_skillList,
- pSEQPrefs->getPrefBool("DockablePlayerSkills",
- "Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_skillList->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_skillList, edge, false);
- if (!m_isSkillListDocked)
- m_skillList->undock();
+ setDockEnabled(m_skillList,
+ pSEQPrefs->getPrefBool("DockablePlayerSkills", "Interface", true));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_skillList->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_skillList);
+ m_skillList->setFloating(!m_isSkillListDocked);
// connect skill list slots to interfaces signals
- connect(this, SIGNAL(saveAllPrefs(void)),
- m_skillList, SLOT(savePrefs(void)));
- connect(this, SIGNAL(restoreFonts(void)),
- m_skillList, SLOT(restoreFont(void)));
+ connect(this, SIGNAL(saveAllPrefs(void)), m_skillList, SLOT(savePrefs(void)));
+ connect(this, SIGNAL(restoreFonts(void)), m_skillList, SLOT(restoreFont(void)));
- // restore the size of the spawn list
- m_skillList->restoreSize();
-
- // only do this move stuff iff the spawn list isn't docked
- // and the user set the option to do so.
- if (!m_isSkillListDocked &&
- pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0))
- m_skillList->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_skillList);
}
@@ -6031,15 +5946,12 @@
if (m_spellList == 0)
{
m_spellList = new SpellListWindow(m_spellShell, this, "spelllist");
- setDockEnabled(m_spellList,
- pSEQPrefs->getPrefBool("DockableSpellList",
- "Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_spellList->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_spellList, edge, false);
- if (!m_isSpellListDocked)
- m_spellList->undock();
+ setDockEnabled(m_spellList,
+ pSEQPrefs->getPrefBool("DockableSpellList", "Interface", true));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_spellList->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_spellList);
+ m_spellList->setFloating(!m_isSpellListDocked);
SpellList* spellList = m_spellList->spellList();
@@ -6057,15 +5969,6 @@
connect(this, SIGNAL(restoreFonts(void)),
m_spellList, SLOT(restoreFont(void)));
- // restore the size of the spell list
- m_spellList->restoreSize();
-
- // only do this move stuff iff the spell list isn't docked
- // and the user set the option to do so.
- if (!m_isSpellListDocked &&
- pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0))
- m_spellList->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_spellList);
}
@@ -6081,15 +5984,12 @@
if (m_compass == 0)
{
m_compass = new CompassFrame(m_player, 0, "compass");
- setDockEnabled(m_compass,
- pSEQPrefs->getPrefBool("DockableCompass",
- "Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_compass->preferenceName(),
- Qt::DockLeft);
- addDockWindow(m_compass, edge, false);
- if (!m_isCompassDocked)
- m_compass->undock();
+ setDockEnabled(m_compass,
+ pSEQPrefs->getPrefBool("DockableCompass", "Interface", true));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_compass->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_compass);
+ m_compass->setFloating(!m_isCompassDocked);
// supply the compass slots with EQInterface signals
connect (this, SIGNAL(selectSpawn(const Item*)),
@@ -6099,12 +5999,6 @@
connect(this, SIGNAL(saveAllPrefs(void)),
m_compass, SLOT(savePrefs(void)));
- m_compass->restoreSize();
-
- // move window to new position
- if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
- m_compass->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_compass);
}
@@ -6119,26 +6013,16 @@
if (m_netDiag == 0)
{
m_netDiag = new NetDiag(m_packet, 0, "NetDiag");
- setDockEnabled(m_netDiag,
- pSEQPrefs->getPrefBool("DockableNetDiag",
- "Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_netDiag->preferenceName(),
- Qt::DockBottom);
- addDockWindow(m_netDiag, edge, true);
- m_netDiag->undock();
+ setDockEnabled(m_netDiag,
+ pSEQPrefs->getPrefBool("DockableNetDiag", "Interface", true));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_netDiag->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_netDiag);
+ m_netDiag->setFloating(true);
- connect(this, SIGNAL(restoreFonts(void)),
- m_netDiag, SLOT(restoreFont(void)));
- connect(this, SIGNAL(saveAllPrefs(void)),
- m_netDiag, SLOT(savePrefs(void)));
+ connect(this, SIGNAL(restoreFonts(void)), m_netDiag, SLOT(restoreFont(void)));
+ connect(this, SIGNAL(saveAllPrefs(void)), m_netDiag, SLOT(savePrefs(void)));
- m_netDiag->restoreSize();
-
- // move window to new position
- if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
- m_netDiag->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_netDiag);
}
@@ -6152,28 +6036,17 @@
{
if (!m_guildListWindow)
{
- m_guildListWindow = new GuildListWindow(m_player, m_guildShell,
- 0, "GuildList");
- setDockEnabled(m_guildListWindow,
- pSEQPrefs->getPrefBool("DockableGuildListWindow",
- "Interface", true));
- Qt::ToolBarDock edge = (Qt::ToolBarDock)pSEQPrefs->getPrefInt("Dock",
- m_guildListWindow->preferenceName(),
- Qt::DockBottom);
- addDockWindow(m_guildListWindow, edge, true);
- m_guildListWindow->undock();
+ m_guildListWindow = new GuildListWindow(m_player, m_guildShell, 0, "GuildList");
+ setDockEnabled(m_guildListWindow,
+ pSEQPrefs->getPrefBool("DockableGuildListWindow", "Interface", true));
+ Qt::DockWidgetArea edge = (Qt::DockWidgetArea)pSEQPrefs->getPrefInt("Dock",
+ m_guildListWindow->preferenceName(), Qt::LeftDockWidgetArea);
+ addDockWidget(edge, m_guildListWindow);
+ m_guildListWindow->setFloating(true);
- connect(this, SIGNAL(restoreFonts(void)),
- m_guildListWindow, SLOT(restoreFont(void)));
- connect(this, SIGNAL(saveAllPrefs(void)),
- m_guildListWindow, SLOT(savePrefs(void)));
+ connect(this, SIGNAL(restoreFonts(void)), m_guildListWindow, SLOT(restoreFont(void)));
+ connect(this, SIGNAL(saveAllPrefs(void)), m_guildListWindow, SLOT(savePrefs(void)));
- m_guildListWindow->restoreSize();
-
- // move window to new position
- if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
- m_guildListWindow->restorePosition();
-
// insert its menu into the window menu
insertWindowMenu(m_guildListWindow);
}
@@ -6421,12 +6294,12 @@
}
}
-void EQInterface::setDockEnabled(Q3DockWindow* dw, bool enable)
+void EQInterface::setDockEnabled(QDockWidget* dw, bool enable)
{
- Q3MainWindow::setDockEnabled(dw, Qt::DockTop, enable);
- Q3MainWindow::setDockEnabled(dw, Qt::DockBottom, enable);
- Q3MainWindow::setDockEnabled(dw, Qt::DockLeft, enable);
- Q3MainWindow::setDockEnabled(dw, Qt::DockRight, enable);
+ if (enable)
+ dw->setAllowedAreas(Qt::AllDockWidgetAreas);
+ else
+ dw->setAllowedAreas(Qt::NoDockWidgetArea);
}
#ifndef QMAKEBUILD
Modified: showeq/branches/pre_6_0_beta/src/interface.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/interface.h 2020-11-08 21:57:35 UTC (rev 1096)
+++ showeq/branches/pre_6_0_beta/src/interface.h 2020-11-08 21:58:00 UTC (rev 1097)
@@ -29,7 +29,7 @@
#include <QLayout>
#include <QMenuBar>
#include <QMenu>
-#include <Q3MainWindow>
+#include <QMainWindow>
#include <QSplitter>
#include <QList>
#include <QTimer>
@@ -119,7 +119,7 @@
/*!
\brief QMainWindow from Hell! Also known as ShowEQ's main window.
*/
-class EQInterface:public Q3MainWindow
+class EQInterface:public QMainWindow
{
Q_OBJECT
@@ -169,7 +169,6 @@
void updateSelectedSpawnStatus(const Item* item);
void savePrefs(void);
- void saveDockAreaPrefs(Q3DockArea* a, Qt::ToolBarDock edge);
void addCategory(void);
void reloadCategories(void);
@@ -341,7 +340,7 @@
void createOPCodeMonitorLog(const QString&);
void insertWindowMenu(SEQWindow* window);
void removeWindowMenu(SEQWindow* window);
- void setDockEnabled(Q3DockWindow* dw, bool enable);
+ void setDockEnabled(QDockWidget* dw, bool enable);
public:
Player* m_player;
Modified: showeq/branches/pre_6_0_beta/src/seqwindow.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/seqwindow.cpp 2020-11-08 21:57:35 UTC (rev 1096)
+++ showeq/branches/pre_6_0_beta/src/seqwindow.cpp 2020-11-08 21:58:00 UTC (rev 1097)
@@ -34,19 +34,19 @@
SEQWindow::SEQWindow(const QString prefName, const QString caption,
QWidget* parent, const char* name, Qt::WFlags f)
- : Q3DockWindow(parent, name, f),
+ : QDockWidget(parent),
m_preferenceName(prefName)
{
+ setObjectName(name);
+ setWindowFlags(f);
// set the windows caption
- Q3DockWindow::setWindowTitle(pSEQPrefs->getPrefString("Caption", preferenceName(),
- caption));
+ QDockWidget::setWindowTitle(pSEQPrefs->getPrefString("Caption", preferenceName(),
+ caption));
- // windows default to resizable
- setResizeEnabled(true);
+ setFeatures(QDockWidget::DockWidgetClosable |
+ QDockWidget::DockWidgetMovable |
+ QDockWidget::DockWidgetFloatable);
- // windows default to be closable when not docked
- setCloseMode(Always);
-
// restore the font
restoreFont();
@@ -69,7 +69,7 @@
void SEQWindow::setCaption(const QString& text)
{
// set the caption
- Q3DockWindow::setWindowTitle(text);
+ QDockWidget::setWindowTitle(text);
setObjectName(windowTitle());
// set the preference
@@ -96,68 +96,8 @@
}
}
-void SEQWindow::restoreSize()
-{
- if (place() == InDock)
- {
- QSize s = pSEQPrefs->getPrefSize("DockFixedExtent", preferenceName(),
- fixedExtent());
- setFixedExtentWidth(s.width());
- setFixedExtentHeight(s.height());
- }
- else
- {
- // retrieve the saved size information
- QSize s = pSEQPrefs->getPrefSize("WindowSize", preferenceName(), size());
-
- resize(s);
- }
+void SEQWindow::savePrefs(void) {}
- if (pSEQPrefs->getPrefBool("DockVisible", preferenceName(), !isHidden()))
- show();
- else
- hide();
-}
-
-void SEQWindow::restorePosition()
-{
- if (place() == InDock)
- {
- setNewLine(pSEQPrefs->getPrefBool("DockNewLine", preferenceName(),
- newLine()));
- setOffset(pSEQPrefs->getPrefInt("DockOffset", preferenceName(), offset()));
- }
- else
- {
- // retrieve the saved position information
- QPoint p = pSEQPrefs->getPrefPoint("WindowPos", preferenceName(), pos());
-
- // Move window to new position
- move(p);
- }
-}
-
-void SEQWindow::savePrefs(void)
-{
- if (pSEQPrefs->getPrefBool("SavePosition", "Interface", true))
- {
- if (place() == InDock)
- {
- pSEQPrefs->setPrefBool("DockNewLine", preferenceName(), newLine());
- pSEQPrefs->setPrefInt("DockOffset", preferenceName(), offset());
- pSEQPrefs->setPrefSize("DockFixedExtent", preferenceName(), fixedExtent());
- }
- else
- {
- // save the windows size and position information
- pSEQPrefs->setPrefSize("WindowSize", preferenceName(), size());
- pSEQPrefs->setPrefPoint("WindowPos", preferenceName(), pos());
- }
-
- pSEQPrefs->setPrefBool("DockVisible", preferenceName(), !isHidden());
- }
-}
-
void SEQWindow::mousePressEvent(QMouseEvent* e)
{
if (e->button() == Qt::RightButton)
@@ -166,10 +106,10 @@
if (popupMenu)
popupMenu->popup(mapToGlobal(e->pos()));
else
- Q3DockWindow::mousePressEvent(e);
+ QDockWidget::mousePressEvent(e);
}
else
- Q3DockWindow::mousePressEvent(e);
+ QDockWidget::mousePressEvent(e);
}
#ifndef QMAKEBUILD
Modified: showeq/branches/pre_6_0_beta/src/seqwindow.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/seqwindow.h 2020-11-08 21:57:35 UTC (rev 1096)
+++ showeq/branches/pre_6_0_beta/src/seqwindow.h 2020-11-08 21:58:00 UTC (rev 1097)
@@ -31,13 +31,13 @@
#include <QWidget>
#include <QString>
-#include <Q3DockWindow>
+#include <QDockWidget>
#include <QMenu>
#include <QMouseEvent>
class QMenu;
-class SEQWindow : public Q3DockWindow
+class SEQWindow : public QDockWidget
{
Q_OBJECT
@@ -53,8 +53,6 @@
public slots:
virtual void setCaption(const QString&);
virtual void setWindowFont(const QFont&);
- virtual void restoreSize();
- virtual void restorePosition();
virtual void restoreFont();
virtual void savePrefs(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|