Changeset 18487
- Timestamp:
- 2013-12-15T19:18:27+01:00 (10 years ago)
- Location:
- branches/adrpo
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/adrpo
- Property svn:mergeinfo changed
/trunk merged: 18483-18486
- Property svn:mergeinfo changed
-
branches/adrpo/Makefile.libraries
r18482 r18487 1 GITCOMMIT= 0667a0452beead764104de23ad60ecbef6e1080b1 GITCOMMIT=9ff54eab7a148768e8e8ac2a94febba08b58db61 2 2 ifdef NOLIBRARIES 3 3 omlibrary: -
branches/adrpo/OMEdit
- Property svn:mergeinfo changed
/trunk/OMEdit merged: 18483
- Property svn:mergeinfo changed
-
branches/adrpo/OMEdit/OMEditGUI/GUI/MainWindow.cpp
r18412 r18487 1043 1043 if (pModelWidget) 1044 1044 { 1045 mpFindReplaceDialog->readFindTextFromSettings();1046 1045 mpFindReplaceDialog->setTextEdit(pModelWidget->getModelicaTextWidget()->getModelicaTextEdit()); 1047 1046 mpFindReplaceDialog->show(); -
branches/adrpo/OMEdit/OMEditGUI/GUI/Widgets/ModelicaTextWidget.cpp
r16954 r18487 990 990 void FindReplaceDialog::show() 991 991 { 992 QTextCursor currentTextCursor = mpModelicaTextEdit->textCursor(); 993 if (currentTextCursor.hasSelection()) 994 { 995 QString selectedText = currentTextCursor.selectedText(); 996 saveFindTextToSettings(selectedText); 997 readFindTextFromSettings(); 998 } 999 else 1000 { 1001 readFindTextFromSettings(); 1002 } 992 1003 mpFindComboBox->lineEdit()->selectAll(); 993 1004 setVisible(true); … … 1095 1106 1096 1107 if(!result) 1097 showError(tr("Can't find the text")); 1108 { 1109 QString message = QString( "Can't find the text '" ) + textToFind + QString( " '." ); 1110 QMessageBox::information( this, "Find", message ); 1111 } 1098 1112 } 1099 1113 … … 1103 1117 void FindReplaceDialog::replace() 1104 1118 { 1105 if (!mpModelicaTextEdit->textCursor().hasSelection()) 1106 { 1107 find(); 1108 } 1119 int compareString(0); 1120 if(mpCaseSensitiveCheckBox->isChecked()) 1121 compareString = Qt::CaseSensitive; 1109 1122 else 1123 compareString = Qt::CaseInsensitive; 1124 find(); 1125 int same = mpModelicaTextEdit->textCursor().selectedText().compare(mpFindComboBox->currentText(),( Qt::CaseSensitivity)compareString ); 1126 if (mpModelicaTextEdit->textCursor().hasSelection()&& same == 0 ) 1110 1127 { 1111 1128 mpModelicaTextEdit->textCursor().insertText(mpReplaceWithTextBox->text()); 1112 1129 find(); 1113 1130 } 1131 else 1132 find(); 1114 1133 } 1115 1134 … … 1119 1138 void FindReplaceDialog::replaceAll() 1120 1139 { 1140 // move cursor to start of text 1141 QTextCursor cursor = mpModelicaTextEdit->textCursor(); 1142 cursor.movePosition(QTextCursor::Start); 1143 mpModelicaTextEdit->setTextCursor(cursor); 1144 1145 QTextDocument::FindFlags flags; 1146 if (mpCaseSensitiveCheckBox->isChecked()) 1147 flags |= QTextDocument::FindCaseSensitively; 1148 if (mpWholeWordCheckBox->isChecked()) 1149 flags |= QTextDocument::FindWholeWords; 1150 1151 // save the find text in settings 1152 saveFindTextToSettings(mpFindComboBox->currentText()); 1153 // replace all 1121 1154 int i=0; 1122 while (mpModelicaTextEdit->textCursor().hasSelection()) 1155 mpModelicaTextEdit->textCursor().beginEditBlock(); 1156 while(mpModelicaTextEdit->find(mpFindComboBox->currentText(), flags )) 1123 1157 { 1124 1158 mpModelicaTextEdit->textCursor().insertText(mpReplaceWithTextBox->text()); 1125 find();1126 1159 i++; 1127 1160 } 1128 showMessage(tr("Replaced %1 occurrence(s)").arg(i)); 1161 mpModelicaTextEdit->textCursor().endEditBlock(); 1162 1163 // show message box with status information 1164 QString message; 1165 message.setNum(i); 1166 message += QString( " occurence(s) of the text '" ) + mpFindComboBox->currentText() + 1167 QString( "' was replaced with the text '" ) + mpReplaceWithTextBox->text() + QString( "'." ); 1168 QMessageBox::information( this, "Replace All", message ); 1129 1169 } 1130 1170 … … 1203 1243 { 1204 1244 mpFindButton->setEnabled(mpFindComboBox->currentText().size() > 0); 1205 1206 } 1207 1245 } 1246
Note: See TracChangeset
for help on using the changeset viewer.