@@ -8,14 +8,6 @@ VFSModel::VFSModel(QObject* parent)
88 SetupDevices ();
99}
1010
11- VFSModel::~VFSModel ()
12- {
13- for (int i = 0 ; i < m_devices.size (); i++)
14- {
15- delete m_devices.at (i);
16- }
17- }
18-
1911int VFSModel::rowCount (const QModelIndex& /* parent*/ ) const
2012{
2113 return m_devices.size ();
@@ -30,7 +22,7 @@ QVariant VFSModel::data(const QModelIndex& index, int role) const
3022{
3123 if (role == Qt::DisplayRole)
3224 {
33- auto device = m_devices.at (index.row ());
25+ const auto & device = m_devices.at (index.row ());
3426 QString val;
3527 switch (index.column ())
3628 {
@@ -51,11 +43,11 @@ QVariant VFSModel::data(const QModelIndex& index, int role) const
5143
5244void VFSModel::SetupDevices ()
5345{
54- m_devices[0 ] = new CDirectoryDevice (" mc0" , PREF_PS2_MC0_DIRECTORY);
55- m_devices[1 ] = new CDirectoryDevice (" mc1" , PREF_PS2_MC1_DIRECTORY);
56- m_devices[2 ] = new CDirectoryDevice (" host" , PREF_PS2_HOST_DIRECTORY);
57- m_devices[3 ] = new CCdrom0Device ();
58- m_devices[4 ] = new CDirectoryDevice (" rom0" , PREF_PS2_ROM0_DIRECTORY);
46+ m_devices[0 ] = std::make_unique< CDirectoryDevice> (" mc0" , PREF_PS2_MC0_DIRECTORY);
47+ m_devices[1 ] = std::make_unique< CDirectoryDevice> (" mc1" , PREF_PS2_MC1_DIRECTORY);
48+ m_devices[2 ] = std::make_unique< CDirectoryDevice> (" host" , PREF_PS2_HOST_DIRECTORY);
49+ m_devices[3 ] = std::make_unique< CCdrom0Device> ();
50+ m_devices[4 ] = std::make_unique< CDirectoryDevice> (" rom0" , PREF_PS2_ROM0_DIRECTORY);
5951}
6052
6153bool VFSModel::setHeaderData (int section, Qt::Orientation orientation, const QVariant& value, int role)
@@ -87,10 +79,11 @@ QVariant VFSModel::headerData(int section, Qt::Orientation orientation, int role
8779 return QAbstractTableModel::headerData (section, orientation, role);
8880}
8981
90- void VFSModel::DoubleClicked (const QModelIndex& index , QWidget* parent)
82+ void VFSModel::DoubleClicked (const QModelIndex& modelIndex , QWidget* parent)
9183{
92- CDevice* m_device = m_devices.at (index.row ());
93- m_device->RequestModification (parent);
84+ const auto & device = m_devices.at (modelIndex.row ());
85+ device->RequestModification (parent);
86+ emit QAbstractTableModel::dataChanged (index (modelIndex.row (), 0 ), index (modelIndex.row (), columnCount ()));
9487}
9588
9689void VFSModel::Save ()
0 commit comments