OpenMW
components/contentselector/view/contentselector.hpp
Go to the documentation of this file.
00001 #ifndef CONTENTSELECTOR_HPP
00002 #define CONTENTSELECTOR_HPP
00003 
00004 #include <QDialog>
00005 
00006 #include "ui_contentselector.h"
00007 #include "../model/contentmodel.hpp"
00008 
00009 class QSortFilterProxyModel;
00010 
00011 namespace ContentSelectorView
00012 {
00013     class ContentSelector : public QObject
00014     {
00015         Q_OBJECT
00016 
00017         QStringList mFilePaths;
00018 
00019     protected:
00020 
00021         ContentSelectorModel::ContentModel *mContentModel;
00022         QSortFilterProxyModel *mGameFileProxyModel;
00023         QSortFilterProxyModel *mAddonProxyModel;
00024 
00025     public:
00026 
00027         explicit ContentSelector(QWidget *parent = 0);
00028 
00029         QString currentFile() const;
00030 
00031         void addFiles(const QString &path);
00032         void setProfileContent (const QStringList &fileList);
00033 
00034         void clearCheckStates();
00035         void setCheckStates (const QStringList &list);
00036 
00037         ContentSelectorModel::ContentFileList selectedFiles() const;
00038 
00039         void setGameFile (const QString &filename = QString(""));
00040 
00041         bool isGamefileSelected() const
00042             { return ui.gameFileView->currentIndex() != -1; }
00043 
00044         QWidget *uiWidget() const
00045             { return ui.contentGroupBox; }
00046 
00047 
00048    private:
00049 
00050         Ui::ContentSelector ui;
00051 
00052         void buildContentModel();
00053         void buildGameFileView();
00054         void buildAddonView();
00055 
00056     signals:
00057         void signalCurrentGamefileIndexChanged (int);
00058         void signalAddonFileSelected (int);
00059         void signalAddonFileUnselected (int);
00060 
00061     private slots:
00062 
00063         void slotCurrentGameFileIndexChanged(int index);
00064         void slotAddonTableItemClicked(const QModelIndex &index);
00065     };
00066 }
00067 
00068 #endif // CONTENTSELECTOR_HPP