Restore show mode when opening from tray
This commit is contained in:
parent
2e4f4d7702
commit
0b01047e02
@ -79,7 +79,7 @@ void rwSettings(bool writing)
|
|||||||
QSettings settings("Recoll.org", "recoll");
|
QSettings settings("Recoll.org", "recoll");
|
||||||
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Int, 0);
|
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Int, 0);
|
||||||
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Int, 0);
|
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Int, 0);
|
||||||
SETTING_RW(prefs.maximized, "/Recoll/geometry/maximized", Bool, 0);
|
SETTING_RW(prefs.showmode, "/Recoll/geometry/showmode", Int, 0);
|
||||||
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Int, 0);
|
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Int, 0);
|
||||||
SETTING_RW(prefs.pvheight, "/Recoll/geometry/pvheight", Int, 0);
|
SETTING_RW(prefs.pvheight, "/Recoll/geometry/pvheight", Int, 0);
|
||||||
SETTING_RW(prefs.toolArea, "/Recoll/geometry/toolArea", Int, 0);
|
SETTING_RW(prefs.toolArea, "/Recoll/geometry/toolArea", Int, 0);
|
||||||
|
|||||||
@ -30,11 +30,9 @@ extern RclDynConf *g_dynconf;
|
|||||||
#include "advshist.h"
|
#include "advshist.h"
|
||||||
extern AdvSearchHist *g_advshistory;
|
extern AdvSearchHist *g_advshistory;
|
||||||
|
|
||||||
#ifndef NO_NAMESPACES
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::list;
|
using std::list;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Holder for preferences (gets saved to user Qt prefs) */
|
/** Holder for preferences (gets saved to user Qt prefs) */
|
||||||
class PrefsPack {
|
class PrefsPack {
|
||||||
@ -68,7 +66,8 @@ class PrefsPack {
|
|||||||
QString queryStemLang;
|
QString queryStemLang;
|
||||||
int mainwidth;
|
int mainwidth;
|
||||||
int mainheight;
|
int mainheight;
|
||||||
bool maximized{false};
|
enum ShowMode {SHOW_NORMAL, SHOW_MAX, SHOW_FULL};
|
||||||
|
int showmode{SHOW_NORMAL};
|
||||||
int pvwidth; // Preview window geom
|
int pvwidth; // Preview window geom
|
||||||
int pvheight;
|
int pvheight;
|
||||||
int toolArea; // Area for "tools" toolbar
|
int toolArea; // Area for "tools" toolbar
|
||||||
|
|||||||
@ -375,10 +375,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
maybeOpenDb(reason);
|
maybeOpenDb(reason);
|
||||||
|
|
||||||
if (prefs.maximized) {
|
switch (prefs.showmode) {
|
||||||
mainWindow->showMaximized();
|
case PrefsPack::SHOW_NORMAL: mainWindow->show(); break;
|
||||||
} else {
|
case PrefsPack::SHOW_MAX: mainWindow->showMaximized(); break;
|
||||||
mainWindow->show();
|
case PrefsPack::SHOW_FULL: mainWindow->showFullScreen(); break;
|
||||||
}
|
}
|
||||||
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
|
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
|
||||||
|
|
||||||
|
|||||||
@ -643,6 +643,13 @@ void RclMain::showTrayMessage(const QString& text)
|
|||||||
void RclMain::closeEvent(QCloseEvent *ev)
|
void RclMain::closeEvent(QCloseEvent *ev)
|
||||||
{
|
{
|
||||||
LOGDEB("RclMain::closeEvent\n");
|
LOGDEB("RclMain::closeEvent\n");
|
||||||
|
if (isFullScreen()) {
|
||||||
|
prefs.showmode = PrefsPack::SHOW_FULL;
|
||||||
|
} else if (isMaximized()) {
|
||||||
|
prefs.showmode = PrefsPack::SHOW_MAX;
|
||||||
|
} else {
|
||||||
|
prefs.showmode = PrefsPack::SHOW_NORMAL;
|
||||||
|
}
|
||||||
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
|
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
|
||||||
hide();
|
hide();
|
||||||
ev->ignore();
|
ev->ignore();
|
||||||
@ -654,6 +661,15 @@ void RclMain::closeEvent(QCloseEvent *ev)
|
|||||||
void RclMain::fileExit()
|
void RclMain::fileExit()
|
||||||
{
|
{
|
||||||
LOGDEB("RclMain: fileExit\n");
|
LOGDEB("RclMain: fileExit\n");
|
||||||
|
// Have to do this both in closeEvent (for close to tray) and fileExit
|
||||||
|
// (^Q, doesnt go through closeEvent)
|
||||||
|
if (isFullScreen()) {
|
||||||
|
prefs.showmode = PrefsPack::SHOW_FULL;
|
||||||
|
} else if (isMaximized()) {
|
||||||
|
prefs.showmode = PrefsPack::SHOW_MAX;
|
||||||
|
} else {
|
||||||
|
prefs.showmode = PrefsPack::SHOW_NORMAL;
|
||||||
|
}
|
||||||
if (m_trayicon) {
|
if (m_trayicon) {
|
||||||
m_trayicon->setVisible(false);
|
m_trayicon->setVisible(false);
|
||||||
}
|
}
|
||||||
@ -662,7 +678,6 @@ void RclMain::fileExit()
|
|||||||
prefs.mainwidth = width();
|
prefs.mainwidth = width();
|
||||||
prefs.mainheight = height();
|
prefs.mainheight = height();
|
||||||
}
|
}
|
||||||
prefs.maximized = isMaximized();
|
|
||||||
|
|
||||||
prefs.toolArea = toolBarArea(m_toolsTB);
|
prefs.toolArea = toolBarArea(m_toolsTB);
|
||||||
prefs.resArea = toolBarArea(m_resTB);
|
prefs.resArea = toolBarArea(m_resTB);
|
||||||
|
|||||||
@ -41,7 +41,11 @@ void RclTrayIcon::onRestore()
|
|||||||
{
|
{
|
||||||
// Hide and show to restore on current desktop
|
// Hide and show to restore on current desktop
|
||||||
m_mainw->hide();
|
m_mainw->hide();
|
||||||
m_mainw->showNormal();
|
switch (prefs.showmode) {
|
||||||
|
case PrefsPack::SHOW_NORMAL: m_mainw->show(); break;
|
||||||
|
case PrefsPack::SHOW_MAX: m_mainw->showMaximized(); break;
|
||||||
|
case PrefsPack::SHOW_FULL: m_mainw->showFullScreen(); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RclTrayIcon::onActivated(QSystemTrayIcon::ActivationReason reason)
|
void RclTrayIcon::onActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user