summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger/qt/deviceswindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/debugger/qt/deviceswindow.cpp')
-rw-r--r--src/osd/modules/debugger/qt/deviceswindow.cpp51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/osd/modules/debugger/qt/deviceswindow.cpp b/src/osd/modules/debugger/qt/deviceswindow.cpp
index 6313e9bf98e..b1b0be2a507 100644
--- a/src/osd/modules/debugger/qt/deviceswindow.cpp
+++ b/src/osd/modules/debugger/qt/deviceswindow.cpp
@@ -4,9 +4,9 @@
#include "deviceswindow.h"
#include "deviceinformationwindow.h"
-DevicesWindowModel::DevicesWindowModel(running_machine *machine, QObject *parent)
+DevicesWindowModel::DevicesWindowModel(running_machine &machine, QObject *parent) :
+ m_machine(machine)
{
- m_machine = machine;
}
DevicesWindowModel::~DevicesWindowModel()
@@ -15,12 +15,13 @@ DevicesWindowModel::~DevicesWindowModel()
QVariant DevicesWindowModel::data(const QModelIndex &index, int role) const
{
- if(!index.isValid() || role != Qt::DisplayRole)
+ if (!index.isValid() || role != Qt::DisplayRole)
return QVariant();
device_t *dev = static_cast<device_t *>(index.internalPointer());
- switch(index.column()) {
- case 0: return dev == &m_machine->root_device() ? QString("<root>") : QString(dev->basetag());
+ switch (index.column())
+ {
+ case 0: return (dev == &m_machine.root_device()) ? QString("<root>") : QString(dev->basetag());
case 1: return QString(dev->name());
}
@@ -29,7 +30,7 @@ QVariant DevicesWindowModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags DevicesWindowModel::flags(const QModelIndex &index) const
{
- if(!index.isValid())
+ if (!index.isValid())
return 0;
return QAbstractItemModel::flags(index);
@@ -37,30 +38,33 @@ Qt::ItemFlags DevicesWindowModel::flags(const QModelIndex &index) const
QVariant DevicesWindowModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if(role != Qt::DisplayRole || section < 0 || section >= 2)
+ if (role != Qt::DisplayRole || section < 0 || section >= 2)
return QVariant();
return QString(section ? "Name" : "Tag");
}
QModelIndex DevicesWindowModel::index(int row, int column, const QModelIndex &parent) const
{
- if(!hasIndex(row, column, parent))
+ if (!hasIndex(row, column, parent))
return QModelIndex();
device_t *target = nullptr;
- if(!parent.isValid()) {
- if(row == 0)
- target = &m_machine->root_device();
+ if (!parent.isValid())
+ {
+ if (row == 0)
+ target = &m_machine.root_device();
- } else {
+ }
+ else
+ {
device_t *dparent = static_cast<device_t *>(parent.internalPointer());
int count = row;
for(target = dparent->subdevices().first(); count && target; target = target->next())
count--;
}
- if(target)
+ if (target)
return createIndex(row, column, target);
return QModelIndex();
@@ -68,19 +72,20 @@ QModelIndex DevicesWindowModel::index(int row, int column, const QModelIndex &pa
QModelIndex DevicesWindowModel::parent(const QModelIndex &index) const
{
- if(!index.isValid())
+ if (!index.isValid())
return QModelIndex();
device_t *dchild = static_cast<device_t *>(index.internalPointer());
device_t *dparent = dchild->owner();
- if(!dparent)
+ if (!dparent)
return QModelIndex();
device_t *dpp = dparent->owner();
int row = 0;
- if(dpp) {
- for(device_t *child = dpp->subdevices().first(); child && child != dparent; child = child->next())
+ if (dpp)
+ {
+ for (device_t *child = dpp->subdevices().first(); child && child != dparent; child = child->next())
row++;
}
return createIndex(row, 0, dparent);
@@ -88,7 +93,7 @@ QModelIndex DevicesWindowModel::parent(const QModelIndex &index) const
int DevicesWindowModel::rowCount(const QModelIndex &parent) const
{
- if(!parent.isValid())
+ if (!parent.isValid())
return 1;
device_t *dparent = static_cast<device_t *>(parent.internalPointer());
@@ -102,7 +107,7 @@ int DevicesWindowModel::columnCount(const QModelIndex &parent) const
-DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) :
+DevicesWindow::DevicesWindow(running_machine &machine, QWidget *parent) :
WindowQt(machine, nullptr),
m_devices_model(machine)
{
@@ -151,17 +156,17 @@ void DevicesWindow::activated(const QModelIndex &index)
//=========================================================================
// DevicesWindowQtConfig
//=========================================================================
-void DevicesWindowQtConfig::buildFromQWidget(QWidget* widget)
+void DevicesWindowQtConfig::buildFromQWidget(QWidget *widget)
{
WindowQtConfig::buildFromQWidget(widget);
- // DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
+ // DevicesWindow *window = dynamic_cast<DevicesWindow *>(widget);
}
-void DevicesWindowQtConfig::applyToQWidget(QWidget* widget)
+void DevicesWindowQtConfig::applyToQWidget(QWidget *widget)
{
WindowQtConfig::applyToQWidget(widget);
- // DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
+ // DevicesWindow *window = dynamic_cast<DevicesWindow *>(widget);
}