Switch to unified view

a/src/qtgui/searchclause_w.cpp b/src/qtgui/searchclause_w.cpp
...
...
34
 *  name 'name' and widget flags set to 'f'.
34
 *  name 'name' and widget flags set to 'f'.
35
 */
35
 */
36
SearchClauseW::SearchClauseW(QWidget* parent)
36
SearchClauseW::SearchClauseW(QWidget* parent)
37
    : QWidget(parent)
37
    : QWidget(parent)
38
{
38
{
39
    QHBoxLayout* hLayout = new QHBoxLayout(this, 0, 3); 
39
    QHBoxLayout* hLayout = new QHBoxLayout(this); 
40
    sTpCMB = new QComboBox(FALSE, this, "sTpCMB");
40
    sTpCMB = new QComboBox(this);
41
    sTpCMB->setEditable(false);
41
    hLayout->addWidget(sTpCMB);
42
    hLayout->addWidget(sTpCMB);
42
43
43
    proxSlackSB = new QSpinBox(this, "proxSlackSB");
44
    proxSlackSB = new QSpinBox(this);
44
    hLayout->addWidget(proxSlackSB);
45
    hLayout->addWidget(proxSlackSB);
45
46
46
    wordsLE = new QLineEdit(this, "wordsLE");
47
    wordsLE = new QLineEdit(this);
47
    wordsLE->setMinimumSize(QSize(250, 0));
48
    wordsLE->setMinimumSize(QSize(250, 0));
48
    hLayout->addWidget(wordsLE);
49
    hLayout->addWidget(wordsLE);
49
50
50
    languageChange();
51
    languageChange();
51
    resize(QSize(0, 0).expandedTo(minimumSizeHint()));
52
    resize(QSize(0, 0).expandedTo(minimumSizeHint()));
...
...
65
 *  Sets the strings of the subwidgets using the current
66
 *  Sets the strings of the subwidgets using the current
66
 *  language.
67
 *  language.
67
 */
68
 */
68
void SearchClauseW::languageChange()
69
void SearchClauseW::languageChange()
69
{
70
{
70
    setCaption(tr("SearchClauseW"));
71
    sTpCMB->clear();
71
    sTpCMB->clear();
72
    sTpCMB->insertItem(tr("Any of these")); // 0
72
    sTpCMB->addItem(tr("Any of these")); // 0
73
    sTpCMB->insertItem(tr("All of these")); //1
73
    sTpCMB->addItem(tr("All of these")); //1
74
    sTpCMB->insertItem(tr("None of these"));//2
74
    sTpCMB->addItem(tr("None of these"));//2
75
    sTpCMB->insertItem(tr("This phrase"));//3
75
    sTpCMB->addItem(tr("This phrase"));//3
76
    sTpCMB->insertItem(tr("Terms in proximity"));//4
76
    sTpCMB->addItem(tr("Terms in proximity"));//4
77
    sTpCMB->insertItem(tr("File name matching"));//5
77
    sTpCMB->addItem(tr("File name matching"));//5
78
    //    sTpCMB->insertItem(tr("Complex clause"));//6
78
    //    sTpCMB->insertItem(tr("Complex clause"));//6
79
79
80
    // Ensure that the spinbox will be enabled/disabled depending on
80
    // Ensure that the spinbox will be enabled/disabled depending on
81
    // combobox state
81
    // combobox state
82
    tpChange(0);
82
    tpChange(0);
83
83
84
    QToolTip::add(sTpCMB, tr("Select the type of query that will be performed with the words"));
84
    sTpCMB->setToolTip(tr("Select the type of query that will be performed with the words"));
85
    QToolTip::add(proxSlackSB, tr("Number of additional words that may be interspersed with the chosen ones"));
85
    proxSlackSB->setToolTip(tr("Number of additional words that may be interspersed with the chosen ones"));
86
}
86
}
87
87
88
using namespace Rcl;
88
using namespace Rcl;
89
89
90
// Translate my window state into an Rcl search clause
90
// Translate my window state into an Rcl search clause
91
SearchDataClause *
91
SearchDataClause *
92
SearchClauseW::getClause()
92
SearchClauseW::getClause()
93
{
93
{
94
    if (wordsLE->text().isEmpty())
94
    if (wordsLE->text().isEmpty())
95
    return 0;
95
    return 0;
96
    switch (sTpCMB->currentItem()) {
96
    switch (sTpCMB->currentIndex()) {
97
    case 0:
97
    case 0:
98
    return new SearchDataClauseSimple(SCLT_OR,
98
    return new SearchDataClauseSimple(SCLT_OR,
99
                  (const char *)wordsLE->text().utf8());
99
                  (const char *)wordsLE->text().toUtf8());
100
    case 1:
100
    case 1:
101
    return new SearchDataClauseSimple(SCLT_AND,
101
    return new SearchDataClauseSimple(SCLT_AND,
102
                  (const char *)wordsLE->text().utf8());
102
                  (const char *)wordsLE->text().toUtf8());
103
    case 2:
103
    case 2:
104
    return new SearchDataClauseSimple(SCLT_EXCL,
104
    return new SearchDataClauseSimple(SCLT_EXCL,
105
                  (const char *)wordsLE->text().utf8());
105
                  (const char *)wordsLE->text().toUtf8());
106
    case 3:
106
    case 3:
107
    return new SearchDataClauseDist(SCLT_PHRASE,
107
    return new SearchDataClauseDist(SCLT_PHRASE,
108
                (const char *)wordsLE->text().utf8(),
108
                (const char *)wordsLE->text().toUtf8(),
109
                    proxSlackSB->value());
109
                    proxSlackSB->value());
110
    case 4:
110
    case 4:
111
    return new SearchDataClauseDist(SCLT_NEAR,
111
    return new SearchDataClauseDist(SCLT_NEAR,
112
                (const char *)wordsLE->text().utf8(),
112
                (const char *)wordsLE->text().toUtf8(),
113
                    proxSlackSB->value());
113
                    proxSlackSB->value());
114
    case 5:
114
    case 5:
115
    return new SearchDataClauseFilename((const char *)wordsLE->text().utf8());
115
    return new SearchDataClauseFilename((const char *)wordsLE->text().toUtf8());
116
    case 6:
116
    case 6:
117
    default:
117
    default:
118
    return 0;
118
    return 0;
119
    }
119
    }
120
}
120
}
...
...
122
// Handle combobox change: may need to enable/disable the distance spinbox
122
// Handle combobox change: may need to enable/disable the distance spinbox
123
void SearchClauseW::tpChange(int index)
123
void SearchClauseW::tpChange(int index)
124
{
124
{
125
    if (index < 0 || index > 5)
125
    if (index < 0 || index > 5)
126
    return;
126
    return;
127
    if (sTpCMB->currentItem() != index)
127
    if (sTpCMB->currentIndex() != index)
128
    sTpCMB->setCurrentItem(index);
128
    sTpCMB->setCurrentIndex(index);
129
    switch (index) {
129
    switch (index) {
130
    case 3:
130
    case 3:
131
    case 4:
131
    case 4:
132
    proxSlackSB->show();
132
    proxSlackSB->show();
133
    proxSlackSB->setEnabled(true);
133
    proxSlackSB->setEnabled(true);