Fix mod default name, crash, and list scroll
Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
parent
8162d97b5e
commit
ec8f3b6964
|
|
@ -43,6 +43,8 @@ QStringList GetModFolders(const QString& root, const QString& fallbackName) {
|
|||
QString name = QtCommon::Frontend::GetTextInput(
|
||||
tr("Mod Name"), tr("What should this mod be called?"), default_name);
|
||||
|
||||
if (name.isEmpty()) return {};
|
||||
|
||||
// if std_path is empty, frontend_common could not determine mod type and/or name.
|
||||
// so we have to prompt the user and set up the structure ourselves
|
||||
if (paths.empty()) {
|
||||
|
|
|
|||
|
|
@ -161,14 +161,14 @@ void ConfigurePerGameAddons::InstallMods(const QStringList& mods) {
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigurePerGameAddons::InstallModPath(const QString& path) {
|
||||
const auto mods = QtCommon::Mod::GetModFolders(path, {});
|
||||
void ConfigurePerGameAddons::InstallModPath(const QString& path, const QString &fallbackName) {
|
||||
const auto mods = QtCommon::Mod::GetModFolders(path, fallbackName);
|
||||
|
||||
if (mods.size() > 1) {
|
||||
ModSelectDialog* dialog = new ModSelectDialog(mods, this);
|
||||
connect(dialog, &ModSelectDialog::modsSelected, this, &ConfigurePerGameAddons::InstallMods);
|
||||
dialog->show();
|
||||
} else {
|
||||
} else if (!mods.empty()) {
|
||||
InstallMods(mods);
|
||||
}
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ void ConfigurePerGameAddons::InstallModZip() {
|
|||
|
||||
const QString extracted = QtCommon::Mod::ExtractMod(path);
|
||||
if (!extracted.isEmpty())
|
||||
InstallModPath(extracted);
|
||||
InstallModPath(extracted, QFileInfo(path).baseName());
|
||||
}
|
||||
|
||||
void ConfigurePerGameAddons::changeEvent(QEvent* event) {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void InstallMods(const QStringList &mods);
|
||||
void InstallModPath(const QString& path);
|
||||
void InstallModPath(const QString& path, const QString& fallbackName = {});
|
||||
|
||||
void InstallModFolder();
|
||||
void InstallModZip();
|
||||
|
|
|
|||
|
|
@ -494,28 +494,27 @@ void GameList::ResetViewMode() {
|
|||
break;
|
||||
}
|
||||
|
||||
auto view = m_currentView->viewport();
|
||||
view->installEventFilter(this);
|
||||
|
||||
// touch gestures
|
||||
view->grabGesture(Qt::SwipeGesture);
|
||||
view->grabGesture(Qt::PanGesture);
|
||||
|
||||
// TODO: touch?
|
||||
QScroller::grabGesture(view, QScroller::LeftMouseButtonGesture);
|
||||
|
||||
auto scroller = QScroller::scroller(view);
|
||||
QScrollerProperties props;
|
||||
props.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy,
|
||||
QScrollerProperties::OvershootAlwaysOff);
|
||||
props.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy,
|
||||
QScrollerProperties::OvershootAlwaysOff);
|
||||
scroller->setScrollerProperties(props);
|
||||
|
||||
if (m_isTreeMode != newTreeMode) {
|
||||
m_isTreeMode = newTreeMode;
|
||||
|
||||
auto view = m_currentView->viewport();
|
||||
|
||||
view->installEventFilter(this);
|
||||
|
||||
// touch gestures
|
||||
view->grabGesture(Qt::SwipeGesture);
|
||||
view->grabGesture(Qt::PanGesture);
|
||||
|
||||
// TODO: touch?
|
||||
QScroller::grabGesture(view, QScroller::LeftMouseButtonGesture);
|
||||
|
||||
auto scroller = QScroller::scroller(view);
|
||||
QScrollerProperties props;
|
||||
props.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy,
|
||||
QScrollerProperties::OvershootAlwaysOff);
|
||||
props.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy,
|
||||
QScrollerProperties::OvershootAlwaysOff);
|
||||
scroller->setScrollerProperties(props);
|
||||
|
||||
RefreshGameDirectory();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue