mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +00:00
b88d32ff5b
1 with the data directories 2 with the BSA archives 3 with the content selector When user select a directory to be added, first we walk the directory hierarchy to make a list of all potential data= entries. If we find none, the selected directory is added. If more than one data directory is found, user is presented with a directory list to check which one(s) are to be added. Directories containing one or more content file are marked with an icon. data= and fallback-archive= lines are handled like content= lines: - they are part of the profile in launcher.cfg, prefixed by the profile name - they are updated in openmw.cfg when profile is selected / created Directories can be moved in the list by drag and drop or by buttons. Insertion is possible anywhere in the list. Global data path and data local are shown but are greyed out, as they are always included. No attempt is made to ensure that the user choice are valid (dependencies, overwrite of content). After a profile is loaded, any added content is highlighted in green.
87 lines
2.4 KiB
C++
87 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; }
|
|
|
|
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
|