diff options
| -rw-r--r-- | Attorney_Online_remake.pro | 6 | ||||
| -rw-r--r-- | aoapplication.cpp | 4 | ||||
| -rw-r--r-- | aoapplication.h | 3 | ||||
| -rw-r--r-- | aocharbutton.cpp | 33 | ||||
| -rw-r--r-- | aocharbutton.h | 21 | ||||
| -rw-r--r-- | courtroom.cpp | 2 | ||||
| -rw-r--r-- | courtroom.h | 13 | ||||
| -rw-r--r-- | path_functions.cpp | 10 | ||||
| -rw-r--r-- | path_functions.h | 2 |
9 files changed, 80 insertions, 14 deletions
diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 1f2af983..a51e1f60 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -28,7 +28,8 @@ SOURCES += main.cpp\ packet_distribution.cpp \ hex_functions.cpp \ encryption_functions.cpp \ - courtroom.cpp + courtroom.cpp \ + aocharbutton.cpp HEADERS += lobby.h \ text_file_functions.h \ @@ -44,4 +45,5 @@ HEADERS += lobby.h \ aopacket.h \ hex_functions.h \ encryption_functions.h \ - courtroom.h + courtroom.h \ + aocharbutton.h diff --git a/aoapplication.cpp b/aoapplication.cpp index c2eef1f6..77066429 100644 --- a/aoapplication.cpp +++ b/aoapplication.cpp @@ -1,6 +1,7 @@ #include <QDebug> #include "lobby.h" +#include "courtroom.h" #include "networkmanager.h" #include "aoapplication.h" @@ -47,8 +48,7 @@ void AOApplication::construct_courtroom() return; } - //T0D0, make custom Courtroom class and uncomment - //w_courtroom = new QMainWindow(this); + w_courtroom = new Courtroom(this); courtroom_constructed = true; } diff --git a/aoapplication.h b/aoapplication.h index d37dc861..34f1fefb 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -21,8 +21,7 @@ public: NetworkManager *net_manager; Lobby *w_lobby; - //T0D0: change to custom class "Courtroom" - QMainWindow *w_courtroom; + Courtroom *w_courtroom; bool lobby_constructed = false; bool courtroom_constructed = false; diff --git a/aocharbutton.cpp b/aocharbutton.cpp new file mode 100644 index 00000000..1c0b4f79 --- /dev/null +++ b/aocharbutton.cpp @@ -0,0 +1,33 @@ +#include "aocharbutton.h" + +#include "path_functions.h" +#include "file_functions.h" + +#include <QFile> + +AOCharButton::AOCharButton(QWidget *parent) +{ + m_parent = parent; + + this->resize(60, 60); +} + +void AOCharButton::set_image(QString p_character) +{ + QString image_path = get_character_path(p_character) + "char_icon.png"; + QString legacy_path = get_demothings_path() + p_character.toLower() + "_char_icon.png"; + + if (file_exists(image_path)) + this->setStyleSheet("border-image:url(\"" + image_path + "\")"); + else if (file_exists(legacy_path)) + { + this->setStyleSheet("border-image:url(\"" + legacy_path + "\")"); + //ninja optimization + QFile::copy(legacy_path, image_path); + } + else + { + this->setStyleSheet("border-image:url()"); + this->setText(p_character); + } +} diff --git a/aocharbutton.h b/aocharbutton.h new file mode 100644 index 00000000..231fe66d --- /dev/null +++ b/aocharbutton.h @@ -0,0 +1,21 @@ +#ifndef AOCHARBUTTON_H +#define AOCHARBUTTON_H + +#include <QPushButton> +#include <QString> +#include <QWidget> + +class AOCharButton : public QPushButton +{ + Q_OBJECT + +public: + AOCharButton(QWidget *parent); + + void set_image(QString p_character); + +private: + QWidget *m_parent; +}; + +#endif // AOCHARBUTTON_H diff --git a/courtroom.cpp b/courtroom.cpp index c49ec036..6032d414 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2,7 +2,7 @@ #include "aoapplication.h" -Courtroom::Courtroom(AOApplication *parent) : QMainWindow(parent) +Courtroom::Courtroom(AOApplication *parent) : QMainWindow() { ao_app = parent; diff --git a/courtroom.h b/courtroom.h index 90ccdb34..932bbe34 100644 --- a/courtroom.h +++ b/courtroom.h @@ -3,6 +3,7 @@ #include "aoimage.h" #include "aobutton.h" +#include "aobuttongrid.h" #include "aopacket.h" #include <QMainWindow> @@ -84,17 +85,15 @@ private: QComboBox *ui_text_color; + QSlider *ui_music_slider; + QSlider *ui_sfx_slider; + QSlider *ui_blip_slider; AOImage *ui_muted; - - - //ui_charselect w/ icons - -signals: - -public slots: + AOImage *ui_char_select_background; + AOButtonGrid *char_button_grid; }; #endif // COURTROOM_H diff --git a/path_functions.cpp b/path_functions.cpp index 4a3cdb77..0282bd4f 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -19,3 +19,13 @@ QString get_default_theme_path() { return get_base_path() + "themes/default/"; } + +QString get_character_path(QString p_character) +{ + return get_base_path() + "characters/" + p_character.toLower() + "/"; +} + +QString get_demothings_path() +{ + return get_base_path() + "misc/demothings/"; +} diff --git a/path_functions.h b/path_functions.h index eae5c75a..67cbd29c 100644 --- a/path_functions.h +++ b/path_functions.h @@ -6,5 +6,7 @@ QString get_base_path(); QString get_theme_path(); QString get_default_theme_path(); +QString get_character_path(QString p_character); +QString get_demothings_path(); #endif // PATH_FUNCTIONS_H |
