mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Remove old unused configuration parser code. (or a part of it)
This commit is contained in:
parent
d11414d181
commit
6bf9bfcf7b
@ -56,117 +56,3 @@ void Configuration::load(QSettings * settings)
|
|||||||
if(!settings->contains(SHOW_TOOLBARS))
|
if(!settings->contains(SHOW_TOOLBARS))
|
||||||
settings->setValue(SHOW_TOOLBARS, true);
|
settings->setValue(SHOW_TOOLBARS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configuration::load(const QString & path)
|
|
||||||
{
|
|
||||||
//load default configuration
|
|
||||||
defaultPath = ".";
|
|
||||||
magnifyingGlassSize = QSize(350,175);
|
|
||||||
gotoSlideSize = QSize(126,200); //normal
|
|
||||||
//gotoSlideSize = QSize(79,125); //small
|
|
||||||
//gotoSlideSize = QSize(173,275); //big
|
|
||||||
//gotoSlideSize = QSize(220,350); //huge
|
|
||||||
zoomLevel = 0.5;
|
|
||||||
adjustToWidth = true;
|
|
||||||
flowType = Strip;
|
|
||||||
fullScreen = false;
|
|
||||||
fitToWidthRatio = 1;
|
|
||||||
windowSize = QSize(0,0);
|
|
||||||
maximized = false;
|
|
||||||
doublePage = false;
|
|
||||||
doubleMangaPage = false;
|
|
||||||
adjustToFullSize = false;
|
|
||||||
backgroundColor = QColor(40,40,40);
|
|
||||||
alwaysOnTop = false;
|
|
||||||
|
|
||||||
//load from file
|
|
||||||
QFile f(YACReader::getSettingsPath()+path);
|
|
||||||
f.open(QIODevice::ReadOnly);
|
|
||||||
QTextStream txtS(&f);
|
|
||||||
QString content = txtS.readAll();
|
|
||||||
QStringList lines = content.split('\n');
|
|
||||||
QString line,name;
|
|
||||||
int i=0;
|
|
||||||
foreach(line,lines)
|
|
||||||
{
|
|
||||||
if((i%2)==0)
|
|
||||||
{
|
|
||||||
name = line.trimmed();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(name==PATH)
|
|
||||||
{
|
|
||||||
defaultPath = line.trimmed();
|
|
||||||
}
|
|
||||||
if(name==MAG_GLASS_SIZE)
|
|
||||||
{
|
|
||||||
QStringList values = line.split(',');
|
|
||||||
magnifyingGlassSize = QSize(values[0].toInt(),values[1].toInt());
|
|
||||||
}
|
|
||||||
if(name==ZOOM_LEVEL)
|
|
||||||
{
|
|
||||||
zoomLevel = line.toFloat();
|
|
||||||
}
|
|
||||||
if(name==SLIDE_SIZE)
|
|
||||||
{
|
|
||||||
int height = line.toInt();
|
|
||||||
gotoSlideSize = QSize(static_cast<int>(height/SLIDE_ASPECT_RATIO),height);
|
|
||||||
}
|
|
||||||
if(name==FIT)
|
|
||||||
{
|
|
||||||
adjustToWidth = line.toInt();
|
|
||||||
}
|
|
||||||
if(name==FLOW_TYPE)
|
|
||||||
{
|
|
||||||
flowType = (FlowType)line.toInt();
|
|
||||||
}
|
|
||||||
if(name==FULLSCREEN)
|
|
||||||
{
|
|
||||||
fullScreen = line.toInt();
|
|
||||||
}
|
|
||||||
if(name==FIT_TO_WIDTH_RATIO)
|
|
||||||
{
|
|
||||||
fitToWidthRatio = line.toFloat();
|
|
||||||
}
|
|
||||||
if(name==Y_WINDOW_POS)
|
|
||||||
{
|
|
||||||
QStringList l = line.split(',');
|
|
||||||
windowPos = QPoint(l[0].toInt(),l[1].toInt());
|
|
||||||
}
|
|
||||||
if(name==Y_WINDOW_SIZE)
|
|
||||||
{
|
|
||||||
QStringList l = line.split(',');
|
|
||||||
windowSize = QSize(l[0].toInt(),l[1].toInt());
|
|
||||||
}
|
|
||||||
if(name==MAXIMIZED)
|
|
||||||
{
|
|
||||||
maximized = line.toInt();
|
|
||||||
}
|
|
||||||
if(name==DOUBLE_PAGE)
|
|
||||||
{
|
|
||||||
doublePage = line.toInt();
|
|
||||||
}
|
|
||||||
if(name==DOUBLE_MANGA_PAGE)
|
|
||||||
{
|
|
||||||
doubleMangaPage = line.toInt();
|
|
||||||
}
|
|
||||||
if(name==ADJUST_TO_FULL_SIZE)
|
|
||||||
{
|
|
||||||
adjustToFullSize = line.toInt();
|
|
||||||
}
|
|
||||||
if(name==BACKGROUND_COLOR)
|
|
||||||
{
|
|
||||||
QStringList l = line.split(',');
|
|
||||||
backgroundColor = QColor(l[0].toInt(),l[1].toInt(),l[2].toInt());
|
|
||||||
}
|
|
||||||
if(name==ALWAYS_ON_TOP)
|
|
||||||
{
|
|
||||||
alwaysOnTop = line.toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user