summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui/findreplacedialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/gui/findreplacedialog.cpp')
-rw-r--r--utils/themeeditor/gui/findreplacedialog.cpp101
1 files changed, 101 insertions, 0 deletions
diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp
new file mode 100644
index 0000000000..234c6f6886
--- /dev/null
+++ b/utils/themeeditor/gui/findreplacedialog.cpp
@@ -0,0 +1,101 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Robert Bieber
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "findreplacedialog.h"
23#include "ui_findreplacedialog.h"
24
25#include <QTextBlock>
26
27FindReplaceDialog::FindReplaceDialog(QWidget *parent) :
28 QDialog(parent),
29 ui(new Ui::FindReplaceDialog), editor(0)
30{
31 ui->setupUi(this);
32 setupUI();
33}
34
35FindReplaceDialog::~FindReplaceDialog()
36{
37 delete ui;
38}
39
40void FindReplaceDialog::changeEvent(QEvent *e)
41{
42 QDialog::changeEvent(e);
43 switch (e->type()) {
44 case QEvent::LanguageChange:
45 ui->retranslateUi(this);
46 break;
47 default:
48 break;
49 }
50}
51
52void FindReplaceDialog::closeEvent(QCloseEvent* event)
53{
54 ui->statusLabel->setText("");
55 event->accept();
56}
57
58void FindReplaceDialog::setupUI()
59{
60 QObject::connect(ui->findButton, SIGNAL(pressed()),
61 this, SLOT(find()));
62 QObject::connect(ui->replaceButton, SIGNAL(pressed()),
63 this, SLOT(replace()));
64 QObject::connect(ui->replaceAllButton, SIGNAL(pressed()),
65 this, SLOT(replaceAll()));
66 QObject::connect(ui->closeButton, SIGNAL(pressed()),
67 this, SLOT(close()));
68 QObject::connect(ui->findBox, SIGNAL(textChanged(QString)),
69 this, SLOT(textChanged()));
70
71 textChanged();
72}
73
74void FindReplaceDialog::find()
75{
76
77 if(!editor)
78 return;
79
80 editor->setTextCursor(editor->document()->find(ui->findBox->text()));
81
82}
83
84void FindReplaceDialog::replace()
85{
86
87}
88
89void FindReplaceDialog::replaceAll()
90{
91
92}
93
94void FindReplaceDialog::textChanged()
95{
96 bool enabled = ui->findBox->text() != "";
97
98 ui->findButton->setEnabled(enabled);
99 ui->replaceButton->setEnabled(enabled);
100 ui->replaceAllButton->setEnabled(enabled);
101}