forked from MrBesen/lolautoaccept
add smitewarn checkbox to ui
This commit is contained in:
parent
58795ad66e
commit
94020e5a04
|
@ -37,6 +37,7 @@ public:
|
|||
std::vector<std::shared_ptr<PositionConfig>> positionConfigs;
|
||||
|
||||
bool enabledAutoAccept;
|
||||
bool enabledSmiteWarn;
|
||||
};
|
||||
|
||||
Config();
|
||||
|
|
|
@ -48,6 +48,7 @@ protected:
|
|||
std::vector<RuneStyle> runestyles;
|
||||
|
||||
bool nextApplyRunes = false;
|
||||
bool smiteWarnEnabled = true;
|
||||
|
||||
std::string chatid; // the chatid of the chat from the champselect
|
||||
std::chrono::time_point<std::chrono::system_clock> lastMessageSent;
|
||||
|
@ -64,6 +65,7 @@ public:
|
|||
|
||||
void setChamps(const std::vector<uint32_t>& champs, State s);
|
||||
void setEnabled(bool b, State s);
|
||||
void setSmiteWarn(bool b);
|
||||
|
||||
bool init(); // returns true on success
|
||||
void run();
|
||||
|
|
|
@ -26,6 +26,7 @@ protected:
|
|||
private slots:
|
||||
void toggleMainswitch(bool);
|
||||
void aatoggled(bool);
|
||||
void smitewarntoggled(bool);
|
||||
|
||||
void tabtoggled(Position, LolAutoAccept::State, bool);
|
||||
void tabchanged(Position, LolAutoAccept::State);
|
||||
|
|
|
@ -87,6 +87,7 @@ Config::RootConfig::RootConfig(const QJsonObject& j) {
|
|||
}
|
||||
|
||||
enabledAutoAccept = getValue(j, "enabledAutoAccept", true);
|
||||
enabledSmiteWarn = getValue(j, "enabledSmiteWarn", true);
|
||||
}
|
||||
|
||||
Config::RootConfig::operator QJsonObject() const {
|
||||
|
@ -99,6 +100,7 @@ Config::RootConfig::operator QJsonObject() const {
|
|||
|
||||
out["positions"] = positionarr;
|
||||
out.insert("enabledAutoAccept", enabledAutoAccept);
|
||||
out.insert("enabledSmiteWarn", enabledSmiteWarn);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ void LolAutoAccept::setEnabled(bool b, State s) {
|
|||
stages.at((int) s).enabled = b;
|
||||
}
|
||||
|
||||
void LolAutoAccept::setSmiteWarn(bool b) {
|
||||
smiteWarnEnabled = b;
|
||||
}
|
||||
|
||||
bool LolAutoAccept::init() {
|
||||
if(clientapi) return true;
|
||||
|
||||
|
@ -430,7 +434,9 @@ void LolAutoAccept::champSelect() {
|
|||
// trade?
|
||||
|
||||
// check for smite
|
||||
smiteWarning(session.myTeam);
|
||||
if(smiteWarnEnabled) {
|
||||
smiteWarning(session.myTeam);
|
||||
}
|
||||
}
|
||||
|
||||
if(nextApplyRunes) {
|
||||
|
|
|
@ -24,6 +24,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
ui->enableAll->setChecked(rc.enabledAutoAccept);
|
||||
lolaa.setEnabled(rc.enabledAutoAccept, LolAutoAccept::State::LOBBY);
|
||||
|
||||
ui->enableSmiteWarning->setChecked(rc.enabledSmiteWarn);
|
||||
lolaa.setSmiteWarn(rc.enabledSmiteWarn);
|
||||
|
||||
resizeEvent(nullptr);
|
||||
}
|
||||
|
||||
|
@ -75,6 +78,13 @@ void MainWindow::aatoggled(bool state) {
|
|||
conf.getConfig().enabledAutoAccept = state;
|
||||
}
|
||||
|
||||
void MainWindow::smitewarntoggled(bool state) {
|
||||
Log::info << "smitewarn checkbox toggled " << state;
|
||||
|
||||
lolaa.setSmiteWarn(state);
|
||||
conf.getConfig().enabledSmiteWarn = state;
|
||||
}
|
||||
|
||||
void MainWindow::tabtoggled(Position p, LolAutoAccept::State s, bool state) {
|
||||
Log::info << "checkbox toggled " << state << " position: " << p << " state: " << (int) s;
|
||||
|
||||
|
|
|
@ -53,6 +53,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableSmiteWarning">
|
||||
<property name="toolTip">
|
||||
<string>Spam "smite" in the chat when there is not exactly 1 player with smite equiped in champ select</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Smite Warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="tabPosition">
|
||||
|
@ -138,7 +151,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>452</width>
|
||||
<height>24</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -174,8 +187,8 @@
|
|||
<slot>aatoggled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>18</x>
|
||||
<y>80</y>
|
||||
<x>19</x>
|
||||
<y>61</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>393</x>
|
||||
|
@ -190,8 +203,8 @@
|
|||
<slot>toggleMainswitch(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>87</x>
|
||||
<y>49</y>
|
||||
<x>88</x>
|
||||
<y>38</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
|
@ -231,6 +244,22 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>enableSmiteWarning</sender>
|
||||
<signal>clicked(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>smitewarntoggled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>190</x>
|
||||
<y>77</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>201</x>
|
||||
<y>88</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<signal>requestTabChange(int)</signal>
|
||||
|
@ -239,5 +268,6 @@
|
|||
<slot>tabchanged(Position, LolAutoAccept::State)</slot>
|
||||
<slot>toggleMainswitch(bool)</slot>
|
||||
<slot>applyRunes()</slot>
|
||||
<slot>smitewarntoggled(bool)</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in New Issue