mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
/*
|
|
* jsonutils.cpp, part of VCMI engine
|
|
*
|
|
* Authors: listed in file AUTHORS in main folder
|
|
*
|
|
* License: GNU General Public License v2.0 or later
|
|
* Full text of license available in license.txt file, in main folder
|
|
*
|
|
*/
|
|
#include "StdInc.h"
|
|
#include "helper.h"
|
|
|
|
#include "../lib/CConfigHandler.h"
|
|
|
|
#include <QObject>
|
|
#include <QScroller>
|
|
|
|
#ifdef VCMI_MOBILE
|
|
static QScrollerProperties generateScrollerProperties()
|
|
{
|
|
QScrollerProperties result;
|
|
|
|
result.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, 0.25);
|
|
result.setScrollMetric(QScrollerProperties::OvershootDragDistanceFactor, 0.25);
|
|
result.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
|
|
|
|
return result;
|
|
}
|
|
#endif
|
|
|
|
namespace Helper
|
|
{
|
|
void loadSettings()
|
|
{
|
|
settings.init("config/settings.json", "vcmi:settings");
|
|
persistentStorage.init("config/persistentStorage.json", "");
|
|
}
|
|
|
|
void enableScrollBySwiping(QObject * scrollTarget)
|
|
{
|
|
#ifdef VCMI_MOBILE
|
|
QScroller::grabGesture(scrollTarget, QScroller::LeftMouseButtonGesture);
|
|
QScroller * scroller = QScroller::scroller(scrollTarget);
|
|
scroller->setScrollerProperties(generateScrollerProperties());
|
|
#endif
|
|
}
|
|
}
|