forked from AttorneyOnline/AO2-Client
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start working on the Emote Menu thingy
- Loading branch information
1 parent
e243e06
commit 4c91f99
Showing
3 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef EMOTE_MENU_FILTER_H | ||
#define EMOTE_MENU_FILTER_H | ||
|
||
#include "aoemotebutton.h" | ||
|
||
#include <QDialog> | ||
#include <QListWidget> | ||
#include <QLineEdit> | ||
#include <QScrollArea> | ||
#include <QPushButton> | ||
#include <QGridLayout> | ||
|
||
class AOApplication; | ||
|
||
QT_BEGIN_NAMESPACE | ||
namespace Ui { class EmoteMenuFilter; } | ||
QT_END_NAMESPACE | ||
|
||
class EmoteMenuFilter : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
EmoteMenuFilter(QDialog *parent = nullptr, AOApplication *p_ao_app = nullptr); | ||
~EmoteMenuFilter(); | ||
|
||
private slots: | ||
void onCategoryChanged(); | ||
void onSearchTextChanged(const QString &text); | ||
|
||
private: | ||
AOApplication *ao_app; | ||
Ui::EmoteMenuFilter *emote_filter_ui; | ||
QListWidget *categoryList; | ||
QLineEdit *searchBox; | ||
QScrollArea *scrollArea; | ||
QWidget *buttonContainer; | ||
QGridLayout *gridLayout; | ||
QPushButton *addCategory; | ||
QPushButton *removeCategory; | ||
|
||
}; | ||
|
||
#endif // EMOTE_MENU_FILTER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Dialog</class> | ||
<widget class="QDialog" name="Dialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>480</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="2" column="1"> | ||
<widget class="QPushButton" name="removeCategory"> | ||
<property name="text"> | ||
<string>Remove</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="2"> | ||
<widget class="QScrollArea" name="scrollArea"> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>290</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
<property name="widgetResizable"> | ||
<bool>true</bool> | ||
</property> | ||
<widget class="QWidget" name="scrollAreaWidgetContents_2"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>288</width> | ||
<height>223</height> | ||
</rect> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout_3"> | ||
<item row="0" column="0"> | ||
<layout class="QGridLayout" name="gridLayout_2"> | ||
<item row="0" column="0"> | ||
<widget class="QWidget" name="buttonContainer" native="true"/> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
</widget> | ||
</item> | ||
<item row="0" column="2"> | ||
<widget class="QLineEdit" name="searchBox"> | ||
<property name="inputMask"> | ||
<string/> | ||
</property> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
<property name="placeholderText"> | ||
<string>Search...</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="2" column="0"> | ||
<widget class="QPushButton" name="addCategory"> | ||
<property name="text"> | ||
<string>Add</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="0" rowspan="2" colspan="2"> | ||
<widget class="QListWidget" name="categoryList"> | ||
<property name="styleSheet"> | ||
<string notr="true"/> | ||
</property> | ||
<property name="alternatingRowColors"> | ||
<bool>false</bool> | ||
</property> | ||
<item> | ||
<property name="text"> | ||
<string>Default Emotes</string> | ||
</property> | ||
<property name="textAlignment"> | ||
<set>AlignCenter</set> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>Favorites</string> | ||
</property> | ||
<property name="textAlignment"> | ||
<set>AlignCenter</set> | ||
</property> | ||
</item> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "emote_menu_filter.h" | ||
#include "aoemotebutton.h" | ||
#include "aoapplication.h" | ||
#include <QVBoxLayout> | ||
#include <QInputDialog> | ||
#include <QMessageBox> | ||
|
||
EmoteMenuFilter::EmoteMenuFilter(QDialog *parent, AOApplication *p_ao_app) | ||
: QDialog(parent), ao_app(p_ao_app), emote_filter_ui(new Ui::EmoteMenuFilter) | ||
{ | ||
emote_filter_ui->setupUi(this); | ||
|
||
categoryList = new QListWidget(this); | ||
categoryList->addItem("Default Emotes"); | ||
categoryList->addItem("Favorites"); | ||
|
||
searchBox = new QLineEdit(this); | ||
scrollArea = new QScrollArea(this); | ||
buttonContainer = new QWidget(this); | ||
gridLayout = new QGridLayout(buttonContainer); | ||
addCategory = new QPushButton("Add Category", this); | ||
removeCategory = new QPushButton("Remove Category", this); | ||
|
||
scrollArea->setWidget(buttonContainer); | ||
scrollArea->setWidgetResizable(true); | ||
|
||
QVBoxLayout *mainLayout = new QVBoxLayout(this); | ||
mainLayout->addWidget(searchBox); | ||
mainLayout->addWidget(categoryList); | ||
mainLayout->addWidget(scrollArea); | ||
mainLayout->addWidget(addCategory); | ||
mainLayout->addWidget(removeCategory); | ||
setLayout(mainLayout); | ||
|
||
// connect(categoryList, &QListWidget::currentTextChanged, this, &EmoteMenuFilter::onCategoryChanged); | ||
connect(addCategory, &QPushButton::clicked, this, &EmoteMenuFilter::addCategory); | ||
connect(removeCategory, &QPushButton::clicked, this, &EmoteMenuFilter::removeCategory); | ||
// connect(searchBox, &QLineEdit::textChanged, this, &EmoteMenuFilter::onSearchTextChanged); | ||
} | ||
|
||
EmoteMenuFilter::~EmoteMenuFilter() | ||
{ | ||
delete emote_filter_ui; | ||
} | ||
|
||
void EmoteMenuFilter::onCategoryChanged() | ||
{ | ||
return; | ||
} | ||
|
||
void EmoteMenuFilter::addCategory() | ||
{ | ||
bool ok; | ||
QString category = QInputDialog::getText(this, tr("Add Category"), | ||
tr("Category name:"), QLineEdit::Normal, | ||
"", &ok); | ||
if (ok && !category.isEmpty()) { | ||
categoryList->addItem(category); | ||
} | ||
} | ||
|
||
void EmoteMenuFilter::removeCategory() | ||
{ | ||
QListWidgetItem *item = categoryList->currentItem(); | ||
if (item) { | ||
delete item; | ||
} else { | ||
QMessageBox::warning(this, tr("Remove Category"), tr("No category selected")); | ||
} | ||
} |