Skip to content

Commit

Permalink
Use filter instead of search.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Nov 22, 2016
1 parent b91a3a1 commit 07c61dc
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
18 changes: 9 additions & 9 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -1431,12 +1431,12 @@ void MainWindow::redo()
}

/*!
* \brief MainWindow::focusSearchClasses
* Sets the focus on search classes text box in Libraries Browser.
* \brief MainWindow::focusFilterClasses
* Sets the focus on filter classes text box in Libraries Browser.
*/
void MainWindow::focusSearchClasses()
void MainWindow::focusFilterClasses()
{
mpLibraryWidget->getTreeSearchFilters()->getSearchTextBox()->setFocus(Qt::ActiveWindowFocusReason);
mpLibraryWidget->getTreeSearchFilters()->getFilterTextBox()->setFocus(Qt::ActiveWindowFocusReason);
}

void MainWindow::setShowGridLines(bool showLines)
Expand Down Expand Up @@ -2449,10 +2449,10 @@ void MainWindow::createActions()
mpRedoAction->setShortcut(QKeySequence::Redo);
mpRedoAction->setEnabled(false);
connect(mpRedoAction, SIGNAL(triggered()), SLOT(redo()));
// search classes action
mpSearchClassesAction = new QAction(Helper::searchClasses, this);
mpSearchClassesAction->setShortcut(QKeySequence("Ctrl+Shift+f"));
connect(mpSearchClassesAction, SIGNAL(triggered()), SLOT(focusSearchClasses()));
// filter classes action
mpFilterClassesAction = new QAction(Helper::filterClasses, this);
mpFilterClassesAction->setShortcut(QKeySequence("Ctrl+Shift+f"));
connect(mpFilterClassesAction, SIGNAL(triggered()), SLOT(focusFilterClasses()));
// cut action
mpCutAction = new QAction(QIcon(":/Resources/icons/cut.svg"), tr("Cut"), this);
mpCutAction->setShortcut(QKeySequence("Ctrl+x"));
Expand Down Expand Up @@ -2831,7 +2831,7 @@ void MainWindow::createMenus()
pEditMenu->addAction(mpUndoAction);
pEditMenu->addAction(mpRedoAction);
pEditMenu->addSeparator();
pEditMenu->addAction(mpSearchClassesAction);
pEditMenu->addAction(mpFilterClassesAction);
// pEditMenu->addAction(mpCutAction);
// pEditMenu->addAction(mpCopyAction);
// pEditMenu->addAction(mpPasteAction);
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/MainWindow.h
Expand Up @@ -263,7 +263,7 @@ class MainWindow : public QMainWindow
// Edit Menu
QAction *mpUndoAction;
QAction *mpRedoAction;
QAction *mpSearchClassesAction;
QAction *mpFilterClassesAction;
QAction *mpCutAction;
QAction *mpCopyAction;
QAction *mpPasteAction;
Expand Down Expand Up @@ -382,7 +382,7 @@ public slots:
void clearRecentFilesList();
void undo();
void redo();
void focusSearchClasses();
void focusFilterClasses();
void setShowGridLines(bool On);
void resetZoom();
void zoomIn();
Expand Down
8 changes: 4 additions & 4 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -3313,9 +3313,9 @@ LibraryWidget::LibraryWidget(QWidget *pParent)
setMinimumWidth(175);
// tree search filters
mpTreeSearchFilters = new TreeSearchFilters(this);
mpTreeSearchFilters->getSearchTextBox()->setPlaceholderText(Helper::searchClasses);
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(returnPressed()), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(textEdited(QString)), SLOT(searchClasses()));
mpTreeSearchFilters->getFilterTextBox()->setPlaceholderText(Helper::filterClasses);
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(returnPressed()), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(textEdited(QString)), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getCaseSensitiveCheckBox(), SIGNAL(toggled(bool)), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getSyntaxComboBox(), SIGNAL(currentIndexChanged(int)), SLOT(searchClasses()));
mpTreeSearchFilters->getExpandAllButton()->hide();
Expand Down Expand Up @@ -4206,7 +4206,7 @@ bool LibraryWidget::saveTotalLibraryTreeItemHelper(LibraryTreeItem *pLibraryTree
*/
void LibraryWidget::searchClasses()
{
QString searchText = mpTreeSearchFilters->getSearchTextBox()->text();
QString searchText = mpTreeSearchFilters->getFilterTextBox()->text();
QRegExp::PatternSyntax syntax = QRegExp::PatternSyntax(mpTreeSearchFilters->getSyntaxComboBox()->itemData(mpTreeSearchFilters->getSyntaxComboBox()->currentIndex()).toInt());
Qt::CaseSensitivity caseSensitivity = mpTreeSearchFilters->getCaseSensitiveCheckBox()->isChecked() ? Qt::CaseSensitive: Qt::CaseInsensitive;
QRegExp regExp(searchText, caseSensitivity, syntax);
Expand Down
10 changes: 5 additions & 5 deletions OMEdit/OMEditGUI/Modeling/ModelicaClassDialog.cpp
Expand Up @@ -51,9 +51,9 @@ LibraryBrowseDialog::LibraryBrowseDialog(QString title, QLineEdit *pLineEdit, Li
mpLineEdit = pLineEdit;
mpLibraryWidget = pLibraryWidget;
mpTreeSearchFilters = new TreeSearchFilters(this);
mpTreeSearchFilters->getSearchTextBox()->setPlaceholderText(Helper::searchClasses);
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(returnPressed()), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(textEdited(QString)), SLOT(searchClasses()));
mpTreeSearchFilters->getFilterTextBox()->setPlaceholderText(Helper::filterClasses);
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(returnPressed()), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(textEdited(QString)), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getCaseSensitiveCheckBox(), SIGNAL(toggled(bool)), SLOT(searchClasses()));
connect(mpTreeSearchFilters->getSyntaxComboBox(), SIGNAL(currentIndexChanged(int)), SLOT(searchClasses()));
// create the tree
Expand All @@ -74,7 +74,7 @@ LibraryBrowseDialog::LibraryBrowseDialog(QString title, QLineEdit *pLineEdit, Li
connect(mpTreeSearchFilters->getCollapseAllButton(), SIGNAL(clicked()), mpLibraryTreeView, SLOT(collapseAll()));
connect(mpLibraryTreeView, SIGNAL(doubleClicked(QModelIndex)), SLOT(useModelicaClass()));
// try to automatically select of user has something in the text box.
mpTreeSearchFilters->getSearchTextBox()->setText(mpLineEdit->text());
mpTreeSearchFilters->getFilterTextBox()->setText(mpLineEdit->text());
searchClasses();
// Create the buttons
mpOkButton = new QPushButton(Helper::ok);
Expand Down Expand Up @@ -103,7 +103,7 @@ LibraryBrowseDialog::LibraryBrowseDialog(QString title, QLineEdit *pLineEdit, Li
void LibraryBrowseDialog::searchClasses()
{
mpLibraryTreeView->selectionModel()->clearSelection();
QString searchText = mpTreeSearchFilters->getSearchTextBox()->text();
QString searchText = mpTreeSearchFilters->getFilterTextBox()->text();
QRegExp::PatternSyntax syntax = QRegExp::PatternSyntax(mpTreeSearchFilters->getSyntaxComboBox()->itemData(mpTreeSearchFilters->getSyntaxComboBox()->currentIndex()).toInt());
Qt::CaseSensitivity caseSensitivity = mpTreeSearchFilters->getCaseSensitiveCheckBox()->isChecked() ? Qt::CaseSensitive: Qt::CaseInsensitive;
QRegExp regExp(searchText, caseSensitivity, syntax);
Expand Down
8 changes: 4 additions & 4 deletions OMEdit/OMEditGUI/Plotting/VariablesWidget.cpp
Expand Up @@ -882,9 +882,9 @@ VariablesWidget::VariablesWidget(QWidget *pParent)
setMinimumWidth(175);
// tree search filters
mpTreeSearchFilters = new TreeSearchFilters(this);
mpTreeSearchFilters->getSearchTextBox()->setPlaceholderText(Helper::findVariables);
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(returnPressed()), SLOT(findVariables()));
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(textEdited(QString)), SLOT(findVariables()));
mpTreeSearchFilters->getFilterTextBox()->setPlaceholderText(Helper::filterVariables);
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(returnPressed()), SLOT(findVariables()));
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(textEdited(QString)), SLOT(findVariables()));
connect(mpTreeSearchFilters->getCaseSensitiveCheckBox(), SIGNAL(toggled(bool)), SLOT(findVariables()));
connect(mpTreeSearchFilters->getSyntaxComboBox(), SIGNAL(currentIndexChanged(int)), SLOT(findVariables()));
// simulation time label and combobox
Expand Down Expand Up @@ -1568,7 +1568,7 @@ void VariablesWidget::showContextMenu(QPoint point)
*/
void VariablesWidget::findVariables()
{
QString findText = mpTreeSearchFilters->getSearchTextBox()->text();
QString findText = mpTreeSearchFilters->getFilterTextBox()->text();
QRegExp::PatternSyntax syntax = QRegExp::PatternSyntax(mpTreeSearchFilters->getSyntaxComboBox()->itemData(mpTreeSearchFilters->getSyntaxComboBox()->currentIndex()).toInt());
Qt::CaseSensitivity caseSensitivity = mpTreeSearchFilters->getCaseSensitiveCheckBox()->isChecked() ? Qt::CaseSensitive: Qt::CaseInsensitive;
QRegExp regExp(findText, caseSensitivity, syntax);
Expand Down
Expand Up @@ -475,9 +475,9 @@ TransformationsWidget::TransformationsWidget(QString infoJSONFullFileName, QWidg
pVariablesBrowserLabel->setObjectName("LabelWithBorder");
// tree search filters
mpTreeSearchFilters = new TreeSearchFilters(this);
mpTreeSearchFilters->getSearchTextBox()->setPlaceholderText(Helper::findVariables);
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(returnPressed()), SLOT(findVariables()));
connect(mpTreeSearchFilters->getSearchTextBox(), SIGNAL(textEdited(QString)), SLOT(findVariables()));
mpTreeSearchFilters->getFilterTextBox()->setPlaceholderText(Helper::filterVariables);
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(returnPressed()), SLOT(findVariables()));
connect(mpTreeSearchFilters->getFilterTextBox(), SIGNAL(textEdited(QString)), SLOT(findVariables()));
connect(mpTreeSearchFilters->getCaseSensitiveCheckBox(), SIGNAL(toggled(bool)), SLOT(findVariables()));
connect(mpTreeSearchFilters->getSyntaxComboBox(), SIGNAL(currentIndexChanged(int)), SLOT(findVariables()));
/* variables tree view */
Expand Down Expand Up @@ -1169,9 +1169,9 @@ void TransformationsWidget::reloadTransformations()
/* Clear the variable operations tree. */
clearTreeWidgetItems(mpVariableOperationsTreeWidget);
/* clear the variable tree filters. */
bool signalsState = mpTreeSearchFilters->getSearchTextBox()->blockSignals(true);
mpTreeSearchFilters->getSearchTextBox()->clear();
mpTreeSearchFilters->getSearchTextBox()->blockSignals(signalsState);
bool signalsState = mpTreeSearchFilters->getFilterTextBox()->blockSignals(true);
mpTreeSearchFilters->getFilterTextBox()->clear();
mpTreeSearchFilters->getFilterTextBox()->blockSignals(signalsState);
signalsState = mpTreeSearchFilters->getSyntaxComboBox()->blockSignals(true);
mpTreeSearchFilters->getSyntaxComboBox()->setCurrentIndex(0);
mpTreeSearchFilters->getSyntaxComboBox()->blockSignals(signalsState);
Expand Down Expand Up @@ -1204,7 +1204,7 @@ void TransformationsWidget::reloadTransformations()
*/
void TransformationsWidget::findVariables()
{
QString findText = mpTreeSearchFilters->getSearchTextBox()->text();
QString findText = mpTreeSearchFilters->getFilterTextBox()->text();
QRegExp::PatternSyntax syntax = QRegExp::PatternSyntax(mpTreeSearchFilters->getSyntaxComboBox()->itemData(mpTreeSearchFilters->getSyntaxComboBox()->currentIndex()).toInt());
Qt::CaseSensitivity caseSensitivity = mpTreeSearchFilters->getCaseSensitiveCheckBox()->isChecked() ? Qt::CaseSensitive: Qt::CaseInsensitive;
QRegExp regExp(findText, caseSensitivity, syntax);
Expand Down
8 changes: 4 additions & 4 deletions OMEdit/OMEditGUI/Util/Helper.cpp
Expand Up @@ -251,14 +251,14 @@ QString Helper::iconView;
QString Helper::diagramView;
QString Helper::textView;
QString Helper::documentationView;
QString Helper::searchClasses;
QString Helper::filterClasses;
QString Helper::findReplaceModelicaText;
QString Helper::left;
QString Helper::center;
QString Helper::right;
QString Helper::createConnection;
QString Helper::connectionAttributes;
QString Helper::findVariables;
QString Helper::filterVariables;
QString Helper::openClass;
QString Helper::openClassTip;
QString Helper::viewDocumentation;
Expand Down Expand Up @@ -474,14 +474,14 @@ void Helper::initHelperVariables()
Helper::diagramView = tr("Diagram View");
Helper::textView = tr("Text View");
Helper::documentationView = tr("Documentation View");
Helper::searchClasses = tr("Search Classes");
Helper::filterClasses = tr("Filter Classes");
Helper::findReplaceModelicaText = tr("Find/Replace...");
Helper::left = tr("Left");
Helper::center = tr("Center");
Helper::right = tr("Right");
Helper::createConnection = tr("Create Connection");
Helper::connectionAttributes = tr("Connection Attributes");
Helper::findVariables = tr("Find Variables");
Helper::filterVariables = tr("Filter Variables");
Helper::openClass = tr("Open Class");
Helper::openClassTip = tr("Opens the class details");
Helper::viewDocumentation = tr("View Documentation");
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/Util/Helper.h
Expand Up @@ -257,14 +257,14 @@ class Helper : public QObject
static QString diagramView;
static QString textView;
static QString documentationView;
static QString searchClasses;
static QString filterClasses;
static QString findReplaceModelicaText;
static QString left;
static QString center;
static QString right;
static QString createConnection;
static QString connectionAttributes;
static QString findVariables;
static QString filterVariables;
static QString openClass;
static QString openClassTip;
static QString viewDocumentation;
Expand Down
8 changes: 4 additions & 4 deletions OMEdit/OMEditGUI/Util/Utilities.cpp
Expand Up @@ -69,9 +69,9 @@ MdiArea::MdiArea(QWidget *pParent)
TreeSearchFilters::TreeSearchFilters(QWidget *pParent)
: QWidget(pParent)
{
// create the search text box
mpSearchTextBox = new QLineEdit;
mpSearchTextBox->installEventFilter(this);
// create the filter text box
mpFilterTextBox = new QLineEdit;
mpFilterTextBox->installEventFilter(this);
// show hide button
mpShowHideButton = new QToolButton;
QString text = tr("Show/hide filters");
Expand Down Expand Up @@ -113,7 +113,7 @@ TreeSearchFilters::TreeSearchFilters(QWidget *pParent)
QGridLayout *pMainLayout = new QGridLayout;
pMainLayout->setContentsMargins(0, 0, 0, 0);
pMainLayout->setAlignment(Qt::AlignTop);
pMainLayout->addWidget(mpSearchTextBox, 0, 0);
pMainLayout->addWidget(mpFilterTextBox, 0, 0);
pMainLayout->addWidget(mpShowHideButton, 0, 1);
pMainLayout->addWidget(mpFiltersWidget, 1, 0, 1, 2);
setLayout(pMainLayout);
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/Util/Utilities.h
Expand Up @@ -101,15 +101,15 @@ class TreeSearchFilters : public QWidget
Q_OBJECT
public:
TreeSearchFilters(QWidget *pParent = 0);
QLineEdit* getSearchTextBox() {return mpSearchTextBox;}
QLineEdit* getFilterTextBox() {return mpFilterTextBox;}
QComboBox* getSyntaxComboBox() {return mpSyntaxComboBox;}
QCheckBox* getCaseSensitiveCheckBox() {return mpCaseSensitiveCheckBox;}
QPushButton* getExpandAllButton() {return mpExpandAllButton;}
QPushButton* getCollapseAllButton() {return mpCollapseAllButton;}

bool eventFilter(QObject *pObject, QEvent *pEvent);
private:
QLineEdit *mpSearchTextBox;
QLineEdit *mpFilterTextBox;
QToolButton *mpShowHideButton;
QWidget *mpFiltersWidget;
QComboBox *mpSyntaxComboBox;
Expand Down

0 comments on commit 07c61dc

Please sign in to comment.