diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-05-21 17:34:41 -0400 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-05-21 17:34:41 -0400 |
| commit | ba4f9b599069b93d2c73e13b43493da5bfe9b40e (patch) | |
| tree | 33ae8f45b810d751e292a8a303dd878b0a15d7a5 /sigmodr/SigmodrUI.cpp | |
| parent | 1c40145b3bfc2c1310bb126b5d876168dc3919cd (diff) | |
| download | sigen-ba4f9b599069b93d2c73e13b43493da5bfe9b40e.tar.gz sigen-ba4f9b599069b93d2c73e13b43493da5bfe9b40e.tar.xz sigen-ba4f9b599069b93d2c73e13b43493da5bfe9b40e.zip | |
Add method for getting the game for an index instead of only the current index
Diffstat (limited to 'sigmodr/SigmodrUI.cpp')
| -rw-r--r-- | sigmodr/SigmodrUI.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/sigmodr/SigmodrUI.cpp b/sigmodr/SigmodrUI.cpp index 53a70d17..72e452cc 100644 --- a/sigmodr/SigmodrUI.cpp +++ b/sigmodr/SigmodrUI.cpp @@ -164,13 +164,11 @@ void SigmodrUI::resizeEvent(QResizeEvent* event) void SigmodrUI::setChangedTitle(const bool changed) { - setCaption(treeSigmod->description(treeSigmod->currentIndex()), changed); + setCaption(treeSigmod->description(m_editedIndex), changed); } void SigmodrUI::setDirty(const bool dirty) { - const Game* game = treeSigmod->currentGame(); - treeSigmod->setDirty(game, dirty); setChangedTitle(dirty); actionCollection()->action("file_save")->setEnabled(dirty); } @@ -252,7 +250,7 @@ bool SigmodrUI::openGame(const QString& path, const bool isRemote) void SigmodrUI::saveGame() { - saveGame(treeSigmod->currentGame()); + saveGame(treeSigmod->game(treeSigmod->currentIndex())); } void SigmodrUI::saveGame(const Game* game) @@ -305,7 +303,7 @@ bool SigmodrUI::saveGame(const Game* game, const KUrl& url) void SigmodrUI::saveAsGame() { - saveAsGame(treeSigmod->currentGame()); + saveAsGame(treeSigmod->game(treeSigmod->currentIndex())); } void SigmodrUI::saveAsGame(const Game* game) @@ -330,7 +328,7 @@ void SigmodrUI::downloadGame() void SigmodrUI::uploadGame() { - uploadGame(treeSigmod->currentGame()); + uploadGame(treeSigmod->game(treeSigmod->currentIndex())); } void SigmodrUI::uploadGame(const Game* game) @@ -383,7 +381,7 @@ bool SigmodrUI::closeWidget() void SigmodrUI::closeGame() { - closeGame(treeSigmod->currentGame()); + closeGame(treeSigmod->game(treeSigmod->currentIndex())); setChangedTitle(treeSigmod->dirty()); } @@ -484,19 +482,23 @@ void SigmodrUI::on_treeSigmod_clicked(const QModelIndex& index) connect(editor, SIGNAL(saved()), this, SLOT(setDirty())); connect(buttonApply, SIGNAL(clicked()), editor, SLOT(apply())); connect(buttonReset, SIGNAL(clicked()), editor, SLOT(discard())); - setChangedTitle(treeSigmod->dirty(treeSigmod->currentGame())); + m_editedIndex = index; + setChangedTitle(treeSigmod->dirty(treeSigmod->game(index))); formPanel->setWidget(editor); formPanel->show(); - m_editedIndex = index; } break; } case 2: if ((m_editedIndex.internalId() != index.internalId()) || closeWidget()) - treeSigmod->model()->removeRow(index.row(), index.parent()); + { + if (treeSigmod->model()->removeRow(index.row(), index.parent())) + setDirty(); + } break; case 3: - treeSigmod->model()->insertRow(treeSigmod->model()->rowCount(index), index); + if (treeSigmod->model()->insertRow(treeSigmod->model()->rowCount(index), index)) + setDirty(); break; default: break; |
