mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-08 18:39:29 +00:00
81 lines
2.4 KiB
C++
81 lines
2.4 KiB
C++
#ifndef CONTENTSELECTOR_HPP
|
|
#define CONTENTSELECTOR_HPP
|
|
|
|
#include <QDialog>
|
|
|
|
#include "ui_contentselector.h"
|
|
#include <components/contentselector/model/contentmodel.hpp>
|
|
|
|
class QSortFilterProxyModel;
|
|
|
|
namespace ContentSelectorView
|
|
{
|
|
class ContentSelector : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
QMenu* mContextMenu;
|
|
|
|
protected:
|
|
ContentSelectorModel::ContentModel* mContentModel;
|
|
QSortFilterProxyModel* mAddonProxyModel;
|
|
|
|
public:
|
|
explicit ContentSelector(QWidget* parent = nullptr, bool showOMWScripts = false);
|
|
|
|
QString currentFile() const;
|
|
|
|
void addFiles(const QString& path, bool newfiles = false);
|
|
void sortFiles();
|
|
bool containsDataFiles(const QString& path);
|
|
void clearFiles();
|
|
void setProfileContent(const QStringList& fileList);
|
|
|
|
void clearCheckStates();
|
|
void setEncoding(const QString& encoding);
|
|
void setContentList(const QStringList& list);
|
|
|
|
ContentSelectorModel::ContentFileList selectedFiles() const;
|
|
|
|
void setGameFile(const QString& filename = QString(""));
|
|
|
|
bool isGamefileSelected() const { return ui.gameFileView->currentIndex() > 0; }
|
|
|
|
QWidget* uiWidget() const { return ui.contentGroupBox; }
|
|
|
|
QComboBox* languageBox() const { return ui.languageComboBox; }
|
|
|
|
QToolButton* refreshButton() const { return ui.refreshButton; }
|
|
|
|
QLineEdit* searchFilter() const { return ui.searchFilter; }
|
|
|
|
private:
|
|
Ui::ContentSelector ui;
|
|
|
|
void buildContentModel(bool showOMWScripts);
|
|
void buildGameFileView();
|
|
void buildAddonView();
|
|
void buildContextMenu();
|
|
void setGameFileSelected(int index, bool selected);
|
|
void setCheckStateForMultiSelectedItems(bool checked);
|
|
|
|
signals:
|
|
void signalCurrentGamefileIndexChanged(int);
|
|
|
|
void signalAddonDataChanged(const QModelIndex& topleft, const QModelIndex& bottomright);
|
|
void signalSelectedFilesChanged(QStringList selectedFiles);
|
|
|
|
private slots:
|
|
|
|
void slotCurrentGameFileIndexChanged(int index);
|
|
void slotAddonTableItemActivated(const QModelIndex& index);
|
|
void slotShowContextMenu(const QPoint& pos);
|
|
void slotCheckMultiSelectedItems();
|
|
void slotUncheckMultiSelectedItems();
|
|
void slotCopySelectedItemsPaths();
|
|
void slotSearchFilterTextChanged(const QString& newText);
|
|
};
|
|
}
|
|
|
|
#endif // CONTENTSELECTOR_HPP
|