Example #1
0
void QuickFindPattern::changeSearchPattern( const QString& pattern )
{
    // Determine the type of regexp depending on the config
    QString searchPattern;
    switch ( Persistent<Configuration>( "settings" )->quickfindRegexpType() ) {
        case Wildcard:
            searchPattern = pattern;
            searchPattern.replace('*', ".*").replace('?', ".");
            break;
        case FixedString:
            searchPattern = QRegularExpression::escape(pattern);
            break;
        default:
            searchPattern = pattern;
            break;
    }

    regexp_.setPattern( pattern );

    if ( regexp_.isValid() && ( ! searchPattern.isEmpty() ) )
        active_ = true;
    else
        active_ = false;

    emit patternUpdated();
}
Example #2
0
void QuickFindPattern::changeSearchPattern( const QString& pattern )
{
    pattern_ = pattern;

    // Determine the type of regexp depending on the config
    QString searchPattern;
    switch ( Persistable::get<Configuration>().quickfindRegexpType() ) {
        case Wildcard:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
            searchPattern = QRegularExpression::wildcardToRegularExpression(pattern);
            searchPattern = searchPattern.mid(2, searchPattern.size() - 4);
#else
            searchPattern = pattern;
            searchPattern.replace('*', ".*").replace('?', ".");
#endif

            break;
        case FixedString:
            searchPattern = QRegularExpression::escape(pattern);
            break;
        default:
            searchPattern = pattern;
            break;
    }

    regexp_.setPattern( searchPattern );

    if ( regexp_.isValid() && ( ! searchPattern.isEmpty() ) )
        active_ = true;
    else
        active_ = false;

    emit patternUpdated();
}
Example #3
0
QuickFindMux::QuickFindMux( std::shared_ptr<QuickFindPattern> pattern ) :
    QObject(), pattern_( pattern ), registeredSearchables_()
{
    selector_ = nullptr;

    // Forward the pattern's signal to our listeners
    connect( pattern_.get(), SIGNAL( patternUpdated() ),
             this, SLOT( notifyPatternChanged() ) );
}