aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt3
-rw-r--r--include/aoapplication.h3
-rw-r--r--include/aolayer.h16
-rw-r--r--include/aolineedit.h26
-rw-r--r--include/aooptionsdialog.h4
-rw-r--r--include/aotextedit.h21
-rw-r--r--include/courtroom.h22
-rw-r--r--include/eventfilters.h36
8 files changed, 74 insertions, 57 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 18cf23b..e74a49b 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -10,13 +10,11 @@ aoevidencebutton.h
aoevidencedisplay.h
aoimage.h
aolayer.h
-aolineedit.h
aomusicplayer.h
aooptionsdialog.h
aopacket.h
aosfxplayer.h
aotextarea.h
-aotextedit.h
bass.h
bassopus.h
chatlogpiece.h
@@ -28,6 +26,7 @@ discord-rpc.h
discord_register.h
discord_rich_presence.h
discord_rpc.h
+eventfilters.h
file_functions.h
hardware_functions.h
lobby.h
diff --git a/include/aoapplication.h b/include/aoapplication.h
index 718029a..0c5359a 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -285,6 +285,9 @@ public:
// Returns whether the log should have a timestamp.
bool get_log_timestamp();
+ // Returns the format string for the log timestamp
+ QString get_log_timestamp_format();
+
// Returns whether to log IC actions.
bool get_log_ic_actions();
diff --git a/include/aolayer.h b/include/aolayer.h
index 7a8e2fd..b890715 100644
--- a/include/aolayer.h
+++ b/include/aolayer.h
@@ -7,6 +7,9 @@
#include <QLabel>
#include <QTimer>
#include <QBitmap>
+#include <QtConcurrent/QtConcurrentRun>
+#include <QMutex>
+#include <QWaitCondition>
class AOApplication;
class VPath;
@@ -139,6 +142,18 @@ protected:
// Center the QLabel in the viewport based on the dimensions of f_pixmap
void center_pixmap(QPixmap f_pixmap);
+private:
+ // Populates the frame and delay vectors.
+ void populate_vectors();
+
+ // used in populate_vectors
+ void load_next_frame();
+ bool exit_loop; //awful solution but i'm not fucking using QThread
+ QFuture<void> frame_loader;
+ QMutex mutex;
+ QWaitCondition frameAdded;
+
+
signals:
void done();
@@ -236,4 +251,5 @@ public:
StickerLayer(QWidget *p_parent, AOApplication *p_ao_app);
void load_image(QString p_charname);
};
+
#endif // AOLAYER_H
diff --git a/include/aolineedit.h b/include/aolineedit.h
deleted file mode 100644
index 5dce3aa..0000000
--- a/include/aolineedit.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef AOLINEEDIT_H
-#define AOLINEEDIT_H
-
-#include <QLineEdit>
-#include <QMouseEvent>
-
-class AOLineEdit : public QLineEdit {
- Q_OBJECT
-
-public:
- AOLineEdit(QWidget *parent);
-
- void preserve_selection(bool toggle) { p_selection = toggle; }
-
-private:
- bool p_selection = false;
-
-protected:
- void mouseDoubleClickEvent(QMouseEvent *e);
- void focusOutEvent(QFocusEvent *ev);
-
-signals:
- void double_clicked();
-};
-
-#endif // AOLINEEDIT_H
diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h
index 4568b1e..77d19a4 100644
--- a/include/aooptionsdialog.h
+++ b/include/aooptionsdialog.h
@@ -62,6 +62,8 @@ private:
QSpinBox *ui_log_margin_spinbox;
QLabel *ui_log_timestamp_lbl;
QCheckBox *ui_log_timestamp_cb;
+ QLabel *ui_log_timestamp_format_lbl;
+ QComboBox *ui_log_timestamp_format_combobox;
QLabel *ui_stay_time_lbl;
QSpinBox *ui_stay_time_spinbox;
QLabel *ui_desync_logs_lbl;
@@ -197,6 +199,8 @@ public slots:
void save_pressed();
void discard_pressed();
void button_clicked(QAbstractButton *button);
+ void on_timestamp_format_edited();
+ void timestamp_cb_changed(int state);
void on_reload_theme_clicked();
void theme_changed(int i);
};
diff --git a/include/aotextedit.h b/include/aotextedit.h
deleted file mode 100644
index 8d876f1..0000000
--- a/include/aotextedit.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef AOTEXTEDIT_H
-#define AOTEXTEDIT_H
-
-#include <QPlainTextEdit>
-
-class AOTextEdit : public QPlainTextEdit {
- Q_OBJECT
-public:
- AOTextEdit(QWidget *parent);
-
-protected:
- void mouseDoubleClickEvent(QMouseEvent *e);
-
-signals:
- void double_clicked();
-
-private slots:
- void on_enter_pressed();
-};
-
-#endif // AOTEXTEDIT_H
diff --git a/include/courtroom.h b/include/courtroom.h
index e814514..4bc8624 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -11,13 +11,11 @@
#include "aoevidencedisplay.h"
#include "aoimage.h"
#include "aolayer.h"
-#include "aolineedit.h"
#include "aomusicplayer.h"
#include "aooptionsdialog.h"
#include "aopacket.h"
#include "aosfxplayer.h"
#include "aotextarea.h"
-#include "aotextedit.h"
#include "chatlogpiece.h"
#include "datatypes.h"
#include "debug_functions.h"
@@ -25,6 +23,7 @@
#include "hardware_functions.h"
#include "lobby.h"
#include "scrolltext.h"
+#include "eventfilters.h"
#include <QCheckBox>
#include <QCloseEvent>
@@ -417,6 +416,9 @@ private:
// True, if the log should have a timestamp.
bool log_timestamp = false;
+ // format string for aforementioned log timestamp
+ QString log_timestamp_format;
+
// How long in miliseconds should the objection wait before appearing.
int objection_threshold = 1500;
@@ -648,7 +650,8 @@ private:
QComboBox *ui_pair_order_dropdown;
- AOLineEdit *ui_ic_chat_message;
+ QLineEdit *ui_ic_chat_message;
+ AOLineEditFilter *ui_ic_chat_message_filter;
QLineEdit *ui_ic_chat_name;
QLineEdit *ui_ooc_chat_message;
@@ -730,7 +733,8 @@ private:
AOButton *ui_evidence_button;
AOImage *ui_evidence;
- AOLineEdit *ui_evidence_name;
+ QLineEdit *ui_evidence_name;
+ AOLineEditFilter *ui_evidence_name_filter;
QWidget *ui_evidence_buttons;
QVector<AOEvidenceButton *> ui_evidence_list;
AOButton *ui_evidence_left;
@@ -738,7 +742,8 @@ private:
AOButton *ui_evidence_present;
AOImage *ui_evidence_overlay;
AOButton *ui_evidence_delete;
- AOLineEdit *ui_evidence_image_name;
+ QLineEdit *ui_evidence_image_name;
+ AOLineEditFilter *ui_evidence_image_name_filter;
AOButton *ui_evidence_image_button;
AOButton *ui_evidence_x;
AOButton *ui_evidence_ok;
@@ -746,7 +751,9 @@ private:
AOButton *ui_evidence_transfer;
AOButton *ui_evidence_save;
AOButton *ui_evidence_load;
- AOTextEdit *ui_evidence_description;
+ AOButton *ui_evidence_edit;
+ QPlainTextEdit *ui_evidence_description;
+
AOImage *ui_char_select_background;
@@ -873,6 +880,7 @@ private slots:
void on_evidence_image_button_clicked();
void on_evidence_clicked(int p_id);
void on_evidence_double_clicked(int p_id);
+ void on_evidence_edit_clicked();
void on_evidence_hover(int p_id, bool p_state);
@@ -928,8 +936,6 @@ private slots:
void on_showname_enable_clicked();
- void on_evidence_name_double_clicked();
- void on_evidence_image_name_double_clicked();
void on_evidence_button_clicked();
void on_evidence_delete_clicked();
diff --git a/include/eventfilters.h b/include/eventfilters.h
new file mode 100644
index 0000000..7847608
--- /dev/null
+++ b/include/eventfilters.h
@@ -0,0 +1,36 @@
+#ifndef EVENTFILTERS_H
+#define EVENTFILTERS_H
+
+#include <QEvent>
+#include <QLineEdit>
+
+class AOLineEditFilter : public QObject
+{
+ Q_OBJECT
+public:
+ bool preserve_selection = false;
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event) override {
+ QLineEdit *lineEdit = qobject_cast<QLineEdit *>(obj);
+ if (event->type() == QEvent::FocusOut && lineEdit != nullptr && preserve_selection) { // lost focus
+ int start = lineEdit->selectionStart();
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ int len = lineEdit->selectionLength();
+ #else
+ int len = lineEdit->selectedText().length();
+ #endif
+ if (start != -1 && len != -1) {
+ lineEdit->setSelection(start, len);\
+ return true;
+ }
+ }
+ return false;
+ }
+signals:
+ void double_clicked();
+};
+
+
+
+#endif // EVENTFILTERS_H