From d24f813f3f2a05c112e803e4256b53535895fc98 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 14 Jul 2021 11:49:10 +1200 Subject: Initial mirror commit --- src/main-view/FindPanel.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/main-view/FindPanel.h (limited to 'src/main-view/FindPanel.h') diff --git a/src/main-view/FindPanel.h b/src/main-view/FindPanel.h new file mode 100644 index 0000000..553522e --- /dev/null +++ b/src/main-view/FindPanel.h @@ -0,0 +1,66 @@ +#ifndef FINDPANEL_H +#define FINDPANEL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class DictTableView; +class MainWindow; + +/** + * Modern find panel for dictionary records. + */ + +class FindPanel: public QWidget +{ + Q_OBJECT +public: + FindPanel( MainWindow* aMainWindow ); + + void setTableView( DictTableView* aTableView ); + bool canFindAgain(); + +protected: + void keyPressEvent( QKeyEvent* event ); + +private: + bool findRegExp( const QRegExp& aSearchRegExp, QListIterator aStartingPoint ); + +public slots: + void show(); + void find(); + +private slots: + void updateFindButtons(); + +private: + static const int ComboBoxMaxItems = 10; + static const int TextEditMinWidth = 300; + +private: + // Data + MainWindow* m_mainWindow; + int m_direction; // Search direction: 1 or -1 + bool m_foundOnce; // The search text was already found once. For "Find again". + + // GUI + QToolButton* m_closeButton; + QComboBox* m_textEdit; + QToolButton* m_findForwardBtn; + QToolButton* m_findBackwardBtn; + QToolButton* m_caseSensitiveBtn; + QToolButton* m_wholeWordsBtn; + QToolButton* m_regExpBtn; + QToolButton* m_inSelectionBtn; + QWidget* m_infoPane; + QLabel* m_infoLbl; +}; + +#endif -- cgit