use SetIcon for AOEmoteButton instead of stylesheets
Fix aolineedit not sending the double_clicked signal Add tooltips for emotes that display the number and the emote_comment (name) Add similar tooltips to evidence buttons Resolve an issue where you could edit evidence name without double-clicking a piece of evidence first
This commit is contained in:
parent
0fe94d5d9f
commit
cda7d430b3
@ -13,9 +13,8 @@ class AOEmoteButton : public QPushButton
|
||||
public:
|
||||
AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
|
||||
|
||||
//void set_on(QString p_char, int p_emote);
|
||||
//void set_off(QString p_char, int p_emote);
|
||||
void set_image(QString p_char, int p_emote, QString suffix);
|
||||
void set_image(QString p_image, QString p_emote_comment);
|
||||
void set_char_image(QString p_char, int p_emote, QString suffix);
|
||||
|
||||
void set_id(int p_id) {m_id = p_id;}
|
||||
int get_id() {return m_id;}
|
||||
|
@ -13,21 +13,28 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x
|
||||
connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
|
||||
}
|
||||
|
||||
void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
|
||||
void AOEmoteButton::set_image(QString p_image, QString p_emote_comment)
|
||||
{
|
||||
if (file_exists(p_image))
|
||||
{
|
||||
this->setIcon(QIcon(p_image));
|
||||
this->setIconSize(this->size());
|
||||
this->setStyleSheet("border:0px");
|
||||
this->setText("");
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setText(p_emote_comment);
|
||||
this->setStyleSheet("border-image:url(\"\")");
|
||||
}
|
||||
}
|
||||
|
||||
void AOEmoteButton::set_char_image(QString p_char, int p_emote, QString suffix)
|
||||
{
|
||||
QString emotion_number = QString::number(p_emote + 1);
|
||||
QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix));
|
||||
|
||||
if (file_exists(image_path))
|
||||
{
|
||||
this->setText("");
|
||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setText(ao_app->get_emote_comment(p_char, p_emote));
|
||||
this->setStyleSheet("border-image:url(\"\")");
|
||||
}
|
||||
this->set_image(image_path, ao_app->get_emote_comment(p_char, p_emote));
|
||||
}
|
||||
|
||||
void AOEmoteButton::on_clicked()
|
||||
|
@ -13,6 +13,7 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
QLineEdit::mouseDoubleClickEvent(e);
|
||||
|
||||
this->setReadOnly(false);
|
||||
double_clicked();
|
||||
}
|
||||
|
||||
void AOLineEdit::on_enter_pressed()
|
||||
|
@ -112,11 +112,12 @@ void Courtroom::set_emote_page()
|
||||
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
|
||||
|
||||
if (n_real_emote == current_emote)
|
||||
f_emote->set_image(current_char, n_real_emote, "_on");
|
||||
f_emote->set_char_image(current_char, n_real_emote, "_on");
|
||||
else
|
||||
f_emote->set_image(current_char, n_real_emote, "_off");
|
||||
f_emote->set_char_image(current_char, n_real_emote, "_off");
|
||||
|
||||
f_emote->show();
|
||||
f_emote->setToolTip(QString::number(n_real_emote+1) + ": " + ao_app->get_emote_comment(current_char, n_real_emote));
|
||||
}
|
||||
|
||||
}
|
||||
@ -130,7 +131,7 @@ void Courtroom::set_emote_dropdown()
|
||||
|
||||
for (int n = 0 ; n < total_emotes ; ++n)
|
||||
{
|
||||
emote_list.append(ao_app->get_emote_comment(current_char, n));
|
||||
emote_list.append(QString::number(n+1) + ": " + ao_app->get_emote_comment(current_char, n));
|
||||
}
|
||||
|
||||
ui_emote_dropdown->addItems(emote_list);
|
||||
@ -142,14 +143,14 @@ void Courtroom::select_emote(int p_id)
|
||||
int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
|
||||
|
||||
if (current_emote >= min && current_emote <= max)
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off");
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_off");
|
||||
|
||||
int old_emote = current_emote;
|
||||
|
||||
current_emote = p_id;
|
||||
|
||||
if (current_emote >= min && current_emote <= max)
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on");
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_on");
|
||||
|
||||
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
|
||||
|
||||
|
@ -141,8 +141,8 @@ void Courtroom::set_evidence_page()
|
||||
int n_real_evidence = n_evidence_button + current_evidence_page * max_evidence_on_page;
|
||||
AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button);
|
||||
|
||||
//ie. the add evidence button
|
||||
f_evidence_button->set_selected(false);
|
||||
f_evidence_button->setToolTip("");
|
||||
if (n_real_evidence == (total_evidence - 1))
|
||||
{
|
||||
f_evidence_button->set_theme_image("addevidence.png");
|
||||
@ -153,11 +153,12 @@ void Courtroom::set_evidence_page()
|
||||
|
||||
if (n_real_evidence == current_evidence)
|
||||
f_evidence_button->set_selected(true);
|
||||
|
||||
f_evidence_button->setToolTip(QString::number(n_real_evidence+1) + ": " + local_evidence_list.at(n_real_evidence).name);
|
||||
}
|
||||
else
|
||||
f_evidence_button->set_image("");
|
||||
|
||||
|
||||
f_evidence_button->show();
|
||||
}
|
||||
}
|
||||
@ -180,6 +181,14 @@ void Courtroom::on_evidence_name_edited(QString text)
|
||||
ao_app->send_server_packet(new AOPacket("EE", f_contents));
|
||||
}
|
||||
|
||||
void Courtroom::on_evidence_name_double_clicked()
|
||||
{
|
||||
if (ui_evidence_overlay->isVisible())
|
||||
ui_evidence_name->setReadOnly(false);
|
||||
else
|
||||
ui_evidence_name->setReadOnly(true);
|
||||
}
|
||||
|
||||
void Courtroom::on_evidence_image_name_edited()
|
||||
{
|
||||
if (current_evidence >= local_evidence_list.size())
|
||||
@ -243,7 +252,7 @@ void Courtroom::on_evidence_clicked(int p_id)
|
||||
|
||||
current_evidence = f_real_id;
|
||||
|
||||
ui_ic_chat_message->setFocus();
|
||||
// ui_ic_chat_message->setFocus();
|
||||
|
||||
}
|
||||
|
||||
@ -319,6 +328,7 @@ void Courtroom::on_evidence_present_clicked()
|
||||
void Courtroom::on_evidence_delete_clicked()
|
||||
{
|
||||
ui_evidence_description->setReadOnly(true);
|
||||
ui_evidence_name->setReadOnly(true);
|
||||
ui_evidence_overlay->hide();
|
||||
|
||||
ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
|
||||
@ -331,7 +341,10 @@ void Courtroom::on_evidence_delete_clicked()
|
||||
void Courtroom::on_evidence_x_clicked()
|
||||
{
|
||||
ui_evidence_description->setReadOnly(true);
|
||||
ui_evidence_name->setReadOnly(true);
|
||||
ui_evidence_overlay->hide();
|
||||
ui_ic_chat_message->setFocus();
|
||||
}
|
||||
|
||||
if (current_evidence >= local_evidence_list.size())
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user