Skip to content

Commit

Permalink
Temporarily removed broken audio element search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilInTheGaps committed Dec 6, 2023
1 parent 64e4849 commit 28e07c2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 52 deletions.
3 changes: 2 additions & 1 deletion app/ui/tools/audio/AudioElementView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Item {

// Search
Item {
visible: false // TODO: reimplement when element filter proxy model is implemented
height: Sizes.toolbarHeight
anchors.bottom: parent.bottom
anchors.right: parent.right
Expand Down Expand Up @@ -186,7 +187,7 @@ Item {
}
}

onTextChanged: AudioTool.findElement(text)
// onTextChanged: AudioTool.findElement(text)

Keys.onEscapePressed: {
if (search_field.activeFocus) {
Expand Down
10 changes: 0 additions & 10 deletions src/tools/audio/audiotool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,3 @@ void AudioTool::setMusicIndex(int index)
musicPlayer.setIndex(index);
}
}

void AudioTool::findElement(const QString &term) const
{
AudioScenario::setFilterString(term);

if (currentProject() && currentProject()->currentCategory())
{
currentProject()->currentCategory()->refreshElements();
}
}
2 changes: 0 additions & 2 deletions src/tools/audio/audiotool.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class AudioTool : public AbstractTool
}
void stop();

Q_INVOKABLE void findElement(const QString &term) const;

// Meta Data
[[nodiscard]] auto metaData() -> AudioMetaData *
{
Expand Down
4 changes: 0 additions & 4 deletions src/tools/audio/project/audiocategory.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ class AudioCategory : public TreeItem
auto deleteScenario(AudioScenario *scenario) -> bool;

[[nodiscard]] auto elements() const -> QList<AudioElement *>;
void refreshElements()
{
if (m_currentScenario) m_currentScenario->refreshElements();
}

READ_LIST_PROPERTY(AudioScenario, scenarios)

Expand Down
31 changes: 4 additions & 27 deletions src/tools/audio/project/audioscenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ auto AudioScenario::toJson() const -> QJsonObject
return object;
}

void AudioScenario::refreshElements()
{
emit elementsChanged();

foreach (auto *scenario, a_scenarios)
{
scenario->refreshElements();
}
}

void AudioScenario::onScenariosChanged()
{
updateModel();
Expand All @@ -166,26 +156,13 @@ auto AudioScenario::elements(bool recursive) const -> QList<AudioElement *>
{
QList<AudioElement *> list;

if (filterString.isEmpty())
{
if (!recursive)
{
return m_elements;
}

list.append(m_elements);
}
else
if (!recursive)
{
foreach (auto *element, m_elements)
{
if (element->name().contains(filterString, Qt::CaseInsensitive))
{
list.push_back(element);
}
}
return m_elements;
}

list.append(m_elements);

if (recursive)
{
foreach (auto *scenario, a_scenarios)
Expand Down
8 changes: 0 additions & 8 deletions src/tools/audio/project/audioscenario.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ class AudioScenario : public TreeItem
auto moveScenario(AudioScenario *scenario, int steps) -> bool;
[[nodiscard]] auto containsScenario(const QString &name) const -> bool;

static void setFilterString(const QString &filter)
{
filterString = filter;
}
void refreshElements();

READ_LIST_PROPERTY(AudioScenario, scenarios)
READ_LIST_PROPERTY(AudioScenario, model)
AUTO_PROPERTY_VAL2(bool, isSubscenario, false)
Expand All @@ -76,8 +70,6 @@ private slots:
const QList<AudioScenario *> &scenarios, bool isSubscenario, QObject *parent);
explicit AudioScenario(const QJsonObject &object, const QString &path, bool isSubscenario, QObject *parent);

inline static QString filterString = QLatin1String();

QString m_path;

QList<AudioElement *> m_elements;
Expand Down

0 comments on commit 28e07c2

Please sign in to comment.