OpenCores
URL https://opencores.org/ocsvn/ezidebug/ezidebug/trunk

Subversion Repositories ezidebug

[/] [ezidebug/] [trunk/] [EziDebug_src/] [finddialog.cpp] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 EziDebug
#include <QtGui>
2
 
3
#include "finddialog.h"
4
 
5
FindDialog::FindDialog(QWidget *parent)
6
    : QDialog(parent)
7
{
8
    label = new QLabel(tr("Find &what:"));
9
    lineEdit = new QLineEdit;
10
    label->setBuddy(lineEdit);
11
 
12
    caseCheckBox = new QCheckBox(tr("Match &case"));
13
    backwardCheckBox = new QCheckBox(tr("Search &backward"));
14
 
15
    findButton = new QPushButton(tr("&Find"));
16
    findButton->setDefault(true);
17
    findButton->setEnabled(false);
18
 
19
    closeButton = new QPushButton(tr("Close"));
20
 
21
    connect(lineEdit, SIGNAL(textChanged(const QString &)),
22
            this, SLOT(enableFindButton(const QString &)));
23
    connect(findButton, SIGNAL(clicked()),
24
            this, SLOT(findClicked()));
25
    connect(closeButton, SIGNAL(clicked()),
26
            this, SLOT(close()));
27
 
28
    QHBoxLayout *topLeftLayout = new QHBoxLayout;
29
    topLeftLayout->addWidget(label);
30
    topLeftLayout->addWidget(lineEdit);
31
 
32
    QVBoxLayout *leftLayout = new QVBoxLayout;
33
    leftLayout->addLayout(topLeftLayout);
34
    leftLayout->addWidget(caseCheckBox);
35
    leftLayout->addWidget(backwardCheckBox);
36
 
37
    QVBoxLayout *rightLayout = new QVBoxLayout;
38
    rightLayout->addWidget(findButton);
39
    rightLayout->addWidget(closeButton);
40
    rightLayout->addStretch();
41
 
42
    QHBoxLayout *mainLayout = new QHBoxLayout;
43
    mainLayout->addLayout(leftLayout);
44
    mainLayout->addLayout(rightLayout);
45
    setLayout(mainLayout);
46
 
47
    setWindowTitle(tr("Find"));
48
    setFixedHeight(sizeHint().height());
49
}
50
 
51
void FindDialog::findClicked()
52
{
53
    QString text = lineEdit->text();
54
    Qt::CaseSensitivity cs =
55
            caseCheckBox->isChecked() ? Qt::CaseSensitive
56
                                      : Qt::CaseInsensitive;
57
    if (backwardCheckBox->isChecked()) {
58
        emit findPrevious(text, cs);
59
    } else {
60
        emit findNext(text, cs);
61
    }
62
}
63
 
64
void FindDialog::enableFindButton(const QString &text)
65
{
66
    findButton->setEnabled(!text.isEmpty());
67
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.