Skip to content

Commit

Permalink
Implement navigation by characters for script breakdown module
Browse files Browse the repository at this point in the history
+ add ability to reorder top-level location objects
  • Loading branch information
dimkanovikov committed Mar 9, 2023
1 parent 4ec4f4b commit 7163f7a
Show file tree
Hide file tree
Showing 22 changed files with 624 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,8 @@ ProjectManager::ProjectManager(QObject* _parent, QWidget* _parentWidget,
Domain::DocumentObjectType::Character, _name, _content);
});
connect(&d->modelsFacade, &ProjectModelsFacade::moveCharacterRequested,
d->projectStructureModel, &BusinessLayer::StructureModel::moveCharacter);
d->projectStructureModel,
qOverload<const QUuid&, int>(&BusinessLayer::StructureModel::moveItem));
connect(&d->modelsFacade, &ProjectModelsFacade::characterNameChanged, this,
[this](BusinessLayer::AbstractModel* _character, const QString& _newName,
const QString& _oldName) {
Expand Down Expand Up @@ -2086,6 +2087,8 @@ ProjectManager::ProjectManager(QObject* _parent, QWidget* _parentWidget,
d->addDocumentToContainer(Domain::DocumentObjectType::Locations,
Domain::DocumentObjectType::Location, _name, _content);
});
connect(&d->modelsFacade, &ProjectModelsFacade::moveLocationRequested, d->projectStructureModel,
qOverload<const QUuid&, int>(&BusinessLayer::StructureModel::moveItem));
connect(&d->modelsFacade, &ProjectModelsFacade::locationNameChanged, this,
[this](BusinessLayer::AbstractModel* _location, const QString& _newName,
const QString& _oldName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,8 @@ BusinessLayer::AbstractModel* ProjectModelsFacade::modelFor(Domain::DocumentObje

connect(locationsModel, &BusinessLayer::LocationsModel::createLocationRequested, this,
&ProjectModelsFacade::createLocationRequested);
connect(locationsModel, &BusinessLayer::LocationsModel::moveLocationRequested, this,
&ProjectModelsFacade::moveLocationRequested);

model = locationsModel;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ class ProjectModelsFacade : public QObject
*/
void createLocationRequested(const QString& _name, const QByteArray& _content);

/**
* @brief Необходимо переставить локацию в новое место
*/
void moveLocationRequested(const QUuid& _uuid, int _to);

/**
* @brief Изменилось название локации
*/
Expand Down
2 changes: 1 addition & 1 deletion src/core/management_layer/plugins/screenplay_breakdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <QMimeData>
#include <QPointer>

#include <set>


namespace BusinessLayer {

Expand Down Expand Up @@ -139,7 +137,6 @@ QModelIndex ScreenplayBreakdownStructureCharactersModel::Implementation::indexFo

void ScreenplayBreakdownStructureCharactersModel::Implementation::clear()
{
charactersToSave.clear();
lastHighlightedItems.clear();

if (!rootItem->hasChildren()) {
Expand Down Expand Up @@ -342,6 +339,7 @@ void ScreenplayBreakdownStructureCharactersModel::setSourceModel(ScreenplayTextM
if (!d->model.isNull()) {
disconnect(d->model);
d->clear();
d->charactersToSave.clear();
}

d->model = _model;
Expand Down Expand Up @@ -377,9 +375,6 @@ void ScreenplayBreakdownStructureCharactersModel::sortBy(ScreenplayBreakdownSort
for (int index = 0; index < d->rootItem->childCount(); ++index) {
characters.append(d->rootItem->childAt(index));
}
//
// ... если понадобится порядок следования в сценарии, определим его
//
std::sort(characters.begin(), characters.end(),
[_sortOrder](ScreenplayBreakdownStructureModelItem* _lhs,
ScreenplayBreakdownStructureModelItem* _rhs) {
Expand Down
Loading

0 comments on commit 7163f7a

Please sign in to comment.