Switch to unified view

a/src/qtgui/spell_w.cpp b/src/qtgui/spell_w.cpp
...
...
97
            this, SLOT(textDoubleClicked()));
97
            this, SLOT(textDoubleClicked()));
98
    // No initial sorting: user can choose to establish one
98
    // No initial sorting: user can choose to establish one
99
    suggsLV->setSorting(100, false);
99
    suggsLV->setSorting(100, false);
100
#else
100
#else
101
    QStringList labels(tr("Term"));
101
    QStringList labels(tr("Term"));
102
    labels.push_back(tr("Count"));
102
    labels.push_back(tr("Doc. / Tot."));
103
    suggsLV->setHorizontalHeaderLabels(labels);
103
    suggsLV->setHorizontalHeaderLabels(labels);
104
    suggsLV->setShowGrid(0);
104
    suggsLV->setShowGrid(0);
105
    suggsLV->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
105
    suggsLV->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
106
    connect(suggsLV,
106
    connect(suggsLV,
107
       SIGNAL(cellDoubleClicked(int, int)),
107
       SIGNAL(cellDoubleClicked(int, int)),
108
            this, SLOT(textDoubleClicked(int, int)));
108
            this, SLOT(textDoubleClicked(int, int)));
109
#endif
109
#endif
110
110
111
    suggsLV->setColumnWidth(0, 200);
111
    suggsLV->setColumnWidth(0, 200);
112
    suggsLV->setColumnWidth(1, 100);
112
    suggsLV->setColumnWidth(1, 150);
113
}
113
}
114
114
115
#if (QT_VERSION < 0x040000)
115
#if (QT_VERSION < 0x040000)
116
// Subclass qlistviewitem for numeric sorting on column 1
116
// Subclass qlistviewitem for numeric sorting on column 1
117
class MyListViewItem : public QListViewItem
117
class MyListViewItem : public QListViewItem
...
...
163
    case 0: mt = Rcl::Db::ET_WILD; break;
163
    case 0: mt = Rcl::Db::ET_WILD; break;
164
    case 1:mt = Rcl::Db::ET_REGEXP; break;
164
    case 1:mt = Rcl::Db::ET_REGEXP; break;
165
    case 2:mt = Rcl::Db::ET_STEM; break;
165
    case 2:mt = Rcl::Db::ET_STEM; break;
166
    }
166
    }
167
167
168
    list<Rcl::TermMatchEntry> entries;
168
    Rcl::TermMatchResult res;
169
    switch (expTypeCMB->currentItem()) {
169
    switch (expTypeCMB->currentItem()) {
170
    case 0: 
170
    case 0: 
171
    case 1:
171
    case 1:
172
    case 2: {
172
    case 2: 
173
    {
173
    string l_stemlang = stemLangCMB->currentText().ascii();
174
    string l_stemlang = stemLangCMB->currentText().ascii();
174
175
175
    if (!rcldb->termMatch(mt, l_stemlang, expr, entries, 200)) {
176
    if (!rcldb->termMatch(mt, l_stemlang, expr, res, 200)) {
176
        LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
177
        LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
177
        return;
178
        return;
178
    }
179
    }
180
        statsLBL->setText(tr("Index: %1 documents, average length %2 terms")
181
                          .arg(res.dbdoccount).arg(res.dbavgdoclen, 0, 'f', 1));
179
    }
182
    }
183
        
180
    break;
184
    break;
181
185
182
#ifdef RCL_USE_ASPELL
186
#ifdef RCL_USE_ASPELL
183
    case 3: {
187
    case 3: {
184
    LOGDEB(("SpellW::doExpand: aspelling\n"));
188
    LOGDEB(("SpellW::doExpand: aspelling\n"));
...
...
195
                 tr("Aspell expansion error. "));
199
                 tr("Aspell expansion error. "));
196
        LOGERR(("SpellW::doExpand:suggest failed: %s\n", reason.c_str()));
200
        LOGERR(("SpellW::doExpand:suggest failed: %s\n", reason.c_str()));
197
    }
201
    }
198
    for (list<string>::const_iterator it = suggs.begin(); 
202
    for (list<string>::const_iterator it = suggs.begin(); 
199
         it != suggs.end(); it++) 
203
         it != suggs.end(); it++) 
200
        entries.push_back(Rcl::TermMatchEntry(*it));
204
        res.entries.push_back(Rcl::TermMatchEntry(*it));
201
    }
205
    }
202
#endif
206
#endif
203
    }
207
    }
204
208
205
209
206
    if (entries.empty()) {
210
    if (res.entries.empty()) {
207
#if (QT_VERSION < 0x040000)
211
#if (QT_VERSION < 0x040000)
208
    new MyListViewItem(suggsLV, tr("No expansion found"), "");
212
    new MyListViewItem(suggsLV, tr("No expansion found"), "");
209
#else
213
#else
210
        suggsLV->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
214
        suggsLV->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
211
#endif
215
#endif
212
    } else {
216
    } else {
213
#if (QT_VERSION < 0x040000)
217
#if (QT_VERSION < 0x040000)
214
    for (list<Rcl::TermMatchEntry>::reverse_iterator it = entries.rbegin(); 
218
    for (list<Rcl::TermMatchEntry>::reverse_iterator it = 
219
                 res.entries.rbegin(); 
215
         it != entries.rend(); it++) {
220
         it != res.entries.rend(); it++) {
216
#else
221
#else
217
        int row = 0;
222
        int row = 0;
218
    for (list<Rcl::TermMatchEntry>::iterator it = entries.begin(); 
223
    for (list<Rcl::TermMatchEntry>::iterator it = res.entries.begin(); 
219
         it != entries.end(); it++) {
224
         it != res.entries.end(); it++) {
220
#endif
225
#endif
221
        LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
226
        LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
222
        char num[20];
227
        char num[20];
223
        if (it->wcf)
228
        if (it->wcf)
224
        sprintf(num, "%d", it->wcf);
229
        sprintf(num, "%d / %d",  it->docs, it->wcf);
225
        else
230
        else
226
        num[0] = 0;
231
        num[0] = 0;
227
#if (QT_VERSION < 0x040000)
232
#if (QT_VERSION < 0x040000)
228
        new MyListViewItem(suggsLV, 
233
        new MyListViewItem(suggsLV, 
229
                  QString::fromUtf8(it->term.c_str()),
234
                  QString::fromUtf8(it->term.c_str()),