Reimplemented content selector for filedialog and datafilespage classes

pull/51/head
graffy76 11 years ago
parent ba3589bc76
commit b48f066f33

@ -121,7 +121,6 @@ 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());
@ -141,13 +140,12 @@ void CS::Editor::openFiles()
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.

@ -88,7 +88,6 @@ void CSVDoc::FileDialog::buildNewFileView()
this, SLOT (slotUpdateCreateButton (int)));
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (createNewFile()));
connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected()));
}
@ -98,12 +97,7 @@ void CSVDoc::FileDialog::buildOpenFileView()
ui.projectGroupBox->setTitle (QString(""));
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (openFiles()));
connect (ui.projectButtonBox, SIGNAL (rejected()), this , SIGNAL (rejected()));
}
void CSVDoc::FileDialog::slotGameFileSelected(int value)
{
emit signalUpdateCreateButton(value > -1, 1);
connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected()));
}
void CSVDoc::FileDialog::slotUpdateCreateButton (int)
@ -129,3 +123,8 @@ QString CSVDoc::FileDialog::filename() const
return QString ("");
}
void CSVDoc::FileDialog::slotRejected()
{
emit rejected();
close();
}

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

@ -21,14 +21,12 @@ ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
buildContentModel();
buildGameFileView();
buildAddonView();
updateViews();
}
void ContentSelectorView::ContentSelector::buildContentModel()
{
mContentModel = new ContentSelectorModel::ContentModel();
connect(mContentModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
//connect(mContentModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
}
void ContentSelectorView::ContentSelector::buildGameFileView()
@ -40,8 +38,8 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
mGameFileProxyModel->setFilterRole (Qt::UserRole);
mGameFileProxyModel->setSourceModel (mContentModel);
gameFileView->setPlaceholderText(QString("Select a game file..."));
gameFileView->setModel(mGameFileProxyModel);
ui.gameFileView->setPlaceholderText(QString("Select a game file..."));
ui.gameFileView->setModel(mGameFileProxyModel);
connect (ui.gameFileView, SIGNAL(currentIndexChanged(int)),
this, SLOT (slotCurrentGameFileIndexChanged(int)));
@ -49,8 +47,8 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
connect (ui.gameFileView, SIGNAL (currentIndexChanged (int)),
this, SIGNAL (signalCurrentGamefileIndexChanged (int)));
gameFileView->setCurrentIndex(-1);
gameFileView->setCurrentIndex(0);
ui.gameFileView->setCurrentIndex(-1);
ui.gameFileView->setCurrentIndex(0);
}
void ContentSelectorView::ContentSelector::buildAddonView()
@ -63,7 +61,7 @@ void ContentSelectorView::ContentSelector::buildAddonView()
mAddonProxyModel->setDynamicSortFilter (true);
mAddonProxyModel->setSourceModel (mContentModel);
addonView->setModel(mAddonProxyModel);
ui.addonView->setModel(mAddonProxyModel);
connect(ui.addonView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotAddonTableItemClicked(const QModelIndex &)));
@ -121,7 +119,7 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
{
static int oldIndex = -1;
QAbstractItemModel *const model = gameFileView->model();
QAbstractItemModel *const model = ui.gameFileView->model();
QSortFilterProxyModel *proxy = dynamic_cast<QSortFilterProxyModel *>(model);
if (proxy)
@ -140,7 +138,7 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)
{
QAbstractItemModel *const model = addonView->model();
QAbstractItemModel *const model = ui.addonView->model();
//QSortFilterProxyModel *proxy = dynamic_cast<QSortFilterProxyModel *>(model);
if (model->data(index, Qt::CheckStateRole).toInt() == Qt::Unchecked)

Loading…
Cancel
Save