musredit 1.0.0
Loading...
Searching...
No Matches
PFindDialog.cpp
Go to the documentation of this file.
1/****************************************************************************
2
3 PFindDialog.cpp
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8*****************************************************************************/
9
10/***************************************************************************
11 * Copyright (C) 2009-2026 by Andreas Suter *
12 * andreas.suter@psi.ch *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
28 ***************************************************************************/
29
42
43#include <QPushButton>
44#include <QComboBox>
45#include <QCheckBox>
46
47#include <QMessageBox>
48
49#include "PFindDialog.h"
50
51//----------------------------------------------------------------------------------------------------
71PFindDialog::PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent) :
72 QDialog(parent), fData(data)
73{
74 setupUi(this);
75
76 setModal(true);
77
78 // if only empty text, disable find button
79 if (fData->findText == "") {
80 fFind_pushButton->setEnabled(false);
81 }
82
83 // if there is no selection, disable that option
84 if (!selection) {
85 fSelectedText_checkBox->setChecked(false);
86 fSelectedText_checkBox->setEnabled(false);
87 }
88
89 fFind_comboBox->setItemText(0, fData->findText);
90 fCaseSensitive_checkBox->setChecked(fData->caseSensitive);
91 fWholeWordsOnly_checkBox->setChecked(fData->wholeWordsOnly);
92 fFromCursor_checkBox->setChecked(fData->fromCursor);
93 fFindBackwards_checkBox->setChecked(fData->findBackwards);
94
95 if (selection) {
96 fSelectedText_checkBox->setChecked(fData->selectedText);
97 }
98}
99
100//----------------------------------------------------------------------------------------------------
120{
121 fData->findText = fFind_comboBox->currentText();
122 fData->caseSensitive = fCaseSensitive_checkBox->isChecked();
123 fData->wholeWordsOnly = fWholeWordsOnly_checkBox->isChecked();
124 fData->fromCursor = fFromCursor_checkBox->isChecked();
125 fData->findBackwards = fFindBackwards_checkBox->isChecked();
126 if (fSelectedText_checkBox->isEnabled())
127 fData->selectedText = fSelectedText_checkBox->isChecked();
128
129 return fData;
130}
131
132//----------------------------------------------------------------------------------------------------
144{
145 if (fFind_comboBox->currentText() != "")
146 fFind_pushButton->setEnabled(true);
147 else
148 fFind_pushButton->setEnabled(false);
149}
150
151//----------------------------------------------------------------------------------------------------
152// END
153//----------------------------------------------------------------------------------------------------
Find dialog for text searching in musredit.
virtual void onFindTextAvailable(const QString &text)
Slot called when the find text changes.
PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent=nullptr)
Constructs and initializes the find dialog.
virtual PFindReplaceData * getData()
Retrieves the search parameters from the dialog.
PFindReplaceData * fData
Pointer to the find/replace data structure for storing search parameters.
Configuration structure for find and replace operations.
Definition musredit.h:109