2013-08-17 03:23:21 +00:00
|
|
|
#ifndef CONTENTSELECTOR_HPP
|
|
|
|
#define CONTENTSELECTOR_HPP
|
|
|
|
|
2013-08-20 17:34:39 +00:00
|
|
|
#include <QDialog>
|
2013-08-17 03:23:21 +00:00
|
|
|
|
2013-10-23 02:52:35 +00:00
|
|
|
#include "ui_contentselector.h"
|
2015-11-28 02:01:28 +00:00
|
|
|
#include <components/contentselector/model/contentmodel.hpp>
|
2013-08-17 03:23:21 +00:00
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
class QSortFilterProxyModel;
|
|
|
|
|
2013-09-22 04:06:29 +00:00
|
|
|
namespace ContentSelectorView
|
2013-08-18 20:11:29 +00:00
|
|
|
{
|
2013-10-23 02:52:35 +00:00
|
|
|
class ContentSelector : public QObject
|
2013-08-17 03:23:21 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2015-05-04 02:52:47 +00:00
|
|
|
QMenu *mContextMenu;
|
2013-09-29 17:19:07 +00:00
|
|
|
|
2013-08-17 10:55:43 +00:00
|
|
|
protected:
|
|
|
|
|
2013-09-22 04:06:29 +00:00
|
|
|
ContentSelectorModel::ContentModel *mContentModel;
|
|
|
|
QSortFilterProxyModel *mAddonProxyModel;
|
2013-08-17 03:23:21 +00:00
|
|
|
|
|
|
|
public:
|
2013-10-07 02:13:47 +00:00
|
|
|
|
2021-10-29 18:09:47 +00:00
|
|
|
explicit ContentSelector(QWidget *parent = nullptr, bool showOMWScripts = false);
|
2013-09-22 04:06:29 +00:00
|
|
|
|
2013-10-24 22:33:28 +00:00
|
|
|
QString currentFile() const;
|
|
|
|
|
2013-10-23 02:52:35 +00:00
|
|
|
void addFiles(const QString &path);
|
2021-11-07 13:15:30 +00:00
|
|
|
void sortFiles();
|
2015-06-16 02:48:45 +00:00
|
|
|
void clearFiles();
|
2013-11-04 03:36:41 +00:00
|
|
|
void setProfileContent (const QStringList &fileList);
|
2013-08-17 03:23:21 +00:00
|
|
|
|
2013-10-07 02:13:47 +00:00
|
|
|
void clearCheckStates();
|
2018-09-24 10:09:24 +00:00
|
|
|
void setEncoding (const QString &encoding);
|
2014-12-31 06:19:54 +00:00
|
|
|
void setContentList(const QStringList &list);
|
2013-10-02 02:29:45 +00:00
|
|
|
|
|
|
|
ContentSelectorModel::ContentFileList selectedFiles() const;
|
|
|
|
|
2013-10-23 02:52:35 +00:00
|
|
|
void setGameFile (const QString &filename = QString(""));
|
|
|
|
|
|
|
|
bool isGamefileSelected() const
|
2021-08-31 23:53:23 +00:00
|
|
|
{ return ui.gameFileView->currentIndex() > 0; }
|
2013-10-23 02:52:35 +00:00
|
|
|
|
|
|
|
QWidget *uiWidget() const
|
|
|
|
{ return ui.contentGroupBox; }
|
2020-03-21 19:35:20 +00:00
|
|
|
|
|
|
|
QToolButton *refreshButton() const
|
|
|
|
{ return ui.refreshButton; }
|
2013-09-18 07:36:23 +00:00
|
|
|
|
2020-06-21 14:45:30 +00:00
|
|
|
QLineEdit *searchFilter() const
|
|
|
|
{ return ui.searchFilter; }
|
|
|
|
|
2013-10-07 02:13:47 +00:00
|
|
|
|
2013-09-18 07:36:23 +00:00
|
|
|
private:
|
2013-09-22 04:06:29 +00:00
|
|
|
|
2013-10-23 02:52:35 +00:00
|
|
|
Ui::ContentSelector ui;
|
2013-09-29 17:19:07 +00:00
|
|
|
|
2021-10-29 18:09:47 +00:00
|
|
|
void buildContentModel(bool showOMWScripts);
|
2013-09-22 04:06:29 +00:00
|
|
|
void buildGameFileView();
|
|
|
|
void buildAddonView();
|
2015-05-04 02:52:47 +00:00
|
|
|
void buildContextMenu();
|
2015-02-24 07:06:06 +00:00
|
|
|
void setGameFileSelected(int index, bool selected);
|
2015-05-04 02:52:47 +00:00
|
|
|
void setCheckStateForMultiSelectedItems(bool checked);
|
2013-08-17 03:23:21 +00:00
|
|
|
|
2013-08-18 00:40:28 +00:00
|
|
|
signals:
|
2013-10-23 02:52:35 +00:00
|
|
|
void signalCurrentGamefileIndexChanged (int);
|
2014-10-16 13:07:51 +00:00
|
|
|
|
|
|
|
void signalAddonDataChanged (const QModelIndex& topleft, const QModelIndex& bottomright);
|
2018-05-23 01:50:31 +00:00
|
|
|
void signalSelectedFilesChanged(QStringList selectedFiles);
|
2013-10-02 02:29:45 +00:00
|
|
|
|
2013-08-17 03:23:21 +00:00
|
|
|
private slots:
|
2013-09-29 17:19:07 +00:00
|
|
|
|
2013-09-22 04:06:29 +00:00
|
|
|
void slotCurrentGameFileIndexChanged(int index);
|
2014-10-16 13:07:51 +00:00
|
|
|
void slotAddonTableItemActivated(const QModelIndex& index);
|
2015-05-04 02:52:47 +00:00
|
|
|
void slotShowContextMenu(const QPoint& pos);
|
|
|
|
void slotCheckMultiSelectedItems();
|
|
|
|
void slotUncheckMultiSelectedItems();
|
2018-09-28 22:54:00 +00:00
|
|
|
void slotCopySelectedItemsPaths();
|
2020-06-21 14:45:30 +00:00
|
|
|
void slotSearchFilterTextChanged(const QString& newText);
|
2013-08-17 03:23:21 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CONTENTSELECTOR_HPP
|