rclmain_w.cpp (recoll-1.27.11) | : | rclmain_w.cpp (recoll-1.27.12) | ||
---|---|---|---|---|
skipping to change at line 77 | skipping to change at line 77 | |||
#include "fragbuts.h" | #include "fragbuts.h" | |||
#include "systray.h" | #include "systray.h" | |||
#include "rclmain_w.h" | #include "rclmain_w.h" | |||
#include "rclhelp.h" | #include "rclhelp.h" | |||
#include "readfile.h" | #include "readfile.h" | |||
#include "moc_rclmain_w.cpp" | #include "moc_rclmain_w.cpp" | |||
using std::pair; | using std::pair; | |||
QString g_stringAllStem, g_stringNoStem; | QString g_stringAllStem, g_stringNoStem; | |||
static const char *settingskey_toolarea="/Recoll/geometry/toolArea"; | ||||
static const char *settingskey_resarea="/Recoll/geometry/resArea"; | ||||
static Qt::ToolBarArea int2area(int in) | static Qt::ToolBarArea int2area(int in) | |||
{ | { | |||
switch (in) { | switch (in) { | |||
case Qt::LeftToolBarArea: return Qt::LeftToolBarArea; | case Qt::LeftToolBarArea: return Qt::LeftToolBarArea; | |||
case Qt::RightToolBarArea: return Qt::RightToolBarArea; | case Qt::RightToolBarArea: return Qt::RightToolBarArea; | |||
case Qt::BottomToolBarArea: return Qt::BottomToolBarArea; | case Qt::BottomToolBarArea: return Qt::BottomToolBarArea; | |||
case Qt::TopToolBarArea: | case Qt::TopToolBarArea: | |||
default: | default: | |||
return Qt::TopToolBarArea; | return Qt::TopToolBarArea; | |||
} | } | |||
skipping to change at line 207 | skipping to change at line 208 | |||
} | } | |||
} | } | |||
curid->setChecked(true); | curid->setChecked(true); | |||
m_toolsTB = new QToolBar(tr("Tools"), this); | m_toolsTB = new QToolBar(tr("Tools"), this); | |||
m_toolsTB->setObjectName(QString::fromUtf8("m_toolsTB")); | m_toolsTB->setObjectName(QString::fromUtf8("m_toolsTB")); | |||
m_toolsTB->addAction(toolsAdvanced_SearchAction); | m_toolsTB->addAction(toolsAdvanced_SearchAction); | |||
m_toolsTB->addAction(toolsDoc_HistoryAction); | m_toolsTB->addAction(toolsDoc_HistoryAction); | |||
m_toolsTB->addAction(toolsSpellAction); | m_toolsTB->addAction(toolsSpellAction); | |||
m_toolsTB->addAction(actionQuery_Fragments); | m_toolsTB->addAction(actionQuery_Fragments); | |||
this->addToolBar(int2area(prefs.toolArea), m_toolsTB); | QSettings settings; | |||
int val = settings.value(settingskey_toolarea).toInt(); | ||||
this->addToolBar(int2area(val), m_toolsTB); | ||||
m_resTB = new QToolBar(tr("Results"), this); | m_resTB = new QToolBar(tr("Results"), this); | |||
m_resTB->setObjectName(QString::fromUtf8("m_resTB")); | m_resTB->setObjectName(QString::fromUtf8("m_resTB")); | |||
this->addToolBar(int2area(prefs.resArea), m_resTB); | val = settings.value(settingskey_resarea).toInt(); | |||
this->addToolBar(int2area(val), m_resTB); | ||||
// Document filter buttons and combobox | // Document filter buttons and combobox | |||
// Combobox version of the document filter control | // Combobox version of the document filter control | |||
m_filtCMB = new QComboBox(m_resTB); | m_filtCMB = new QComboBox(m_resTB); | |||
m_filtCMB->setEditable(false); | m_filtCMB->setEditable(false); | |||
m_filtCMB->addItem(tr("All")); | m_filtCMB->addItem(tr("All")); | |||
m_filtCMB->setToolTip(tr("Document filter")); | m_filtCMB->setToolTip(tr("Document filter")); | |||
// Buttons version of the document filter control | // Buttons version of the document filter control | |||
m_filtFRM = new QFrame(this); | m_filtFRM = new QFrame(this); | |||
m_filtFRM->setObjectName(QString::fromUtf8("m_filtFRM")); | m_filtFRM->setObjectName(QString::fromUtf8("m_filtFRM")); | |||
skipping to change at line 451 | skipping to change at line 455 | |||
this, SLOT(startPreview(Rcl::Doc))); | this, SLOT(startPreview(Rcl::Doc))); | |||
setFilterCtlStyle(prefs.filterCtlStyle); | setFilterCtlStyle(prefs.filterCtlStyle); | |||
if (prefs.keepSort && prefs.sortActive) { | if (prefs.keepSort && prefs.sortActive) { | |||
m_sortspec.field = (const char *)prefs.sortField.toUtf8(); | m_sortspec.field = (const char *)prefs.sortField.toUtf8(); | |||
m_sortspec.desc = prefs.sortDesc; | m_sortspec.desc = prefs.sortDesc; | |||
onSortDataChanged(m_sortspec); | onSortDataChanged(m_sortspec); | |||
emit sortDataChanged(m_sortspec); | emit sortDataChanged(m_sortspec); | |||
} | } | |||
QSettings settings; | ||||
restoreGeometry(settings.value("/Recoll/geometry/maingeom").toByteArray()); | restoreGeometry(settings.value("/Recoll/geometry/maingeom").toByteArray()); | |||
enableTrayIcon(prefs.showTrayIcon); | enableTrayIcon(prefs.showTrayIcon); | |||
fileRebuildIndexAction->setEnabled(false); | fileRebuildIndexAction->setEnabled(false); | |||
fileToggleIndexingAction->setEnabled(false); | fileToggleIndexingAction->setEnabled(false); | |||
fileRetryFailedAction->setEnabled(false); | fileRetryFailedAction->setEnabled(false); | |||
// Start timer on a slow period (used for checking ^C). Will be | // Start timer on a slow period (used for checking ^C). Will be | |||
// speeded up during indexing | // speeded up during indexing | |||
periodictimer->start(1000); | periodictimer->start(1000); | |||
skipping to change at line 485 | skipping to change at line 488 | |||
} | } | |||
} | } | |||
void RclMain::setSynEnabled(bool on) | void RclMain::setSynEnabled(bool on) | |||
{ | { | |||
prefs.synFileEnable = on; | prefs.synFileEnable = on; | |||
if (uiprefs) | if (uiprefs) | |||
uiprefs->synFileCB->setChecked(prefs.synFileEnable); | uiprefs->synFileCB->setChecked(prefs.synFileEnable); | |||
} | } | |||
QString RclMain::readDarkCSS() | ||||
{ | ||||
if (nullptr == theconfig) { | ||||
return QString(); | ||||
} | ||||
string fn = path_cat( | ||||
path_cat(theconfig->getDatadir(), "examples"), "recoll-dark.css"); | ||||
string data; | ||||
string reason; | ||||
if (!file_to_string(fn, data, &reason)) { | ||||
QMessageBox::warning(0, "Recoll", tr("Could not read: ") + u8s2qs(fn)); | ||||
return QString(); | ||||
} | ||||
return u8s2qs(data); | ||||
} | ||||
void RclMain::setDarkModeEnabled(bool on) | void RclMain::setDarkModeEnabled(bool on) | |||
{ | { | |||
string fn; | string fn; | |||
if (on) { | if (on) { | |||
if (!prefs.reslistheadertext.isEmpty() || !prefs.qssFile.isEmpty()) { | if (!prefs.reslistheadertext.isEmpty() || !prefs.qssFile.isEmpty()) { | |||
QString message = | QString message = | |||
tr("This will replace the current contents of the result list" | tr("This will replace the current contents of the result list" | |||
" header string and GUI qss file name. Continue ?"); | " header string and GUI qss file name. Continue ?"); | |||
switch(QMessageBox::warning(0, "Recoll", message, | switch(QMessageBox::warning(0, "Recoll", message, | |||
skipping to change at line 508 | skipping to change at line 527 | |||
case 1: | case 1: | |||
goto resetcheckednosigs; | goto resetcheckednosigs; | |||
} | } | |||
} | } | |||
string datadir = theconfig->getDatadir(); | string datadir = theconfig->getDatadir(); | |||
fn = path_cat(path_cat(datadir, "examples"), "recoll-dark.qss"); | fn = path_cat(path_cat(datadir, "examples"), "recoll-dark.qss"); | |||
if (!path_readable(fn)) { | if (!path_readable(fn)) { | |||
goto unreadable; | goto unreadable; | |||
} | } | |||
prefs.qssFile = u8s2qs(fn); | prefs.qssFile = u8s2qs(fn); | |||
fn = path_cat(path_cat(datadir, "examples"), "recoll-dark.css"); | ||||
string data; | prefs.reslistheadertext = readDarkCSS(); | |||
string reason; | ||||
if (!file_to_string(fn, data, &reason)) { | ||||
goto unreadable; | ||||
} | ||||
prefs.reslistheadertext = u8s2qs(data); | ||||
} else { | } else { | |||
prefs.reslistheadertext.clear(); | prefs.reslistheadertext.clear(); | |||
prefs.qssFile.clear(); | prefs.qssFile.clear(); | |||
} | } | |||
applyStyleSheet(); | applyStyleSheet(); | |||
prefs.darkMode = on; | prefs.darkMode = on; | |||
if (uiprefs) { | if (uiprefs) { | |||
uiprefs->resetStylesheet(prefs.qssFile); | uiprefs->resetStylesheet(prefs.qssFile); | |||
} | } | |||
skipping to change at line 735 | skipping to change at line 749 | |||
prefs.showmode = PrefsPack::SHOW_MAX; | prefs.showmode = PrefsPack::SHOW_MAX; | |||
} else { | } else { | |||
prefs.showmode = PrefsPack::SHOW_NORMAL; | prefs.showmode = PrefsPack::SHOW_NORMAL; | |||
} | } | |||
if (m_trayicon) { | if (m_trayicon) { | |||
m_trayicon->setVisible(false); | m_trayicon->setVisible(false); | |||
} | } | |||
// Don't save geometry if we're currently maximized. At least under X11 | // Don't save geometry if we're currently maximized. At least under X11 | |||
// this saves the maximized size. otoh isFullscreen() does not seem needed | // this saves the maximized size. otoh isFullscreen() does not seem needed | |||
QSettings settings; | ||||
if (!isMaximized()) { | if (!isMaximized()) { | |||
QSettings settings; | ||||
settings.setValue("/Recoll/geometry/maingeom", saveGeometry()); | settings.setValue("/Recoll/geometry/maingeom", saveGeometry()); | |||
} | } | |||
settings.setValue(settingskey_toolarea, toolBarArea(m_toolsTB)); | ||||
prefs.toolArea = toolBarArea(m_toolsTB); | settings.setValue(settingskey_resarea, toolBarArea(m_resTB)); | |||
prefs.resArea = toolBarArea(m_resTB); | ||||
restable->saveColState(); | restable->saveColState(); | |||
if (prefs.ssearchTypSav) { | if (prefs.ssearchTypSav) { | |||
prefs.ssearchTyp = sSearch->searchTypCMB->currentIndex(); | prefs.ssearchTyp = sSearch->searchTypCMB->currentIndex(); | |||
} | } | |||
rwSettings(true); | rwSettings(true); | |||
deleteAllTempFiles(); | deleteAllTempFiles(); | |||
qApp->exit(0); | qApp->exit(0); | |||
End of changes. 9 change blocks. | ||||
15 lines changed or deleted | 28 lines changed or added |