Skip to content

Commit

Permalink
Final touch
Browse files Browse the repository at this point in the history
  • Loading branch information
boutinb committed Jan 14, 2025
1 parent f7c488d commit 6b458a9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CommonData/dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,9 @@ bool DataSet::initColumnWithStrings(int colIndex, const std::string & newName, c
return anyChanges || column->type() != prevType;
}

bool DataSet::isFilterNameFree(const std::string& filterName)
{
return -1 == db().filterGetId(filterName);
}


1 change: 1 addition & 0 deletions CommonData/dataset.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class DataSet : public DataSetBaseNode
void setWorkspaceEmptyValues( const stringset& values);
const std::string & description() const { return _description; }
void setDescription( const std::string& desc);
bool isFilterNameFree( const std::string& filterName);

private:
void upgradeTo019(const Json::Value & emptyVals);
Expand Down
5 changes: 0 additions & 5 deletions CommonData/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ bool Filter::checkForUpdates()
return false;
}

bool Filter::filterNameIsFree(const std::string &filterName)
{
return -1 == DatabaseInterface::singleton()->filterGetId(filterName);
}

void Filter::reset()
{
if(!_data->writeBatchedToDB())
Expand Down
5 changes: 1 addition & 4 deletions CommonData/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ class Filter : public DataSetBaseNode
bool dbLoadResultAndError(); ///< Loads (updated) filtervalues from database and the (possible) error msg, returns true if an error is set
void dbDelete();
void incRevision() override;
bool checkForUpdates();

static bool filterNameIsFree(const std::string & filterName);

bool checkForUpdates();
void reset();

DatabaseInterface & db();
Expand Down
2 changes: 0 additions & 2 deletions QMLComponents/ALTNavigation/altnavscope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include <QQmlProperty>
#include <QMetaObject>
#include <QDirIterator>
#include "log.h"

ALTNavScope::ALTNavScope(QObject* attachee)
: QObject{attachee}
Expand Down
3 changes: 2 additions & 1 deletion QMLComponents/models/listmodelfiltereddataentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "log.h"
#include "controls/jaspcontrol.h"
#include "filter.h"
#include "dataset.h"

ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent)
: ListModelTableViewBase(parent)
Expand All @@ -21,7 +22,7 @@ ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent)
{
_filterName = "ListModelFilteredDataEntry_" + std::to_string(counter++);
}
while(!Filter::filterNameIsFree(_filterName));
while(!dataSet->isFilterNameFree(_filterName));

connect(VariableInfo::info(), &VariableInfo::dataSetChanged, this, &ListModelFilteredDataEntry::dataSetChangedHandler);
}
Expand Down

0 comments on commit 6b458a9

Please sign in to comment.