1 /* 2 This file is part of the Okteta Kasten module, made within the KDE community. 3 4 SPDX-FileCopyrightText: 2006-2007, 2009 Friedrich W. H. Kossebau <kossebau@kde.org> 5 6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 7 */ 8 9 #ifndef KASTEN_ABSTRACTFINDDIALOG_HPP 10 #define KASTEN_ABSTRACTFINDDIALOG_HPP 11 12 // lib 13 #include "finddirection.hpp" 14 // Qt 15 #include <QDialog> 16 #include <QByteArray> 17 #include <QString> 18 19 namespace Okteta { 20 class ByteArrayComboBox; 21 } 22 23 class QGroupBox; 24 class QCheckBox; 25 class QPushButton; 26 class QVBoxLayout; 27 28 namespace Kasten { 29 30 class AbstractFindDialog : public QDialog 31 { 32 Q_OBJECT 33 34 public: 35 explicit AbstractFindDialog(QWidget* parent = nullptr); 36 ~AbstractFindDialog() override; 37 38 public: // set 39 void setDirection(FindDirection Direction); 40 void setInSelection(bool InSelection); 41 void setInSelectionEnabled(bool inSelectionEnabled); 42 43 public: // get 44 QByteArray data() const; 45 bool fromCursor() const; 46 bool inSelection() const; 47 Qt::CaseSensitivity caseSensitivity() const; 48 FindDirection direction() const; 49 50 public Q_SLOTS: 51 void setCharCodec(const QString& codecName); 52 53 protected: // QWidget API 54 void showEvent(QShowEvent* e) override; 55 56 protected: 57 void setFindButton(const QString& buttonText, const QString& buttonIconName, 58 const QString& buttonToolTip, const QString& buttonWhatsThis); 59 void setFindButtonEnabled(bool enabled); 60 void setupFindBox(); 61 void setupOperationBox(QGroupBox* operationBox = nullptr); 62 void setupCheckBoxes(QCheckBox* optionCheckBox = nullptr); 63 64 protected: // API to be implemented 65 virtual void onFindButtonClicked(); 66 virtual void rememberCurrentSettings(); 67 68 private Q_SLOTS: 69 void onSearchDataChanged(const QByteArray& ata); 70 void onSearchDataFormatChanged(int Format); 71 void onSelectedToggled(bool checked); 72 void forwardFindButtonClicked(); 73 74 private: 75 QVBoxLayout* MainWidgetLayout; 76 Okteta::ByteArrayComboBox* SearchDataEdit; 77 QCheckBox* BackwardsCheckBox; 78 QCheckBox* AtCursorCheckBox; 79 QCheckBox* SelectedCheckBox; 80 QCheckBox* WholeWordsCheckBox; 81 QCheckBox* CaseSensitiveCheckBox; 82 QPushButton* FindButton; 83 }; 84 85 } 86 87 #endif 88