Compare commits

...

16 Commits

27 changed files with 511 additions and 230 deletions

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
lolautoaccept (0.0.8) focal; urgency=medium
* add Rune Tab to manage runes
* add RuneEditor to edit runes
* add Loading window
* fix Bug that caused to many processes to be inspected for Lol-Client informations
* add --access flag for debugging and testing
* add Dodge Button
-- MrBesen <> Sat, 02 Sep 2023 16:28:31 +0200
lolautoaccept (0.0.7) unstable; urgency=medium
* add tab icons

View File

@ -2,6 +2,7 @@
struct Args {
int debugLog = 0; // cast to bool later
int access = 0;
};
Args parseArgs(int argc, char** argv);

View File

@ -195,6 +195,7 @@ public:
ChampSelectSession getChampSelectSession();
bool setChampSelectAction(int32_t actionid, int32_t champid, bool completed);
PlayerInfo getSelf();
void dodge();
std::vector<int32_t> getBannableChampIDs();
std::vector<int32_t> getPickableChampIDs();
@ -231,9 +232,9 @@ private:
std::ostream& operator<<(std::ostream&, const ClientAPI::CLASS&); \
QDebug operator<<(QDebug, const ClientAPI::CLASS&);
DEFINEOPERATOR(ReadyCheckState);
DEFINEOPERATOR(GameflowPhase);
DEFINEOPERATOR(ChampSelectPhase);
DEFINEOPERATOR(ChampSelectActionType);
DEFINEOPERATOR(ReadyCheckState)
DEFINEOPERATOR(GameflowPhase)
DEFINEOPERATOR(ChampSelectPhase)
DEFINEOPERATOR(ChampSelectActionType)
#undef DEFINEOPERATOR

View File

@ -45,6 +45,8 @@ protected:
std::vector<RuneAspekt> runeaspekts;
std::vector<RuneStyle> runestyles;
ClientAPI::GameflowPhase lastPhase;
bool dodgeNow = false;
bool nextApplyRunes = false;
bool smiteWarnEnabled = true;
bool autoWriteTextEnabled = false;
@ -86,9 +88,13 @@ public:
const std::vector<RuneStyle>& getRuneStyles();
void setAutoWriteText(bool enabled, const QString& text = {});
public slots:
void dodge();
signals:
void statusChanged(LolAutoAccept::Status); // new status: 0 = off, 1 = on, 2 = failed
void positionChanged(Position);
void dodgePossible(bool); // true = the dodge button is available
private:
void stopJoinThread();

View File

@ -12,9 +12,11 @@ QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class QMessageBox;
class QTimer;
class LoadingWindow;
class X11Helper;
class MainWindow : public QMainWindow {
@ -36,6 +38,8 @@ public slots:
private slots:
void loadingStatus(float);
void toggleLeagueVisibility();
void toggleMainswitch(bool);
void aatoggled(bool);
void smitewarntoggled(bool);
@ -61,6 +65,8 @@ private:
Config conf;
LolAutoAccept lolaa;
LoadingWindow* lwin;
QMessageBox* dodgeQuestion;
X11Helper* x11Helper;
};
#endif // MAINWINDOW_H

View File

@ -18,4 +18,4 @@ QString toShortString(Position p);
std::ostream& operator<<(std::ostream&, const Position&);
QDebug operator<<(QDebug , const Position&);
Q_DECLARE_METATYPE(Position);
Q_DECLARE_METATYPE(Position)

View File

@ -29,6 +29,7 @@ public:
private slots:
void loadRunes();
void reloadClientRunes();
void setRunesEnabled(bool enabled);
void saveRunePageClient(int id, QString name, const RunePage& rp);

35
include/x11helper.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef X11HELPER_H
#define X11HELPER_H
#include <QObject>
using Window = unsigned long;
struct _XDisplay;
using Display = struct _XDisplay;
class X11Helper : public QObject
{
Q_OBJECT
public:
static const Window InvalidWindow;
static const bool IsSupported;
explicit X11Helper(QObject* parent = nullptr);
virtual ~X11Helper();
Window findWindow(const QString& name, float aspektRatio = 0.0);
public slots:
void map(Window win);
void unmap(Window win);
void setMap(Window win, bool b);
private:
Window searchWindows(Window top, const QString& search, float aspektRatio);
#ifdef X11SUPPORT
Display* disp;
#endif
};
#endif // X11HELPER_H

View File

@ -26,7 +26,9 @@ DEFINES += LOG_ENABLEQT=1
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
DEFINES += LOLAA_VERSION=\\\"0.0.7\\\"
DEFINES += LOLAA_VERSION=\\\"0.0.8\\\"
QMAKE_CXXFLAGS += -Wall -Wpedantic -Wextra
# parameters: var, prepend, append
defineReplace(prependAll) {
@ -64,11 +66,12 @@ SOURCES += \
src/runepagelist.cpp \
src/settingstab.cpp \
src/stagesettings.cpp \
src/x11helper.cpp \
thirdparty/Log/Log.cpp
# platform specific implementations
win32:SOURCES += src/clientaccess_windows.cpp
unix:SOURCES += src/clientaccess_linux.cpp
win32:SOURCES += src/clientaccess_windows.cpp src/x11helper_other.cpp
unix:SOURCES += src/clientaccess_linux.cpp src/x11helper_x11.cpp
HEADERS += \
include/arg.h \
@ -99,6 +102,7 @@ HEADERS += \
include/runepagelist.h \
include/settingstab.h \
include/stagesettings.h \
include/x11helper.h \
thirdparty/Log/Log.h
FORMS += \
@ -123,11 +127,14 @@ CONFIG += lrelease embed_translations
TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/resources/ts/, .ts)
updatelang.commands = lupdate $$_PRO_FILE_
updatelang.commands = lupdate -locations none $$_PRO_FILE_
QMAKE_EXTRA_TARGETS += updatelang
# build AppImage
unix {
DEFINES += X11SUPPORT=1
LIBS += -lX11
linuxdeploy-x86_64.AppImage.commands = wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage && chmod u+x linuxdeploy-x86_64.AppImage
resources/lolautoaccept.png.depends = resources/lolautoaccept.svg

View File

@ -4,12 +4,10 @@
<context>
<name>ChampionSearch</name>
<message>
<location filename="../../ui/championsearch.ui" line="14"/>
<source>Champion Search</source>
<translation>Champion Suche</translation>
</message>
<message>
<location filename="../../ui/championsearch.ui" line="20"/>
<source>Champion:</source>
<translation>Champion:</translation>
</message>
@ -17,65 +15,64 @@
<context>
<name>ClipboardPopup</name>
<message>
<location filename="../../ui/clipboardpopup.ui" line="14"/>
<source>Clipboard Text</source>
<translation>Zwischenablage</translation>
</message>
<message>
<location filename="../../ui/clipboardpopup.ui" line="30"/>
<source>Copy To Clipboard</source>
<translation>In Zwischenablage kopieren</translation>
</message>
<message>
<location filename="../../src/clipboardpopup.cpp" line="11"/>
<source>Paste here</source>
<translation>Hier einfügen</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<name>LoadingWindow</name>
<message>
<source>LoL-Auto-Accept</source>
<translation>LoL-Auto-Accept</translation>
</message>
<message>
<source>Loading Champion: %0</source>
<translation>Lade Champion: %0</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../../ui/mainwindow.ui" line="20"/>
<source>LoL-Auto-Accept</source>
<translation>LoL-Auto-Accept</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="99"/>
<source>Mainswitch</source>
<translation>Hauptschalter</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="119"/>
<source>Enable LoL-Auto-Accept</source>
<translation>Spiel automatisch annehmen</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="106"/>
<source>Spam &quot;smite&quot; in the chat when there is not exactly 1 player with smite equiped in champ select</source>
<translation>Wenn nicht genau 1 Spieler Smite ausgewählt hat, wird &quot;smite&quot; in den Chat gespammt</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="40"/>
<source>Auto Accept</source>
<translation type="unfinished"></translation>
<translation>Auto Annehmen</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="64"/>
<source>Write a Text as soon as you are in a champ select lobby.</source>
<translation>Einen Text schreiben, sobald du in der Champion Auswahl bist.</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="67"/>
<source>Auto Write</source>
<translation>Automatisch Schreiben</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="96"/>
<source>This controls the connection to the LoL client. As long as this is off, no interactions with the LoL client take place.</source>
<translation>Dies kontrolliert die Verbindung zum LoL Client. Solange dies aus ist, wird nicht mit dem LoL Client interagiert.</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="109"/>
<source>Enable Smite Warning</source>
<translation>Smite Warnung</translation>
</message>
@ -84,72 +81,76 @@
<translation type="vanished">Entwickelt von MrBesen</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="156"/>
<source>autowriteText</source>
<translation>Zu schreibender Text</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="182"/>
<source>This Tab is used, when you are in a gamemode with no fixed roles</source>
<translation>Dieser Tab wird verwendet, wenn der Gamemode keine festen Rollen hat</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="188"/>
<source>Default</source>
<translation>Default</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="200"/>
<source>Top</source>
<translation>Top</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="212"/>
<source>Jungle</source>
<translation>Jungle</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="224"/>
<source>Middle</source>
<translation></translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="236"/>
<source>Bottom</source>
<translation></translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="248"/>
<source>Support</source>
<translation>Support</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="257"/>
<source>Dodge without closing the client.
You will still be punished.</source>
<translation>Dodgen ohne den Client zu schließen
Du wirst trotzdem bestraft.</translation>
</message>
<message>
<source>Dodge</source>
<translation>Dodge</translation>
</message>
<message>
<source>Runes</source>
<translation>Runen</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="77"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Developed by MrBesen&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lolautoacceptor.mrbesen.de/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Webseite&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Version: %1&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Entwickelt von MrBesen&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lolautoacceptor.mrbesen.de/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Webseite&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Version: %1&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="86"/>
<source>League of Legends Client not found!</source>
<translation>League of Legends Client nicht gefunden!</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="184"/>
<source>Auto-Acceptor started!</source>
<translation></translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="181"/>
<source>Auto-Acceptor stoped!</source>
<translation>Auto Acceptor gestoppt!</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="187"/>
<source>Dodge?</source>
<translation>Dodgen?</translation>
</message>
<message>
<source>Are you sure you want to dodge?</source>
<translation>Bist du dir sicher, dass du dodgen möchtest?</translation>
</message>
<message>
<source>Auto-Acceptor failed!</source>
<translation>Auto-Acceptor fehlgeschlagen!</translation>
</message>
@ -157,7 +158,6 @@
<context>
<name>QWidget</name>
<message>
<location filename="../../src/champrow.cpp" line="16"/>
<source>Champion: %1
Type: %2
Title: %3
@ -171,17 +171,14 @@ ID: %4</translation>
<context>
<name>RuneDisplay</name>
<message>
<location filename="../../ui/runedisplay.ui" line="14"/>
<source>Form</source>
<translation></translation>
</message>
<message>
<location filename="../../ui/runedisplay.ui" line="23"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select a Runepage and modify it to this runes.&lt;br/&gt;The page used is the first that:&lt;/p&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;matches this Runes&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;has a name starting with &amp;quot;AA:&amp;quot;&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;is currently selected&lt;/li&gt;&lt;/ol&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Eine Runenseite auswählen und entsprechend modifizieren.&lt;br/&gt;Die ausgewählte Seite ist die erste, die die erste der Eigenschaften erfüllt:&lt;/p&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;schon die richtigen Runen enthält&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;einen Namen der mit &amp;quot;AA:&amp;quot; anfängt hat&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;gerade ausgewählt ist&lt;/li&gt;&lt;/ol&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../../ui/runedisplay.ui" line="26"/>
<source>Apply Runes</source>
<translation>Runen Anwenden</translation>
</message>
@ -189,7 +186,6 @@ ID: %4</translation>
<context>
<name>RuneEditor</name>
<message>
<location filename="../../ui/runeeditor.ui" line="14"/>
<source>Runepage Editor</source>
<translation>Runenseiten Editor</translation>
</message>
@ -197,27 +193,22 @@ ID: %4</translation>
<context>
<name>RuneManager</name>
<message>
<location filename="../../ui/runemanager.ui" line="17"/>
<source>Runes in the Client</source>
<translation>Runen im Client</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="24"/>
<source>Runes in the Autoacceptor</source>
<translation>Runen im Autoacceptor</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="51"/>
<source>Reload</source>
<translation>Neuladen</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="62"/>
<source>Runes from the client get copied to the autoacceptor automatically.</source>
<translation>Runen vom Client werden automatisch in den Autoacceptor kopiert.</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="65"/>
<source>Auto Copy Runes</source>
<translation>Auto Runen kopieren</translation>
</message>
@ -225,32 +216,30 @@ ID: %4</translation>
<context>
<name>RunePageList</name>
<message>
<location filename="../../src/runepagelist.cpp" line="80"/>
<source>Edit (Beta)</source>
<translation>Bearbeiten (Beta)</translation>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="81"/>
<source>Duplicate</source>
<translation>Dublizieren</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="82"/>
<source>Export</source>
<translation>Exportieren</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="83"/>
<source>Import</source>
<translation>Importerien</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="84"/>
<source>Delete</source>
<translation>Löschen</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="235"/>
<source>Loading runes</source>
<translation>Lade Runnen</translation>
</message>
<message>
<source>with</source>
<translation>mit</translation>
</message>
@ -258,12 +247,10 @@ ID: %4</translation>
<context>
<name>SettingsTab</name>
<message>
<location filename="../../ui/settingstab.ui" line="32"/>
<source>Ban</source>
<translation>Bannen</translation>
</message>
<message>
<location filename="../../ui/settingstab.ui" line="54"/>
<source>Pick</source>
<translation>Picken</translation>
</message>
@ -275,7 +262,6 @@ ID: %4</translation>
<translation type="vanished">Champion:</translation>
</message>
<message>
<location filename="../../src/stagesettings.cpp" line="29"/>
<source>Enable %1</source>
<translation>Aktiviere %1</translation>
</message>
@ -294,12 +280,10 @@ Titel: %3
ID: %4</translation>
</message>
<message>
<location filename="../../ui/stagesettings.ui" line="77"/>
<source>Add Champion</source>
<translation>Champion hinzufügen</translation>
</message>
<message>
<location filename="../../ui/stagesettings.ui" line="90"/>
<source>Remove Champion</source>
<translation>Champion entfernen</translation>
</message>

View File

@ -4,12 +4,10 @@
<context>
<name>ChampionSearch</name>
<message>
<location filename="../../ui/championsearch.ui" line="14"/>
<source>Champion Search</source>
<translation>Champion Search</translation>
</message>
<message>
<location filename="../../ui/championsearch.ui" line="20"/>
<source>Champion:</source>
<translation>Champion:</translation>
</message>
@ -17,65 +15,64 @@
<context>
<name>ClipboardPopup</name>
<message>
<location filename="../../ui/clipboardpopup.ui" line="14"/>
<source>Clipboard Text</source>
<translation type="unfinished"></translation>
<translation>Clipboard Text</translation>
</message>
<message>
<location filename="../../ui/clipboardpopup.ui" line="30"/>
<source>Copy To Clipboard</source>
<translation type="unfinished"></translation>
<translation>Copy To Clipboard</translation>
</message>
<message>
<location filename="../../src/clipboardpopup.cpp" line="11"/>
<source>Paste here</source>
<translation type="unfinished"></translation>
<translation>Paste here</translation>
</message>
</context>
<context>
<name>LoadingWindow</name>
<message>
<source>LoL-Auto-Accept</source>
<translation>LoL-Auto-Accept</translation>
</message>
<message>
<source>Loading Champion: %0</source>
<translation>Loading Champion: %0</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../../ui/mainwindow.ui" line="20"/>
<source>LoL-Auto-Accept</source>
<translation>LoL-Auto-Accept</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="99"/>
<source>Mainswitch</source>
<translation>Mainswitch</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="119"/>
<source>Enable LoL-Auto-Accept</source>
<translation>Automatically accept game</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="106"/>
<source>Spam &quot;smite&quot; in the chat when there is not exactly 1 player with smite equiped in champ select</source>
<translation>Spam &quot;smite&quot; in the chat when there is not exactly 1 player with smite equiped in champ select</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="40"/>
<source>Auto Accept</source>
<translation type="unfinished"></translation>
<translation>Auto Accept</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="64"/>
<source>Write a Text as soon as you are in a champ select lobby.</source>
<translation>Write a Text as soon as you are in the champ select lobby.</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="67"/>
<source>Auto Write</source>
<translation>Auto write</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="96"/>
<source>This controls the connection to the LoL client. As long as this is off, no interactions with the LoL client take place.</source>
<translation type="unfinished"></translation>
<translation>This controls the connection to the LoL client. As long as this is off, no interactions with the LoL client take place.</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="109"/>
<source>Enable Smite Warning</source>
<translation>Enable Smite Warning</translation>
</message>
@ -84,72 +81,76 @@
<translation type="vanished">Developed by MrBesen</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="156"/>
<source>autowriteText</source>
<translation>Text to autowrite</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="182"/>
<source>This Tab is used, when you are in a gamemode with no fixed roles</source>
<translation>This Tab is used, when you are in a gamemode with no fixed roles</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="188"/>
<source>Default</source>
<translation>Default</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="200"/>
<source>Top</source>
<translation>Top</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="212"/>
<source>Jungle</source>
<translation>Jungle</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="224"/>
<source>Middle</source>
<translation></translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="236"/>
<source>Bottom</source>
<translation></translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="248"/>
<source>Support</source>
<translation>Support</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="257"/>
<source>Runes</source>
<translation type="unfinished"></translation>
<source>Dodge without closing the client.
You will still be punished.</source>
<translation>Dodge without closing the client.
You will still be punished.</translation>
</message>
<message>
<source>Dodge</source>
<translation>Dodge</translation>
</message>
<message>
<source>Runes</source>
<translation>Runes</translation>
</message>
<message>
<location filename="../../ui/mainwindow.ui" line="77"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Developed by MrBesen&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lolautoacceptor.mrbesen.de/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Webseite&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Version: %1&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Developed by MrBesen&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lolautoacceptor.mrbesen.de/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Webseite&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Version: %1&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="86"/>
<source>League of Legends Client not found!</source>
<translation>League of Legends Client not found!</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="184"/>
<source>Auto-Acceptor started!</source>
<translation>Auto-Acceptor started!</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="181"/>
<source>Auto-Acceptor stoped!</source>
<translation>Auto-Acceptor stopped!</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="187"/>
<source>Dodge?</source>
<translation>Dodge?</translation>
</message>
<message>
<source>Are you sure you want to dodge?</source>
<translation>Are you sure you want to dodge?</translation>
</message>
<message>
<source>Auto-Acceptor failed!</source>
<translation>Auto-Acceptor failed!</translation>
</message>
@ -157,7 +158,6 @@
<context>
<name>QWidget</name>
<message>
<location filename="../../src/champrow.cpp" line="16"/>
<source>Champion: %1
Type: %2
Title: %3
@ -171,17 +171,14 @@ ID: %4</translation>
<context>
<name>RuneDisplay</name>
<message>
<location filename="../../ui/runedisplay.ui" line="14"/>
<source>Form</source>
<translation></translation>
</message>
<message>
<location filename="../../ui/runedisplay.ui" line="23"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select a Runepage and modify it to this runes.&lt;br/&gt;The page used is the first that:&lt;/p&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;matches this Runes&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;has a name starting with &amp;quot;AA:&amp;quot;&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;is currently selected&lt;/li&gt;&lt;/ol&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select a Runepage and modify it to this runes.&lt;br/&gt;The page used is the first that:&lt;/p&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;matches this Runes&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;has a name starting with &amp;quot;AA:&amp;quot;&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;is currently selected&lt;/li&gt;&lt;/ol&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../../ui/runedisplay.ui" line="26"/>
<source>Apply Runes</source>
<translation>Apply Runes</translation>
</message>
@ -189,35 +186,29 @@ ID: %4</translation>
<context>
<name>RuneEditor</name>
<message>
<location filename="../../ui/runeeditor.ui" line="14"/>
<source>Runepage Editor</source>
<translation type="unfinished"></translation>
<translation>Runepage Editor</translation>
</message>
</context>
<context>
<name>RuneManager</name>
<message>
<location filename="../../ui/runemanager.ui" line="17"/>
<source>Runes in the Client</source>
<translation type="unfinished"></translation>
<translation>Runes in the Client</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="24"/>
<source>Runes in the Autoacceptor</source>
<translation type="unfinished"></translation>
<translation>Runes in the Autoacceptor</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="51"/>
<source>Reload</source>
<translation type="unfinished"></translation>
<translation>Reload</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="62"/>
<source>Runes from the client get copied to the autoacceptor automatically.</source>
<translation type="unfinished"></translation>
<translation>Runes from the client get copied to the autoacceptor automatically.</translation>
</message>
<message>
<location filename="../../ui/runemanager.ui" line="65"/>
<source>Auto Copy Runes</source>
<translation>Auto copy Runes</translation>
</message>
@ -225,45 +216,41 @@ ID: %4</translation>
<context>
<name>RunePageList</name>
<message>
<location filename="../../src/runepagelist.cpp" line="80"/>
<source>Edit (Beta)</source>
<translation type="unfinished"></translation>
<source>Edit</source>
<translation>Edit</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="81"/>
<source>Duplicate</source>
<translation type="unfinished"></translation>
<translation>Duplicate</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="82"/>
<source>Export</source>
<translation type="unfinished"></translation>
<translation>Export</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="83"/>
<source>Import</source>
<translation type="unfinished"></translation>
<translation>Import</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="84"/>
<source>Delete</source>
<translation type="unfinished"></translation>
<translation>Delete</translation>
</message>
<message>
<source>Loading runes</source>
<translation>Loading runes</translation>
</message>
<message>
<location filename="../../src/runepagelist.cpp" line="235"/>
<source>with</source>
<translation type="unfinished"></translation>
<translation>with</translation>
</message>
</context>
<context>
<name>SettingsTab</name>
<message>
<location filename="../../ui/settingstab.ui" line="32"/>
<source>Ban</source>
<translation>Ban</translation>
</message>
<message>
<location filename="../../ui/settingstab.ui" line="54"/>
<source>Pick</source>
<translation>Pick</translation>
</message>
@ -275,7 +262,6 @@ ID: %4</translation>
<translation type="vanished">Champion:</translation>
</message>
<message>
<location filename="../../src/stagesettings.cpp" line="29"/>
<source>Enable %1</source>
<translation>Enable %1</translation>
</message>
@ -294,12 +280,10 @@ Title: %3
ID: %4</translation>
</message>
<message>
<location filename="../../ui/stagesettings.ui" line="77"/>
<source>Add Champion</source>
<translation>Add Champion</translation>
</message>
<message>
<location filename="../../ui/stagesettings.ui" line="90"/>
<source>Remove Champion</source>
<translation>Remove Champion</translation>
</message>

View File

@ -9,6 +9,7 @@ Args parseArgs(int argc, char** argv) {
while (1) {
static struct option long_options[] = {
{"debug-log", no_argument, &a.debugLog, 1},
{"access", no_argument, &a.access, 1},
{0, 0, 0, 0}
};
/* getopt_long stores the option index here. */

View File

@ -108,6 +108,11 @@ ClientAPI::PlayerInfo ClientAPI::getSelf() {
return {};
}
void ClientAPI::dodge() {
QJsonDocument doc = request("lol-login/v1/session/invoke?destination=lcdsServiceProxy&method=call&args=[\"\",\"teambuilder-draft\",\"quitV2\", \"\"]", Method::POST, "");
qDebug() << "dodge result:" << doc;
}
static std::vector<int32_t> fromArrayToVector(const QJsonArray& arr) {
std::vector<int32_t> out;
out.reserve(arr.size());
@ -249,7 +254,7 @@ bool ClientAPI::editRunePage(const RunePage& page) {
qInfo().noquote() << "requeststr: " << requestdocstr;
QJsonDocument doc = request("lol-perks/v1/pages/" + QString::number(page.id), Method::PUT, requestdocstr);
if(doc.isEmpty()) return true; // ok
if(doc.isObject() && doc["isValid"].isBool() && doc["isValid"].toBool()) return true; // ok
// error
qWarning() << "error editing runepage: " << page.id << " " << doc.toJson();
@ -276,7 +281,7 @@ bool ClientAPI::createRunePage(const RunePage& page) {
qInfo() << "requeststr: " << requestdocstr;
QJsonDocument doc = request("lol-perks/v1/pages/", Method::POST, requestdocstr);
if(doc.isEmpty()) return true; // ok
if(doc.isObject() && doc["isValid"].isBool() && doc["isValid"].toBool()) return true; // ok
// error
qWarning() << "error creating runepage: " << page.name << " " << doc.toJson();

View File

@ -12,12 +12,12 @@
#define ARR(NAME, ...) static const QString NAME ## Names[] = {__VA_ARGS__}; \
static const uint32_t NAME ## NamesCount = ARRSIZE(NAME ## Names);
ARR(ReadyCheckState, "Invalid", "None", "InProgress", "Accepted", "Declined");
ARR(GameflowPhase, "None", "Lobby", "Matchmaking", "CheckedIntoTournament", "ReadyCheck", "ChampSelect", "GameStart", "FailedToLaunch", "InProgress", "Reconnect", "WaitingForStats", "PreEndOfGame", "EndOfGame", "TerminatedInError");
ARR(ChampSelectPhase, "Invalid", "GAME_STARTING", "PLANNING", "BAN_PICK", "FINALIZATION");
ARR(Position, "Invalid", "top", "jungle", "middle", "bottom", "utility");
ARR(ShortPosition, "", "Top", "Jgl", "Mid", "Bot", "Sup");
ARR(ChampSelectActionType, "Invalid", "ban", "pick", "ten_bans_reveal");
ARR(ReadyCheckState, "Invalid", "None", "InProgress", "Accepted", "Declined")
ARR(GameflowPhase, "None", "Lobby", "Matchmaking", "CheckedIntoTournament", "ReadyCheck", "ChampSelect", "GameStart", "FailedToLaunch", "InProgress", "Reconnect", "WaitingForStats", "PreEndOfGame", "EndOfGame", "TerminatedInError")
ARR(ChampSelectPhase, "Invalid", "GAME_STARTING", "PLANNING", "BAN_PICK", "FINALIZATION")
ARR(Position, "Invalid", "top", "jungle", "middle", "bottom", "utility")
ARR(ShortPosition, "", "Top", "Jgl", "Mid", "Bot", "Sup")
ARR(ChampSelectActionType, "Invalid", "ban", "pick", "ten_bans_reveal")
template<typename T>
static T mapEnum(const QString& input, const QString* names, uint32_t count, T defaul) {

View File

@ -18,7 +18,7 @@
static const QString BASEURL = "https://ddragon.leagueoflegends.com/";
const DataDragon::ChampData DataDragon::EMPTYCHAMP;
DataDragon::DataDragon(const QString& locale) : RestClient(BASEURL), locale(locale), cache({{"square", ".png"}, {"loading", "_0.jpg"}, {"splash", "_0.jpg"}}) {
DataDragon::DataDragon(const QString& locale) : RestClient(BASEURL), locale(locale), cache{{"square", ".png"}, {"loading", "_0.jpg"}, {"splash", "_0.jpg"}} {
this->setObjectName("DataDragon");
}
@ -321,12 +321,11 @@ void DataDragon::getChampsInternal() {
QJsonObject obj = jchamps.object();
auto it = obj.constFind("data");
if(it != obj.constEnd() && it.value().isObject()) {
QJsonObject jchampsdata = it.value().toObject();
for(auto champit = jchampsdata.constBegin(); champit != jchampsdata.constEnd(); champit++) {
if(champit.value().isObject()) {
champs.emplace_back(champit.value().toObject());
notDownloadedImages.insert(champs.back().id);
if(it != obj.constEnd() && it->isObject()) {
for(auto&& champdata : it->toObject()) {
if(champdata.isObject()) {
auto& dataobj = champs.emplace_back(champdata.toObject());
notDownloadedImages.insert(dataobj.id);
}
}
}
@ -369,8 +368,7 @@ void DataDragon::threadLoop() {
lock.unlock();
auto it = notDownloadedImages.begin();
QString champid = *it;
notDownloadedImages.erase(it);
auto champid = std::move(notDownloadedImages.extract(it).value());
prefetchChampImage(champid, ImageType::SQUARE);

View File

@ -116,6 +116,10 @@ void LolAutoAccept::setAutoWriteText(bool enabled, const QString& text) {
autoWriteText = text;
}
void LolAutoAccept::dodge() {
dodgeNow = true;
}
void LolAutoAccept::stopJoinThread() {
stop();
@ -161,6 +165,16 @@ void LolAutoAccept::innerRun() {
} else if(phase == ClientAPI::GameflowPhase::CHAMPSELECT) {
champSelect();
extrasleep = 0; // no extra sleep
// first time champselect phase -> enable dodge button
if(lastPhase != phase) {
dodgeNow = false;
emit this->dodgePossible(true);
} else if (dodgeNow) {
// this makes sure that the event comes after the phase was entered and is not lingering from before
dodgeNow = false;
clientapi->dodge();
}
} else if(phase == ClientAPI::GameflowPhase::INPROGRESS) {
extrasleep = 30000; // 30s bonus sleep
resetAllOffsets();
@ -178,6 +192,13 @@ void LolAutoAccept::innerRun() {
resetAllOffsets();
}
// change phase to non champselect phase -> disable dodge button
if(phase != ClientAPI::GameflowPhase::CHAMPSELECT && lastPhase != phase) {
emit this->dodgePossible(false);
}
lastPhase = phase;
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> dur = (end-start);
//if(dur.count() > 1e-5)
@ -214,6 +235,7 @@ void LolAutoAccept::resetAllOffsets() {
currentPositionSet = false;
chatid.clear();
autoWriteTextDone = false;
dodgeNow = false;
}
void LolAutoAccept::applyConfigToStage(Stage& stage, const Config::StageConfig& stageconf) {

View File

@ -32,6 +32,12 @@ int main(int argc, char** argv) {
qInfo() << "Hello, World!";
qInfo() << "Using Locale: " << QLocale().name();
if(args.access) {
auto access = ClientAccess::find();
qInfo() << "Access: port=" << access->getPort() << " basicAuth=" << access->getBasicAuth();
return 0;
}
QApplication app(argc, argv);
QTranslator translator;
if(translator.load(QLocale().name(), ":/i18n")) {

View File

@ -3,15 +3,27 @@
#include <QApplication>
#include <QTimer>
#include <QMessageBox>
#include <Log.h>
#include "loadingwindow.h"
#include "x11helper.h"
#ifdef X11SUPPORT
#define INIT_X11HELPER new X11Helper(this)
#else
#define INIT_X11HELPER nullptr
#endif
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), loading(true), ui(new Ui::MainWindow), saveTimer(new QTimer(this)), dd(QLocale().name()),
lolaa(conf.getConfig(), dd), lwin(new LoadingWindow(nullptr)) {
lolaa(conf.getConfig(), dd), lwin(new LoadingWindow(nullptr)),
dodgeQuestion(new QMessageBox(QMessageBox::Icon::Warning, MainWindow::tr("Dodge?"), MainWindow::tr("Are you sure you want to dodge?"), QMessageBox::Cancel | QMessageBox::Yes, this)),
x11Helper(INIT_X11HELPER) {
ui->setupUi(this);
ui->hideLeague->setEnabled(X11Helper::IsSupported);
QObject::connect(&dd, &DataDragon::fetchingChamp, lwin, &LoadingWindow::setChampion);
QObject::connect(&dd, &DataDragon::loading, lwin, &LoadingWindow::setProgress);
QObject::connect(&dd, &DataDragon::loading, this, &MainWindow::loadingStatus);
@ -19,9 +31,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), loading(true), ui
QObject::connect(lwin, &LoadingWindow::closed, qApp, &QCoreApplication::quit, Qt::ConnectionType::QueuedConnection);
dd.startThread();
QObject::connect(&lolaa, &LolAutoAccept::dodgePossible, ui->dodgeBtn, &QAbstractButton::setEnabled);
QObject::connect(ui->dodgeBtn, &QAbstractButton::pressed, dodgeQuestion, &QMessageBox::show);
QObject::connect(dodgeQuestion, &QMessageBox::accepted, &lolaa, &LolAutoAccept::dodge);
QObject::connect(&lolaa, &LolAutoAccept::statusChanged, this, &MainWindow::lolaaStatusChanged);
QObject::connect(&lolaa, &LolAutoAccept::positionChanged, this, &MainWindow::onPosChange);
QObject::connect(ui->hideLeague, &QCheckBox::stateChanged, this, &MainWindow::toggleLeagueVisibility);
saveTimer->setInterval(std::chrono::minutes(1));
saveTimer->setSingleShot(true);
QObject::connect(saveTimer, &QTimer::timeout, this, &MainWindow::saveConfig);
@ -92,6 +109,20 @@ void MainWindow::loadingStatus(float f) {
}
}
void MainWindow::toggleLeagueVisibility() {
if(x11Helper) {
const bool shouldBeHidden = ui->hideLeague->isChecked();
Window win = x11Helper->findWindow("League of Legends", 1280.0/720.0);
qInfo() << "LeagueClient win id:" << win;
if(win != 0) {
x11Helper->setMap(win, shouldBeHidden);
} else {
// TODO: show error in status bar?
// TODO: reset checkbox to unchecked?
}
}
}
void MainWindow::toggleMainswitch(bool state) {
qDebug() << "mainswitch toggled: " << state;

View File

@ -110,7 +110,9 @@ QByteArray RestClient::requestRaw(const QString& url, Method m, const QString& d
case Method::POST:
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, dataArr.data());
headerlist = curl_slist_append(headerlist, "Content-Type: application/json");
if(!dataArr.isEmpty()) {
headerlist = curl_slist_append(headerlist, "Content-Type: application/json");
}
break;
case Method::PUT:
case Method::PATCH:

View File

@ -177,12 +177,14 @@ const RunePage& RuneEditor::getRunepage() {
runepage.selectedAspects.clear();
runepage.selectedAspects.resize(9, 0);
uint_fast8_t index = 0;
for(const RuneAspektButtonGroup* group : groups) {
if(!group) continue;
const QVector<int>& selected = group->getSelectedRunes();
for(uint32_t i = 0; i < group->getSize(); ++i) {
runepage.selectedAspects.push_back(selected.at(i));
runepage.selectedAspects.at(index) = (selected.at(i));
++index;
}
}

View File

@ -83,8 +83,7 @@ void RuneManager::loadRunes() {
this->ui->listaaRunes->setRuneInfos(runeInfo, runeStyles);
// load runepages
const std::vector<ClientAPI::RunePage> runePages = client->getAllRunePages();
ui->listClientRunes->loadRunePages(runePages);
reloadClientRunes();
// reload runepages - so they ids can get their names
reloadAARunes();
@ -106,6 +105,13 @@ void RuneManager::loadRunes() {
this->ui->btnRetry->setEnabled(true);
}
void RuneManager::reloadClientRunes() {
if(client) {
const std::vector<ClientAPI::RunePage> runePages = client->getAllRunePages();
ui->listClientRunes->loadRunePages(runePages);
}
}
void RuneManager::setRunesEnabled(bool enabled) {
this->ui->lblClientRunes->setEnabled(enabled);
@ -131,6 +137,7 @@ void RuneManager::saveRunePageClient(int id, QString name, const RunePage& rp) {
// TODO: some error occured
}
}
reloadClientRunes();
} catch(RestClient::WebException& e) {
qCritical() << "webexception: " << e.curlresponse;

View File

@ -8,6 +8,7 @@
#include <QTextStream>
#include "clipboardpopup.h"
#include "loadingwindow.h"
#include "runeeditor.h"
RunePageList::RunePageList(QWidget* parent) : QListWidget(parent), ui(new Ui::RunePageList) {
@ -76,7 +77,7 @@ void RunePageList::openContextMenu(const QPoint& pos) {
QPoint globalPos = mapToGlobal(pos);
QMenu menu;
menu.addAction(QIcon(":/icons/edit.svg"), RunePageList::tr("Edit (Beta)"), this, &RunePageList::editCurrentItem);
menu.addAction(QIcon(":/icons/edit.svg"), RunePageList::tr("Edit"), this, &RunePageList::editCurrentItem);
menu.addAction(QIcon(":/icons/duplicate.svg"), RunePageList::tr("Duplicate"), this, &RunePageList::duplicateCurrentItem);
menu.addAction(QIcon(":/icons/export.svg"), RunePageList::tr("Export"), this, &RunePageList::exportCurrentItem);
menu.addAction(QIcon(":/icons/import.svg"), RunePageList::tr("Import"), this, &RunePageList::importItem);
@ -106,12 +107,22 @@ void RunePageList::editCurrentItem() {
RunePage* rp = (RunePage*) item->data(RolePointer).toULongLong();
const uint32_t id = item->data(RoleId).toUInt();
RuneEditor re;
LoadingWindow lw;
lw.setText(RunePageList::tr("Loading runes"));
lw.setProgress(0.5f);
lw.show();
// make sure the Loading window is rendered
QApplication::processEvents();
RuneEditor re;
re.setName(item->text());
QApplication::processEvents();
re.setClient(*client);
QApplication::processEvents();
re.setRunepage(*rp);
lw.close();
int result = re.exec();
// check result - save

3
src/x11helper.cpp Normal file
View File

@ -0,0 +1,3 @@
#include "x11helper.h"
const Window X11Helper::InvalidWindow = 0;

25
src/x11helper_other.cpp Normal file
View File

@ -0,0 +1,25 @@
#include "x11helper.h"
#include <X11/Xlib.h>
const bool X11Helper::IsSupported = false;
X11Helper::X11Helper(QObject *parent) : QObject(parent) {
}
X11Helper::~X11Helper() {}
Window X11Helper::findWindow(const QString&, float) {
return InvalidWindow;
}
Window X11Helper::searchWindows(Window, const QString&, float) {
return InvalidWindow;
}
void X11Helper::map(Window win) {}
void X11Helper::unmap(Window win) {}
void X11Helper::setMap(Window win, bool b) {}

77
src/x11helper_x11.cpp Normal file
View File

@ -0,0 +1,77 @@
#include "x11helper.h"
#include <X11/Xlib.h>
const bool X11Helper::IsSupported = true;
X11Helper::X11Helper(QObject *parent) : QObject(parent), disp(XOpenDisplay(nullptr)) {
}
X11Helper::~X11Helper() {
XCloseDisplay(this->disp);
}
Window X11Helper::findWindow(const QString& name, float aspektRatio) {
return searchWindows(DefaultRootWindow(disp), name, aspektRatio);
}
Window X11Helper::searchWindows(Window top, const QString& search, float aspektRatio) {
{
char* window_name;
if (XFetchName(disp, top, &window_name)) {
QString winName(window_name);
XFree(window_name);
if (search == winName) {
if(aspektRatio == 0.0) {
return top; // dont look for kids
}
XWindowAttributes attribs;
if(XGetWindowAttributes(disp, top, &attribs)) {
const float winAspektRation = attribs.width / (float) attribs.height;
if(qAbs(winAspektRation - aspektRatio) < aspektRatio/10.0) {
return top;
}
}
}
}
}
Window* children = nullptr;
Window dummy;
unsigned int nchildren;
if (!XQueryTree(disp, top, &dummy, &dummy, &children, &nchildren)) {
return InvalidWindow;
}
for (unsigned int i = 0; i < nchildren; i++) {
Window res = searchWindows(children[i], search, aspektRatio);
if(res != InvalidWindow) {
XFree((char*) children);
return res;
}
}
if (children) {
XFree((char*) children);
}
return InvalidWindow;
}
void X11Helper::map(Window win) {
XMapRaised(disp, win);
}
void X11Helper::unmap(Window win) {
XUnmapWindow(disp, win);
}
void X11Helper::setMap(Window win, bool b) {
if(b) {
map(win);
} else {
unmap(win);
}
}

View File

@ -19,6 +19,16 @@
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
@ -29,17 +39,36 @@
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="alignment">
<set>Qt::AlignCenter</set>
<widget class="QPushButton" name="icon">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/res.qrc">
<normaloff>:/lolautoaccept.svg</normaloff>:/lolautoaccept.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>icon</tabstop>
</tabstops>
<resources>
<include location="../resources/res.qrc"/>
</resources>

View File

@ -62,7 +62,7 @@
<property name="spacing">
<number>9</number>
</property>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="enableAutoWrite">
<property name="toolTip">
<string>Write a Text as soon as you are in a champ select lobby.</string>
@ -72,7 +72,34 @@
</property>
</widget>
</item>
<item row="0" column="1" rowspan="6">
<item row="10" column="0" colspan="2">
<widget class="QPushButton" name="dodgeBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Dodge without closing the client.
You will still be punished.</string>
</property>
<property name="text">
<string>Dodge</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="enableSmiteWarning">
<property name="toolTip">
<string>Spam &quot;smite&quot; 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 row="0" column="1" rowspan="7">
<widget class="QLabel" name="copyrightlabel">
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
@ -94,74 +121,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="mainswitch">
<property name="toolTip">
<string>This controls the connection to the LoL client. As long as this is off, no interactions with the LoL client take place.</string>
</property>
<property name="text">
<string>Mainswitch</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="enableSmiteWarning">
<property name="toolTip">
<string>Spam &quot;smite&quot; 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 row="2" column="0" rowspan="2">
<widget class="QCheckBox" name="enableAll">
<property name="text">
<string>Enable LoL-Auto-Accept</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QTextEdit" name="autoWriteText">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
<property name="placeholderText">
<string>autowriteText</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::North</enum>
@ -170,7 +130,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
@ -254,6 +214,72 @@
</widget>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QTextEdit" name="autoWriteText">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
<property name="placeholderText">
<string>autowriteText</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2">
<widget class="QCheckBox" name="enableAll">
<property name="text">
<string>Enable LoL-Auto-Accept</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="mainswitch">
<property name="toolTip">
<string>This controls the connection to the LoL client. As long as this is off, no interactions with the LoL client take place.</string>
</property>
<property name="text">
<string>Mainswitch</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="hideLeague">
<property name="toolTip">
<string>This hides the League Client.
It will not anoy you anymore.
Only available on Linux with X11.</string>
</property>
<property name="text">
<string>Hide League Client</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="RuneManager" name="runesPage">