Various model editing bug fixes

This commit is contained in:
Jack Andersen 2018-08-30 10:34:10 -10:00
parent 2d4fd3493e
commit 9cc4bdefd0
9 changed files with 185 additions and 112 deletions

View File

@ -415,9 +415,7 @@ protected:
for (const auto& p : m_data) for (const auto& p : m_data)
{ {
static_cast<LayersModel*>(m_view->model())->_insertRow(p.second, p.first); static_cast<LayersModel*>(m_view->model())->_insertRow(p.second, p.first);
m_view->selectionModel()->select(QItemSelection( m_view->setCurrentIndex(m_view->model()->index(p.second, 0));
m_view->model()->index(p.second, 0), m_view->model()->index(p.second, 7)),
QItemSelectionModel::SelectCurrent);
} }
} }
void del() void del()
@ -481,7 +479,7 @@ bool LayersModel::moveRows(const QModelIndex& sourceParent, int sourceRow, int c
{ {
if (!m_node) if (!m_node)
return false; return false;
beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, destinationParent, destinationChild); bool moving = beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, destinationParent, destinationChild);
std::vector<amuse::LayerMapping>& layers = *m_node->m_obj; std::vector<amuse::LayerMapping>& layers = *m_node->m_obj;
if (destinationChild < sourceRow) if (destinationChild < sourceRow)
{ {
@ -505,6 +503,7 @@ bool LayersModel::moveRows(const QModelIndex& sourceParent, int sourceRow, int c
layers[destinationChild - 1] = std::move(tmp); layers[destinationChild - 1] = std::move(tmp);
} }
} }
if (moving)
endMoveRows(); endMoveRows();
return true; return true;
} }
@ -627,6 +626,16 @@ void LayersEditor::resizeEvent(QResizeEvent* ev)
m_addRemoveButtons.move(0, ev->size().height() - 32); m_addRemoveButtons.move(0, ev->size().height() - 32);
} }
void LayersEditor::rowsInserted(const QModelIndex& parent, int first, int last)
{
m_tableView.scrollTo(m_tableView.model()->index(first, 0));
}
void LayersEditor::rowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row)
{
m_tableView.scrollTo(m_tableView.model()->index(row, 0));
}
void LayersEditor::doAdd() void LayersEditor::doAdd()
{ {
QModelIndex idx = m_tableView.selectionModel()->currentIndex(); QModelIndex idx = m_tableView.selectionModel()->currentIndex();
@ -661,6 +670,10 @@ LayersEditor::LayersEditor(QWidget* parent)
m_tableView.setModel(&m_model); m_tableView.setModel(&m_model);
connect(m_tableView.selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), connect(m_tableView.selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
this, SLOT(doSelectionChanged())); this, SLOT(doSelectionChanged()));
connect(&m_model, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
this, SLOT(rowsInserted(const QModelIndex&, int, int)));
connect(&m_model, SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
this, SLOT(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
m_addRemoveButtons.addAction()->setToolTip(tr("Add new layer mapping")); m_addRemoveButtons.addAction()->setToolTip(tr("Add new layer mapping"));
connect(m_addRemoveButtons.addAction(), SIGNAL(triggered(bool)), this, SLOT(doAdd())); connect(m_addRemoveButtons.addAction(), SIGNAL(triggered(bool)), this, SLOT(doAdd()));

View File

@ -81,7 +81,9 @@ public:
ProjectModel::INode* currentNode() const; ProjectModel::INode* currentNode() const;
void resizeEvent(QResizeEvent* ev); void resizeEvent(QResizeEvent* ev);
AmuseItemEditFlags itemEditFlags() const; AmuseItemEditFlags itemEditFlags() const;
public slots: private slots:
void rowsInserted(const QModelIndex& parent, int first, int last);
void rowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row);
void doAdd(); void doAdd();
void doSelectionChanged(); void doSelectionChanged();
void itemDeleteAction(); void itemDeleteAction();

View File

@ -438,7 +438,7 @@ void ProjectModel::NameUndoRegistry::registerSongName(amuse::SongId id) const
{ {
auto search = m_songIDs.find(id); auto search = m_songIDs.find(id);
if (search != m_songIDs.cend()) if (search != m_songIDs.cend())
g_MainWindow->projectModel()->_allocateSongId(id, search->second); g_MainWindow->projectModel()->allocateSongId(id, search->second);
} }
void ProjectModel::NameUndoRegistry::unregisterSongName(amuse::SongId id) void ProjectModel::NameUndoRegistry::unregisterSongName(amuse::SongId id)
{ {
@ -1173,12 +1173,12 @@ void ProjectModel::_renameNode(INode* node, const QString& name)
default: default:
break; break;
} }
if (moving)
endMoveRows();
QModelIndex idx = index(node); QModelIndex idx = index(node);
emit dataChanged(idx, idx, {Qt::DisplayRole, Qt::EditRole}); emit dataChanged(idx, idx, {Qt::DisplayRole, Qt::EditRole});
if (g_MainWindow->getEditorNode() == node) if (g_MainWindow->getEditorNode() == node)
g_MainWindow->updateWindowTitle(); g_MainWindow->updateWindowTitle();
if (moving)
endMoveRows();
} }
bool ProjectModel::setData(const QModelIndex& index, const QVariant& value, int role) bool ProjectModel::setData(const QModelIndex& index, const QVariant& value, int role)
@ -2253,25 +2253,25 @@ void ProjectModel::setMIDIPathOfSong(amuse::SongId id, const QString& path)
m_midiFiles[id].m_path = path; m_midiFiles[id].m_path = path;
} }
void ProjectModel::_allocateSongId(amuse::SongId id, std::string_view name) std::pair<amuse::SongId, std::string> ProjectModel::bootstrapSongId()
{
m_projectDatabase.setIdDatabases();
amuse::SongId::CurNameDB->registerPair(name, id);
Song& song = m_midiFiles[id];
++song.m_refCount;
}
std::pair<amuse::SongId, std::string> ProjectModel::allocateSongId()
{ {
m_projectDatabase.setIdDatabases(); m_projectDatabase.setIdDatabases();
std::pair<amuse::SongId, std::string> ret; std::pair<amuse::SongId, std::string> ret;
ret.first = amuse::SongId::CurNameDB->generateId(amuse::NameDB::Type::Song); ret.first = amuse::SongId::CurNameDB->generateId(amuse::NameDB::Type::Song);
ret.second = amuse::SongId::CurNameDB->generateName(ret.first, amuse::NameDB::Type::Song); ret.second = amuse::SongId::CurNameDB->generateName(ret.first, amuse::NameDB::Type::Song);
amuse::SongId::CurNameDB->registerPair(ret.second, ret.first); amuse::SongId::CurNameDB->registerPair(ret.second, ret.first);
m_midiFiles[ret.first] = {{}, 1}; m_midiFiles[ret.first] = {{}, 0};
return ret; return ret;
} }
void ProjectModel::allocateSongId(amuse::SongId id, std::string_view name)
{
m_projectDatabase.setIdDatabases();
amuse::SongId::CurNameDB->registerPair(name, id);
Song& song = m_midiFiles[id];
++song.m_refCount;
}
void ProjectModel::deallocateSongId(amuse::SongId oldId) void ProjectModel::deallocateSongId(amuse::SongId oldId)
{ {
Song& oldSong = m_midiFiles[oldId]; Song& oldSong = m_midiFiles[oldId];

View File

@ -504,8 +504,8 @@ public:
GroupNode* getGroupOfSfx(amuse::SFXId id) const; GroupNode* getGroupOfSfx(amuse::SFXId id) const;
QString getMIDIPathOfSong(amuse::SongId id) const; QString getMIDIPathOfSong(amuse::SongId id) const;
void setMIDIPathOfSong(amuse::SongId id, const QString& path); void setMIDIPathOfSong(amuse::SongId id, const QString& path);
void _allocateSongId(amuse::SongId id, std::string_view name); std::pair<amuse::SongId, std::string> bootstrapSongId();
std::pair<amuse::SongId, std::string> allocateSongId(); void allocateSongId(amuse::SongId id, std::string_view name);
void deallocateSongId(amuse::SongId oldId); void deallocateSongId(amuse::SongId oldId);
amuse::SongId exchangeSongId(amuse::SongId oldId, std::string_view newName); amuse::SongId exchangeSongId(amuse::SongId oldId, std::string_view newName);

View File

@ -677,15 +677,14 @@ bool PageModel::setData(const QModelIndex& index, const QVariant& value, int rol
tr("Program %1 is already defined in table").arg(value.toInt())); tr("Program %1 is already defined in table").arg(value.toInt()));
return false; return false;
} }
emit layoutAboutToBeChanged(); int newIdx = _hypotheticalIndexOfProgram(prog);
bool moving = beginMoveRows(index.parent(), index.row(), index.row(), index.parent(), newIdx);
g_MainWindow->pushUndoCommand(new PageDataChangeUndoCommand(m_node.get(), g_MainWindow->pushUndoCommand(new PageDataChangeUndoCommand(m_node.get(),
tr("Change %1").arg(headerData(0, Qt::Horizontal).toString()), m_drum, entry->first, 0, value.toInt())); tr("Change %1").arg(headerData(0, Qt::Horizontal).toString()), m_drum, entry->first, 0, prog));
_buildSortedList(); _buildSortedList();
QModelIndex newIndex = _indexOfProgram(value.toInt()); if (moving)
changePersistentIndex(index, newIndex); endMoveRows();
emit layoutChanged(); QModelIndex newIndex = _indexOfProgram(prog);
emit dataChanged(newIndex, newIndex); emit dataChanged(newIndex, newIndex);
return true; return true;
} }
@ -755,9 +754,7 @@ protected:
for (const auto& p : m_data) for (const auto& p : m_data)
{ {
int row = static_cast<PageModel*>(m_view->model())->_insertRow(p); int row = static_cast<PageModel*>(m_view->model())->_insertRow(p);
m_view->selectionModel()->select(QItemSelection( m_view->setCurrentIndex(m_view->model()->index(row, 0));
m_view->model()->index(row, 0), m_view->model()->index(row, 3)),
QItemSelectionModel::SelectCurrent);
} }
} }
void del() void del()
@ -950,13 +947,13 @@ bool SetupListModel::setData(const QModelIndex& index, const QVariant& value, in
tr("Song %1 is already defined in project").arg(value.toString())); tr("Song %1 is already defined in project").arg(value.toString()));
return false; return false;
} }
emit layoutAboutToBeChanged(); bool moving = beginMoveRows(index.parent(), index.row(), index.row(), index.parent(), _hypotheticalIndexOfSong(utf8key.data()));
g_MainWindow->pushUndoCommand(new SongNameChangeUndoCommand(m_node.get(), g_MainWindow->pushUndoCommand(new SongNameChangeUndoCommand(m_node.get(),
tr("Change Song Name"), entry.m_it->first, utf8key.data())); tr("Change Song Name"), entry.m_it->first, utf8key.data()));
_buildSortedList(); _buildSortedList();
if (moving)
endMoveRows();
QModelIndex newIndex = _indexOfSong(entry.m_it->first); QModelIndex newIndex = _indexOfSong(entry.m_it->first);
changePersistentIndex(index, newIndex);
emit layoutChanged();
emit dataChanged(newIndex, newIndex, {Qt::DisplayRole, Qt::EditRole}); emit dataChanged(newIndex, newIndex, {Qt::DisplayRole, Qt::EditRole});
return true; return true;
@ -999,9 +996,7 @@ protected:
for (auto& p : m_data) for (auto& p : m_data)
{ {
int row = static_cast<SetupListModel*>(m_view->m_listView->model())->_insertRow(p); int row = static_cast<SetupListModel*>(m_view->m_listView->model())->_insertRow(p);
listView->selectionModel()->select(QItemSelection( listView->setCurrentIndex(listView->model()->index(row, 0));
listView->model()->index(row, 0), listView->model()->index(row, 1)),
QItemSelectionModel::SelectCurrent);
} }
} }
void del() void del()
@ -1060,7 +1055,7 @@ int SetupListModel::_insertRow(
if (std::get<0>(data).id == 0xffff) if (std::get<0>(data).id == 0xffff)
std::get<0>(data) = amuse::SongId::CurNameDB->generateId(amuse::NameDB::Type::Song); std::get<0>(data) = amuse::SongId::CurNameDB->generateId(amuse::NameDB::Type::Song);
g_MainWindow->projectModel()->_allocateSongId(std::get<0>(data), std::get<1>(data)); g_MainWindow->projectModel()->allocateSongId(std::get<0>(data), std::get<1>(data));
int idx = _hypotheticalIndexOfSong(std::get<1>(data)); int idx = _hypotheticalIndexOfSong(std::get<1>(data));
beginInsertRows(QModelIndex(), idx, idx); beginInsertRows(QModelIndex(), idx, idx);
map[std::get<0>(data)] = std::get<2>(data); map[std::get<0>(data)] = std::get<2>(data);
@ -1255,7 +1250,7 @@ void PageTableView::deleteSelection()
std::vector<std::pair<uint8_t, amuse::SongGroupIndex::PageEntry>> data; std::vector<std::pair<uint8_t, amuse::SongGroupIndex::PageEntry>> data;
data.reserve(list.size()); data.reserve(list.size());
for (QModelIndex idx : list) for (QModelIndex idx : list)
data.push_back(std::make_pair(model()->data(idx).toInt(), amuse::SongGroupIndex::PageEntry{})); data.push_back(std::make_pair(model()->data(idx).toInt() - 1, amuse::SongGroupIndex::PageEntry{}));
std::sort(data.begin(), data.end(), [](const auto& a, const auto& b) { return a.first < b.first; }); std::sort(data.begin(), data.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
g_MainWindow->pushUndoCommand( g_MainWindow->pushUndoCommand(
new PageRowDelUndoCommand(static_cast<PageModel*>(model())->m_node.get(), new PageRowDelUndoCommand(static_cast<PageModel*>(model())->m_node.get(),
@ -1531,7 +1526,7 @@ void SongGroupEditor::doAdd()
SetupListModel* model = static_cast<SetupListModel*>(table->m_listView->model()); SetupListModel* model = static_cast<SetupListModel*>(table->m_listView->model());
g_MainWindow->projectModel()->setIdDatabases(model->m_node.get()); g_MainWindow->projectModel()->setIdDatabases(model->m_node.get());
std::vector<std::tuple<amuse::SongId, std::string, std::array<amuse::SongGroupIndex::MIDISetup, 16>>> data; std::vector<std::tuple<amuse::SongId, std::string, std::array<amuse::SongGroupIndex::MIDISetup, 16>>> data;
auto songId = g_MainWindow->projectModel()->allocateSongId(); auto songId = g_MainWindow->projectModel()->bootstrapSongId();
data.push_back(std::make_tuple(songId.first, songId.second, std::array<amuse::SongGroupIndex::MIDISetup, 16>{})); data.push_back(std::make_tuple(songId.first, songId.second, std::array<amuse::SongGroupIndex::MIDISetup, 16>{}));
g_MainWindow->pushUndoCommand( g_MainWindow->pushUndoCommand(
new SetupRowAddUndoCommand(model->m_node.get(), tr("Add Setup Entry"), table, std::move(data))); new SetupRowAddUndoCommand(model->m_node.get(), tr("Add Setup Entry"), table, std::move(data)));
@ -1575,7 +1570,39 @@ void SongGroupEditor::currentTabChanged(int idx)
} }
} }
void SongGroupEditor::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last) void SongGroupEditor::normRowsInserted(const QModelIndex& parent, int first, int last)
{
m_normTable->scrollTo(m_normTable->model()->index(first, 0));
}
void SongGroupEditor::normRowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row)
{
m_normTable->scrollTo(m_normTable->model()->index(row, 0));
}
void SongGroupEditor::drumRowsInserted(const QModelIndex& parent, int first, int last)
{
m_drumTable->scrollTo(m_drumTable->model()->index(first, 0));
}
void SongGroupEditor::drumRowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row)
{
m_drumTable->scrollTo(m_drumTable->model()->index(row, 0));
}
void SongGroupEditor::setupRowsInserted(const QModelIndex& parent, int first, int last)
{
m_setupTable->m_listView->scrollTo(m_setupTable->m_listView->model()->index(first, 0));
setupDataChanged();
}
void SongGroupEditor::setupRowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row)
{
m_setupTable->m_listView->scrollTo(m_setupTable->m_listView->model()->index(row, 0));
setupDataChanged();
}
void SongGroupEditor::setupRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
{ {
for (int i = first; i <= last; ++i) for (int i = first; i <= last; ++i)
{ {
@ -1588,7 +1615,7 @@ void SongGroupEditor::rowsAboutToBeRemoved(const QModelIndex &parent, int first,
} }
} }
void SongGroupEditor::modelAboutToBeReset() void SongGroupEditor::setupModelAboutToBeReset()
{ {
m_setup.unloadData(); m_setup.unloadData();
} }
@ -1699,12 +1726,24 @@ SongGroupEditor::SongGroupEditor(QWidget* parent)
connect(m_setupTable->m_listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), connect(m_setupTable->m_listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
this, SLOT(doSetupSelectionChanged())); this, SLOT(doSetupSelectionChanged()));
connect(&m_setupList, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), connect(&m_normPages, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
this, SLOT(rowsAboutToBeRemoved(const QModelIndex&, int, int))); this, SLOT(normRowsInserted(const QModelIndex&, int, int)));
connect(&m_setupList, SIGNAL(modelAboutToBeReset()), connect(&m_normPages, SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
this, SLOT(modelAboutToBeReset())); this, SLOT(normRowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
connect(&m_drumPages, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
this, SLOT(drumRowsInserted(const QModelIndex&, int, int)));
connect(&m_drumPages, SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
this, SLOT(drumRowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
connect(&m_setupList, SIGNAL(rowsInserted(const QModelIndex&, int, int)), connect(&m_setupList, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
this, SLOT(setupDataChanged())); this, SLOT(setupRowsInserted(const QModelIndex&, int, int)));
connect(&m_setupList, SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
this, SLOT(setupRowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
connect(&m_setupList, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)),
this, SLOT(setupRowsAboutToBeRemoved(const QModelIndex&, int, int)));
connect(&m_setupList, SIGNAL(modelAboutToBeReset()),
this, SLOT(setupModelAboutToBeReset()));
connect(&m_setupList, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), connect(&m_setupList, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(setupDataChanged())); this, SLOT(setupDataChanged()));
connect(&m_setupList, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)), connect(&m_setupList, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)),

View File

@ -280,13 +280,19 @@ public:
void resizeEvent(QResizeEvent* ev); void resizeEvent(QResizeEvent* ev);
QTableView* getSetupListView() const { return m_setupTable->m_listView; } QTableView* getSetupListView() const { return m_setupTable->m_listView; }
AmuseItemEditFlags itemEditFlags() const; AmuseItemEditFlags itemEditFlags() const;
public slots: private slots:
void doAdd(); void doAdd();
void doSelectionChanged(); void doSelectionChanged();
void doSetupSelectionChanged(); void doSetupSelectionChanged();
void currentTabChanged(int idx); void currentTabChanged(int idx);
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); void normRowsInserted(const QModelIndex& parent, int first, int last);
void modelAboutToBeReset(); void normRowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row);
void drumRowsInserted(const QModelIndex& parent, int first, int last);
void drumRowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row);
void setupRowsInserted(const QModelIndex& parent, int first, int last);
void setupRowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row);
void setupRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
void setupModelAboutToBeReset();
void setupDataChanged(); void setupDataChanged();
void itemDeleteAction(); void itemDeleteAction();
}; };

View File

@ -304,13 +304,14 @@ bool SFXModel::setData(const QModelIndex& index, const QVariant& value, int role
tr("SFX %1 is already defined in project").arg(value.toString())); tr("SFX %1 is already defined in project").arg(value.toString()));
return false; return false;
} }
emit layoutAboutToBeChanged(); int newIdx = _hypotheticalIndexOfSFX(utf8key.data());
bool moving = beginMoveRows(index.parent(), index.row(), index.row(), index.parent(), newIdx);
g_MainWindow->pushUndoCommand(new SFXNameChangeUndoCommand(m_node.get(), g_MainWindow->pushUndoCommand(new SFXNameChangeUndoCommand(m_node.get(),
tr("Change SFX Name"), entry->first, utf8key.data())); tr("Change SFX Name"), entry->first, utf8key.data()));
_buildSortedList(); _buildSortedList();
if (moving)
endMoveRows();
QModelIndex newIndex = _indexOfSFX(entry->first); QModelIndex newIndex = _indexOfSFX(entry->first);
changePersistentIndex(index, newIndex);
emit layoutChanged();
emit dataChanged(newIndex, newIndex, {Qt::DisplayRole, Qt::EditRole}); emit dataChanged(newIndex, newIndex, {Qt::DisplayRole, Qt::EditRole});
return true; return true;
} }
@ -394,9 +395,7 @@ protected:
for (auto& p : m_data) for (auto& p : m_data)
{ {
int row = static_cast<SFXModel*>(m_view->model())->_insertRow(p); int row = static_cast<SFXModel*>(m_view->model())->_insertRow(p);
m_view->selectionModel()->select(QItemSelection( m_view->setCurrentIndex(m_view->model()->index(row, 0));
m_view->model()->index(row, 0), m_view->model()->index(row, 6)),
QItemSelectionModel::SelectCurrent);
} }
} }
void del() void del()
@ -647,6 +646,18 @@ void SoundGroupEditor::doSelectionChanged()
g_MainWindow->updateFocus(); g_MainWindow->updateFocus();
} }
void SoundGroupEditor::rowsInserted(const QModelIndex &parent, int first, int last)
{
m_sfxTable->scrollTo(m_sfxTable->model()->index(first, 0));
sfxDataChanged();
}
void SoundGroupEditor::rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
{
m_sfxTable->scrollTo(m_sfxTable->model()->index(row, 0));
sfxDataChanged();
}
void SoundGroupEditor::sfxDataChanged() void SoundGroupEditor::sfxDataChanged()
{ {
int idx = 0; int idx = 0;
@ -676,13 +687,13 @@ SoundGroupEditor::SoundGroupEditor(QWidget* parent)
this, SLOT(doSelectionChanged())); this, SLOT(doSelectionChanged()));
connect(&m_sfxs, SIGNAL(rowsInserted(const QModelIndex&, int, int)), connect(&m_sfxs, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
this, SLOT(sfxDataChanged())); this, SLOT(rowsInserted(const QModelIndex&, int, int)));
connect(&m_sfxs, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), connect(&m_sfxs, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(sfxDataChanged())); this, SLOT(sfxDataChanged()));
connect(&m_sfxs, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)), connect(&m_sfxs, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)),
this, SLOT(sfxDataChanged())); this, SLOT(sfxDataChanged()));
connect(&m_sfxs, SIGNAL(layoutChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint)), connect(&m_sfxs, SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
this, SLOT(sfxDataChanged())); this, SLOT(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
connect(&m_sfxs, SIGNAL(modelReset()), connect(&m_sfxs, SIGNAL(modelReset()),
this, SLOT(sfxDataChanged())); this, SLOT(sfxDataChanged()));

View File

@ -121,7 +121,9 @@ public:
void resizeEvent(QResizeEvent* ev); void resizeEvent(QResizeEvent* ev);
QTableView* getSFXListView() const { return m_sfxTable; } QTableView* getSFXListView() const { return m_sfxTable; }
AmuseItemEditFlags itemEditFlags() const; AmuseItemEditFlags itemEditFlags() const;
public slots: private slots:
void rowsInserted(const QModelIndex &parent, int first, int last);
void rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
void doAdd(); void doAdd();
void doSelectionChanged(); void doSelectionChanged();
void sfxDataChanged(); void sfxDataChanged();

View File

@ -245,17 +245,17 @@
<context> <context>
<name>LayersEditor</name> <name>LayersEditor</name>
<message> <message>
<location filename="../LayersEditor.cpp" line="639"/> <location filename="../LayersEditor.cpp" line="648"/>
<source>Add Layer</source> <source>Add Layer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../LayersEditor.cpp" line="665"/> <location filename="../LayersEditor.cpp" line="678"/>
<source>Add new layer mapping</source> <source>Add new layer mapping</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../LayersEditor.cpp" line="667"/> <location filename="../LayersEditor.cpp" line="680"/>
<source>Remove selected layer mappings</source> <source>Remove selected layer mappings</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -321,12 +321,12 @@
<context> <context>
<name>LayersTableView</name> <name>LayersTableView</name>
<message> <message>
<location filename="../LayersEditor.cpp" line="561"/> <location filename="../LayersEditor.cpp" line="560"/>
<source>Delete Layers</source> <source>Delete Layers</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../LayersEditor.cpp" line="561"/> <location filename="../LayersEditor.cpp" line="560"/>
<source>Delete Layer</source> <source>Delete Layer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -427,13 +427,13 @@
<context> <context>
<name>MIDIPlayerWidget</name> <name>MIDIPlayerWidget</name>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1405"/> <location filename="../SongGroupEditor.cpp" line="1400"/>
<source>Stop</source> <source>Stop</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1419"/> <location filename="../SongGroupEditor.cpp" line="1414"/>
<location filename="../SongGroupEditor.cpp" line="1454"/> <location filename="../SongGroupEditor.cpp" line="1449"/>
<source>Play</source> <source>Play</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1138,27 +1138,27 @@
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="683"/> <location filename="../SongGroupEditor.cpp" line="683"/>
<location filename="../SongGroupEditor.cpp" line="709"/> <location filename="../SongGroupEditor.cpp" line="708"/>
<source>Change %1</source> <source>Change %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="723"/> <location filename="../SongGroupEditor.cpp" line="722"/>
<source>Program</source> <source>Program</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="725"/> <location filename="../SongGroupEditor.cpp" line="724"/>
<source>Object</source> <source>Object</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="727"/> <location filename="../SongGroupEditor.cpp" line="726"/>
<source>Priority</source> <source>Priority</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="729"/> <location filename="../SongGroupEditor.cpp" line="728"/>
<source>Max Voices</source> <source>Max Voices</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1192,12 +1192,12 @@
<context> <context>
<name>PageTableView</name> <name>PageTableView</name>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1262"/> <location filename="../SongGroupEditor.cpp" line="1257"/>
<source>Delete Page Entries</source> <source>Delete Page Entries</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1262"/> <location filename="../SongGroupEditor.cpp" line="1257"/>
<source>Delete Page Entry</source> <source>Delete Page Entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1588,47 +1588,47 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="309"/> <location filename="../SoundGroupEditor.cpp" line="310"/>
<source>Change SFX Name</source> <source>Change SFX Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="342"/> <location filename="../SoundGroupEditor.cpp" line="343"/>
<source>Change %1</source> <source>Change %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="356"/> <location filename="../SoundGroupEditor.cpp" line="357"/>
<source>SFX</source> <source>SFX</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="358"/> <location filename="../SoundGroupEditor.cpp" line="359"/>
<source>Object</source> <source>Object</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="360"/> <location filename="../SoundGroupEditor.cpp" line="361"/>
<source>Priority</source> <source>Priority</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="362"/> <location filename="../SoundGroupEditor.cpp" line="363"/>
<source>Max Voices</source> <source>Max Voices</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="364"/> <location filename="../SoundGroupEditor.cpp" line="365"/>
<source>Velocity</source> <source>Velocity</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="366"/> <location filename="../SoundGroupEditor.cpp" line="367"/>
<source>Panning</source> <source>Panning</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="368"/> <location filename="../SoundGroupEditor.cpp" line="369"/>
<source>Key</source> <source>Key</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1644,13 +1644,13 @@
<context> <context>
<name>SFXPlayerWidget</name> <name>SFXPlayerWidget</name>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="550"/> <location filename="../SoundGroupEditor.cpp" line="549"/>
<source>Stop</source> <source>Stop</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="564"/> <location filename="../SoundGroupEditor.cpp" line="563"/>
<location filename="../SoundGroupEditor.cpp" line="598"/> <location filename="../SoundGroupEditor.cpp" line="597"/>
<source>Play</source> <source>Play</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1658,12 +1658,12 @@
<context> <context>
<name>SFXTableView</name> <name>SFXTableView</name>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="504"/> <location filename="../SoundGroupEditor.cpp" line="503"/>
<source>Delete SFX Entries</source> <source>Delete SFX Entries</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="504"/> <location filename="../SoundGroupEditor.cpp" line="503"/>
<source>Delete SFX Entry</source> <source>Delete SFX Entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1742,27 +1742,27 @@
<context> <context>
<name>SetupListModel</name> <name>SetupListModel</name>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="949"/> <location filename="../SongGroupEditor.cpp" line="946"/>
<source>Song Conflict</source> <source>Song Conflict</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="950"/> <location filename="../SongGroupEditor.cpp" line="947"/>
<source>Song %1 is already defined in project</source> <source>Song %1 is already defined in project</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="955"/> <location filename="../SongGroupEditor.cpp" line="952"/>
<source>Change Song Name</source> <source>Change Song Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="972"/> <location filename="../SongGroupEditor.cpp" line="969"/>
<source>Song</source> <source>Song</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="974"/> <location filename="../SongGroupEditor.cpp" line="971"/>
<source>MIDI File</source> <source>MIDI File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1770,32 +1770,32 @@
<context> <context>
<name>SetupModel</name> <name>SetupModel</name>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1197"/> <location filename="../SongGroupEditor.cpp" line="1192"/>
<source>Change %1</source> <source>Change %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1214"/> <location filename="../SongGroupEditor.cpp" line="1209"/>
<source>Program</source> <source>Program</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1216"/> <location filename="../SongGroupEditor.cpp" line="1211"/>
<source>Volume</source> <source>Volume</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1218"/> <location filename="../SongGroupEditor.cpp" line="1213"/>
<source>Panning</source> <source>Panning</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1220"/> <location filename="../SongGroupEditor.cpp" line="1215"/>
<source>Reverb</source> <source>Reverb</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1222"/> <location filename="../SongGroupEditor.cpp" line="1217"/>
<source>Chorus</source> <source>Chorus</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1803,12 +1803,12 @@
<context> <context>
<name>SetupTableView</name> <name>SetupTableView</name>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1327"/> <location filename="../SongGroupEditor.cpp" line="1322"/>
<source>Delete Setup Entries</source> <source>Delete Setup Entries</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1327"/> <location filename="../SongGroupEditor.cpp" line="1322"/>
<source>Delete Setup Entry</source> <source>Delete Setup Entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1816,37 +1816,37 @@
<context> <context>
<name>SongGroupEditor</name> <name>SongGroupEditor</name>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1525"/> <location filename="../SongGroupEditor.cpp" line="1520"/>
<source>Add Page Entry</source> <source>Add Page Entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1537"/> <location filename="../SongGroupEditor.cpp" line="1532"/>
<source>Add Setup Entry</source> <source>Add Setup Entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1686"/> <location filename="../SongGroupEditor.cpp" line="1713"/>
<source>Normal Pages</source> <source>Normal Pages</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1687"/> <location filename="../SongGroupEditor.cpp" line="1714"/>
<source>Drum Pages</source> <source>Drum Pages</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1688"/> <location filename="../SongGroupEditor.cpp" line="1715"/>
<source>MIDI Setups</source> <source>MIDI Setups</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1717"/> <location filename="../SongGroupEditor.cpp" line="1756"/>
<source>Add new page entry</source> <source>Add new page entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SongGroupEditor.cpp" line="1719"/> <location filename="../SongGroupEditor.cpp" line="1758"/>
<source>Remove selected page entries</source> <source>Remove selected page entries</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1854,17 +1854,17 @@
<context> <context>
<name>SoundGroupEditor</name> <name>SoundGroupEditor</name>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="641"/> <location filename="../SoundGroupEditor.cpp" line="640"/>
<source>Add SFX Entry</source> <source>Add SFX Entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="689"/> <location filename="../SoundGroupEditor.cpp" line="700"/>
<source>Add new SFX entry</source> <source>Add new SFX entry</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../SoundGroupEditor.cpp" line="691"/> <location filename="../SoundGroupEditor.cpp" line="702"/>
<source>Remove selected SFX entries</source> <source>Remove selected SFX entries</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>