Switch to unified view

a/src/qtgui/searchclause_w.cpp b/src/qtgui/searchclause_w.cpp
...
...
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
#include "autoconfig.h"
17
#include "autoconfig.h"
18
18
19
#include "recoll.h"
19
#include "recoll.h"
20
#include "debuglog.h"
20
21
21
#include "searchclause_w.h"
22
#include "searchclause_w.h"
22
23
23
#include <qvariant.h>
24
#include <qvariant.h>
24
#include <qcombobox.h>
25
#include <qcombobox.h>
25
#include <qspinbox.h>
26
#include <qspinbox.h>
26
#include <qlineedit.h>
27
#include <qlineedit.h>
27
#include <qlayout.h>
28
#include <qlayout.h>
28
#include <qtooltip.h>
29
#include <qtooltip.h>
29
#include <qwhatsthis.h>
30
#include <qwhatsthis.h>
31
32
using namespace Rcl;
30
33
31
/*
34
/*
32
 *  Constructs a SearchClauseW as a child of 'parent', with the
35
 *  Constructs a SearchClauseW as a child of 'parent', with the
33
 *  name 'name' and widget flags set to 'f'.
36
 *  name 'name' and widget flags set to 'f'.
34
 */
37
 */
...
...
98
101
99
    sTpCMB->setToolTip(tr("Select the type of query that will be performed with the words"));
102
    sTpCMB->setToolTip(tr("Select the type of query that will be performed with the words"));
100
    proxSlackSB->setToolTip(tr("Number of additional words that may be interspersed with the chosen ones"));
103
    proxSlackSB->setToolTip(tr("Number of additional words that may be interspersed with the chosen ones"));
101
}
104
}
102
105
103
using namespace Rcl;
104
105
// Translate my window state into an Rcl search clause
106
// Translate my window state into an Rcl search clause
106
SearchDataClause *
107
SearchClauseW::getClause()
107
SearchDataClause *SearchClauseW::getClause()
108
{
108
{
109
    if (wordsLE->text().isEmpty())
109
    if (wordsLE->text().isEmpty())
110
    return 0;
110
    return 0;
111
    string field;
111
    string field;
112
    if (fldCMB->currentIndex() != 0) {
112
    if (fldCMB->currentIndex() != 0) {
...
...
132
    default:
132
    default:
133
    return 0;
133
    return 0;
134
    }
134
    }
135
}
135
}
136
136
137
138
void SearchClauseW::setFromClause(SearchDataClauseSimple *cl)
139
{
140
    LOGDEB(("SearchClauseW::setFromClause\n"));
141
    switch(cl->getTp()) {
142
    case SCLT_OR: tpChange(0); break;
143
    case SCLT_AND: tpChange(1); break;
144
    case SCLT_EXCL: tpChange(2); break;
145
    case SCLT_PHRASE: tpChange(3); break;
146
    case SCLT_NEAR: tpChange(4); break;
147
    case SCLT_FILENAME:   tpChange(5); break;
148
    default: return;
149
    }
150
    LOGDEB(("SearchClauseW::setFromClause: calling erase\n"));
151
    clear();
152
153
    QString text = QString::fromUtf8(cl->gettext().c_str());
154
    QString field = QString::fromUtf8(cl->getfield().c_str()); 
155
156
    switch(cl->getTp()) {
157
    case SCLT_OR: case SCLT_AND: case SCLT_EXCL:
158
    case SCLT_PHRASE: case SCLT_NEAR:
159
  if (!field.isEmpty()) {
160
      int idx = fldCMB->findText(field);
161
      if (field >= 0) {
162
      fldCMB->setCurrentIndex(idx);
163
      } else {
164
      fldCMB->setEditText(field);
165
      }
166
  }
167
  /* FALLTHROUGH */
168
    case SCLT_FILENAME:
169
  wordsLE->setText(text);
170
  break;
171
    default: break;
172
    }
173
174
    switch(cl->getTp()) {
175
    case SCLT_PHRASE: case SCLT_NEAR:
176
    {
177
  SearchDataClauseDist *cls = dynamic_cast<SearchDataClauseDist*>(cl);
178
  proxSlackSB->setValue(cls->getslack());
179
    }
180
    break;
181
    default: break;
182
    }
183
}
184
185
void SearchClauseW::clear()
186
{
187
    wordsLE->setText("");
188
    fldCMB->setCurrentIndex(0);
189
    proxSlackSB->setValue(0);
190
}
191
137
// Handle combobox change: may need to enable/disable the distance
192
// Handle combobox change: may need to enable/disable the distance
138
// spinbox and field spec
193
// spinbox and field spec
139
void SearchClauseW::tpChange(int index)
194
void SearchClauseW::tpChange(int index)
140
{
195
{
141
    if (index < 0 || index > 5)
196
    if (index < 0 || index > 5)