From b085be5a2a0512c432bc9fd58413a9d8f93d451e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 21:08:43 +0300 Subject: Add two new helper functions - get_design_element and get_static_image_suffix Modify all set_image calls to utilize said suffix helper function Dynamically change betweehn chatblank, chat, chatmed, chatbig based on the showname's length Use char.ini showname if showname is set to whitespace (doesn't yet check if char.ini showname is also whitespace) --- src/aobutton.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/aobutton.cpp') diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 5be2e678..1459729f 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -15,8 +15,8 @@ AOButton::~AOButton() void AOButton::set_image(QString p_image) { - QString image_path = ao_app->get_theme_path(p_image); - QString default_image_path = ao_app->get_default_theme_path(p_image); + QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); if (file_exists(image_path)) this->setStyleSheet("border-image:url(\"" + image_path + "\")"); -- cgit From 8409b71611d8c213fd7286359d4404f2a181e59b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 17 Sep 2019 21:17:30 +0300 Subject: Tool tips! Tool tips for everyone! Change the way AOButton loads images into itself (stylesheet broke tooltips) --- src/aobutton.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/aobutton.cpp') diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 1459729f..d80226f2 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -19,8 +19,20 @@ void AOButton::set_image(QString p_image) QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); if (file_exists(image_path)) - this->setStyleSheet("border-image:url(\"" + image_path + "\")"); + { + this->setIcon(QIcon(image_path)); + this->setIconSize(this->size()); + this->setStyleSheet("border:0px"); + this->setText(""); + } + else if (file_exists(default_image_path)) + { + this->setIcon(QIcon(default_image_path)); + this->setIconSize(this->size()); + this->setStyleSheet("border:0px"); + this->setText(""); + } else - this->setStyleSheet("border-image:url(\"" + default_image_path + "\")"); + return; } -- cgit From d3f23708c43bc132c322b778b2aa8d31a68d1c0c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 15:54:45 +0300 Subject: Revert buttons using setIcon and use a better stylesheet method instead Fix evidence buttons and emote buttons being hardcoded size --- src/aobutton.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/aobutton.cpp') diff --git a/src/aobutton.cpp b/src/aobutton.cpp index d80226f2..9efe13d0 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -20,17 +20,15 @@ void AOButton::set_image(QString p_image) if (file_exists(image_path)) { - this->setIcon(QIcon(image_path)); - this->setIconSize(this->size()); - this->setStyleSheet("border:0px"); this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); } else if (file_exists(default_image_path)) { - this->setIcon(QIcon(default_image_path)); - this->setIconSize(this->size()); - this->setStyleSheet("border:0px"); this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); } else return; -- cgit From c8e12558cdd3fd0769b81679ad09edf1f29b780f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 01:18:24 +0300 Subject: Clang-ify the code with this styling using Visual Studio Code: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Stroustrup, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All } (this is the Visual Studio preset with only "BreakBeforeBraces" changed from Allman to Stroustrup) --- src/aobutton.cpp | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'src/aobutton.cpp') diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 9efe13d0..05dedc16 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -5,32 +5,28 @@ AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; } AOButton::~AOButton() { - } void AOButton::set_image(QString p_image) { - QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); - QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); + QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); - if (file_exists(image_path)) - { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else if (file_exists(default_image_path)) - { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else - return; + if (file_exists(image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } + else if (file_exists(default_image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } + else + return; } - -- cgit From 88de4cde0433ef5e606f38a2f1e6041f0d24a87e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 02:14:54 +0300 Subject: clang 2 electric boogaloo { BasedOnStyle: LLVM, BreakBeforeBraces: Stroustrup} --- src/aobutton.cpp | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'src/aobutton.cpp') diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 05dedc16..dc2d8817 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -3,30 +3,36 @@ #include "debug_functions.h" #include "file_functions.h" -AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent) +AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) + : QPushButton(parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; } -AOButton::~AOButton() -{ -} +AOButton::~AOButton() {} void AOButton::set_image(QString p_image) { - QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); - QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); + QString image_path = + ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = + ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); - if (file_exists(image_path)) { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else if (file_exists(default_image_path)) { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else - return; + if (file_exists(image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + } + else if (file_exists(default_image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + + default_image_path + + "\"); }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + } + else + return; } -- cgit