Switch to unified view

a/src/qtgui/spell_w.cpp b/src/qtgui/spell_w.cpp
...
...
103
    resTW->setColumnWidth(0, 200);
103
    resTW->setColumnWidth(0, 200);
104
    resTW->setColumnWidth(1, 150);
104
    resTW->setColumnWidth(1, 150);
105
    resTW->installEventFilter(this);
105
    resTW->installEventFilter(this);
106
}
106
}
107
107
108
static const int maxexpand = 10000;
109
108
/* Expand term according to current mode */
110
/* Expand term according to current mode */
109
void SpellW::doExpand()
111
void SpellW::doExpand()
110
{
112
{
111
    // Can't clear qt4 table widget: resets column headers too
113
    // Can't clear qt4 table widget: resets column headers too
112
    resTW->setRowCount(0);
114
    resTW->setRowCount(0);
...
...
138
    case 1:
140
    case 1:
139
    case 2: 
141
    case 2: 
140
    {
142
    {
141
    string l_stemlang = (const char*)stemLangCMB->currentText().toAscii();
143
    string l_stemlang = (const char*)stemLangCMB->currentText().toAscii();
142
144
143
    if (!rcldb->termMatch(mt, l_stemlang, expr, res, 200)) {
145
    if (!rcldb->termMatch(mt, l_stemlang, expr, res, maxexpand)) {
144
        LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
146
        LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
145
        return;
147
        return;
146
    }
148
    }
147
        statsLBL->setText(tr("Index: %1 documents, average length %2 terms")
149
        statsLBL->setText(tr("Index: %1 documents, average length %2 terms."
150
               "%3 results")
148
                          .arg(res.dbdoccount).arg(res.dbavgdoclen, 0, 'f', 1));
151
                          .arg(res.dbdoccount).arg(res.dbavgdoclen, 0, 'f', 1)
152
            .arg(res.entries.size()));
149
    }
153
    }
150
        
154
        
151
    break;
155
    break;
152
156
153
#ifdef RCL_USE_ASPELL
157
#ifdef RCL_USE_ASPELL
...
...
174
    if (!rclsugg.empty()) {
178
    if (!rclsugg.empty()) {
175
        res.entries.push_back(Rcl::TermMatchEntry("Xapian spelling:"));
179
        res.entries.push_back(Rcl::TermMatchEntry("Xapian spelling:"));
176
        res.entries.push_back(Rcl::TermMatchEntry(rclsugg));
180
        res.entries.push_back(Rcl::TermMatchEntry(rclsugg));
177
    }
181
    }
178
#endif // TESTING_XAPIAN_SPELL
182
#endif // TESTING_XAPIAN_SPELL
183
        statsLBL->setText(tr("%1 results").arg(res.entries.size()));
179
    }
184
    }
180
#endif
185
#endif
181
    }
186
    }
182
187
183
188
184
    if (res.entries.empty()) {
189
    if (res.entries.empty()) {
185
        resTW->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
190
        resTW->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
186
    } else {
191
    } else {
187
        int row = 0;
192
        int row = 0;
193
194
  if (maxexpand > 0 && int(res.entries.size()) >= maxexpand) {
195
      resTW->setRowCount(row + 1);
196
      resTW->setSpan(row, 0, 1, 2);
197
      resTW->setItem(row++, 0, 
198
             new QTableWidgetItem(
199
                 tr("List was truncated alphabetically, "
200
                "some frequent "))); 
201
      resTW->setRowCount(row + 1);
202
      resTW->setSpan(row, 0, 1, 2);
203
      resTW->setItem(row++, 0, new QTableWidgetItem(
204
                 tr("terms may be missing. "
205
                "Try using a longer root.")));
206
      resTW->setRowCount(row + 1);
207
      resTW->setItem(row++, 0, new QTableWidgetItem(""));
208
  }
209
188
    for (vector<Rcl::TermMatchEntry>::iterator it = res.entries.begin(); 
210
    for (vector<Rcl::TermMatchEntry>::iterator it = res.entries.begin(); 
189
         it != res.entries.end(); it++) {
211
         it != res.entries.end(); it++) {
190
        LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
212
        LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
191
        char num[30];
213
        char num[30];
192
        if (it->wcf)
214
        if (it->wcf)
193
        sprintf(num, "%d / %d",  it->docs, it->wcf);
215
        sprintf(num, "%d / %d",  it->docs, it->wcf);
194
        else
216
        else
195
        num[0] = 0;
217
        num[0] = 0;
196
            if (resTW->rowCount() <= row)
197
                resTW->setRowCount(row+1);
218
      resTW->setRowCount(row+1);
198
            resTW->setItem(row, 0, 
219
            resTW->setItem(row, 0, 
199
                    new QTableWidgetItem(QString::fromUtf8(it->term.c_str()))); 
220
                    new QTableWidgetItem(QString::fromUtf8(it->term.c_str()))); 
200
            resTW->setItem(row++, 1, 
221
            resTW->setItem(row++, 1, 
201
                             new QTableWidgetItem(QString::fromAscii(num)));
222
                             new QTableWidgetItem(QString::fromAscii(num)));
202
    }
223
    }
203
        resTW->setRowCount(row+1);
204
    }
224
    }
205
}
225
}
206
226
207
void SpellW::wordChanged(const QString &text)
227
void SpellW::wordChanged(const QString &text)
208
{
228
{