|
@@ -1,32 +1,79 @@
|
|
|
#include "fb2dlgs.hpp"
|
|
|
+#include "fb2code.hpp"
|
|
|
#include "fb2view.hpp"
|
|
|
#include "fb2utils.h"
|
|
|
#include "ui_fb2find.h"
|
|
|
#include "ui_fb2note.h"
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
-// Fb2FindDlg
|
|
|
+// Fb2CodeFindDlg
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
-Fb2FindDlg::Fb2FindDlg(QWidget *parent) :
|
|
|
- QDialog(parent),
|
|
|
- ui(new Ui::Fb2Find)
|
|
|
+Fb2CodeFindDlg::Fb2CodeFindDlg(Fb2CodeEdit &edit)
|
|
|
+ : QDialog(&edit)
|
|
|
+ , ui(new Ui::Fb2Find)
|
|
|
+ , m_edit(edit)
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
+ ui->checkHigh->setText(tr("Complete words"));
|
|
|
+ connect(ui->btnFind, SIGNAL(clicked()), this, SLOT(find()));
|
|
|
}
|
|
|
|
|
|
-Fb2FindDlg::~Fb2FindDlg()
|
|
|
+Fb2CodeFindDlg::~Fb2CodeFindDlg()
|
|
|
{
|
|
|
delete ui;
|
|
|
}
|
|
|
|
|
|
+void Fb2CodeFindDlg::find()
|
|
|
+{
|
|
|
+ QString text = ui->editText->text();
|
|
|
+ if (text.isEmpty()) return;
|
|
|
+ QTextDocument::FindFlags options = 0;
|
|
|
+ if (ui->radioUp->isChecked()) options |= QTextDocument::FindBackward;
|
|
|
+ if (ui->checkCase->isChecked()) options |= QTextDocument::FindCaseSensitively;
|
|
|
+ if (ui->checkHigh->isChecked()) options |= QTextDocument::FindWholeWords;
|
|
|
+
|
|
|
+ m_edit.findText(text, options);
|
|
|
+}
|
|
|
+
|
|
|
+//---------------------------------------------------------------------------
|
|
|
+// Fb2TextFindDlg
|
|
|
+//---------------------------------------------------------------------------
|
|
|
+
|
|
|
+Fb2TextFindDlg::Fb2TextFindDlg(Fb2WebView &edit)
|
|
|
+ : QDialog(&edit)
|
|
|
+ , ui(new Ui::Fb2Find)
|
|
|
+ , m_edit(edit)
|
|
|
+{
|
|
|
+ ui->setupUi(this);
|
|
|
+ connect(ui->btnFind, SIGNAL(clicked()), this, SLOT(find()));
|
|
|
+}
|
|
|
+
|
|
|
+Fb2TextFindDlg::~Fb2TextFindDlg()
|
|
|
+{
|
|
|
+ m_edit.findText(QString(), QWebPage::HighlightAllOccurrences);
|
|
|
+ delete ui;
|
|
|
+}
|
|
|
+
|
|
|
+void Fb2TextFindDlg::find()
|
|
|
+{
|
|
|
+ QString text = ui->editText->text();
|
|
|
+ if (text.isEmpty()) return;
|
|
|
+ QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument;
|
|
|
+ if (ui->radioUp->isChecked()) options |= QWebPage::FindBackward;
|
|
|
+ if (ui->checkCase->isChecked()) options |= QWebPage::FindCaseSensitively;
|
|
|
+ if (ui->checkHigh->isChecked()) options |= QWebPage::HighlightAllOccurrences;
|
|
|
+
|
|
|
+ m_edit.findText(text, options);
|
|
|
+}
|
|
|
+
|
|
|
//---------------------------------------------------------------------------
|
|
|
// Fb2NoteDlg
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
-Fb2NoteDlg::Fb2NoteDlg(Fb2WebView &view, QWidget *parent) :
|
|
|
- QDialog(parent),
|
|
|
- ui(new Ui::Fb2Note)
|
|
|
+Fb2NoteDlg::Fb2NoteDlg(Fb2WebView &view)
|
|
|
+ : QDialog(&view)
|
|
|
+ , ui(new Ui::Fb2Note)
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
ui->m_key->addItem(tr("<create new>"));
|