mirror of
https://github.com/YACReader/yacreader
synced 2025-05-27 19:00:29 -04:00
Qt documentation recommends calling saveGeometry() in closeEvent(). This commit fixes the following bug on my GNU/Linux with Xfce system: 1. Move the top of the YACReader window to the top of the screen. 2. Restart YACReader (exit and run again). 2. Enter full screen mode. 4. Restart YACReader. 5. Exit full screen mode. At this point YACReader's title bar is hidden beyond the top of the screen, i.e. the window has moved up.
70 lines
2.1 KiB
C++
70 lines
2.1 KiB
C++
#include "configuration.h"
|
|
|
|
#include <QFile>
|
|
#include <QFile>
|
|
#include <QTextStream>
|
|
#include <QCoreApplication>
|
|
#include <QStringList>
|
|
#include <QMessageBox>
|
|
|
|
#include "yacreader_global.h"
|
|
|
|
Configuration::Configuration()
|
|
{
|
|
}
|
|
|
|
QSettings *Configuration::getSettings()
|
|
{
|
|
return settings;
|
|
}
|
|
|
|
void Configuration::load(QSettings *settings)
|
|
{
|
|
this->settings = settings;
|
|
|
|
//TODO set defaults
|
|
if (!settings->contains(PATH))
|
|
settings->setValue(PATH, ".");
|
|
if (!settings->contains(GO_TO_FLOW_SIZE))
|
|
settings->setValue(GO_TO_FLOW_SIZE, QSize(126, 200));
|
|
if (!settings->contains(MAG_GLASS_SIZE))
|
|
settings->setValue(MAG_GLASS_SIZE, QSize(350, 175));
|
|
if (!settings->contains(ZOOM_LEVEL))
|
|
settings->setValue(MAG_GLASS_SIZE, QSize(350, 175));
|
|
if (!settings->contains(FLOW_TYPE))
|
|
settings->setValue(FLOW_TYPE, 0);
|
|
if (!settings->contains(FULLSCREEN))
|
|
settings->setValue(FULLSCREEN, false);
|
|
if (!settings->contains(MAXIMIZED))
|
|
settings->setValue(MAXIMIZED, false);
|
|
if (!settings->contains(DOUBLE_PAGE))
|
|
settings->setValue(DOUBLE_PAGE, false);
|
|
if (!settings->contains(BACKGROUND_COLOR))
|
|
settings->setValue(BACKGROUND_COLOR, QColor(40, 40, 40));
|
|
if (!settings->contains(ALWAYS_ON_TOP))
|
|
settings->setValue(ALWAYS_ON_TOP, false);
|
|
if (!settings->contains(SHOW_TOOLBARS))
|
|
settings->setValue(SHOW_TOOLBARS, true);
|
|
if (!settings->contains(QUICK_NAVI_MODE))
|
|
settings->setValue(QUICK_NAVI_MODE, false);
|
|
//old fit stuff
|
|
/*if(!settings->contains(FIT))
|
|
settings->setValue(FIT,false);
|
|
if(!settings->contains(FIT_TO_WIDTH_RATIO))
|
|
settings->setValue(FIT_TO_WIDTH_RATIO,1);
|
|
if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
|
settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
|
*/
|
|
}
|
|
void Configuration::updateOpenRecentList(QString path)
|
|
{
|
|
QStringList list = openRecentList();
|
|
list.removeAll(path);
|
|
list.prepend(path);
|
|
//TODO: Make list lenght configurable
|
|
while (list.length() > getOpenRecentSize()) {
|
|
list.removeLast();
|
|
}
|
|
settings->setValue("recentFiles", list);
|
|
}
|