Revert "Implemented ContentSelector as a singleton "charm" modifier for"

This reverts commit 24b167b755.

Conflicts:
	apps/launcher/datafilespage.cpp
	apps/opencs/editor.cpp
	apps/opencs/view/doc/filedialog.cpp
	apps/opencs/view/doc/filedialog.hpp
	components/contentselector/view/contentselector.cpp
	components/contentselector/view/contentselector.hpp
actorid
graffy76 11 years ago
parent f9591ddda6
commit ba3589bc76

@ -28,7 +28,6 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
, QWidget(parent)
{
ui.setupUi (this);
setObjectName ("DataFilesPage");
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);

@ -121,6 +121,7 @@ void CS::Editor::loadDocument()
void CS::Editor::openFiles()
{
std::vector<boost::filesystem::path> files;
QStringList paths = mFileDialog.checkedItemsPaths();
foreach (const QString &path, mFileDialog.selectedFilePaths()) {
files.push_back(path.toStdString());
@ -130,28 +131,30 @@ void CS::Editor::openFiles()
qDebug() << "loading files: " << fp.c_str();
/// \todo Get the save path from the file dialogue
CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), false);
mViewManager.addView (document);
mFileDialog.close();
mFileDialog.hide();
}
void CS::Editor::createNewFile()
{
std::vector<boost::filesystem::path> files;
QStringList paths = mFileDialog.checkedItemsPaths();
foreach (const QString &path, mFileDialog.selectedFilePaths()) {
files.push_back(path.toStdString());
}
files.push_back(mFileDialog.filename().toStdString());
files.push_back(mFileDialog.fileName().toStdString());
/// \todo Get the save path from the file dialogue.
CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), true);
mViewManager.addView (document);
mFileDialog.close();
mFileDialog.hide();
}
void CS::Editor::createNewGame (const boost::filesystem::path& file)

@ -10,10 +10,10 @@
#include <QPushButton>
#include <QLabel>
#include <QGroupBox>
#include <QGridLayout>
#include "components/contentselector/model/esmfile.hpp"
#include "components/contentselector/view/contentselector.hpp"
#include "filewidget.hpp"
#include "adjusterwidget.hpp"
@ -101,9 +101,9 @@ void CSVDoc::FileDialog::buildOpenFileView()
connect (ui.projectButtonBox, SIGNAL (rejected()), this , SIGNAL (rejected()));
}
void CSVDoc::FileDialog::slotRejected()
void CSVDoc::FileDialog::slotGameFileSelected(int value)
{
close();
emit signalUpdateCreateButton(value > -1, 1);
}
void CSVDoc::FileDialog::slotUpdateCreateButton (int)

@ -53,19 +53,18 @@ namespace CSVDoc
void buildOpenFileView();
signals:
void openFiles();
void createNewFile();
public slots:
void signalUpdateCreateButton (bool, int);
void signalUpdateCreateButtonFlags(int);
void slotRejected();
public slots:
private slots:
void slotUpdateCreateButton (int);
void slotUpdateCreateButton (const QString &, bool);
};
}
#endif // FILEDIALOG_HPP

@ -6,6 +6,7 @@
#include <QMenu>
#include <QContextMenuEvent>
#include <QGridLayout>
#include <QMessageBox>
#include <assert.h>
@ -21,26 +22,13 @@ ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
buildGameFileView();
buildAddonView();
/*
//mContentModel->sort(3); // Sort by date accessed
*/
updateViews();
}
void ContentSelectorView::ContentSelector::buildContentModel()
{
mContentModel = new ContentSelectorModel::ContentModel();
if (mFilePaths.size()>0)
{
foreach (const QString &path, mFilePaths)
mContentModel->addFiles(path);
mFilePaths.clear();
}
ui.gameFileView->setCurrentIndex(-1);
mContentModel->uncheckAll();
connect(mContentModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
}
void ContentSelectorView::ContentSelector::buildGameFileView()
@ -52,8 +40,8 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
mGameFileProxyModel->setFilterRole (Qt::UserRole);
mGameFileProxyModel->setSourceModel (mContentModel);
ui.gameFileView->setPlaceholderText(QString("Select a game file..."));
ui.gameFileView->setModel(mGameFileProxyModel);
gameFileView->setPlaceholderText(QString("Select a game file..."));
gameFileView->setModel(mGameFileProxyModel);
connect (ui.gameFileView, SIGNAL(currentIndexChanged(int)),
this, SLOT (slotCurrentGameFileIndexChanged(int)));
@ -61,7 +49,8 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
connect (ui.gameFileView, SIGNAL (currentIndexChanged (int)),
this, SIGNAL (signalCurrentGamefileIndexChanged (int)));
ui.gameFileView->setCurrentIndex(-1);
gameFileView->setCurrentIndex(-1);
gameFileView->setCurrentIndex(0);
}
void ContentSelectorView::ContentSelector::buildAddonView()
@ -74,7 +63,7 @@ void ContentSelectorView::ContentSelector::buildAddonView()
mAddonProxyModel->setDynamicSortFilter (true);
mAddonProxyModel->setSourceModel (mContentModel);
ui.addonView->setModel(mAddonProxyModel);
addonView->setModel(mAddonProxyModel);
connect(ui.addonView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotAddonTableItemClicked(const QModelIndex &)));
@ -120,7 +109,6 @@ ContentSelectorModel::ContentFileList
return mContentModel->checkedItems();
}
void ContentSelectorView::ContentSelector::addFiles(const QString &path)
{
mContentModel->addFiles(path);
@ -133,7 +121,7 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
{
static int oldIndex = -1;
QAbstractItemModel *const model = ui.gameFileView->model();
QAbstractItemModel *const model = gameFileView->model();
QSortFilterProxyModel *proxy = dynamic_cast<QSortFilterProxyModel *>(model);
if (proxy)
@ -152,7 +140,8 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)
{
QAbstractItemModel *const model = ui.addonView->model();
QAbstractItemModel *const model = addonView->model();
//QSortFilterProxyModel *proxy = dynamic_cast<QSortFilterProxyModel *>(model);
if (model->data(index, Qt::CheckStateRole).toInt() == Qt::Unchecked)
model->setData(index, Qt::Checked, Qt::CheckStateRole);

@ -10,7 +10,6 @@ class QSortFilterProxyModel;
namespace ContentSelectorView
{
class ContentSelector : public QObject
{
Q_OBJECT

Loading…
Cancel
Save