Add map list sorting and filtering

This commit is contained in:
Diegoisawesome
2018-10-05 01:02:40 -05:00
parent 54a9d8b23b
commit 0e58fed23b
5 changed files with 275 additions and 62 deletions

View File

@@ -13,6 +13,7 @@
#include "map.h"
#include "editor.h"
#include "tileseteditor.h"
#include "filterchildrenproxymodel.h"
namespace Ui {
class MainWindow;
@@ -128,19 +129,32 @@ private slots:
void on_actionTileset_Editor_triggered();
void mapSortOrder_changed(QAction *action);
void on_lineEdit_filterBox_textChanged(const QString &arg1);
private:
Ui::MainWindow *ui;
TilesetEditor *tilesetEditor = nullptr;
FilterChildrenProxyModel *mapListProxyModel;
QStandardItemModel *mapListModel;
QList<QStandardItem*> *mapGroupsModel;
QList<QStandardItem*> *mapGroupItemsList;
QMap<QString, QModelIndex> mapListIndexes;
Editor *editor = nullptr;
QIcon* mapIcon;
QIcon* mapEditedIcon;
enum MapSortOrder {
Group = 0,
Name = 1,
Layout = 2,
} mapSortOrder;
void setMap(QString, bool scrollTreeView = false);
void redrawMapScene();
void loadDataStructures();
void populateMapList();
void sortMapList();
QString getExistingDirectory(QString);
void openProject(QString dir);
QString getDefaultMap();
@@ -157,14 +171,18 @@ private:
void initExtraShortcuts();
void initExtraSignals();
void initEditor();
void initMiscHeapObjects();
void initMapSortOrder();
void loadUserSettings();
void openRecentProject();
void updateTilesetEditor();
bool isProjectOpen();
};
enum MapListUserRoles {
GroupRole = Qt::UserRole + 1, // Used to hold the map group number.
TypeRole = Qt::UserRole + 2, // Used to differentiate between the different layers of the map list tree view.
TypeRole, // Used to differentiate between the different layers of the map list tree view.
};
#endif // MAINWINDOW_H

View File

@@ -64,6 +64,9 @@ public:
QString getNewMapName();
QString getProjectTitle();
QString readMapLayoutId(QString map_name);
QString readMapLocation(QString map_name);
QList<QStringList>* getLabelMacros(QList<QStringList>*, QString);
QStringList* getLabelValues(QList<QStringList>*, QString);
void readMapHeader(Map*);