aboutsummaryrefslogtreecommitdiff
path: root/src/aocharbutton.cpp
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2020-05-22 01:18:24 +0300
committerCrystalwarrior <varsash@gmail.com>2020-05-22 01:18:24 +0300
commitc8e12558cdd3fd0769b81679ad09edf1f29b780f (patch)
tree7dae2225e574c3ee55d6b82a1d2f399db4ace5c0 /src/aocharbutton.cpp
parentdfac0652c8eb9bd48ceea7ae755e9c2f7e5cb1a2 (diff)
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)
Diffstat (limited to 'src/aocharbutton.cpp')
-rw-r--r--src/aocharbutton.cpp118
1 files changed, 56 insertions, 62 deletions
diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp
index 6acad70b..d8c337d9 100644
--- a/src/aocharbutton.cpp
+++ b/src/aocharbutton.cpp
@@ -4,98 +4,92 @@
AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent)
{
- m_parent = parent;
+ m_parent = parent;
- ao_app = p_ao_app;
+ ao_app = p_ao_app;
- taken = is_taken;
+ taken = is_taken;
- this->resize(60, 60);
- this->move(x_pos, y_pos);
+ this->resize(60, 60);
+ this->move(x_pos, y_pos);
- ui_taken = new AOImage(this, ao_app);
- ui_taken->resize(60, 60);
- ui_taken->set_image("char_taken");
- ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_taken->hide();
-
- ui_passworded = new AOImage(this, ao_app);
- ui_passworded->resize(60, 60);
- ui_passworded->set_image("char_passworded");
- ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_passworded->hide();
+ ui_taken = new AOImage(this, ao_app);
+ ui_taken->resize(60, 60);
+ ui_taken->set_image("char_taken");
+ ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
+ ui_taken->hide();
- ui_selector = new AOImage(parent, ao_app);
- ui_selector->resize(62, 62);
- ui_selector->move(x_pos - 1, y_pos - 1);
- ui_selector->set_image("char_selector");
- ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_selector->hide();
+ ui_passworded = new AOImage(this, ao_app);
+ ui_passworded->resize(60, 60);
+ ui_passworded->set_image("char_passworded");
+ ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents);
+ ui_passworded->hide();
+
+ ui_selector = new AOImage(parent, ao_app);
+ ui_selector->resize(62, 62);
+ ui_selector->move(x_pos - 1, y_pos - 1);
+ ui_selector->set_image("char_selector");
+ ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
+ ui_selector->hide();
}
void AOCharButton::reset()
{
- ui_taken->hide();
- ui_passworded->hide();
- ui_selector->hide();
+ ui_taken->hide();
+ ui_passworded->hide();
+ ui_selector->hide();
}
void AOCharButton::set_taken(bool is_taken)
{
- taken = is_taken;
+ taken = is_taken;
}
void AOCharButton::apply_taken_image()
{
- if (taken)
- {
- ui_taken->move(0,0);
- ui_taken->show();
- }
- else
- {
- ui_taken->hide();
- }
+ if (taken) {
+ ui_taken->move(0, 0);
+ ui_taken->show();
+ }
+ else {
+ ui_taken->hide();
+ }
}
void AOCharButton::set_passworded()
{
- ui_passworded->show();
+ ui_passworded->show();
}
void AOCharButton::set_image(QString p_character)
{
- QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_character, "char_icon"));
-
- this->setText("");
-
- if (file_exists(image_path))
- {
- 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
- {
- this->setStyleSheet("QPushButton { border-image: url(); }"
- "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }");
- this->setText(p_character);
- }
+ QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_character, "char_icon"));
+
+ this->setText("");
+
+ if (file_exists(image_path)) {
+ 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 {
+ this->setStyleSheet("QPushButton { border-image: url(); }"
+ "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }");
+ this->setText(p_character);
+ }
}
-void AOCharButton::enterEvent(QEvent * e)
+void AOCharButton::enterEvent(QEvent *e)
{
- ui_selector->move(this->x() - 1, this->y() - 1);
- ui_selector->raise();
- ui_selector->show();
+ ui_selector->move(this->x() - 1, this->y() - 1);
+ ui_selector->raise();
+ ui_selector->show();
- setFlat(false);
- QPushButton::enterEvent(e);
+ setFlat(false);
+ QPushButton::enterEvent(e);
}
-void AOCharButton::leaveEvent(QEvent * e)
+void AOCharButton::leaveEvent(QEvent *e)
{
- ui_selector->hide();
- QPushButton::leaveEvent(e);
+ ui_selector->hide();
+ QPushButton::leaveEvent(e);
}
-
-