2024-04-21 16:56:39 +02:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
2024-05-01 20:05:01 +02:00
|
|
|
#include <QObject>
|
|
|
|
#include <QScroller>
|
|
|
|
|
2024-06-08 17:56:20 +02:00
|
|
|
#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
|
|
|
|
|
2024-05-01 20:05:01 +02:00
|
|
|
namespace Helper
|
|
|
|
{
|
|
|
|
void loadSettings()
|
2024-04-21 16:56:39 +02:00
|
|
|
{
|
|
|
|
settings.init("config/settings.json", "vcmi:settings");
|
|
|
|
}
|
2024-05-01 20:05:01 +02:00
|
|
|
|
|
|
|
void enableScrollBySwiping(QObject * scrollTarget)
|
|
|
|
{
|
|
|
|
#ifdef VCMI_MOBILE
|
|
|
|
QScroller::grabGesture(scrollTarget, QScroller::LeftMouseButtonGesture);
|
2024-06-08 17:56:20 +02:00
|
|
|
QScroller * scroller = QScroller::scroller(scrollTarget);
|
|
|
|
scroller->setScrollerProperties(generateScrollerProperties());
|
2024-05-01 20:05:01 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|