forked from mirror/openmw-tes3mp
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
This commit is contained in:
parent
f9591ddda6
commit
ba3589bc76
6 changed files with 23 additions and 34 deletions
|
@ -28,7 +28,6 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
|
||||||
, QWidget(parent)
|
, QWidget(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi (this);
|
ui.setupUi (this);
|
||||||
|
|
||||||
setObjectName ("DataFilesPage");
|
setObjectName ("DataFilesPage");
|
||||||
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);
|
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,7 @@ void CS::Editor::loadDocument()
|
||||||
void CS::Editor::openFiles()
|
void CS::Editor::openFiles()
|
||||||
{
|
{
|
||||||
std::vector<boost::filesystem::path> files;
|
std::vector<boost::filesystem::path> files;
|
||||||
|
QStringList paths = mFileDialog.checkedItemsPaths();
|
||||||
|
|
||||||
foreach (const QString &path, mFileDialog.selectedFilePaths()) {
|
foreach (const QString &path, mFileDialog.selectedFilePaths()) {
|
||||||
files.push_back(path.toStdString());
|
files.push_back(path.toStdString());
|
||||||
|
@ -130,28 +131,30 @@ void CS::Editor::openFiles()
|
||||||
qDebug() << "loading files: " << fp.c_str();
|
qDebug() << "loading files: " << fp.c_str();
|
||||||
|
|
||||||
/// \todo Get the save path from the file dialogue
|
/// \todo Get the save path from the file dialogue
|
||||||
|
|
||||||
CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), false);
|
CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), false);
|
||||||
|
|
||||||
mViewManager.addView (document);
|
mViewManager.addView (document);
|
||||||
mFileDialog.close();
|
mFileDialog.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CS::Editor::createNewFile()
|
void CS::Editor::createNewFile()
|
||||||
{
|
{
|
||||||
std::vector<boost::filesystem::path> files;
|
std::vector<boost::filesystem::path> files;
|
||||||
|
QStringList paths = mFileDialog.checkedItemsPaths();
|
||||||
|
|
||||||
foreach (const QString &path, mFileDialog.selectedFilePaths()) {
|
foreach (const QString &path, mFileDialog.selectedFilePaths()) {
|
||||||
files.push_back(path.toStdString());
|
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.
|
/// \todo Get the save path from the file dialogue.
|
||||||
|
|
||||||
CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), true);
|
CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), true);
|
||||||
|
|
||||||
mViewManager.addView (document);
|
mViewManager.addView (document);
|
||||||
mFileDialog.close();
|
mFileDialog.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CS::Editor::createNewGame (const boost::filesystem::path& file)
|
void CS::Editor::createNewGame (const boost::filesystem::path& file)
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QGridLayout>
|
|
||||||
|
|
||||||
#include "components/contentselector/model/esmfile.hpp"
|
#include "components/contentselector/model/esmfile.hpp"
|
||||||
#include "components/contentselector/view/contentselector.hpp"
|
#include "components/contentselector/view/contentselector.hpp"
|
||||||
|
|
||||||
#include "filewidget.hpp"
|
#include "filewidget.hpp"
|
||||||
#include "adjusterwidget.hpp"
|
#include "adjusterwidget.hpp"
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ void CSVDoc::FileDialog::buildOpenFileView()
|
||||||
connect (ui.projectButtonBox, SIGNAL (rejected()), this , SIGNAL (rejected()));
|
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)
|
void CSVDoc::FileDialog::slotUpdateCreateButton (int)
|
||||||
|
|
|
@ -53,19 +53,18 @@ namespace CSVDoc
|
||||||
void buildOpenFileView();
|
void buildOpenFileView();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void openFiles();
|
void openFiles();
|
||||||
void createNewFile();
|
void createNewFile();
|
||||||
|
|
||||||
public slots:
|
void signalUpdateCreateButton (bool, int);
|
||||||
|
void signalUpdateCreateButtonFlags(int);
|
||||||
|
|
||||||
void slotRejected();
|
public slots:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void slotUpdateCreateButton (int);
|
void slotUpdateCreateButton (int);
|
||||||
void slotUpdateCreateButton (const QString &, bool);
|
void slotUpdateCreateButton (const QString &, bool);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // FILEDIALOG_HPP
|
#endif // FILEDIALOG_HPP
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -21,26 +22,13 @@ ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
|
||||||
buildGameFileView();
|
buildGameFileView();
|
||||||
buildAddonView();
|
buildAddonView();
|
||||||
|
|
||||||
/*
|
updateViews();
|
||||||
//mContentModel->sort(3); // Sort by date accessed
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildContentModel()
|
void ContentSelectorView::ContentSelector::buildContentModel()
|
||||||
{
|
{
|
||||||
mContentModel = new ContentSelectorModel::ContentModel();
|
mContentModel = new ContentSelectorModel::ContentModel();
|
||||||
|
connect(mContentModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
|
||||||
if (mFilePaths.size()>0)
|
|
||||||
{
|
|
||||||
foreach (const QString &path, mFilePaths)
|
|
||||||
mContentModel->addFiles(path);
|
|
||||||
|
|
||||||
mFilePaths.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.gameFileView->setCurrentIndex(-1);
|
|
||||||
mContentModel->uncheckAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildGameFileView()
|
void ContentSelectorView::ContentSelector::buildGameFileView()
|
||||||
|
@ -52,8 +40,8 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
|
||||||
mGameFileProxyModel->setFilterRole (Qt::UserRole);
|
mGameFileProxyModel->setFilterRole (Qt::UserRole);
|
||||||
mGameFileProxyModel->setSourceModel (mContentModel);
|
mGameFileProxyModel->setSourceModel (mContentModel);
|
||||||
|
|
||||||
ui.gameFileView->setPlaceholderText(QString("Select a game file..."));
|
gameFileView->setPlaceholderText(QString("Select a game file..."));
|
||||||
ui.gameFileView->setModel(mGameFileProxyModel);
|
gameFileView->setModel(mGameFileProxyModel);
|
||||||
|
|
||||||
connect (ui.gameFileView, SIGNAL(currentIndexChanged(int)),
|
connect (ui.gameFileView, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT (slotCurrentGameFileIndexChanged(int)));
|
this, SLOT (slotCurrentGameFileIndexChanged(int)));
|
||||||
|
@ -61,7 +49,8 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
|
||||||
connect (ui.gameFileView, SIGNAL (currentIndexChanged (int)),
|
connect (ui.gameFileView, SIGNAL (currentIndexChanged (int)),
|
||||||
this, SIGNAL (signalCurrentGamefileIndexChanged (int)));
|
this, SIGNAL (signalCurrentGamefileIndexChanged (int)));
|
||||||
|
|
||||||
ui.gameFileView->setCurrentIndex(-1);
|
gameFileView->setCurrentIndex(-1);
|
||||||
|
gameFileView->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildAddonView()
|
void ContentSelectorView::ContentSelector::buildAddonView()
|
||||||
|
@ -74,7 +63,7 @@ void ContentSelectorView::ContentSelector::buildAddonView()
|
||||||
mAddonProxyModel->setDynamicSortFilter (true);
|
mAddonProxyModel->setDynamicSortFilter (true);
|
||||||
mAddonProxyModel->setSourceModel (mContentModel);
|
mAddonProxyModel->setSourceModel (mContentModel);
|
||||||
|
|
||||||
ui.addonView->setModel(mAddonProxyModel);
|
addonView->setModel(mAddonProxyModel);
|
||||||
|
|
||||||
connect(ui.addonView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotAddonTableItemClicked(const QModelIndex &)));
|
connect(ui.addonView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotAddonTableItemClicked(const QModelIndex &)));
|
||||||
|
|
||||||
|
@ -120,7 +109,6 @@ ContentSelectorModel::ContentFileList
|
||||||
return mContentModel->checkedItems();
|
return mContentModel->checkedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::addFiles(const QString &path)
|
void ContentSelectorView::ContentSelector::addFiles(const QString &path)
|
||||||
{
|
{
|
||||||
mContentModel->addFiles(path);
|
mContentModel->addFiles(path);
|
||||||
|
@ -133,7 +121,7 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
|
||||||
{
|
{
|
||||||
static int oldIndex = -1;
|
static int oldIndex = -1;
|
||||||
|
|
||||||
QAbstractItemModel *const model = ui.gameFileView->model();
|
QAbstractItemModel *const model = gameFileView->model();
|
||||||
QSortFilterProxyModel *proxy = dynamic_cast<QSortFilterProxyModel *>(model);
|
QSortFilterProxyModel *proxy = dynamic_cast<QSortFilterProxyModel *>(model);
|
||||||
|
|
||||||
if (proxy)
|
if (proxy)
|
||||||
|
@ -152,7 +140,8 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)
|
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)
|
if (model->data(index, Qt::CheckStateRole).toInt() == Qt::Unchecked)
|
||||||
model->setData(index, Qt::Checked, Qt::CheckStateRole);
|
model->setData(index, Qt::Checked, Qt::CheckStateRole);
|
||||||
|
|
|
@ -10,7 +10,6 @@ class QSortFilterProxyModel;
|
||||||
|
|
||||||
namespace ContentSelectorView
|
namespace ContentSelectorView
|
||||||
{
|
{
|
||||||
|
|
||||||
class ContentSelector : public QObject
|
class ContentSelector : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Reference in a new issue