Switch to unified view

a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp
...
...
47
#include "rclconfig.h"
47
#include "rclconfig.h"
48
#include "pathut.h"
48
#include "pathut.h"
49
#include "uiprefs_w.h"
49
#include "uiprefs_w.h"
50
#include "viewaction_w.h"
50
#include "viewaction_w.h"
51
#include "debuglog.h"
51
#include "debuglog.h"
52
#include "editdialog.h"
52
53
53
void UIPrefsDialog::init()
54
void UIPrefsDialog::init()
54
{
55
{
55
    m_viewAction = 0;
56
    m_viewAction = 0;
56
57
...
...
68
        this, SLOT(togExtraDbPB_clicked()));
69
        this, SLOT(togExtraDbPB_clicked()));
69
    connect(actAllExtraDbPB, SIGNAL(clicked()), 
70
    connect(actAllExtraDbPB, SIGNAL(clicked()), 
70
        this, SLOT(actAllExtraDbPB_clicked()));
71
        this, SLOT(actAllExtraDbPB_clicked()));
71
    connect(unacAllExtraDbPB, SIGNAL(clicked()), 
72
    connect(unacAllExtraDbPB, SIGNAL(clicked()), 
72
        this, SLOT(unacAllExtraDbPB_clicked()));
73
        this, SLOT(unacAllExtraDbPB_clicked()));
73
74
    connect(CLEditPara, SIGNAL(clicked()), this, SLOT(editParaFormat()));
75
    connect(CLEditHeader, SIGNAL(clicked()), this, SLOT(editHeaderText()));
74
    connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
76
    connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
75
    connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
77
    connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
76
    connect(buildAbsCB, SIGNAL(toggled(bool)), 
78
    connect(buildAbsCB, SIGNAL(toggled(bool)), 
77
        replAbsCB, SLOT(setEnabled(bool)));
79
        replAbsCB, SLOT(setEnabled(bool)));
78
    connect(useDesktopOpenCB, SIGNAL(toggled(bool)), 
80
    connect(useDesktopOpenCB, SIGNAL(toggled(bool)), 
...
...
127
    } else {
129
    } else {
128
    string nm = path_getsimple((const char *)stylesheetFile.toLocal8Bit());
130
    string nm = path_getsimple((const char *)stylesheetFile.toLocal8Bit());
129
    stylesheetPB->setText(QString::fromLocal8Bit(nm.c_str()));
131
    stylesheetPB->setText(QString::fromLocal8Bit(nm.c_str()));
130
    }
132
    }
131
133
132
    rlfTE->setPlainText(prefs.reslistformat);
134
    paraFormat = prefs.reslistformat;
135
    headerText = prefs.reslistheadertext;
133
136
134
    // Stemming language combobox
137
    // Stemming language combobox
135
    stemLangCMB->clear();
138
    stemLangCMB->clear();
136
    stemLangCMB->addItem(g_stringNoStem);
139
    stemLangCMB->addItem(g_stringNoStem);
137
    stemLangCMB->addItem(g_stringAllStem);
140
    stemLangCMB->addItem(g_stringAllStem);
...
...
199
    prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8();
202
    prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8();
200
203
201
    prefs.reslistfontfamily = reslistFontFamily;
204
    prefs.reslistfontfamily = reslistFontFamily;
202
    prefs.reslistfontsize = reslistFontSize;
205
    prefs.reslistfontsize = reslistFontSize;
203
    prefs.stylesheetFile = stylesheetFile;
206
    prefs.stylesheetFile = stylesheetFile;
204
    prefs.reslistformat =  rlfTE->toPlainText();
207
    prefs.reslistformat =  paraFormat;
208
    prefs.reslistheadertext =  headerText;
205
    if (prefs.reslistformat.trimmed().isEmpty()) {
209
    if (prefs.reslistformat.trimmed().isEmpty()) {
206
    prefs.reslistformat = prefs.dfltResListFormat;
210
    prefs.reslistformat = prefs.dfltResListFormat;
207
  rlfTE->setPlainText(prefs.reslistformat);
211
  paraFormat = prefs.reslistformat;
208
    }
212
    }
209
213
210
    prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
214
    prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
211
215
212
    if (stemLangCMB->currentIndex() == 0) {
216
    if (stemLangCMB->currentIndex() == 0) {
...
...
251
    rwSettings(true);
255
    rwSettings(true);
252
    string reason;
256
    string reason;
253
    maybeOpenDb(reason, true);
257
    maybeOpenDb(reason, true);
254
    emit uiprefsDone();
258
    emit uiprefsDone();
255
    QDialog::accept();
259
    QDialog::accept();
260
}
261
262
void UIPrefsDialog::editParaFormat()
263
{
264
    EditDialog dialog(this);
265
    dialog.plainTextEdit->setPlainText(paraFormat);
266
    int result = dialog.exec();
267
    if (result == QDialog::Accepted)
268
  paraFormat = dialog.plainTextEdit->toPlainText();
269
}
270
void UIPrefsDialog::editHeaderText()
271
{
272
    EditDialog dialog(this);
273
    dialog.plainTextEdit->setPlainText(headerText);
274
    int result = dialog.exec();
275
    if (result == QDialog::Accepted)
276
  headerText = dialog.plainTextEdit->toPlainText();
256
}
277
}
257
278
258
void UIPrefsDialog::reject()
279
void UIPrefsDialog::reject()
259
{
280
{
260
    setFromPrefs();
281
    setFromPrefs();
...
...
290
311
291
    font = QFontDialog::getFont(&ok, font, this);
312
    font = QFontDialog::getFont(&ok, font, this);
292
    if (ok) {
313
    if (ok) {
293
    // Check if the default font was set, in which case we
314
    // Check if the default font was set, in which case we
294
    // erase the preference
315
    // erase the preference
316
  QString s;
295
    if (font.family().compare(this->font().family()) || 
317
    if (font.family().compare(this->font().family()) || 
296
        font.pointSize() != this->font().pointSize()) {
318
        font.pointSize() != this->font().pointSize()) {
297
        reslistFontFamily = font.family();
319
        reslistFontFamily = font.family();
298
        reslistFontSize = font.pointSize();
320
        reslistFontSize = font.pointSize();
299
      QString s;
300
        reslistFontPB->setText(reslistFontFamily + "-" +
321
        reslistFontPB->setText(reslistFontFamily + "-" +
301
                   s.setNum(reslistFontSize));
322
                   s.setNum(reslistFontSize));
302
    } else {
323
    } else {
303
        reslistFontFamily = "";
324
        reslistFontFamily = "";
304
        reslistFontSize = 0;
325
        reslistFontSize = 0;
326
      reslistFontPB->setText(this->font().family() + "-" +
327
                 s.setNum(this->font().pointSize()));
305
    }
328
    }
306
    }
329
    }
307
}
330
}
308
331
309
void UIPrefsDialog::showStylesheetDialog()
332
void UIPrefsDialog::showStylesheetDialog()