aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-01-26 16:03:48 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-01-26 16:03:48 +0100
commit5e2ea2b24c2c0151ff8b0354632aa00148e0e6d6 (patch)
tree4373f833ae982e12d072466df971c91e48a628de
parent47ffce5db5220f476e01e88a17dffcb0f5970f7e (diff)
finished charselect and cleaned up some files
-rw-r--r--aocharbutton.cpp58
-rw-r--r--aocharbutton.h15
-rw-r--r--base/background/gs4/bancoacusacion.gifbin2288 -> 0 bytes
-rw-r--r--base/background/gs4/bancoacusacion.pngbin1838 -> 0 bytes
-rw-r--r--base/background/gs4/bancodefensa.gifbin1446 -> 0 bytes
-rw-r--r--base/background/gs4/bancodefensa.pngbin1918 -> 0 bytes
-rw-r--r--base/background/gs4/defenseempty.pngbin20664 -> 0 bytes
-rw-r--r--base/background/gs4/estrado.gifbin3536 -> 0 bytes
-rw-r--r--base/background/gs4/estrado.pngbin3762 -> 0 bytes
-rw-r--r--base/background/gs4/gallery.gifbin29619 -> 0 bytes
-rw-r--r--base/background/gs4/helperstand.pngbin23540 -> 0 bytes
-rw-r--r--base/background/gs4/judgestand.pngbin28073 -> 0 bytes
-rw-r--r--base/background/gs4/prohelperstand.pngbin29440 -> 0 bytes
-rw-r--r--base/background/gs4/prosecutorempty.pngbin20487 -> 0 bytes
-rw-r--r--base/background/gs4/speedlineupclose.pngbin3516 -> 0 bytes
-rw-r--r--base/background/gs4/super anim.pngbin17676 -> 0 bytes
-rw-r--r--base/background/gs4/tribunal.gifbin29619 -> 0 bytes
-rw-r--r--base/background/gs4/witnessempty.pngbin25245 -> 0 bytes
-rw-r--r--base/config.ini~1
-rw-r--r--base/serverlist.txt4
-rw-r--r--base/themes/default/courtroom_design.ini7
-rw-r--r--base/themes/default/design.ini28
-rw-r--r--base/themes/default/loadingbackground.pngbin0 -> 2194 bytes
-rw-r--r--base/themes/default/lobby_design.ini16
-rw-r--r--base/themes/default/muted.pngbin5703 -> 1013 bytes
-rw-r--r--base/themes/default/muted_old.pngbin0 -> 5703 bytes
-rw-r--r--courtroom.cpp109
-rw-r--r--courtroom.h21
-rw-r--r--packet_distribution.cpp3
29 files changed, 219 insertions, 43 deletions
diff --git a/aocharbutton.cpp b/aocharbutton.cpp
index 41a4f402..01b3c1c9 100644
--- a/aocharbutton.cpp
+++ b/aocharbutton.cpp
@@ -5,13 +5,50 @@
#include <QFile>
-AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent)
+AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos) : QPushButton(parent)
{
m_parent = parent;
ao_app = p_ao_app;
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.png");
+ 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_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.png");
+ ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
+ ui_selector->hide();
+}
+
+void AOCharButton::reset()
+{
+ ui_taken->hide();
+ ui_passworded->hide();
+ ui_selector->hide();
+}
+
+void AOCharButton::set_taken()
+{
+ ui_taken->show();
+}
+
+void AOCharButton::set_passworded()
+{
+ ui_passworded->show();
}
void AOCharButton::set_image(QString p_character)
@@ -19,6 +56,8 @@ void AOCharButton::set_image(QString p_character)
QString image_path = ao_app->get_character_path(p_character) + "char_icon.png";
QString legacy_path = ao_app->get_demothings_path() + p_character.toLower() + "_char_icon.png";
+ this->setText("");
+
if (file_exists(image_path))
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
else if (file_exists(legacy_path))
@@ -33,3 +72,20 @@ void AOCharButton::set_image(QString p_character)
this->setText(p_character);
}
}
+
+void AOCharButton::enterEvent(QEvent * e)
+{
+ ui_selector->raise();
+ ui_selector->show();
+
+ setFlat(false);
+ QPushButton::enterEvent(e);
+}
+
+void AOCharButton::leaveEvent(QEvent * e)
+{
+ ui_selector->hide();
+ QPushButton::leaveEvent(e);
+}
+
+
diff --git a/aocharbutton.h b/aocharbutton.h
index e91a1201..f7154169 100644
--- a/aocharbutton.h
+++ b/aocharbutton.h
@@ -6,20 +6,33 @@
#include <QPushButton>
#include <QString>
#include <QWidget>
+#include "aoimage.h"
class AOCharButton : public QPushButton
{
Q_OBJECT
public:
- AOCharButton(QWidget *parent, AOApplication *p_ao_app);
+ AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos);
AOApplication *ao_app;
+ void reset();
+ void set_taken();
+ void set_passworded();
+
void set_image(QString p_character);
private:
QWidget *m_parent;
+
+ AOImage *ui_taken;
+ AOImage *ui_passworded;
+ AOImage *ui_selector;
+
+protected:
+ void enterEvent(QEvent *e);
+ void leaveEvent(QEvent *e);
};
#endif // AOCHARBUTTON_H
diff --git a/base/background/gs4/bancoacusacion.gif b/base/background/gs4/bancoacusacion.gif
deleted file mode 100644
index 7b330a3c..00000000
--- a/base/background/gs4/bancoacusacion.gif
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/bancoacusacion.png b/base/background/gs4/bancoacusacion.png
deleted file mode 100644
index cce6bfe1..00000000
--- a/base/background/gs4/bancoacusacion.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/bancodefensa.gif b/base/background/gs4/bancodefensa.gif
deleted file mode 100644
index bb30ac14..00000000
--- a/base/background/gs4/bancodefensa.gif
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/bancodefensa.png b/base/background/gs4/bancodefensa.png
deleted file mode 100644
index c7121cc3..00000000
--- a/base/background/gs4/bancodefensa.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/defenseempty.png b/base/background/gs4/defenseempty.png
deleted file mode 100644
index fc9069e5..00000000
--- a/base/background/gs4/defenseempty.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/estrado.gif b/base/background/gs4/estrado.gif
deleted file mode 100644
index cd5075f7..00000000
--- a/base/background/gs4/estrado.gif
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/estrado.png b/base/background/gs4/estrado.png
deleted file mode 100644
index 9341a810..00000000
--- a/base/background/gs4/estrado.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/gallery.gif b/base/background/gs4/gallery.gif
deleted file mode 100644
index 4469bceb..00000000
--- a/base/background/gs4/gallery.gif
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/helperstand.png b/base/background/gs4/helperstand.png
deleted file mode 100644
index 882c30ce..00000000
--- a/base/background/gs4/helperstand.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/judgestand.png b/base/background/gs4/judgestand.png
deleted file mode 100644
index 6a17e7c9..00000000
--- a/base/background/gs4/judgestand.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/prohelperstand.png b/base/background/gs4/prohelperstand.png
deleted file mode 100644
index 6554d32d..00000000
--- a/base/background/gs4/prohelperstand.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/prosecutorempty.png b/base/background/gs4/prosecutorempty.png
deleted file mode 100644
index eecf8522..00000000
--- a/base/background/gs4/prosecutorempty.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/speedlineupclose.png b/base/background/gs4/speedlineupclose.png
deleted file mode 100644
index 06dc9b3a..00000000
--- a/base/background/gs4/speedlineupclose.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/super anim.png b/base/background/gs4/super anim.png
deleted file mode 100644
index fd3ec29a..00000000
--- a/base/background/gs4/super anim.png
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/tribunal.gif b/base/background/gs4/tribunal.gif
deleted file mode 100644
index 4469bceb..00000000
--- a/base/background/gs4/tribunal.gif
+++ /dev/null
Binary files differ
diff --git a/base/background/gs4/witnessempty.png b/base/background/gs4/witnessempty.png
deleted file mode 100644
index 11e22f74..00000000
--- a/base/background/gs4/witnessempty.png
+++ /dev/null
Binary files differ
diff --git a/base/config.ini~ b/base/config.ini~
deleted file mode 100644
index 61e18830..00000000
--- a/base/config.ini~
+++ /dev/null
@@ -1 +0,0 @@
-theme = default
diff --git a/base/serverlist.txt b/base/serverlist.txt
new file mode 100644
index 00000000..fef701da
--- /dev/null
+++ b/base/serverlist.txt
@@ -0,0 +1,4 @@
+10.0.0.1:27071:the shit server
+88.203.168.170:27777:Demon Server For Demons! Vanilla! 1.8+
+24.193.75.13:27053:The Flaming Phoenix
+51.255.160.217:50000:Attorney Online Vidya(Dedicated)
diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini
index c96d2620..e7a3de4b 100644
--- a/base/themes/default/courtroom_design.ini
+++ b/base/themes/default/courtroom_design.ini
@@ -8,7 +8,7 @@ area_list = 266, 494, 224, 174
music_list = 490, 342, 224, 326
ic_chat_message = 0, 192, 255, 23
ooc_chat_message = 492, 281, 222, 19
-ooc_chat_name = 492, 300, 32, 19
+ooc_chat_name = 492, 300, 85, 19
area_password = 266, 471, 224, 23
music_search = 490, 319, 226, 23
emote_left = 0, 253, 20, 20
@@ -20,6 +20,7 @@ sfx_label = 260, 410, 21, 16
blip_label = 260, 430, 31, 16
hold_it = 10, 312, 76, 28
objection = 90, 312, 76, 28
+take_that = 170, 312, 76, 28
ooc_toggle = 580, 300, 133, 19
witness_testimony = 5, 345, 85, 42
cross_examination = 95, 345, 85, 42
@@ -30,8 +31,8 @@ pre = 187, 345, 51, 21
flip = 187, 362, 51, 21
guard = 187, 379, 61, 21
custom_objection = 250, 325, 40, 40
-realization = 295, 323, 40, 40
-mute = 340, 325, 40, 40
+realization = 295, 325, 40, 40
+mute_button = 340, 325, 40, 40
defense_plus = 477, 325, 9, 9
defense_minus = 385, 325, 9, 9
prosecution_plus = 477, 342, 9, 9
diff --git a/base/themes/default/design.ini b/base/themes/default/design.ini
deleted file mode 100644
index 5488ac4b..00000000
--- a/base/themes/default/design.ini
+++ /dev/null
@@ -1,28 +0,0 @@
-hold_it = 10, 312
-objection = 90, 312
-take_that = 170, 312
-objection_custom = 250, 325
-realization = 295, 325
-mute = 340, 325
-text_color = 390, 360
-defense_bar = 393, 323
-prosecution_bar = 393, 340
-def_plus = 477, 325
-def_minus = 385, 325
-pro_plus = 477, 342
-pro_minus = 385, 342
-witness_testimony = 5, 345
-cross_examination = 95, 345
-pre = 187, 345
-flip = 187, 362
-guard = 187, 379
-change_character = 5, 390
-reload_theme = 5, 415
-call_mod = 5, 440
-music_label = 260, 390
-music_slider = 310, 392
-sfx_label = 260, 410
-sfx_slider = 310, 412
-blips_label = 260, 430
-blips_slider = 310, 432
-
diff --git a/base/themes/default/loadingbackground.png b/base/themes/default/loadingbackground.png
new file mode 100644
index 00000000..202a8813
--- /dev/null
+++ b/base/themes/default/loadingbackground.png
Binary files differ
diff --git a/base/themes/default/lobby_design.ini b/base/themes/default/lobby_design.ini
new file mode 100644
index 00000000..efce59a7
--- /dev/null
+++ b/base/themes/default/lobby_design.ini
@@ -0,0 +1,16 @@
+lobby = 0, 0, 517, 666
+public_servers = 46, 88, 114, 30
+favorites = 164, 88, 114, 30
+refresh = 56, 381, 132, 28
+add_to_fav = 194, 381, 132, 28
+connect = 332, 381, 132, 28
+about = 428, 1, 88, 21
+server_list = 20, 125, 286, 240
+player_count = 336, 91, 173, 16
+description = 337, 109, 173, 245
+chatbox = 2, 445, 515, 198
+chatname = 3, 646, 85, 19
+chatmessage = 93, 646, 424, 19
+loading_label = 135, 92, 254, 95
+progress_bar = 135, 188, 254, 21
+cancel = 220, 220, 80, 20
diff --git a/base/themes/default/muted.png b/base/themes/default/muted.png
index f9878f1a..969da04e 100644
--- a/base/themes/default/muted.png
+++ b/base/themes/default/muted.png
Binary files differ
diff --git a/base/themes/default/muted_old.png b/base/themes/default/muted_old.png
new file mode 100644
index 00000000..f9878f1a
--- /dev/null
+++ b/base/themes/default/muted_old.png
Binary files differ
diff --git a/courtroom.cpp b/courtroom.cpp
index 282c70cd..381d1595 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -11,6 +11,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
{
ao_app = p_ao_app;
+ char_button_mapper = new QSignalMapper(this);
+
ui_background = new AOImage(this, ao_app);
//viewport elements like background, desk, etc.
@@ -91,7 +93,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_char_select_background = new AOImage(this, ao_app);
- //setting up the grid and positions
+ //constructing character button grid
const int base_x_pos{25};
const int base_y_pos{36};
@@ -103,15 +105,37 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
for (int n = 0 ; n < 90 ; ++n)
{
- ui_char_button_list.append(new AOCharButton(ui_char_select_background, ao_app));
+ int x_pos = base_x_pos + (x_modifier * x_mod_count);
+ int y_pos = base_y_pos + (y_modifier * y_mod_count);
+
+ ui_char_button_list.append(new AOCharButton(ui_char_select_background, ao_app, x_pos, y_pos));
+
+ connect(ui_char_button_list.at(n), SIGNAL(clicked()), char_button_mapper, SLOT(map())) ;
+ char_button_mapper->setMapping (ui_char_button_list.at(n), n) ;
+
+ ++x_mod_count;
+
+ //if char number is divisible by ten with rest 9 then the next charicon should start on a new line
+ if (n % 10 == 9 && n != 0)
+ {
+ ++y_mod_count;
+ x_mod_count = 0;
+ }
}
+ connect (char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int))) ;
+
ui_selector = new AOImage(ui_char_select_background, ao_app);
+ ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
+ ui_selector->resize(62, 62);
ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app);
ui_char_password = new QLineEdit(ui_char_select_background);
+ ui_char_select_left = new AOButton(ui_char_select_background, ao_app);
+ ui_char_select_right = new AOButton(ui_char_select_background, ao_app);
+
ui_spectator = new AOButton(ui_char_select_background, ao_app);
connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked()));
@@ -120,6 +144,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
+ connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked()));
+ connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked()));
+
connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
set_widgets();
@@ -256,10 +283,9 @@ void Courtroom::set_widgets()
ui_char_select_background->move(0, 0);
ui_char_select_background->resize(m_courtroom_width, m_courtroom_height);
- //T0D0: uncomment and set position properly
- //QVector<AOCharButton*> ui_char_button_list;
+ //buttons are in the constructor
- ui_selector->set_image("selector.png");
+ ui_selector->set_image("char_selector.png");
ui_selector->hide();
ui_back_to_lobby->setText("Back to Lobby");
@@ -267,6 +293,14 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_char_password, "char_password");
+ ui_char_select_left->set_image("arrow_left.png");
+ ui_char_select_left->move(2, 325);
+ ui_char_select_left->resize(20, 20);
+
+ ui_char_select_right->set_image("arrow_right.png");
+ ui_char_select_right->move(691, 325);
+ ui_char_select_right->resize(20, 20);
+
ui_spectator->setText("Spectator");
set_size_and_pos(ui_spectator, "spectator");
@@ -305,13 +339,57 @@ void Courtroom::set_taken(int n_char, bool p_taken)
}
char_type f_char;
- f_char.name = char_list.at(0).name;
- f_char.description = char_list.at(1).description;
+ f_char.name = char_list.at(n_char).name;
+ f_char.description = char_list.at(n_char).description;
f_char.taken = p_taken;
char_list.replace(n_char, f_char);
}
+void Courtroom::set_char_select_page()
+{
+ ui_char_select_background->show();
+
+ ui_char_select_left->hide();
+ ui_char_select_right->hide();
+
+ for (AOCharButton *i_button : ui_char_button_list)
+ i_button->hide();
+
+ int total_pages = char_list.size() / 90;
+ int chars_on_page = 0;
+
+ if (char_list.size() % 90 != 0)
+ {
+ ++total_pages;
+ //i. e. not on the last page
+ if (total_pages > current_char_page + 1)
+ chars_on_page = 90;
+ else
+ chars_on_page = char_list.size() % 90;
+
+ }
+ else
+ chars_on_page = 90;
+
+ qDebug() << "chars_on_page: " << chars_on_page;
+
+ if (total_pages > current_char_page + 1)
+ ui_char_select_right->show();
+
+ if (current_char_page > 0)
+ ui_char_select_left->show();
+
+ for (int n_button = 0 ; n_button < chars_on_page ; ++n_button)
+ {
+ int n_real_char = n_button + current_char_page * 90;
+
+ ui_char_button_list.at(n_button)->set_image(char_list.at(n_real_char).name);
+ ui_char_button_list.at(n_button)->show();
+ }
+
+}
+
void Courtroom::on_change_character_clicked()
{
ui_char_select_background->show();
@@ -331,11 +409,28 @@ void Courtroom::on_back_to_lobby_clicked()
ao_app->destruct_courtroom();
}
+void Courtroom::on_char_select_left_clicked()
+{
+ --current_char_page;
+ set_char_select_page();
+}
+
+void Courtroom::on_char_select_right_clicked()
+{
+ ++current_char_page;
+ set_char_select_page();
+}
+
void Courtroom::on_spectator_clicked()
{
ui_char_select_background->hide();
}
+void Courtroom::char_clicked(int n_char)
+{
+
+}
+
Courtroom::~Courtroom()
{
diff --git a/courtroom.h b/courtroom.h
index ec31961f..5b2a1115 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -16,6 +16,7 @@
#include <QSlider>
#include <QVector>
#include <QCloseEvent>
+#include <QSignalMapper>
class AOApplication;
@@ -32,6 +33,7 @@ public:
void set_widgets();
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
void set_taken(int n_char, bool p_taken);
+ void set_char_select_page();
~Courtroom();
@@ -51,8 +53,15 @@ private:
QVector<evi_type> evidence_list;
QVector<QString> music_list;
+ QSignalMapper *char_button_mapper;
+
+ //0 is the first page, 1 second etc.
+ //makes char arithmetic easier
+ int current_char_page = 0;
+
AOImage *ui_background;
- //viewport elements like background, desk, etc.
+
+ //T0D0: add viewport elements like background, desk, etc.
QPlainTextEdit *ui_ic_chatlog;
@@ -72,7 +81,7 @@ private:
QLineEdit *ui_area_password;
QLineEdit *ui_music_search;
- //emote buttons
+ //T0D0: add emote buttons
AOButton *ui_emote_left;
AOButton *ui_emote_right;
@@ -129,6 +138,9 @@ private:
QLineEdit *ui_char_password;
+ AOButton *ui_char_select_left;
+ AOButton *ui_char_select_right;
+
AOButton *ui_spectator;
private slots:
void on_change_character_clicked();
@@ -138,6 +150,11 @@ private slots:
void on_spectator_clicked();
+ void on_char_select_left_clicked();
+ void on_char_select_right_clicked();
+
+ void char_clicked(int n_char);
+
};
#endif // COURTROOM_H
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index a20429e0..d53b5a6a 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -176,6 +176,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size));
w_courtroom->append_char(f_char);
+ //qDebug() << "appended " << f_char.name << " to char_list";
}
if (loaded_chars < char_list_size)
@@ -278,6 +279,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (!courtroom_constructed)
return;
+ w_courtroom->set_char_select_page();
+
w_courtroom->show();
destruct_lobby();