Add the "not equals" operator to all fields in the smart playlist wizard. Fixes issue 3329
This commit is contained in:
parent
7d4f5764dc
commit
82575f233f
@ -93,21 +93,21 @@ QString SearchTerm::ToSql() const {
|
||||
else if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date ||
|
||||
TypeOf(field_) == Type_Time)
|
||||
return col + " = " + value + "";
|
||||
return col + " = " + value;
|
||||
else
|
||||
return col + " = '" + value + "'";
|
||||
case Op_GreaterThan:
|
||||
if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date ||
|
||||
TypeOf(field_) == Type_Time)
|
||||
return col + " > " + value + "";
|
||||
return col + " > " + value;
|
||||
else
|
||||
return col + " > '" + value + "'";
|
||||
case Op_LessThan:
|
||||
if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date ||
|
||||
TypeOf(field_) == Type_Time)
|
||||
return col + " < " + value + "";
|
||||
return col + " < " + value;
|
||||
else
|
||||
return col + " < '" + value + "'";
|
||||
case Op_NumericDate:
|
||||
@ -119,7 +119,11 @@ QString SearchTerm::ToSql() const {
|
||||
return "(" + col + " < " + "DATETIME('now', '-" + value + " " + date +"', 'localtime') AND " +
|
||||
col + " > " + "DATETIME('now', '-" + second_value + " " + date +"', 'localtime'))";
|
||||
case Op_NotEquals:
|
||||
return col + " <> " + value + "";
|
||||
if (TypeOf(field_) == Type_Text) {
|
||||
return col + " <> '" + value + "'";
|
||||
} else {
|
||||
return col + " <> " + value;
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
@ -185,7 +189,7 @@ OperatorList SearchTerm::OperatorsForType(Type type) {
|
||||
switch (type) {
|
||||
case Type_Text:
|
||||
return OperatorList() << Op_Contains << Op_NotContains << Op_Equals
|
||||
<< Op_StartsWith << Op_EndsWith;
|
||||
<< Op_NotEquals << Op_StartsWith << Op_EndsWith;
|
||||
case Type_Date:
|
||||
return OperatorList() << Op_Equals << Op_NotEquals << Op_GreaterThan << Op_LessThan
|
||||
<< Op_NumericDate << Op_NumericDateNot << Op_RelativeDate;
|
||||
|
@ -58,26 +58,25 @@ public:
|
||||
enum Operator {
|
||||
// For text
|
||||
Op_Contains = 0,
|
||||
Op_NotContains,
|
||||
Op_StartsWith,
|
||||
Op_EndsWith,
|
||||
Op_NotContains = 1,
|
||||
Op_StartsWith = 2,
|
||||
Op_EndsWith = 3,
|
||||
|
||||
// For numbers
|
||||
Op_GreaterThan,
|
||||
Op_LessThan,
|
||||
Op_GreaterThan = 4,
|
||||
Op_LessThan = 5,
|
||||
|
||||
// For everything
|
||||
Op_Equals,
|
||||
Op_Equals = 6,
|
||||
Op_NotEquals = 9,
|
||||
|
||||
// For numeric dates (e.g. in the last X days)
|
||||
Op_NumericDate,
|
||||
Op_NumericDate = 7,
|
||||
// For relative dates
|
||||
Op_RelativeDate,
|
||||
Op_RelativeDate = 8,
|
||||
|
||||
// For everything except for text
|
||||
Op_NotEquals,
|
||||
// For numeric dates (e.g. not in the last X days)
|
||||
Op_NumericDateNot,
|
||||
Op_NumericDateNot = 10,
|
||||
};
|
||||
|
||||
enum Type {
|
||||
|
Loading…
x
Reference in New Issue
Block a user