From 716a2e40670f0c229151d4307c6e980fdefa44b9 Mon Sep 17 00:00:00 2001 From: mrbesen Date: Sun, 17 Jul 2022 00:21:15 +0200 Subject: [PATCH] allow for a default position --- include/lolautoaccept.h | 1 + src/lolautoaccept.cpp | 9 ++++----- src/mainwindow.cpp | 6 +++--- ui/mainwindow.ui | 21 ++++++++++++++++----- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/include/lolautoaccept.h b/include/lolautoaccept.h index c5a7ede..3caacb8 100644 --- a/include/lolautoaccept.h +++ b/include/lolautoaccept.h @@ -28,6 +28,7 @@ protected: std::mutex stagesMutex; // protects stagesvector std::vector stages; Position currentPosition = Position::INVALID; + bool currentPositionSet = false; Config::RootConfig& config; DataDragon& dd; diff --git a/src/lolautoaccept.cpp b/src/lolautoaccept.cpp index 573019f..180999a 100644 --- a/src/lolautoaccept.cpp +++ b/src/lolautoaccept.cpp @@ -69,7 +69,8 @@ void LolAutoAccept::stop() { void LolAutoAccept::reload() { Log::note << "reload LolAutoAccept"; - loadPosition(currentPosition); + if(currentPositionSet) + loadPosition(currentPosition); } const std::vector& LolAutoAccept::getRuneAspekts() { @@ -180,6 +181,7 @@ void LolAutoAccept::resetAllOffsets() { stage.currentOffset = 0; } currentPosition = Position::INVALID; + currentPositionSet = false; } void LolAutoAccept::resetRunes() { @@ -209,6 +211,7 @@ void LolAutoAccept::loadPosition(Position pos) { applyConfigToStage(stages.at((int) State::PICK), posconf.pick); currentPosition = pos; + currentPositionSet = true; } uint32_t LolAutoAccept::getChampOfState(State s) { @@ -365,10 +368,6 @@ void LolAutoAccept::champSelect() { } Position pos = me ? me->position : Position::INVALID; - if(pos == Position::INVALID) { - pos = Position::UTILITY; // default: support TODO: make the default changeable? extra tab? - } - // check if runes need adjustment if(pickedChamp != lastPickedChamp) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index eabf84c..a06ba58 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -98,8 +98,8 @@ void MainWindow::applyRunes() { } void MainWindow::onPosChange(Position newpos) { - if(newpos != Position::INVALID) { - emit requestTabChange((int) newpos -1); - } + assert(newpos <= Position::UTILITY); + + emit requestTabChange((int) newpos); } diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 5bf9ab9..549a9b3 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 433 - 638 + 452 + 645 @@ -31,7 +31,7 @@ 0 0 - 431 + 465 581 @@ -62,7 +62,7 @@ QTabWidget::Rounded - 4 + 0 Qt::ElideNone @@ -73,6 +73,17 @@ false + + + This Tab is used, when you are in a gamemode with no fixed roles + + + 0 + + + Default + + 1 @@ -126,7 +137,7 @@ 0 0 - 433 + 452 24