1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

[launcher] add more places for finger scrolling

This commit is contained in:
Laserlicht 2024-05-01 21:05:01 +03:00 committed by Andrey Filipenkov
parent 59b40c7871
commit ed6ab19818
5 changed files with 29 additions and 4 deletions

View File

@ -19,6 +19,7 @@
#include "../../lib/Languages.h"
#include "../../lib/VCMIDirs.h"
#include "../../lib/filesystem/Filesystem.h"
#include "../helper.h"
#include "../languages.h"
#ifdef ENABLE_INNOEXTRACT
@ -37,6 +38,8 @@ FirstLaunchView::FirstLaunchView(QWidget * parent)
ui->lineEditDataSystem->setText(pathToQString(boost::filesystem::absolute(VCMIDirs::get().dataPaths().front())));
ui->lineEditDataUser->setText(pathToQString(boost::filesystem::absolute(VCMIDirs::get().userDataPath())));
Helper::enableScrollBySwiping(ui->listWidgetLanguage);
#ifndef ENABLE_INNOEXTRACT
ui->pushButtonGogInstall->hide();
#endif

View File

@ -12,7 +12,20 @@
#include "../lib/CConfigHandler.h"
void Helper::loadSettings()
#include <QObject>
#include <QScroller>
namespace Helper
{
void loadSettings()
{
settings.init("config/settings.json", "vcmi:settings");
}
void enableScrollBySwiping(QObject * scrollTarget)
{
#ifdef VCMI_MOBILE
QScroller::grabGesture(scrollTarget, QScroller::LeftMouseButtonGesture);
#endif
}
}

View File

@ -9,7 +9,10 @@
*/
#pragma once
class QObject;
namespace Helper
{
void loadSettings();
void enableScrollBySwiping(QObject * scrollTarget);
}

View File

@ -151,13 +151,14 @@ CModListView::CModListView(QWidget * parent)
{
manager->resetRepositories();
}
#ifdef Q_OS_IOS
#ifdef VCMI_MOBILE
for(auto * scrollWidget : {
(QAbstractItemView*)ui->allModsView,
(QAbstractItemView*)ui->screenshotsList})
{
QScroller::grabGesture(scrollWidget, QScroller::LeftMouseButtonGesture);
Helper::enableScrollBySwiping(scrollWidget);
scrollWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
scrollWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
@ -405,6 +406,9 @@ void CModListView::selectMod(const QModelIndex & index)
ui->modInfoBrowser->setHtml(genModInfoText(mod));
ui->changelogBrowser->setHtml(genChangelogText(mod));
Helper::enableScrollBySwiping(ui->modInfoBrowser);
Helper::enableScrollBySwiping(ui->changelogBrowser);
bool hasInvalidDeps = !findInvalidDependencies(modName).empty();
bool hasBlockingMods = !findBlockingMods(modName).empty();
bool hasDependentMods = !findDependentMods(modName, true).empty();

View File

@ -14,6 +14,7 @@
#include "mainwindow_moc.h"
#include "../modManager/cmodlistview_moc.h"
#include "../helper.h"
#include "../jsonutils.h"
#include "../languages.h"
#include "../launcherdirs.h"
@ -284,6 +285,7 @@ CSettingsView::CSettingsView(QWidget * parent)
: QWidget(parent), ui(new Ui::CSettingsView)
{
ui->setupUi(this);
Helper::enableScrollBySwiping(ui->settingsScrollArea);
loadSettings();
}