Merge pull request #1767 from onewhl/issue962
Redesign find and replace panel
This commit is contained in:
commit
9592df2bbd
2 changed files with 37 additions and 32 deletions
|
|
@ -488,66 +488,72 @@
|
|||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="findTypeComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Replace</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="findInputField">
|
||||
<property name="placeholderText">
|
||||
<string>Search string</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="prevButton">
|
||||
<widget class="QPushButton" name="findPrevButton">
|
||||
<property name="text">
|
||||
<string><</string>
|
||||
<string>Find Previous</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="nextButton">
|
||||
<widget class="QPushButton" name="findNextButton">
|
||||
<property name="text">
|
||||
<string>></string>
|
||||
<string>Find Next</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="hideFindButton">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Done</string>
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="replaceInputField">
|
||||
<property name="placeholderText">
|
||||
<string>Replacement string</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="findLabel">
|
||||
<property name="text">
|
||||
<string>Find:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="replaceButton">
|
||||
<property name="text">
|
||||
<string>Replace</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="replaceAllButton">
|
||||
<property name="text">
|
||||
<string>All</string>
|
||||
<string>Replace All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="replaceLabel">
|
||||
<property name="text">
|
||||
<string>Replace with:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -459,9 +459,8 @@ MainWindow::MainWindow(const QString &filename)
|
|||
this->setColorScheme(cs);
|
||||
|
||||
//find and replace panel
|
||||
connect(this->findTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFindType(int)));
|
||||
connect(this->findInputField, SIGNAL(textChanged(QString)), this, SLOT(findString(QString)));
|
||||
connect(this->findInputField, SIGNAL(returnPressed()), this->nextButton, SLOT(animateClick()));
|
||||
connect(this->findInputField, SIGNAL(returnPressed()), this->findNextButton, SLOT(animateClick()));
|
||||
find_panel->installEventFilter(this);
|
||||
if (QApplication::clipboard()->supportsFindBuffer()) {
|
||||
connect(this->findInputField, SIGNAL(textChanged(QString)), this, SLOT(updateFindBuffer(QString)));
|
||||
|
|
@ -471,9 +470,9 @@ MainWindow::MainWindow(const QString &filename)
|
|||
this->findInputField->setText(QApplication::clipboard()->text(QClipboard::FindBuffer));
|
||||
}
|
||||
|
||||
connect(this->prevButton, SIGNAL(clicked()), this, SLOT(findPrev()));
|
||||
connect(this->nextButton, SIGNAL(clicked()), this, SLOT(findNext()));
|
||||
connect(this->hideFindButton, SIGNAL(clicked()), find_panel, SLOT(hide()));
|
||||
connect(this->findPrevButton, SIGNAL(clicked()), this, SLOT(findPrev()));
|
||||
connect(this->findNextButton, SIGNAL(clicked()), this, SLOT(findNext()));
|
||||
connect(this->cancelButton, SIGNAL(clicked()), find_panel, SLOT(hide()));
|
||||
connect(this->replaceButton, SIGNAL(clicked()), this, SLOT(replace()));
|
||||
connect(this->replaceAllButton, SIGNAL(clicked()), this, SLOT(replaceAll()));
|
||||
connect(this->replaceInputField, SIGNAL(returnPressed()), this->replaceButton, SLOT(animateClick()));
|
||||
|
|
@ -1469,10 +1468,10 @@ void MainWindow::pasteViewportRotation()
|
|||
|
||||
void MainWindow::find()
|
||||
{
|
||||
findTypeComboBox->setCurrentIndex(0);
|
||||
replaceInputField->hide();
|
||||
replaceButton->hide();
|
||||
replaceAllButton->hide();
|
||||
replaceLabel->setVisible(false);
|
||||
find_panel->show();
|
||||
if (!editor->selectedText().isEmpty()) {
|
||||
findInputField->setText(editor->selectedText());
|
||||
|
|
@ -1488,10 +1487,10 @@ void MainWindow::findString(QString textToFind)
|
|||
|
||||
void MainWindow::findAndReplace()
|
||||
{
|
||||
findTypeComboBox->setCurrentIndex(1);
|
||||
replaceInputField->show();
|
||||
replaceButton->show();
|
||||
replaceAllButton->show();
|
||||
replaceLabel->setVisible(true);
|
||||
find_panel->show();
|
||||
if (!editor->selectedText().isEmpty()) {
|
||||
findInputField->setText(editor->selectedText());
|
||||
|
|
|
|||
Loading…
Reference in a new issue